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/proposal/myrmidon/src/java/org/apache/myrmidon/framework AbstractContainerTask.java
Date Sun, 03 Mar 2002 06:41:26 GMT
donaldp     02/03/02 22:41:26

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        AbstractContainerTask.java
  Log:
  Start process of simplifying writing container tasks
  
  Revision  Changes    Path
  1.19      +29 -34    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java
  
  Index: AbstractContainerTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractContainerTask.java	25 Feb 2002 10:42:44 -0000	1.18
  +++ AbstractContainerTask.java	3 Mar 2002 06:41:26 -0000	1.19
  @@ -17,6 +17,7 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
  +import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.type.TypeException;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
  @@ -26,7 +27,7 @@
    * This is the class that Task writers should extend to provide custom tasks.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.18 $ $Date: 2002/02/25 10:42:44 $
  + * @version $Revision: 1.19 $ $Date: 2002/03/03 06:41:26 $
    */
   public abstract class AbstractContainerTask
       extends AbstractTask
  @@ -42,6 +43,7 @@
   
       ///For executing sub-elements as tasks
       private Executor m_executor;
  +    private ExecutionFrame m_frame;
   
       /**
        * Retrieve context from container.
  @@ -55,6 +57,7 @@
           m_configurer = (Configurer)getService( Configurer.class );
           m_converter = (Converter)getService( Converter.class );
           m_executor = (Executor)getService( Executor.class );
  +        m_frame = (ExecutionFrame)getService( ExecutionFrame.class );
       }
   
       /**
  @@ -70,7 +73,7 @@
       {
           try
           {
  -            return getConverter().convert( to, object, getContext() );
  +            return m_converter.convert( to, object, getContext() );
           }
           catch( final ConverterException ce )
           {
  @@ -89,7 +92,7 @@
       protected final void configure( final Object object, final Configuration element )
           throws ConfigurationException
       {
  -        getConfigurer().configure( object, element, getContext() );
  +        m_configurer.configure( object, element, getContext() );
       }
   
       /**
  @@ -103,7 +106,29 @@
       protected final void configure( final Object object, final String name, final String
value )
           throws ConfigurationException
       {
  -        getConfigurer().configure( object, name, value, getContext() );
  +        m_configurer.configure( object, name, value, getContext() );
  +    }
  +
  +    /**
  +     * Utility method to execute specified tasks in current ExecutionFrame.
  +     */
  +    protected final void executeTasks( final Configuration[] tasks )
  +        throws TaskException
  +    {
  +        for( int i = 0; i < tasks.length; i++ )
  +        {
  +            final Configuration task = tasks[ i ];
  +            executeTask( task );
  +        }
  +    }
  +
  +    /**
  +     * Utility method to execute specified task in current ExecutionFrame.
  +     */
  +    protected final void executeTask( final Configuration task )
  +        throws TaskException
  +    {
  +        m_executor.execute( task, m_frame );
       }
   
       /**
  @@ -143,35 +168,5 @@
               final String message = REZ.getString( "container.no-factory.error", roleType.getName()
);
               throw new TaskException( message, te );
           }
  -    }
  -
  -    /**
  -     * Convenience method for sub-class to retrieve Configurer.
  -     *
  -     * @return the configurer
  -     */
  -    protected final Configurer getConfigurer()
  -    {
  -        return m_configurer;
  -    }
  -
  -    /**
  -     * Convenience method for sub-class to retrieve Converter.
  -     *
  -     * @return the converter
  -     */
  -    protected final Converter getConverter()
  -    {
  -        return m_converter;
  -    }
  -
  -    /**
  -     * Convenience method for sub-class to retrieve Executor.
  -     *
  -     * @return the executor
  -     */
  -    protected final Executor getExecutor()
  -    {
  -        return m_executor;
       }
   }
  
  
  

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