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 Sun, 30 Jun 2002 10:19:00 GMT
donaldp     2002/06/30 03:18:59

  Modified:    container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutionFrame.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java DefaultWorkspace.java
                        ProjectEntry.java
               container/src/java/org/apache/myrmidon/interfaces/executor
                        ExecutionFrame.java
  Log:
  Start removing cruft from ExecutionFrame that we no longer need to expose.
  
  Revision  Changes    Path
  1.25      +25 -27    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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultExecutionFrame.java	30 Jun 2002 09:58:14 -0000	1.24
  +++ DefaultExecutionFrame.java	30 Jun 2002 10:18:58 -0000	1.25
  @@ -44,26 +44,22 @@
       }
   
       /**
  -     * Returns the name of the execution frame.
  -     * This is used when generating TaskEvents as the
  -     * "path" element.
  -     *
  -     * @return the name of execution frame
  +     * Returns the service in frame.
        */
  -    public String getName()
  -    {
  -        return m_name;
  -    }
  -
  -    public File getBaseDirectory()
  +    public Object lookup( String role )
  +        throws TaskException
       {
  -        return m_baseDirectory;
  +        try
  +        {
  +            return m_serviceKernel.getService( role );
  +        }
  +        catch( final ServiceException se )
  +        {
  +            throw new TaskException( se.getMessage(), se );
  +        }
       }
   
  -    /**
  -     * Returns the service in frame.
  -     */
  -    public Object lookup( String role )
  +    private Object lookup2( String role )
           throws TaskException
       {
           try
  @@ -76,6 +72,7 @@
           }
       }
   
  +
       /**
        * Create a {@link org.apache.myrmidon.api.TaskContext} object for current frame.
        *
  @@ -87,15 +84,16 @@
           throws TaskException
       {
           final TaskEventManager eventManager =
  -            (TaskEventManager)lookup( TaskEventManager.ROLE );
  +            (TaskEventManager)lookup2( TaskEventManager.ROLE );
           final PropertyStore propertyStore =
  -            (PropertyStore)lookup( PropertyStore.ROLE );
  +            (PropertyStore)lookup2( PropertyStore.ROLE );
           final AntServiceKernel serviceKernel =
  -            (AntServiceKernel)lookup( AntServiceKernel.ROLE );
  +            (AntServiceKernel)lookup2( AntServiceKernel.ROLE );
           return new DefaultTaskContext( this,
                                          taskName,
  -                                       getName(),
  +                                       m_name,
                                          location,
  +                                       m_baseDirectory,
                                          eventManager,
                                          propertyStore,
                                          serviceKernel );
  @@ -109,13 +107,13 @@
           // TODO - we never dispose of these services.  That's bad
           try
           {
  -            final PropertyStore basePS = (PropertyStore)lookup( PropertyStore.ROLE );
  +            final PropertyStore basePS = (PropertyStore)lookup2( PropertyStore.ROLE );
               final PropertyStore ps = basePS.createChildStore();
   
  -            final TypeManager baseTM = (TypeManager)lookup( TypeManager.ROLE );
  +            final TypeManager baseTM = (TypeManager)lookup2( TypeManager.ROLE );
               final TypeManager tm = baseTM.getChildTypeManager();
   
  -            final AntServiceKernel baseSK = (AntServiceKernel)lookup( AntServiceKernel.ROLE
);
  +            final AntServiceKernel baseSK = (AntServiceKernel)lookup2( AntServiceKernel.ROLE
);
               final AntServiceKernel sk = baseSK.createChild();
   
               sk.registerService( PropertyStore.ROLE, ps );
  @@ -125,7 +123,7 @@
               sk.registerService( TypeManager.ROLE, tm );
               sk.registerService( TypeRegistry.ROLE, tm );
   
  -            return new DefaultExecutionFrame( getName() + "/" + name,
  +            return new DefaultExecutionFrame( m_name + "/" + name,
                                                 baseDirectory,
                                                 sk );
           }
  @@ -137,7 +135,7 @@
   
       public ExecutionFrame createChildFrame( String name )
       {
  -        final String newName = getName() + "/" + name;
  +        final String newName = m_name + "/" + name;
           return new DefaultExecutionFrame( newName,
                                             m_baseDirectory,
                                             m_serviceKernel );
  @@ -145,6 +143,6 @@
   
       public String toString()
       {
  -        return "Frame: " + getName() + ",id=" + System.identityHashCode( this );
  +        return "Frame: " + m_name + ",id=" + System.identityHashCode( this );
       }
   }
  
  
  
  1.60      +7 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
  
  Index: DefaultTaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- DefaultTaskContext.java	30 Jun 2002 09:58:14 -0000	1.59
  +++ DefaultTaskContext.java	30 Jun 2002 10:18:59 -0000	1.60
  @@ -51,6 +51,7 @@
                                  final String name,
                                  final String path,
                                  final String location,
  +                               final File baseDirectory,
                                  final TaskEventManager eventManager,
                                  final PropertyStore propertyStore,
                                  final AntServiceKernel serviceKernel )
  @@ -80,11 +81,15 @@
           {
               throw new NullPointerException( "propertyStore" );
           }
  +        if( null == baseDirectory )
  +        {
  +            throw new NullPointerException( "baseDirectory" );
  +        }
   
           m_frame = frame;
           m_name = name;
           m_path = path;
  -        m_baseDirectory = frame.getBaseDirectory();
  +        m_baseDirectory = baseDirectory;
           m_location = location;
           m_eventManager = eventManager;
           m_propertyStore = propertyStore;
  
  
  
  1.105     +7 -6      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.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- DefaultWorkspace.java	30 Jun 2002 09:58:14 -0000	1.104
  +++ DefaultWorkspace.java	30 Jun 2002 10:18:59 -0000	1.105
  @@ -48,6 +48,7 @@
        * Map from ProjectDescriptor to ProjectEntry for that project.
        */
       private final Map m_entries = new HashMap();
  +    private AntServiceKernel m_serviceKernel;
   
       /**
        * Sets the root execution frame for this workspace.
  @@ -57,9 +58,8 @@
           m_frame = frame;
           try
           {
  -            final AntServiceKernel serviceKernel =
  -                (AntServiceKernel)m_frame.lookup( AntServiceKernel.ROLE );
  -            serviceKernel.registerService( Workspace.ROLE, this );
  +            m_serviceKernel = (AntServiceKernel)m_frame.lookup( AntServiceKernel.ROLE );
  +            m_serviceKernel.registerService( Workspace.ROLE, this );
           }
           catch( Exception e )
           {
  @@ -170,7 +170,7 @@
       {
           final String key = Project.KEY + '-' + descriptor.toKey();
           final PropertyStore propertyStore =
  -            (PropertyStore)m_frame.lookup( PropertyStore.ROLE );
  +            (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
           if( propertyStore.isPropertySet( key ) )
           {
               return (Project)propertyStore.getProperty( key );
  @@ -186,7 +186,8 @@
       {
           try
           {
  -            final Embeddor embeddor = (Embeddor)m_frame.lookup( Embeddor.ROLE );
  +            final Embeddor embeddor =
  +                (Embeddor)m_serviceKernel.getService( Embeddor.ROLE );
               return embeddor.createProject( descriptor, null );
           }
           catch( final Exception e )
  
  
  
  1.16      +3 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java
  
  Index: ProjectEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ProjectEntry.java	27 Jun 2002 11:13:08 -0000	1.15
  +++ ProjectEntry.java	30 Jun 2002 10:18:59 -0000	1.16
  @@ -54,7 +54,8 @@
       private final ProjectRef m_selfRef;
   
       public ProjectEntry( final Project project,
  -                         final ExecutionFrame frame ) throws TaskException
  +                         final ExecutionFrame frame )
  +        throws TaskException
       {
           m_project = project;
           m_frame = frame;
  
  
  
  1.24      +1 -17     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ExecutionFrame.java	30 Jun 2002 09:58:14 -0000	1.23
  +++ ExecutionFrame.java	30 Jun 2002 10:18:59 -0000	1.24
  @@ -30,22 +30,6 @@
       String ROLE = ExecutionFrame.class.getName();
   
       /**
  -     * Returns the name of the execution frame.
  -     * This is used when generating TaskEvents as the
  -     * "path" element.
  -     *
  -     * @return the name of execution frame
  -     */
  -    String getName();
  -
  -    /**
  -     * Returns the directory in which the frame executes.
  -     *
  -     * @return the working directory of frame
  -     */
  -    File getBaseDirectory();
  -
  -    /**
        * Returns the service in frame.
        */
       Object lookup( String role )
  
  
  

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