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/interfaces/context TaskContextManager.java
Date Tue, 02 Jul 2002 09:56:27 GMT
donaldp     2002/07/02 02:56:26

  Modified:    framework/src/java/org/apache/myrmidon/framework
                        AbstractContainerTask.java
               framework/src/java/org/apache/myrmidon/framework/project
                        AbstractWorkspaceTask.java TargetTask.java
               container/src/conf ant-services.xml
               container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutor.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java DefaultWorkspace.java
                        ProjectEntry.java
               antlib/src/java/org/apache/antlib/project DependsTask.java
               api/src/java/org/apache/myrmidon/api TaskContext.java
  Removed:     container/src/java/org/apache/myrmidon/components/context
                        DefaultTaskContextManager.java
               container/src/java/org/apache/myrmidon/interfaces/context
                        TaskContextManager.java
  Log:
  Kill DefaultTaskContextManager and go back to TaskContext.createChild()
  
  Really need to find a better solution
  
  Revision  Changes    Path
  1.17      +8 -11     jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java
  
  Index: AbstractContainerTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractContainerTask.java	2 Jul 2002 07:33:31 -0000	1.16
  +++ AbstractContainerTask.java	2 Jul 2002 09:56:25 -0000	1.17
  @@ -7,10 +7,10 @@
    */
   package org.apache.myrmidon.framework;
   
  -import org.apache.excalibur.converter.Converter;
  -import org.apache.excalibur.converter.ConverterException;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.excalibur.converter.Converter;
  +import org.apache.excalibur.converter.ConverterException;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
  @@ -21,7 +21,6 @@
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
   import org.apache.myrmidon.interfaces.type.TypeManager;
  -import org.apache.myrmidon.interfaces.context.TaskContextManager;
   
   /**
    * This is the class that Task writers should extend to provide custom tasks.
  @@ -43,7 +42,6 @@
   
       ///For executing sub-elements as tasks
       private Executor m_executor;
  -    private TaskContextManager m_taskContextManager;
   
       /**
        * Retrieve context from container.
  @@ -57,7 +55,6 @@
           m_configurer = (Configurer)getService( Configurer.class );
           m_converter = (Converter)getService( Converter.class );
           m_executor = (Executor)getService( Executor.class );
  -        m_taskContextManager = (TaskContextManager)getService( TaskContextManager.class
);
       }
   
       /**
  @@ -165,11 +162,11 @@
       protected final void executeTask( final ModelElement task )
           throws TaskException
       {
  -        final TaskContext context =
  -            m_taskContextManager.createContext( getContext(),
  -                                                task.getName(),
  -                                                task.getLocation() );
  -        m_executor.execute( task, context );
  +        final TaskContext newContext =
  +            getContext().createChild( task.getName(),
  +                                      task.getLocation() );
  +
  +        m_executor.execute( task, newContext );
       }
   
       /**
  
  
  
  1.4       +3 -2      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractWorkspaceTask.java
  
  Index: AbstractWorkspaceTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractWorkspaceTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractWorkspaceTask.java	27 Jun 2002 11:13:07 -0000	1.3
  +++ AbstractWorkspaceTask.java	2 Jul 2002 09:56:25 -0000	1.4
  @@ -76,7 +76,8 @@
       protected ProjectDescriptor getProjectDescriptor( final String projectName )
           throws TaskException
       {
  -        final ProjectRefs projectRefs = (ProjectRefs)getContext().getProperty( ProjectRefs.KEY
);
  +        final ProjectRefs projectRefs =
  +            (ProjectRefs)getContext().getProperty( ProjectRefs.KEY );
           final ProjectRef projectRef = projectRefs.getProjectRef( projectName );
           if( null == projectRef )
           {
  
  
  
  1.3       +4 -5      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/TargetTask.java
  
  Index: TargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/TargetTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TargetTask.java	2 Jul 2002 02:12:07 -0000	1.2
  +++ TargetTask.java	2 Jul 2002 09:56:25 -0000	1.3
  @@ -16,7 +16,6 @@
   import java.util.ArrayList;
   import java.util.StringTokenizer;
   import java.util.List;
  -import java.util.Iterator;
   
   /**
    * An abstract base class for implementing >target< tasks.
  @@ -128,10 +127,10 @@
       protected void executeDependencies()
           throws TaskException
       {
  -        Iterator iter = m_dependencies.iterator();
  -        while( iter.hasNext() )
  +        final int count = m_dependencies.size();
  +        for( int i = 0; i < count; i++ )
           {
  -            Dependency dependency = (Dependency)iter.next();
  +            final Dependency dependency = (Dependency)m_dependencies.get( i );
               executeDependency( dependency );
           }
       }
  
  
  
  1.8       +0 -3      jakarta-ant-myrmidon/container/src/conf/ant-services.xml
  
  Index: ant-services.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/conf/ant-services.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ant-services.xml	2 Jul 2002 07:31:45 -0000	1.7
  +++ ant-services.xml	2 Jul 2002 09:56:26 -0000	1.8
  @@ -26,9 +26,6 @@
       <service classname="org.apache.myrmidon.components.event.DefaultTaskEventManager">
           <role name="org.apache.myrmidon.interfaces.event.TaskEventManager"/>
       </service>
  -    <service classname="org.apache.myrmidon.components.context.DefaultTaskContextManager">
  -        <role name="org.apache.myrmidon.interfaces.context.TaskContextManager"/>
  -    </service>
       <service classname="org.apache.myrmidon.components.converter.DefaultMasterConverter">
           <role name="org.apache.myrmidon.interfaces.converter.ConverterRegistry"/>
           <role name="org.apache.excalibur.converter.Converter"/>
  
  
  
  1.118     +8 -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.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- DefaultEmbeddor.java	2 Jul 2002 07:52:24 -0000	1.117
  +++ DefaultEmbeddor.java	2 Jul 2002 09:56:26 -0000	1.118
  @@ -75,6 +75,7 @@
       private Context m_context;
       private TaskContext m_rootContext;
       private PropertyStore m_rootProps;
  +    private File m_homeDir;
   
       /**
        * Setup basic properties of engine.
  @@ -89,6 +90,7 @@
           throws ContextException
       {
           m_context = context;
  +        m_homeDir = (File)m_context.get( "myrmidon.home" );
       }
   
       /**
  @@ -185,7 +187,10 @@
           m_serviceKernel.registerService( Embeddor.ROLE, this );
   
           // setup the root components
  -        final InstantiatingServiceManager instServiceManager = new InstantiatingServiceManager(
getLogger(), m_context, m_serviceKernel );
  +        final InstantiatingServiceManager instServiceManager =
  +            new InstantiatingServiceManager( getLogger(),
  +                                             m_context,
  +                                             m_serviceKernel );
           ContainerUtil.enableLogging( instServiceManager, getLogger() );
           m_serviceKernel.registerService( ServiceRegistry.ROLE,
                                            instServiceManager );
  @@ -394,7 +399,7 @@
   
           //Add runtime info
           store.setProperty( "myrmidon.container.description", Constants.BUILD_DESCRIPTION
);
  -        store.setProperty( "myrmidon.home", (File)m_context.get( "myrmidon.home" ) );
  +        store.setProperty( "myrmidon.home", m_homeDir );
       }
   
       /**
  
  
  
  1.54      +2 -1      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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- DefaultExecutor.java	2 Jul 2002 08:04:25 -0000	1.53
  +++ DefaultExecutor.java	2 Jul 2002 09:56:26 -0000	1.54
  @@ -45,6 +45,7 @@
       {
           final TaskEventManager eventManager =
               (TaskEventManager)context.getService( TaskEventManager.class );
  +
           final String taskName = taskModel.getName();
           final String taskPath = context.getPath();
           final String taskLocation = taskModel.getLocation();
  
  
  
  1.64      +13 -1     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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- DefaultTaskContext.java	2 Jul 2002 07:40:32 -0000	1.63
  +++ DefaultTaskContext.java	2 Jul 2002 09:56:26 -0000	1.64
  @@ -394,4 +394,16 @@
                              0 );
           m_eventManager.fireTaskMessage( event );
       }
  +
  +    public TaskContext createChild( final String name,
  +                                    final String location )
  +        throws TaskException
  +    {
  +        return
  +            new DefaultTaskContext( name,
  +                                    getQualifiedName(),
  +                                    location,
  +                                    getBaseDirectory(),
  +                                    m_serviceKernel );
  +    }
   }
  
  
  
  1.109     +9 -12     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- DefaultWorkspace.java	2 Jul 2002 08:02:55 -0000	1.108
  +++ DefaultWorkspace.java	2 Jul 2002 09:56:26 -0000	1.109
  @@ -16,7 +16,6 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  -import org.apache.myrmidon.interfaces.context.TaskContextManager;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.model.Project;
  @@ -52,8 +51,6 @@
   
       private AntServiceKernel m_serviceKernel;
   
  -    private TaskContextManager m_taskContextManager;
  -
       /**
        * Sets the root execution frame for this workspace.
        */
  @@ -61,7 +58,6 @@
           throws TaskException
       {
           m_taskContext = taskContext;
  -        m_taskContextManager = (TaskContextManager)taskContext.getService( TaskContextManager.class
);
           m_serviceKernel = (AntServiceKernel)taskContext.getService( AntServiceKernel.class
);
   
           try
  @@ -214,7 +210,7 @@
                                       "",
                                       project.getProjectDescriptor().getUri(),
                                       project.getBaseDirectory(),
  -                                    serviceKernel );
  +                                    serviceKernel.createChild() );
   
           final ProjectEntry entry = new ProjectEntry( project, projectContext );
   
  @@ -278,12 +274,13 @@
           throws TaskException
       {
           final ModelElement targetModel = target.getModel();
  -        final TaskContext context =
  -            m_taskContextManager.createContext( entry.getContext(),
  -                                                target.getName(),
  -                                                targetModel.getLocation() );
   
  -        final Executor executor = (Executor)context.getService( Executor.class );
  -        executor.execute( targetModel, context );
  +        final TaskContext newContext =
  +            entry.getContext().createChild( target.getName(),
  +                                            targetModel.getLocation() );
  +        final Executor executor =
  +            (Executor)newContext.getService( Executor.class );
  +
  +        executor.execute( targetModel, newContext );
       }
   }
  
  
  
  1.19      +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java
  
  Index: ProjectEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ProjectEntry.java	2 Jul 2002 07:38:21 -0000	1.18
  +++ ProjectEntry.java	2 Jul 2002 09:56:26 -0000	1.19
  @@ -116,7 +116,7 @@
        */
       public ProjectRef getProjectRef( final String name )
       {
  -        if( name == null )
  +        if( null == name )
           {
               return m_selfRef;
           }
  
  
  
  1.4       +2 -1      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/DependsTask.java
  
  Index: DependsTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/DependsTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DependsTask.java	27 Jun 2002 11:13:08 -0000	1.3
  +++ DependsTask.java	2 Jul 2002 09:56:26 -0000	1.4
  @@ -62,6 +62,7 @@
           throws TaskException
       {
           validate();
  +        System.out.println( "getContext().getQualifiedName() = " + getContext().getQualifiedName()
);
           executeDependency( getDependency() );
       }
   
  
  
  
  1.41      +12 -1     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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- TaskContext.java	2 Jul 2002 07:26:49 -0000	1.40
  +++ TaskContext.java	2 Jul 2002 09:56:26 -0000	1.41
  @@ -206,5 +206,16 @@
        * @param throwable the throwable
        */
       void error( String message, Throwable throwable );
  +
  +    /**
  +     * Create a child context with specified name and location.
  +     *
  +     * @param name the name of new context
  +     * @param location the location of task associated with context
  +     * @return the created TaskContext
  +     * @todo remove me in future when we deal with classLoader issues
  +     */
  +    TaskContext createChild( String name, String location )
  +        throws TaskException;
   }
   
  
  
  

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