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/java/org/apache/myrmidon/components/embeddor DefaultEmbeddor.java
Date Thu, 14 Jun 2001 12:11:09 GMT
donaldp     01/06/14 05:11:09

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java ProjectBuilder.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
  Log:
  Modify ProjectBuilder interface to accept Parameters. This allows arbitrary builders to
be added in the future (such as for templating etc).
  
  Revision  Changes    Path
  1.8       +5 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultProjectBuilder.java	2001/06/12 13:46:58	1.7
  +++ DefaultProjectBuilder.java	2001/06/14 12:11:05	1.8
  @@ -18,6 +18,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
   import org.apache.avalon.framework.logger.AbstractLoggable;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.log.Logger;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.components.model.Condition;
  @@ -50,7 +51,7 @@
        * @exception IOException if an error occurs
        * @exception Exception if an error occurs
        */
  -    public Project build( final String source )
  +    public Project build( final String source, final Parameters parameters )
           throws Exception
       {
           final File file = new File( source );
  @@ -102,7 +103,7 @@
        * @exception Exception if an error occurs
        * @exception ConfigurationException if an error occurs
        */
  -    private DefaultProject buildProject( final File file, 
  +    private DefaultProject buildProject( final File file,
                                            final Configuration configuration )
           throws Exception
       {
  @@ -226,7 +227,7 @@
           if( !validName( name ) )
           {
               throw new Exception( "Projectref with an invalid name attribute at " +
  -                                 element.getLocation() );           
  +                                 element.getLocation() );
           }
   
           if( null == location )
  @@ -301,7 +302,7 @@
           if( !validName( name ) )
           {
               throw new Exception( "Target with an invalid name at " +
  -                                 target.getLocation() );           
  +                                 target.getLocation() );
           }
   
           getLogger().debug( "Parsing target: " + name );
  
  
  
  1.7       +2 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ProjectBuilder.java
  
  Index: ProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ProjectBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProjectBuilder.java	2001/06/12 13:46:58	1.6
  +++ ProjectBuilder.java	2001/06/14 12:11:06	1.7
  @@ -10,6 +10,7 @@
   import java.io.File;
   import java.io.IOException;
   import org.apache.avalon.framework.component.Component;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.myrmidon.components.model.Project;
   
   /**
  @@ -30,6 +31,6 @@
        * @exception IOException if an error occurs
        * @exception AntException if an error occurs
        */
  -    Project build( String source )
  +    Project build( String source, Parameters parameters )
           throws Exception;
   }
  
  
  
  1.4       +21 -2     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultEmbeddor.java	2001/06/12 13:55:12	1.3
  +++ DefaultEmbeddor.java	2001/06/14 12:11:08	1.4
  @@ -76,11 +76,30 @@
       }
   
       public Project createProject( final String location, 
  -                                  final String type, 
  +                                  String type, 
                                     final Parameters parameters )
           throws Exception
       {
  -        return m_builder.build( location );
  +        if( null == type )
  +        {
  +            type = guessTypeFor( location );
  +        }
  +
  +        final ProjectBuilder builder = getProjectBuilder( type );
  +        return builder.build( location, parameters );
  +    }
  +
  +    private String guessTypeFor( final String location )
  +    {
  +        //TODO: use hueristics to map filename extention to type
  +        return "ant";
  +    }
  +
  +    private ProjectBuilder getProjectBuilder( final String type )
  +        throws Exception
  +    {
  +        //FIXME: Should not be ignoring type
  +        return m_builder;
       }
   
       public ProjectManager createProjectManager( final Project project, 
  
  
  

Mime
View raw message