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/java/org/apache/myrmidon/interfaces/executor ExecutionFrame.java
Date Thu, 20 Jun 2002 09:52:21 GMT
donaldp     2002/06/20 02:52:20

  Modified:    container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutionFrame.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
               container/src/java/org/apache/myrmidon/interfaces/executor
                        ExecutionFrame.java
  Log:
  Dont pass in serviceManager to frame but register each server against frame after creating
 a partitioning frame. Can you say Ugly hack? I can!
  
  Revision  Changes    Path
  1.18      +15 -21    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java
  
  Index: DefaultExecutionFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultExecutionFrame.java	20 Jun 2002 08:14:05 -0000	1.17
  +++ DefaultExecutionFrame.java	20 Jun 2002 09:52:20 -0000	1.18
  @@ -67,6 +67,14 @@
       }
   
       /**
  +     * @todo Remove this ugly damn hack!!!
  +     */
  +    public void registerService( String role, Object service )
  +    {
  +        m_serviceManager.put( role, service );
  +    }
  +
  +    /**
        * Returns the service in frame.
        */
       public Object lookup( String role )
  @@ -83,16 +91,6 @@
       }
   
       /**
  -     * Register the service in frame.
  -     * @todo Remove me as I am an ugly hack!!!
  -     */
  -    public void registerService( String role, Object service )
  -        throws TaskException
  -    {
  -        m_serviceManager.put( role, service );
  -    }
  -
  -    /**
        * Create a {@link org.apache.myrmidon.api.TaskContext} object for current frame.
        *
        * @param taskName the name of task
  @@ -120,23 +118,19 @@
           }
       }
   
  -    public ExecutionFrame createChildFrame( final String name,
  -                                            final File baseDirectory,
  -                                            final ServiceManager newServiceManager )
  +    public ExecutionFrame createPartition( final String name,
  +                                           final File baseDirectory )
       {
           final String newName = getName() + "/" + name;
   
  -        ServiceManager serviceManager = newServiceManager;
  +        final DefaultServiceManager dsm = new DefaultServiceManager( m_serviceManager );
           try
           {
               //What an UGLY Hack!!!
               final PropertyStore basePropertyStore =
  -                (PropertyStore)newServiceManager.lookup( PropertyStore.ROLE );
  +                (PropertyStore)m_serviceManager.lookup( PropertyStore.ROLE );
               final PropertyStore propertyStore = basePropertyStore.createChildStore();
  -            final DefaultServiceManager defaultServiceManager =
  -                new DefaultServiceManager( newServiceManager );
  -            defaultServiceManager.put( PropertyStore.ROLE, propertyStore );
  -            serviceManager = defaultServiceManager;
  +            dsm.put( PropertyStore.ROLE, propertyStore );
           }
           catch( final ServiceException se )
           {
  @@ -145,7 +139,7 @@
   
           return new DefaultExecutionFrame( newName,
                                             baseDirectory,
  -                                          serviceManager );
  +                                          dsm );
       }
   
       public ExecutionFrame createChildFrame( String name )
  
  
  
  1.94      +10 -15    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.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- DefaultWorkspace.java	20 Jun 2002 08:14:05 -0000	1.93
  +++ DefaultWorkspace.java	20 Jun 2002 09:52:20 -0000	1.94
  @@ -16,7 +16,6 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  @@ -55,10 +54,8 @@
        * Sets the root execution frame for this workspace.
        */
       public void setFrame( final ExecutionFrame frame )
  -        throws TaskException
       {
           m_frame = frame;
  -        m_frame.registerService( Workspace.ROLE, this );
       }
   
       public void execute( final ProjectDescriptor descriptor,
  @@ -139,28 +136,25 @@
       {
           try
           {
  +            final String projectName = project.getProjectName();
  +            final File baseDirectory = project.getBaseDirectory();
  +            final ExecutionFrame childFrame = frame.createPartition( projectName, baseDirectory
);
  +
               // TODO - move all this stuff to a customised ServiceManager, and call
  -            // from ExecutionFrame.createChildFrame( ..., true ).
  +            // from ExecutionFrame.createPartition( ..., true ).
   
               // Add child services, for the scoped services.
               final Map services = new HashMap();
               addChildService( TypeManager.ROLE, frame, services );
               addChildService( Deployer.ROLE, frame, services );
  +            // TODO - Add child role manager and configurer
   
  -            final DefaultServiceManager serviceManager =
  -                new DefaultServiceManager( frame.getServiceManager() );
  -
  -            setupServices( services.values(), serviceManager );
  +            frame.registerService( Workspace.ROLE, this );
   
  -            // TODO - Add child role manager and configurer
  +            setupServices( services.values(), childFrame.getServiceManager() );
   
               // TODO - we never dispose of these services.  That's bad
   
  -            final String projectName = project.getProjectName();
  -            final File baseDirectory = project.getBaseDirectory();
  -            final ExecutionFrame childFrame =
  -                frame.createChildFrame( projectName, baseDirectory, serviceManager );
  -
               final PropertyStore propertyStore =
                   (PropertyStore)childFrame.lookup( PropertyStore.ROLE );
               propertyStore.setProperty( ProjectDescriptor.KEY,
  @@ -227,6 +221,7 @@
           {
               childService = ( (ScopedService)service ).createChildService();
               scopedServices.put( service, childService );
  +            frame.registerService( role, childService );
           }
       }
   
  
  
  
  1.22      +8 -13     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java
  
  Index: ExecutionFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ExecutionFrame.java	20 Jun 2002 08:14:05 -0000	1.21
  +++ ExecutionFrame.java	20 Jun 2002 09:52:20 -0000	1.22
  @@ -59,6 +59,12 @@
           throws TaskException;
   
       /**
  +     * @todo Remove this ugly damn hack!!!
  +     */
  +    void registerService( String role, Object service );
  +
  +
  +    /**
        * Create a {@link TaskContext} object for current frame.
        *
        * @param taskName the name of task
  @@ -83,20 +89,9 @@
        * @param name the name of child frame relative to this frame.
        * @param baseDirectory the directory from which the child frame operates.
        *        If null will use this frame's base directory.
  -     * @param serviceManager the services to use in the child frame.  If null
  -     *        will use this frame's services.
        * @return the new child ExecutionFrame.
        */
  -    ExecutionFrame createChildFrame( String name,
  -                                     File baseDirectory,
  -                                     ServiceManager serviceManager );
  +    ExecutionFrame createPartition( String name, File baseDirectory );
   
       ExecutionFrame createChildFrame( String name );
  -
  -    /**
  -     * Register the service in frame.
  -     * @todo Remove me as I am an ugly hack!!!
  -     */
  -    public void registerService( String role, Object service )
  -        throws TaskException;
   }
  
  
  

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