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 DefaultTaskContext.java
Date Thu, 13 Jun 2002 01:50:28 GMT
donaldp     2002/06/12 18:50:28

  Modified:    container/src/java/org/apache/myrmidon/interfaces/executor
                        DefaultExecutionFrame.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java
  Log:
  Update DefaultTaskContext so that EventManager + PropertyStore are passed in via constructor
not aquired via frame
  
  Revision  Changes    Path
  1.7       +18 -2     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/executor/DefaultExecutionFrame.java
  
  Index: DefaultExecutionFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/executor/DefaultExecutionFrame.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultExecutionFrame.java	13 Jun 2002 01:43:14 -0000	1.6
  +++ DefaultExecutionFrame.java	13 Jun 2002 01:50:28 -0000	1.7
  @@ -14,6 +14,7 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.components.workspace.DefaultTaskContext;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
   import org.apache.myrmidon.interfaces.property.PropertyStore;
   
   /**
  @@ -74,7 +75,22 @@
       public TaskContext createTaskContext( String taskName, String location )
           throws TaskException
       {
  -        return new DefaultTaskContext( this, taskName, location );
  +        try
  +        {
  +            final TaskEventManager eventManager =
  +                (TaskEventManager)m_serviceManager.lookup( TaskEventManager.ROLE );
  +            final PropertyStore propertyStore =
  +                (PropertyStore)m_serviceManager.lookup( PropertyStore.ROLE );
  +            return new DefaultTaskContext( this,
  +                                           taskName,
  +                                           location,
  +                                           eventManager,
  +                                           propertyStore );
  +        }
  +        catch( final ServiceException se )
  +        {
  +            throw new TaskException( se.getMessage(), se );
  +        }
       }
   
       /**
  
  
  
  1.54      +17 -6     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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- DefaultTaskContext.java	13 Jun 2002 01:43:15 -0000	1.53
  +++ DefaultTaskContext.java	13 Jun 2002 01:50:28 -0000	1.54
  @@ -39,15 +39,17 @@
       private final String m_name;
       private final File m_baseDirectory;
       private final String m_location;
  -    private TaskEventManager m_eventManager;
  -    private PropertyStore m_propertyStore;
  +    private final TaskEventManager m_eventManager;
  +    private final PropertyStore m_propertyStore;
   
       /**
        * Constructor that takes adapts TaskContext to a particular frame.
        */
       public DefaultTaskContext( final ExecutionFrame frame,
                                  final String name,
  -                               final String location )
  +                               final String location,
  +                               final TaskEventManager eventManager,
  +                               final PropertyStore propertyStore )
           throws TaskException
       {
           if( null == frame )
  @@ -62,12 +64,21 @@
           {
               throw new NullPointerException( "location" );
           }
  +        if( null == eventManager )
  +        {
  +            throw new NullPointerException( "eventManager" );
  +        }
  +        if( null == propertyStore )
  +        {
  +            throw new NullPointerException( "propertyStore" );
  +        }
  +
           m_frame = frame;
           m_name = name;
           m_baseDirectory = frame.getBaseDirectory();
           m_location = location;
  -        m_eventManager = (TaskEventManager)getService( TaskEventManager.class );
  -        m_propertyStore = (PropertyStore)getService( PropertyStore.class );
  +        m_eventManager = eventManager;
  +        m_propertyStore = propertyStore;
       }
   
       /**
  
  
  

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