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/executor DefaultExecutor.java
Date Tue, 23 Apr 2002 07:44:06 GMT
donaldp     02/04/23 00:44:06

  Modified:    container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutor.java
  Log:
  Generate task events at the start and end of an events lifecycle
  
  Still  need to generate events for log messages
  
  Revision  Changes    Path
  1.37      +28 -4     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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultExecutor.java	21 Apr 2002 01:54:28 -0000	1.36
  +++ DefaultExecutor.java	23 Apr 2002 07:44:06 -0000	1.37
  @@ -20,12 +20,13 @@
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
   
   /**
    * The basic executor that just executes the tasks.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.36 $ $Date: 2002/04/21 01:54:28 $
  + * @version $Revision: 1.37 $ $Date: 2002/04/23 07:44:06 $
    */
   public class DefaultExecutor
       extends AbstractLogEnabled
  @@ -40,6 +41,31 @@
       public void execute( final ModelElement taskModel, final ExecutionFrame frame )
           throws TaskException
       {
  +        final TaskEventManager eventManager = frame.getTaskEventManager();
  +        eventManager.fireTaskStarting( frame.getName(), taskModel.getName(), taskModel.getLocation()
);
  +        doExecute( taskModel, frame );
  +        eventManager.fireTaskFinished( frame.getName(), taskModel.getName(), taskModel.getLocation()
);
  +    }
  +
  +    /**
  +     * Actually execute task by
  +     *
  +     * <ul>
  +     *   <li>Creating the task object</li>
  +     *   <li>Contextualizing task/li>
  +     *   <li>configuring task</li>
  +     *   <li>Calling tasks execute() method</li>
  +     * </ul>
  +     *
  +     * @param taskModel the task model representing task
  +     * @param frame the frame in which to execute task
  +     * @throws TaskException if the task generates a TaskException
  +     *         or there is a failure configuring task
  +     */
  +    protected void doExecute( final ModelElement taskModel,
  +                              final ExecutionFrame frame )
  +        throws TaskException
  +    {
           final String taskName = taskModel.getName();
           try
           {
  @@ -81,9 +107,7 @@
       {
           // TODO - need to deactivate the context once the task has finished
           // executing
  -        return new DefaultTaskContext( frame.getServiceManager(),
  -                                       frame.getLogger(),
  -                                       frame.getProperties() );
  +        return new DefaultTaskContext( frame );
       }
   
       /**
  
  
  

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