ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers JasperC.java
Date Thu, 17 Jan 2002 08:04:54 GMT
donaldp     02/01/17 00:04:54

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Available.java Java.java Javac.java
                        PathConvert.java Property.java Rmic.java
                        SQLExec.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        BorlandGenerateClient.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp
                        WLJspc.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
                        JasperC.java
  Log:
  This is the first patch of the looong process of refactoring the
  setX()/createX() and setX()/addX() method pairs into a single setX() or
  addX() method.  I've started with Path, to get rid of some its inertia.
  
  Submitted by: "Adam Murdoch" <adammurdoch_ml@yahoo.com>
  
  Revision  Changes    Path
  1.17      +20 -26    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Available.java	15 Jan 2002 09:51:07 -0000	1.16
  +++ Available.java	17 Jan 2002 08:04:54 -0000	1.17
  @@ -48,10 +48,20 @@
           }
       }
   
  -    public void setClasspath( Path classpath )
  +    /**
  +     * Adds a classpath element.
  +     */
  +    public void addClasspath( Path classpath )
           throws TaskException
       {
  -        createClasspath().append( classpath );
  +        if ( m_classpath == null )
  +        {
  +            m_classpath = classpath;
  +        }
  +        else
  +        {
  +            m_classpath.addPath(classpath);
  +        }
       }
   
       public void setFile( String file )
  @@ -59,12 +69,6 @@
           m_file = file;
       }
   
  -    public void setFilepath( Path filepath )
  -        throws TaskException
  -    {
  -        createFilepath().append( filepath );
  -    }
  -
       public void setProperty( String property )
       {
           m_property = property;
  @@ -85,30 +89,20 @@
           m_value = value;
       }
   
  -    public Path createClasspath()
  +    /**
  +     * Adds a file search path element.
  +     */
  +    public void addFilepath( Path path )
           throws TaskException
       {
  -        if( m_classpath == null )
  +        if( m_filepath == null )
           {
  -            m_classpath = new Path();
  +            m_filepath = path;
           }
  -        Path path1 = m_classpath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
  -    }
  -
  -    public Path createFilepath()
  -        throws TaskException
  -    {
  -        if( m_filepath == null )
  +        else
           {
  -            m_filepath = new Path();
  +            m_filepath.addPath( path );
           }
  -        Path path1 = m_filepath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       public boolean eval()
  
  
  
  1.23      +3 -15     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Java.java	15 Jan 2002 09:51:07 -0000	1.22
  +++ Java.java	17 Jan 2002 08:04:54 -0000	1.23
  @@ -45,12 +45,12 @@
       }
   
       /**
  -     * Set the classpath to be used for this compilation.
  +     * Add a classpath element.
        */
  -    public void setClasspath( final Path classpath )
  +    public void addClasspath( final Path classpath )
           throws TaskException
       {
  -        createClasspath().append( classpath );
  +        m_cmdl.createClasspath().addPath( classpath );
       }
   
       /**
  @@ -109,18 +109,6 @@
       public Argument createArg()
       {
           return m_cmdl.createArgument();
  -    }
  -
  -    /**
  -     * Creates a nested classpath element
  -     */
  -    public Path createClasspath()
  -        throws TaskException
  -    {
  -        Path path1 = m_cmdl.createClasspath();
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       /**
  
  
  
  1.25      +14 -84    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Javac.java	15 Jan 2002 09:51:07 -0000	1.24
  +++ Javac.java	17 Jan 2002 08:04:54 -0000	1.25
  @@ -88,11 +88,12 @@
       private String target;
   
       /**
  -     * Sets the bootclasspath that will be used to compile the classes against.
  +     * Adds an element to the bootclasspath that will be used to compile the
  +     * classes against.
        *
        * @param bootclasspath The new Bootclasspath value
        */
  -    public void setBootclasspath( Path bootclasspath )
  +    public void addBootclasspath( Path bootclasspath )
           throws TaskException
       {
           if( this.bootclasspath == null )
  @@ -101,16 +102,16 @@
           }
           else
           {
  -            this.bootclasspath.append( bootclasspath );
  +            this.bootclasspath.addPath( bootclasspath );
           }
       }
   
       /**
  -     * Set the classpath to be used for this compilation.
  +     * Adds an element to the classpath to be used for this compilation.
        *
        * @param classpath The new Classpath value
        */
  -    public void setClasspath( Path classpath )
  +    public void addClasspath( Path classpath )
           throws TaskException
       {
           if( compileClasspath == null )
  @@ -119,7 +120,7 @@
           }
           else
           {
  -            compileClasspath.append( classpath );
  +            compileClasspath.addPath( classpath );
           }
       }
   
  @@ -185,11 +186,12 @@
       }
   
       /**
  -     * Sets the extension directories that will be used during the compilation.
  +     * Adds an element to the extension directories that will be used during
  +     * the compilation.
        *
        * @param extdirs The new Extdirs value
        */
  -    public void setExtdirs( Path extdirs )
  +    public void addExtdirs( Path extdirs )
           throws TaskException
       {
           if( this.extdirs == null )
  @@ -198,7 +200,7 @@
           }
           else
           {
  -            this.extdirs.append( extdirs );
  +            this.extdirs.addPath( extdirs );
           }
       }
   
  @@ -322,11 +324,11 @@
       }
   
       /**
  -     * Set the source dirs to find the source Java files.
  +     * Adds an element to the source dirs to find the source Java files.
        *
        * @param srcDir The new Srcdir value
        */
  -    public void setSrcdir( Path srcDir )
  +    public void addSrcdir( Path srcDir )
           throws TaskException
       {
           if( src == null )
  @@ -335,7 +337,7 @@
           }
           else
           {
  -            src.append( srcDir );
  +            src.addPath( srcDir );
           }
       }
   
  @@ -631,42 +633,6 @@
       }
   
       /**
  -     * Maybe creates a nested classpath element.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createBootclasspath()
  -        throws TaskException
  -    {
  -        if( bootclasspath == null )
  -        {
  -            bootclasspath = new Path();
  -        }
  -        Path path1 = bootclasspath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
  -    }
  -
  -    /**
  -     * Maybe creates a nested classpath element.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createClasspath()
  -        throws TaskException
  -    {
  -        if( compileClasspath == null )
  -        {
  -            compileClasspath = new Path();
  -        }
  -        Path path1 = compileClasspath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
  -    }
  -
  -    /**
        * Adds an implementation specific command line argument.
        *
        * @return Description of the Returned Value
  @@ -677,42 +643,6 @@
               new ImplementationSpecificArgument();
           implementationSpecificArgs.add( arg );
           return arg;
  -    }
  -
  -    /**
  -     * Maybe creates a nested classpath element.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createExtdirs()
  -        throws TaskException
  -    {
  -        if( extdirs == null )
  -        {
  -            extdirs = new Path();
  -        }
  -        Path path1 = extdirs;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
  -    }
  -
  -    /**
  -     * Create a nested src element for multiple source path support.
  -     *
  -     * @return a nested src element.
  -     */
  -    public Path createSrc()
  -        throws TaskException
  -    {
  -        if( src == null )
  -        {
  -            src = new Path();
  -        }
  -        Path path1 = src;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       /**
  
  
  
  1.12      +7 -7      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  
  Index: PathConvert.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PathConvert.java	15 Jan 2002 09:51:07 -0000	1.11
  +++ PathConvert.java	17 Jan 2002 08:04:54 -0000	1.12
  @@ -96,19 +96,19 @@
       }
   
       /**
  -     * Create a nested PATH element
  +     * Adds a PATH element
        */
  -    public Path createPath()
  +    public void addPath( Path path )
           throws TaskException
       {
           if( m_path == null )
           {
  -            m_path = new Path();
  +            m_path = path;
  +        }
  +        else
  +        {
  +            m_path.addPath( path );
           }
  -        Path path1 = m_path;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       public void execute()
  
  
  
  1.25      +2 -15     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Property.java	15 Jan 2002 09:51:07 -0000	1.24
  +++ Property.java	17 Jan 2002 08:04:54 -0000	1.25
  @@ -35,7 +35,7 @@
       private String m_resource;
       private String m_value;
   
  -    public void setClasspath( Path classpath )
  +    public void addClasspath( Path classpath )
           throws TaskException
       {
           if( m_classpath == null )
  @@ -44,7 +44,7 @@
           }
           else
           {
  -            m_classpath.append( classpath );
  +            m_classpath.addPath( classpath );
           }
       }
   
  @@ -66,19 +66,6 @@
       public void setValue( String value )
       {
           m_value = value;
  -    }
  -
  -    public Path createClasspath()
  -        throws TaskException
  -    {
  -        if( m_classpath == null )
  -        {
  -            m_classpath = new Path();
  -        }
  -        Path path1 = m_classpath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       public void execute()
  
  
  
  1.23      +7 -42     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java
  
  Index: Rmic.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Rmic.java	15 Jan 2002 09:51:07 -0000	1.22
  +++ Rmic.java	17 Jan 2002 08:04:54 -0000	1.23
  @@ -102,11 +102,11 @@
       }
   
       /**
  -     * Set the classpath to be used for this compilation.
  +     * Add an element to the classpath to be used for this compilation.
        *
        * @param classpath The new Classpath value
        */
  -    public void setClasspath( Path classpath )
  +    public void addClasspath( Path classpath )
           throws TaskException
       {
           if( compileClasspath == null )
  @@ -115,7 +115,7 @@
           }
           else
           {
  -            compileClasspath.append( classpath );
  +            compileClasspath.addPath( classpath );
           }
       }
   
  @@ -130,11 +130,12 @@
       }
   
       /**
  -     * Sets the extension directories that will be used during the compilation.
  +     * Adds an element to the extension directories that will be used during
  +     * the compilation.
        *
        * @param extdirs The new Extdirs value
        */
  -    public void setExtdirs( Path extdirs )
  +    public void addExtdirs( Path extdirs )
           throws TaskException
       {
           if( this.extdirs == null )
  @@ -143,7 +144,7 @@
           }
           else
           {
  -            this.extdirs.append( extdirs );
  +            this.extdirs.addPath( extdirs );
           }
       }
   
  @@ -457,42 +458,6 @@
           }
           // we only get here if an exception has been thrown
           return false;
  -    }
  -
  -    /**
  -     * Creates a nested classpath element.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createClasspath()
  -        throws TaskException
  -    {
  -        if( compileClasspath == null )
  -        {
  -            compileClasspath = new Path();
  -        }
  -        Path path1 = compileClasspath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
  -    }
  -
  -    /**
  -     * Maybe creates a nested extdirs element.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createExtdirs()
  -        throws TaskException
  -    {
  -        if( extdirs == null )
  -        {
  -            extdirs = new Path();
  -        }
  -        Path path1 = extdirs;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       public void execute()
  
  
  
  1.20      +3 -21     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  
  Index: SQLExec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SQLExec.java	15 Jan 2002 09:51:07 -0000	1.19
  +++ SQLExec.java	17 Jan 2002 08:04:54 -0000	1.20
  @@ -162,11 +162,11 @@
       }
   
       /**
  -     * Set the classpath for loading the driver.
  +     * Adds an element to the classpath for loading the driver.
        *
        * @param classpath The new Classpath value
        */
  -    public void setClasspath( Path classpath )
  +    public void addClasspath( Path classpath )
           throws TaskException
       {
           if( this.classpath == null )
  @@ -175,7 +175,7 @@
           }
           else
           {
  -            this.classpath.append( classpath );
  +            this.classpath.addPath( classpath );
           }
       }
   
  @@ -343,24 +343,6 @@
       public void addContent( String sql )
       {
           this.sqlCommand += sql;
  -    }
  -
  -    /**
  -     * Create the classpath for loading the driver.
  -     *
  -     * @return Description of the Returned Value
  -     */
  -    public Path createClasspath()
  -        throws TaskException
  -    {
  -        if( this.classpath == null )
  -        {
  -            this.classpath = new Path();
  -        }
  -        Path path1 = this.classpath;
  -        final Path path = new Path();
  -        path1.addPath( path );
  -        return path;
       }
   
       /**
  
  
  
  1.15      +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  
  Index: BorlandGenerateClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BorlandGenerateClient.java	15 Jan 2002 09:51:08 -0000	1.14
  +++ BorlandGenerateClient.java	17 Jan 2002 08:04:54 -0000	1.15
  @@ -215,7 +215,7 @@
               //classpath
               //add at the end of the classpath
               //the system classpath in order to find the tools.jar file
  -            execTask.setClasspath( classpath.concatSystemClasspath() );
  +            execTask.addClasspath( classpath.concatSystemClasspath() );
   
               execTask.setFork( true );
               execTask.createArg().setValue( "generateclient" );
  
  
  
  1.16      +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
  
  Index: WLJspc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WLJspc.java	12 Jan 2002 23:52:15 -0000	1.15
  +++ WLJspc.java	17 Jan 2002 08:04:54 -0000	1.16
  @@ -229,7 +229,7 @@
   
               //helperTask.clearArgs();
               helperTask.createArg().setValue( arg );
  -            helperTask.setClasspath( compileClasspath );
  +            helperTask.addClasspath( compileClasspath );
               if( helperTask.executeJava() != 0 )
               {
                   getLogger().warn( files[ i ] + " failed to compile" );
  
  
  
  1.8       +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  
  Index: JasperC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JasperC.java	12 Jan 2002 05:01:23 -0000	1.7
  +++ JasperC.java	17 Jan 2002 08:04:54 -0000	1.8
  @@ -37,7 +37,7 @@
               //FIXME
               Java java = null;//(Java)( getJspc().getProject() ).createTask( "java" );
               if( getJspc().getClasspath() != null )
  -                java.setClasspath( getJspc().getClasspath() );
  +                java.addClasspath( getJspc().getClasspath() );
               java.setClassname( "org.apache.jasper.JspC" );
               String args[] = cmd.getArguments();
               for( int i = 0; i < args.length; i++ )
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message