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 DefaultExecutionFrame.java
Date Tue, 23 Apr 2002 07:41:15 GMT
donaldp     02/04/23 00:41:15

  Modified:    container/src/java/org/apache/myrmidon/components/workspace
                        DefaultExecutionFrame.java
  Log:
  Implement the new ExecutionFrame interface.
  
  Note that when partitioning that the TaskEventManager is not properly partitioned (ie it
isn't at alll at the moment)
  
  Revision  Changes    Path
  1.7       +82 -4     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultExecutionFrame.java
  
  Index: DefaultExecutionFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultExecutionFrame.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultExecutionFrame.java	9 Apr 2002 02:26:35 -0000	1.6
  +++ DefaultExecutionFrame.java	23 Apr 2002 07:41:14 -0000	1.7
  @@ -8,7 +8,9 @@
   package org.apache.myrmidon.components.workspace;
   
   import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.property.PropertyStore;
   
  @@ -16,22 +18,40 @@
    * Frames in which tasks are executed.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/04/09 02:26:35 $
  + * @version $Revision: 1.7 $ $Date: 2002/04/23 07:41:14 $
    */
   public class DefaultExecutionFrame
       implements ExecutionFrame
   {
  +    private final String m_name;
       private final Logger m_logger;
       private final PropertyStore m_propertyStore;
       private final ServiceManager m_serviceManager;
  +    private final TaskEventManager m_eventManager;
   
  -    public DefaultExecutionFrame( final Logger logger,
  +    public DefaultExecutionFrame( final String name,
  +                                  final Logger logger,
                                     final PropertyStore propertyStore,
  -                                  final ServiceManager serviceManager )
  +                                  final ServiceManager serviceManager,
  +                                  final TaskEventManager eventManager )
       {
  +        m_name = name;
           m_logger = logger;
           m_propertyStore = propertyStore;
           m_serviceManager = serviceManager;
  +        m_eventManager = eventManager;
  +    }
  +
  +    /**
  +     * Returns the name of the execution frame.
  +     * This is used when generating TaskEvents as the
  +     * "path" element.
  +     *
  +     * @return the name of execution frame
  +     */
  +    public String getName()
  +    {
  +        return m_name;
       }
   
       /**
  @@ -54,8 +74,66 @@
       /**
        * Returns the set of properties to be supplied to tasks.
        */
  -    public PropertyStore getProperties()
  +    public PropertyStore getPropertyStore()
       {
           return m_propertyStore;
  +    }
  +
  +    /**
  +     * Returns the {@link TaskEventManager} that can be used to fire events
  +     * or to register listeners.
  +     */
  +    public TaskEventManager getTaskEventManager()
  +    {
  +        return m_eventManager;
  +    }
  +
  +    /**
  +     * Create a child execution frame.
  +     *
  +     * @param name the name of child frame relative to current frame
  +     * @param partition true if frame is partition frame
  +     * @return the new child ExecutionFrame
  +     * @see ExecutionFrame#createChildFrame
  +     */
  +    public ExecutionFrame createChildFrame( final String name,
  +                                            final boolean partition )
  +    {
  +        if( !partition )
  +        {
  +            final String newName = m_name + "/" + name;
  +            return new DefaultExecutionFrame( newName,
  +                                              m_logger,
  +                                              m_propertyStore,
  +                                              m_serviceManager,
  +                                              m_eventManager );
  +        }
  +        else
  +        {
  +            return createPartitionedFrame( name );
  +        }
  +    }
  +
  +    /**
  +     * Create a partitioned pane so that modifications of child
  +     * elements does not effect parent objects.
  +     *
  +     * @param name the relative name of frame
  +     * @return the partiioned frame that is created
  +     */
  +    private ExecutionFrame createPartitionedFrame( final String name )
  +    {
  +        final String newName = m_name + "/" + name;
  +        final Logger logger = m_logger.getChildLogger( name );
  +        final PropertyStore propertyStore =
  +            m_propertyStore.createChildStore( name );
  +        final DefaultServiceManager serviceManager =
  +            new DefaultServiceManager( m_serviceManager );
  +
  +        return new DefaultExecutionFrame( newName,
  +                                          logger,
  +                                          propertyStore,
  +                                          serviceManager,
  +                                          m_eventManager );
       }
   }
  
  
  

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