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/components/workspace DefaultWorkspace.java
Date Thu, 04 Jul 2002 08:21:12 GMT
donaldp     2002/07/04 01:21:12

  Modified:    container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
  Log:
  Clean up structure a little bit
  
  Revision  Changes    Path
  1.119     +16 -6     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.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- DefaultEmbeddor.java	2 Jul 2002 09:56:26 -0000	1.118
  +++ DefaultEmbeddor.java	4 Jul 2002 08:21:12 -0000	1.119
  @@ -113,7 +113,7 @@
        * Creates an execution frame.
        */
       public AntServiceKernel createExecutionFrame( final Map properties,
  -                                                final Project[] projects )
  +                                                  final Project[] projects )
           throws Exception
       {
           final DefaultAntServiceKernel serviceKernel =
  @@ -282,7 +282,7 @@
           throws TaskException
       {
           final DefaultTaskContext context =
  -            new DefaultTaskContext( "", "", "", new File("."), frame );
  +            new DefaultTaskContext( "", "", "", new File( "." ), frame );
   
           final Workspace workspace = createWorkspace( context );
           if( targets == null || targets.length == 0 )
  @@ -304,9 +304,19 @@
       private Workspace createWorkspace( final TaskContext context )
           throws TaskException
       {
  -        final DefaultWorkspace workspace = new DefaultWorkspace();
  -        setupLogger( workspace );
  -        workspace.setTaskContext( context );
  +        final DefaultWorkspace workspace = new DefaultWorkspace( context );
  +
  +        final AntServiceKernel serviceKernel =
  +            (AntServiceKernel)context.getService( AntServiceKernel.class );
  +        try
  +        {
  +            serviceKernel.registerService( Workspace.ROLE, workspace );
  +        }
  +        catch( Exception e )
  +        {
  +            throw new TaskException( e.toString(), e );
  +        }
  +
           return workspace;
       }
   
  
  
  
  1.117     +22 -52    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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- DefaultWorkspace.java	4 Jul 2002 07:44:16 -0000	1.116
  +++ DefaultWorkspace.java	4 Jul 2002 08:21:12 -0000	1.117
  @@ -9,8 +9,6 @@
   
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.service.ServiceException;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  @@ -32,7 +30,6 @@
    * @version $Revision$ $Date$
    */
   public class DefaultWorkspace
  -    extends AbstractLogEnabled
       implements Workspace
   {
       private static final Resources REZ =
  @@ -43,25 +40,12 @@
        */
       private TaskContext m_taskContext;
   
  -    private AntServiceKernel m_serviceKernel;
  -
       /**
  -     * Sets the root execution frame for this workspace.
  +     * Constructs and sets the root execution frame for this workspace.
        */
  -    public void setTaskContext( final TaskContext taskContext )
  -        throws TaskException
  +    public DefaultWorkspace( final TaskContext taskContext )
       {
           m_taskContext = taskContext;
  -        m_serviceKernel = (AntServiceKernel)taskContext.getService( AntServiceKernel.class
);
  -
  -        try
  -        {
  -            m_serviceKernel.registerService( Workspace.ROLE, this );
  -        }
  -        catch( Exception e )
  -        {
  -            throw new IllegalStateException( e.toString() );
  -        }
       }
   
       public void execute( final ProjectDescriptor descriptor,
  @@ -189,26 +173,19 @@
       {
           final String key = ProjectEntry.KEY + "-" + descriptor.toKey();
   
  -        try
  -        {
  -            final PropertyStore propertyStore =
  -                (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
  +        final PropertyStore propertyStore =
  +            (PropertyStore)m_taskContext.getService( PropertyStore.class );
   
  -            if( propertyStore.isPropertySet( key ) )
  -            {
  -                return (ProjectEntry)propertyStore.getProperty( key );
  -            }
  -            else
  -            {
  -                final Project project = getProject( descriptor );
  -                final ProjectEntry entry = createProjectEntry( project, m_taskContext );
  -                propertyStore.setProperty( key, entry );
  -                return entry;
  -            }
  +        if( propertyStore.isPropertySet( key ) )
  +        {
  +            return (ProjectEntry)propertyStore.getProperty( key );
           }
  -        catch( final ServiceException se )
  +        else
           {
  -            throw new TaskException( se.getMessage(), se );
  +            final Project project = getProject( descriptor );
  +            final ProjectEntry entry = createProjectEntry( project, m_taskContext );
  +            propertyStore.setProperty( key, entry );
  +            return entry;
           }
       }
   
  @@ -216,24 +193,17 @@
           throws TaskException
       {
           final String key = Project.KEY + '-' + descriptor.toKey();
  -        try
  +        final PropertyStore propertyStore =
  +            (PropertyStore)m_taskContext.getService( PropertyStore.class );
  +        if( propertyStore.isPropertySet( key ) )
           {
  -            final PropertyStore propertyStore =
  -                (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
  -            if( propertyStore.isPropertySet( key ) )
  -            {
  -                return (Project)propertyStore.getProperty( key );
  -            }
  -            else
  -            {
  -                final Project project = createProject( descriptor );
  -                propertyStore.setProperty( key, project );
  -                return project;
  -            }
  +            return (Project)propertyStore.getProperty( key );
           }
  -        catch( ServiceException e )
  +        else
           {
  -            throw new TaskException( e.getMessage(), e );
  +            final Project project = createProject( descriptor );
  +            propertyStore.setProperty( key, project );
  +            return project;
           }
       }
   
  @@ -243,7 +213,7 @@
           try
           {
               final Embeddor embeddor =
  -                (Embeddor)m_serviceKernel.getService( Embeddor.ROLE );
  +                (Embeddor)m_taskContext.getService( Embeddor.class );
               return embeddor.createProject( descriptor, null );
           }
           catch( final Exception e )
  
  
  

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