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/api/src/java/org/apache/myrmidon/api TaskContext.java
Date Fri, 21 Jun 2002 00:45:16 GMT
donaldp     2002/06/20 17:45:16

  Modified:    container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutionFrame.java DefaultExecutor.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java
               framework/src/test/org/apache/myrmidon/framework
                        ExpectOutputTask.java
               antlib/src/java/org/apache/antlib/extensions
                        JarLibManifestTask.java
               api/src/java/org/apache/myrmidon/api TaskContext.java
  Log:
  * Remove TaskContext.CONTAINER_DESCRIPTION as it was only used in one location
  
  * add a TaskContext.getPath() method to retrieve the path to task. This change implemented
with aim of eventually zapping need for ExecutionFrame
  
  Revision  Changes    Path
  1.102     +2 -3      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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- DefaultEmbeddor.java	20 Jun 2002 08:14:05 -0000	1.101
  +++ DefaultEmbeddor.java	21 Jun 2002 00:45:16 -0000	1.102
  @@ -256,7 +256,6 @@
        * Creates a new workspace to execute this project in.
        */
       private Workspace createWorkspace( final ExecutionFrame frame )
  -        throws TaskException
       {
           final DefaultWorkspace workspace = new DefaultWorkspace();
           setupLogger( workspace );
  @@ -357,7 +356,7 @@
           addToStore( store, System.getProperties() );
   
           //Add runtime info
  -        store.setProperty( TaskContext.CONTAINER_DESCRIPTION, Constants.BUILD_DESCRIPTION
);
  +        store.setProperty( "myrmidon.container.description", Constants.BUILD_DESCRIPTION
);
           store.setProperty( "myrmidon.home", m_context.get( "myrmidon.home" ) );
   
           return store;
  
  
  
  1.19      +2 -1      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultExecutionFrame.java	20 Jun 2002 09:52:20 -0000	1.18
  +++ DefaultExecutionFrame.java	21 Jun 2002 00:45:16 -0000	1.19
  @@ -108,6 +108,7 @@
                   (PropertyStore)m_serviceManager.lookup( PropertyStore.ROLE );
               return new DefaultTaskContext( this,
                                              taskName,
  +                                           getName(),
                                              location,
                                              eventManager,
                                              propertyStore );
  
  
  
  1.48      +4 -16     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
  
  Index: DefaultExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- DefaultExecutor.java	20 Jun 2002 07:12:02 -0000	1.47
  +++ DefaultExecutor.java	21 Jun 2002 00:45:16 -0000	1.48
  @@ -39,10 +39,11 @@
       /**
        * Executes a task.
        */
  -    public void execute( final ModelElement taskModel, final ExecutionFrame frame )
  +    public void execute( final ModelElement taskModel,
  +                         final ExecutionFrame frame )
           throws TaskException
       {
  -        final TaskEventManager eventManager = getTaskEventManager( frame );
  +        final TaskEventManager eventManager = (TaskEventManager)frame.lookup( TaskEventManager.ROLE
);
           final String taskName = taskModel.getName();
           final String taskPath = frame.getName();
           final String taskLocation = taskModel.getLocation();
  @@ -74,19 +75,6 @@
           // Fire finish event
           final TaskEvent finishEvent = new TaskEvent( taskPath, taskName, taskLocation,
0 );
           eventManager.fireTaskFinished( finishEvent );
  -    }
  -
  -    /**
  -     * Get TaskEventManager from frame.
  -     *
  -     * @param frame the frame
  -     * @return the event Manager
  -     * @throws TaskException if error occurs aquiring manager
  -     */
  -    private TaskEventManager getTaskEventManager( final ExecutionFrame frame )
  -        throws TaskException
  -    {
  -        return (TaskEventManager)frame.lookup( TaskEventManager.ROLE );
       }
   
       /**
  
  
  
  1.58      +22 -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.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- DefaultTaskContext.java	20 Jun 2002 07:12:02 -0000	1.57
  +++ DefaultTaskContext.java	21 Jun 2002 00:45:16 -0000	1.58
  @@ -35,6 +35,7 @@
   
       private final ExecutionFrame m_frame;
       private final String m_name;
  +    private final String m_path;
       private final File m_baseDirectory;
       private final String m_location;
       private final TaskEventManager m_eventManager;
  @@ -45,6 +46,7 @@
        */
       public DefaultTaskContext( final ExecutionFrame frame,
                                  final String name,
  +                               final String path,
                                  final String location,
                                  final TaskEventManager eventManager,
                                  final PropertyStore propertyStore )
  @@ -58,6 +60,10 @@
           {
               throw new NullPointerException( "name" );
           }
  +        if( null == path )
  +        {
  +            throw new NullPointerException( "path" );
  +        }
           if( null == location )
           {
               throw new NullPointerException( "location" );
  @@ -73,6 +79,7 @@
   
           m_frame = frame;
           m_name = name;
  +        m_path = path;
           m_baseDirectory = frame.getBaseDirectory();
           m_location = location;
           m_eventManager = eventManager;
  @@ -90,6 +97,19 @@
       }
   
       /**
  +     * Returns the Path to task.
  +     * The path represents abstract location within a execution. For
  +     * example a task in the "myTarget" target of the "myProject" project would
  +     * have a path of "/myProject/myTarget".
  +     *
  +     * @return the Path to task
  +     */
  +    public String getPath()
  +    {
  +        return m_path;
  +    }
  +
  +    /**
        * Get the location of task in physical medium.
        *
        * @return the location of task in physical medium
  @@ -339,7 +359,7 @@
                                 final Throwable throwable )
       {
           final TaskEvent event =
  -            new TaskEvent( m_frame.getName(),
  +            new TaskEvent( getPath(),
                              getName(),
                              getLocation(),
                              message,
  
  
  
  1.3       +3 -5      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTask.java
  
  Index: ExpectOutputTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExpectOutputTask.java	13 Jun 2002 04:45:30 -0000	1.2
  +++ ExpectOutputTask.java	21 Jun 2002 00:45:16 -0000	1.3
  @@ -8,10 +8,9 @@
   package org.apache.myrmidon.framework;
   
   import org.apache.myrmidon.LogMessageTracker;
  -import org.apache.myrmidon.interfaces.event.TaskEventManager;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
   
   /**
    * A task that unit tests can use to verify the output of a set of nested
  @@ -64,8 +63,7 @@
           final LogMessageTracker listener = new LogMessageTracker();
           if( m_output != null )
           {
  -            final ExecutionFrame frame = (ExecutionFrame)getService( ExecutionFrame.class
);
  -            final String path = frame.getName();
  +            final String path = getContext().getPath();
               configureListener( listener, m_output, path );
           }
   
  
  
  
  1.4       +1 -4      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/extensions/JarLibManifestTask.java
  
  Index: JarLibManifestTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/extensions/JarLibManifestTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JarLibManifestTask.java	6 May 2002 09:29:43 -0000	1.3
  +++ JarLibManifestTask.java	21 Jun 2002 00:45:16 -0000	1.4
  @@ -19,7 +19,6 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.IOUtil;
   import org.apache.myrmidon.api.AbstractTask;
  -import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   
   /**
  @@ -150,7 +149,7 @@
           final Attributes attributes = manifest.getMainAttributes();
   
           attributes.put( Attributes.Name.MANIFEST_VERSION, MANIFEST_VERSION );
  -        final Object containerDescription = getContext().getProperty( TaskContext.CONTAINER_DESCRIPTION
);
  +        final Object containerDescription = getContext().getProperty( "myrmidon.container.description"
);
           if( containerDescription != null )
           {
               attributes.putValue( CREATED_BY, containerDescription.toString() );
  @@ -265,12 +264,10 @@
        *
        * @param attributes the attributes to add extensions to
        * @param extensions the list of extensions
  -     * @throws TaskException if an error occurs
        */
       private void appendLibraryList( final Attributes attributes,
                                       final String listPrefix,
                                       final ArrayList extensions )
  -        throws TaskException
       {
           final int size = extensions.size();
           for( int i = 0; i < size; i++ )
  
  
  
  1.37      +15 -6     jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java
  
  Index: TaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- TaskContext.java	28 May 2002 01:27:19 -0000	1.36
  +++ TaskContext.java	21 Jun 2002 00:45:16 -0000	1.37
  @@ -17,16 +17,25 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  - *
  - * @todo Add some additional standard properties.
    */
   public interface TaskContext
   {
  -    // Sandard properties that every TaskContext must contain
       /**
  -     * The name of the container description.  This is an optional property.
  +     * Retrieve Name of task.
  +     *
  +     * @return the name
        */
  -    String CONTAINER_DESCRIPTION = "myrmidon.container.description";
  +    String getName();
  +
  +    /**
  +     * Returns the Path to task.
  +     * The path represents abstract location within a execution. For
  +     * example a task in the "myTarget" target of the "myProject" project would
  +     * have a path of "/myProject/myTarget".
  +     *
  +     * @return the Path to task
  +     */
  +    String getPath();
   
       /**
        * Retrieve Name of task.
  
  
  

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