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-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test DefaultEmbeddorTest.java
Date Sun, 30 Jun 2002 06:36:36 GMT
donaldp     2002/06/29 23:36:36

  Modified:    container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
               container/src/java/org/apache/myrmidon/interfaces/embeddor
                        Embeddor.java
               container/src/test/org/apache/myrmidon/components/embeddor/test
                        DefaultEmbeddorTest.java
  Log:
  Allow users to specify TaskContext when creating a project from embeddor.
  
  Thus newly registered ProjectBuilders can be grabbed from TaskContext rather than using
builtin builders.
  
  Revision  Changes    Path
  1.109     +15 -5     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- DefaultEmbeddor.java	30 Jun 2002 06:23:30 -0000	1.108
  +++ DefaultEmbeddor.java	30 Jun 2002 06:36:35 -0000	1.109
  @@ -86,7 +86,6 @@
       private ExecutionFrame m_rootFrame;
       private TaskContext m_rootContext;
       private PropertyStore m_rootProps;
  -    private ProjectBuilder m_projectBuilder;
   
       /**
        * Setup basic properties of engine.
  @@ -106,14 +105,26 @@
       /**
        * Builds a project.
        */
  -    public Project createProject( final ProjectDescriptor project )
  +    public Project createProject( final ProjectDescriptor project,
  +                                  final TaskContext context )
           throws Exception
       {
  +        ProjectBuilder builder;
  +        if( null != context )
  +        {
  +            builder =
  +                (ProjectBuilder)context.getService( ProjectBuilder.class );
  +        }
  +        else
  +        {
  +            builder =
  +                (ProjectBuilder)m_serviceManager.lookup( ProjectBuilder.ROLE );
  +        }
           /*       final TypeFactory factory = m_typeManager.getFactory( ModelBuilder.ROLE
);
                  final ModelBuilder modelBuilder =
                      (ModelBuilder)factory.create( project.getType() );
                  final ModelElement model = modelBuilder.build( project.getUri() );*/
  -        return m_projectBuilder.build( project );
  +        return builder.build( project );
       }
   
       /**
  @@ -195,7 +206,6 @@
   
           // locate the components we need
           m_deployer = (Deployer)m_serviceManager.lookup( Deployer.ROLE );
  -        m_projectBuilder = (ProjectBuilder)m_serviceManager.lookup( ProjectBuilder.ROLE
);
           m_libraryManager = (LibraryManager)m_serviceManager.lookup( LibraryManager.ROLE
);
           m_configurer = (Configurer)m_serviceManager.lookup( Configurer.ROLE );
   
  
  
  
  1.103     +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- DefaultWorkspace.java	27 Jun 2002 11:13:08 -0000	1.102
  +++ DefaultWorkspace.java	30 Jun 2002 06:36:35 -0000	1.103
  @@ -179,7 +179,7 @@
           try
           {
               final Embeddor embeddor = (Embeddor)m_frame.lookup( Embeddor.ROLE );
  -            return embeddor.createProject( descriptor );
  +            return embeddor.createProject( descriptor, null );
           }
           catch( final Exception e )
           {
  
  
  
  1.27      +6 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java
  
  Index: Embeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Embeddor.java	13 Jun 2002 05:19:00 -0000	1.26
  +++ Embeddor.java	30 Jun 2002 06:36:36 -0000	1.27
  @@ -9,6 +9,7 @@
   
   import java.util.Map;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.event.TaskListener;
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  @@ -30,10 +31,13 @@
        * Creates a project from a project file.
        *
        * @param project The descriptor describing location and type of project
  +     * @param context The context in which you build project (and thus which
  +     *                ProjectBuidlers are available). May be null.
        * @return the created Project
        * @throws Exception If an error occurs creating the Project.
        */
  -    Project createProject( ProjectDescriptor project )
  +    Project createProject( ProjectDescriptor project,
  +                           TaskContext context )
           throws Exception;
   
       /**
  
  
  
  1.37      +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
  
  Index: DefaultEmbeddorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultEmbeddorTest.java	20 Jun 2002 06:00:59 -0000	1.36
  +++ DefaultEmbeddorTest.java	30 Jun 2002 06:36:36 -0000	1.37
  @@ -84,7 +84,7 @@
           final File projectFile = getTestResource( "project-builder.ant" );
           final String uri = projectFile.toURL().toExternalForm();
           final ProjectDescriptor descriptor = new ProjectDescriptor( uri );
  -        final Project project = getEmbeddor().createProject( descriptor );
  +        final Project project = getEmbeddor().createProject( descriptor, null );
   
           // Verify the project.
           assertEquals( "test-project", project.getProjectName() );
  @@ -125,7 +125,7 @@
   
           final String uri = projectFile.toURL().toExternalForm();
           final ProjectDescriptor descriptor = new ProjectDescriptor( uri );
  -        final Project project = embeddor.createProject( descriptor );
  +        final Project project = embeddor.createProject( descriptor, null );
   
           // Build the workspace
           final ExecutionFrame frame = embeddor.createExecutionFrame( new HashMap(), null
);
  
  
  

--
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