You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cm...@yahoo.com on 2001/05/02 19:54:17 UTC

Re: cvs commit: jakarta-tomcat/proposals/build2/ant tomcat.jsp

Hi Casey,

Sorry, I have too many things for now - the web based build is going to
wait a bit. If you could check in the changes, great.( I hope you got the
commit access )

BTW, I have few ideas for the pooling in jasper34 ( I would like to make
the pool pluggable, and managed by the container ). Getting the code
generator to work is first, but I hope in few weeks to finally merge the 2
runtimes and make the changes, and I hope you can review ( or help
:-) some of it.

Costin

On Sun, 29 Apr 2001, Casey Lucas wrote:

> 
> Costin,
> 
> Web based build will be a nice addition -- cool.
> 
> Small comment though.  Keep in mind that I don't have a complete understanding
> of all associated code, but at first glance, it appears that AntTag won't work
> correctly if tag pooling is being used.  I think the fix is simple though.  Just
> reset the list of targets and args at tag start time:
> 
> 
> >   1.1                  jakarta-tomcat/proposals/build2/WEB-INF/src/AntTag.java
> > 
> >   Index: AntTag.java
> >   ===================================================================
> >   package tadm;
> >   import java.util.*;
> >   import java.io.*;
> >   import java.net.URL;
> >   import javax.servlet.http.*;
> >   import javax.servlet.*;
> > 
> >   import javax.servlet.jsp.*;
> >   import javax.servlet.jsp.tagext.*;
> > 
> >   import org.apache.tools.ant.*;
> > 
> >   /**
> >    * This tag will run ant tasks
> >    *
> >    */
> >   public class AntTag extends TagSupport {
> > 
> >       public AntTag() {}
> > 
> >       public int doStartTag() throws JspException {
> 
> add:
> 
> args.clear()
> targets.clear() // or removeAllElements() etc.
> 
> 
> >         try {
> >             pageContext.setAttribute("antProperties",
> >                                      args);
> >         } catch (Exception ex ) {
> >             ex.printStackTrace();
> >         }
> >         return EVAL_BODY_INCLUDE;
> >       }
> > 
> >       public int doEndTag() throws JspException {
> >         runTest();
> >         return EVAL_PAGE;
> >       }
> > 
> >       // -------------------- child tag support --------------------
> >       Properties args=new Properties();
> >       Vector targets=new Vector();
> > 
> >       public void setProperty( String name, String value ) {
> >         System.out.println("Adding property " + name + "=" + value );
> >         args.put(name, value );
> >       }
> > 
> >       public String getProperty( String name ) {
> >         System.out.println("Getting property " + name  );
> >         return args.getProperty(name );
> >       }
> > 
> >       public void addTarget( String n ) {
> >         System.out.println("Adding target " + n );
> >         targets.addElement( n );
> >       }
> > 
> >       //-------------------- Properties --------------------
> > 
> >       /** Set the name of the test.xml, relative to the base dir.
> >        *  For example, /WEB-INF/test-tomcat.xml
> >        */
> >       public void setTestFile( String s ) {
> >         args.put("ant.file", s);
> >       }
> > 
> >       /** Set the target - a subset of tests to be run
> >        */
> >       public void setTarget( String s ) {
> >         addTarget(s);
> >       }
> > 
> >       public void setDebug( String s ) {
> >         args.put( "debug", s);
> >       }
> > 
> >       // -------------------- Implementation methods --------------------
> > 
> >       private void runTest() throws JspException {
> >         PrintWriter out=null;
> >         try {
> >             out=pageContext.getResponse().getWriter();
> >             pageContext.getOut().flush();
> >             out.flush(); // we need a writer for ant
> > 
> >             Project project=new Project();
> > 
> >             AntServletLogger log=new AntServletLogger();
> >             log.setWriter( out );
> >             project.addBuildListener( log );
> > 
> >             project.init();
> > 
> >             Enumeration argsE=args.propertyNames();
> >             while( argsE.hasMoreElements() ) {
> >                 String k=(String)argsE.nextElement();
> >                 String v=args.getProperty( k );
> >                 if( k!=null && v!= null )
> >                     project.setUserProperty( k, v );
> >             }
> > 
> >             String antFileN=args.getProperty("ant.file");
> >             if( antFileN==null )
> >                 throw new JspException( "ant.file not specified");
> >             File antF=new File(antFileN);
> >             ProjectHelper.configureProject( project,
> >                                            antF );
> > 
> >             // pre-execution properties
> >             Hashtable antProperties=project.getProperties();
> >             argsE=antProperties.keys();
> >             while( argsE.hasMoreElements() ) {
> >                 String k=(String)argsE.nextElement();
> >                 String v=(String)antProperties.get( k );
> >                 if( k!=null && v!= null )
> >                     args.put( k, v ); // includes "revision"
> >             }
> > 
> >             if( targets.size()==0 ) {
> >                 //targets.addElement("client");
> >             }
> > 
> >             project.executeTargets( targets );
> > 
> >             // post-execution properties
> >             antProperties=project.getProperties();
> > 
> >             argsE=antProperties.keys();
> >             while( argsE.hasMoreElements() ) {
> >                 String k=(String)argsE.nextElement();
> >                 String v=(String)antProperties.get( k );
> >                 if( k!=null && v!= null )
> >                     args.put( k, v );
> >             }
> > 
> >         } catch( BuildException ex ) {
> >             if( out==null ) out=new PrintWriter(System.out);
> >             ex.printStackTrace(out);
> >             Throwable ex1=ex.getException();
> >             out.println("Root cause: " );
> >             if( ex1!=null)
> >                 ex1.printStackTrace(out);
> >             out.flush();
> >             throw new JspException( ex.toString() );
> >         } catch( IOException ioex ) {
> >             if( out==null ) out=new PrintWriter(System.out);
> >             ioex.printStackTrace(out);
> >             throw new JspException( ioex.toString() );
> >         }
> >       }
> >   }
> >
> 


Re: cvs commit: jakarta-tomcat/proposals/build2/ant tomcat.jsp

Posted by Casey Lucas <cl...@armassolutions.com>.
Hey costin,

Sure thing.  We recently moved and have been very busy but I'm starting to
have a little more time (knock on wood).  I should be able to help out with
at least the pooling stuff, so just let me know if you have specific ideas
or need help.

-casey

cmanolache@yahoo.com wrote:
> 
> Hi Casey,
> 
> Sorry, I have too many things for now - the web based build is going to
> wait a bit. If you could check in the changes, great.( I hope you got the
> commit access )
> 
> BTW, I have few ideas for the pooling in jasper34 ( I would like to make
> the pool pluggable, and managed by the container ). Getting the code
> generator to work is first, but I hope in few weeks to finally merge the 2
> runtimes and make the changes, and I hope you can review ( or help
> :-) some of it.
> 
> Costin
> 
> On Sun, 29 Apr 2001, Casey Lucas wrote:
> 
> >
> > Costin,
> >
> > Web based build will be a nice addition -- cool.
> >
> > Small comment though.  Keep in mind that I don't have a complete understanding
> > of all associated code, but at first glance, it appears that AntTag won't work
> > correctly if tag pooling is being used.  I think the fix is simple though.  Just
> > reset the list of targets and args at tag start time:
> >
> >
> > >   1.1                  jakarta-tomcat/proposals/build2/WEB-INF/src/AntTag.java
> > >
> > >   Index: AntTag.java
> > >   ===================================================================
> > >   package tadm;
> > >   import java.util.*;
> > >   import java.io.*;
> > >   import java.net.URL;
> > >   import javax.servlet.http.*;
> > >   import javax.servlet.*;
> > >
> > >   import javax.servlet.jsp.*;
> > >   import javax.servlet.jsp.tagext.*;
> > >
> > >   import org.apache.tools.ant.*;
> > >
> > >   /**
> > >    * This tag will run ant tasks
> > >    *
> > >    */
> > >   public class AntTag extends TagSupport {
> > >
> > >       public AntTag() {}
> > >
> > >       public int doStartTag() throws JspException {
> >
> > add:
> >
> > args.clear()
> > targets.clear() // or removeAllElements() etc.
> >
> >
> > >         try {
> > >             pageContext.setAttribute("antProperties",
> > >                                      args);
> > >         } catch (Exception ex ) {
> > >             ex.printStackTrace();
> > >         }
> > >         return EVAL_BODY_INCLUDE;
> > >       }
> > >
> > >       public int doEndTag() throws JspException {
> > >         runTest();
> > >         return EVAL_PAGE;
> > >       }
> > >
> > >       // -------------------- child tag support --------------------
> > >       Properties args=new Properties();
> > >       Vector targets=new Vector();
> > >
> > >       public void setProperty( String name, String value ) {
> > >         System.out.println("Adding property " + name + "=" + value );
> > >         args.put(name, value );
> > >       }
> > >
> > >       public String getProperty( String name ) {
> > >         System.out.println("Getting property " + name  );
> > >         return args.getProperty(name );
> > >       }
> > >
> > >       public void addTarget( String n ) {
> > >         System.out.println("Adding target " + n );
> > >         targets.addElement( n );
> > >       }
> > >
> > >       //-------------------- Properties --------------------
> > >
> > >       /** Set the name of the test.xml, relative to the base dir.
> > >        *  For example, /WEB-INF/test-tomcat.xml
> > >        */
> > >       public void setTestFile( String s ) {
> > >         args.put("ant.file", s);
> > >       }
> > >
> > >       /** Set the target - a subset of tests to be run
> > >        */
> > >       public void setTarget( String s ) {
> > >         addTarget(s);
> > >       }
> > >
> > >       public void setDebug( String s ) {
> > >         args.put( "debug", s);
> > >       }
> > >
> > >       // -------------------- Implementation methods --------------------
> > >
> > >       private void runTest() throws JspException {
> > >         PrintWriter out=null;
> > >         try {
> > >             out=pageContext.getResponse().getWriter();
> > >             pageContext.getOut().flush();
> > >             out.flush(); // we need a writer for ant
> > >
> > >             Project project=new Project();
> > >
> > >             AntServletLogger log=new AntServletLogger();
> > >             log.setWriter( out );
> > >             project.addBuildListener( log );
> > >
> > >             project.init();
> > >
> > >             Enumeration argsE=args.propertyNames();
> > >             while( argsE.hasMoreElements() ) {
> > >                 String k=(String)argsE.nextElement();
> > >                 String v=args.getProperty( k );
> > >                 if( k!=null && v!= null )
> > >                     project.setUserProperty( k, v );
> > >             }
> > >
> > >             String antFileN=args.getProperty("ant.file");
> > >             if( antFileN==null )
> > >                 throw new JspException( "ant.file not specified");
> > >             File antF=new File(antFileN);
> > >             ProjectHelper.configureProject( project,
> > >                                            antF );
> > >
> > >             // pre-execution properties
> > >             Hashtable antProperties=project.getProperties();
> > >             argsE=antProperties.keys();
> > >             while( argsE.hasMoreElements() ) {
> > >                 String k=(String)argsE.nextElement();
> > >                 String v=(String)antProperties.get( k );
> > >                 if( k!=null && v!= null )
> > >                     args.put( k, v ); // includes "revision"
> > >             }
> > >
> > >             if( targets.size()==0 ) {
> > >                 //targets.addElement("client");
> > >             }
> > >
> > >             project.executeTargets( targets );
> > >
> > >             // post-execution properties
> > >             antProperties=project.getProperties();
> > >
> > >             argsE=antProperties.keys();
> > >             while( argsE.hasMoreElements() ) {
> > >                 String k=(String)argsE.nextElement();
> > >                 String v=(String)antProperties.get( k );
> > >                 if( k!=null && v!= null )
> > >                     args.put( k, v );
> > >             }
> > >
> > >         } catch( BuildException ex ) {
> > >             if( out==null ) out=new PrintWriter(System.out);
> > >             ex.printStackTrace(out);
> > >             Throwable ex1=ex.getException();
> > >             out.println("Root cause: " );
> > >             if( ex1!=null)
> > >                 ex1.printStackTrace(out);
> > >             out.flush();
> > >             throw new JspException( ex.toString() );
> > >         } catch( IOException ioex ) {
> > >             if( out==null ) out=new PrintWriter(System.out);
> > >             ioex.printStackTrace(out);
> > >             throw new JspException( ioex.toString() );
> > >         }
> > >       }
> > >   }
> > >
> >