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/framework/src/java/org/apache/myrmidon/framework AbstractContainerTask.java ExecuteTarget.java
Date Sun, 30 Jun 2002 10:49:41 GMT
donaldp     2002/06/30 03:49:41

  Modified:    container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java DefaultWorkspace.java
                        ProjectEntry.java
               container/src/java/org/apache/myrmidon/interfaces
                        EmbeddedAnt.java
               container/src/java/org/apache/myrmidon/interfaces/embeddor
                        Embeddor.java
               container/src/test/org/apache/myrmidon/components
                        AbstractComponentTest.java
               container/src/test/org/apache/myrmidon/components/embeddor/test
                        DefaultEmbeddorTest.java
               framework/src/java/org/apache/myrmidon/framework
                        AbstractContainerTask.java ExecuteTarget.java
  Added:       container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultExecutionFrame.java
               container/src/java/org/apache/myrmidon/interfaces/embeddor
                        ExecutionFrame.java
  Removed:     container/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutionFrame.java
               container/src/java/org/apache/myrmidon/interfaces/executor
                        ExecutionFrame.java
  Log:
  Moved ExecutionFrame into embeddor package as that is the only location in which it is still
used (Nominally in AbstractContainerTask aswell but that is about to go zappo).
  
  Revision  Changes    Path
  1.113     +2 -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.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- DefaultEmbeddor.java	30 Jun 2002 09:58:14 -0000	1.112
  +++ DefaultEmbeddor.java	30 Jun 2002 10:49:40 -0000	1.113
  @@ -30,7 +30,6 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.event.TaskListener;
   import org.apache.myrmidon.api.metadata.ModelElement;
  -import org.apache.myrmidon.components.executor.DefaultExecutionFrame;
   import org.apache.myrmidon.components.service.DefaultAntServiceKernel;
   import org.apache.myrmidon.components.service.InstantiatingServiceManager;
   import org.apache.myrmidon.components.workspace.DefaultWorkspace;
  @@ -38,7 +37,7 @@
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.library.Library;
   import org.apache.myrmidon.interfaces.library.LibraryManager;
   import org.apache.myrmidon.interfaces.model.Project;
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultExecutionFrame.java
  
  Index: DefaultExecutionFrame.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components.embeddor;
  
  import java.io.File;
  import org.apache.avalon.framework.service.ServiceException;
  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.embeddor.ExecutionFrame;
  import org.apache.myrmidon.interfaces.property.PropertyStore;
  import org.apache.myrmidon.interfaces.role.RoleManager;
  import org.apache.myrmidon.interfaces.role.RoleRegistry;
  import org.apache.myrmidon.interfaces.service.AntServiceKernel;
  import org.apache.myrmidon.interfaces.type.TypeManager;
  import org.apache.myrmidon.interfaces.type.TypeRegistry;
  
  /**
   * Frames in which tasks are executed.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/30 10:49:40 $
   */
  public class DefaultExecutionFrame
      implements ExecutionFrame
  {
      private final String m_name;
      private final File m_baseDirectory;
      private final AntServiceKernel m_serviceKernel;
  
      public DefaultExecutionFrame( final String name,
                                    final File baseDirectory,
                                    final AntServiceKernel serviceKernel )
      {
          m_name = name;
          m_baseDirectory = baseDirectory;
          m_serviceKernel = serviceKernel;
      }
  
      /**
       * Returns the service in frame.
       */
      public Object lookup( String role )
          throws TaskException
      {
          try
          {
              return m_serviceKernel.getService( role );
          }
          catch( final ServiceException se )
          {
              throw new TaskException( se.getMessage(), se );
          }
      }
  
      private Object lookup2( String role )
          throws TaskException
      {
          try
          {
              return m_serviceKernel.getService( role );
          }
          catch( final ServiceException se )
          {
              throw new TaskException( se.getMessage(), se );
          }
      }
  
  
      /**
       * Create a {@link org.apache.myrmidon.api.TaskContext} object for current frame.
       *
       * @param taskName the name of task
       * @param location the location of task
       * @return the new TaskContext
       */
      public TaskContext createTaskContext( String taskName, String location )
          throws TaskException
      {
          final TaskEventManager eventManager =
              (TaskEventManager)lookup2( TaskEventManager.ROLE );
          final PropertyStore propertyStore =
              (PropertyStore)lookup2( PropertyStore.ROLE );
          final AntServiceKernel serviceKernel =
              (AntServiceKernel)lookup2( AntServiceKernel.ROLE );
          return new DefaultTaskContext( this,
                                         taskName,
                                         m_name,
                                         location,
                                         m_baseDirectory,
                                         eventManager,
                                         propertyStore,
                                         serviceKernel );
  
      }
  
      public ExecutionFrame createPartition( final String name,
                                             final File baseDirectory )
      {
          //What an UGLY Hack!!!
          // TODO - we never dispose of these services.  That's bad
          try
          {
              final PropertyStore basePS = (PropertyStore)lookup2( PropertyStore.ROLE );
              final PropertyStore ps = basePS.createChildStore();
  
              final TypeManager baseTM = (TypeManager)lookup2( TypeManager.ROLE );
              final TypeManager tm = baseTM.getChildTypeManager();
  
              final AntServiceKernel baseSK = (AntServiceKernel)lookup2( AntServiceKernel.ROLE
);
              final AntServiceKernel sk = baseSK.createChild();
  
              sk.registerService( PropertyStore.ROLE, ps );
              sk.registerService( AntServiceKernel.ROLE, sk );
              sk.registerService( RoleManager.ROLE, tm );
              sk.registerService( RoleRegistry.ROLE, tm );
              sk.registerService( TypeManager.ROLE, tm );
              sk.registerService( TypeRegistry.ROLE, tm );
  
              return new DefaultExecutionFrame( m_name + "/" + name,
                                                baseDirectory,
                                                sk );
          }
          catch( final Exception e )
          {
              throw new IllegalStateException( e.toString() );
          }
      }
  
      public ExecutionFrame createChildFrame( String name )
      {
          final String newName = m_name + "/" + name;
          return new DefaultExecutionFrame( newName,
                                            m_baseDirectory,
                                            m_serviceKernel );
      }
  
      public String toString()
      {
          return "Frame: " + m_name + ",id=" + System.identityHashCode( this );
      }
  }
  
  
  
  1.62      +2 -2      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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- DefaultTaskContext.java	30 Jun 2002 10:24:54 -0000	1.61
  +++ DefaultTaskContext.java	30 Jun 2002 10:49:40 -0000	1.62
  @@ -18,7 +18,7 @@
   import org.apache.myrmidon.api.event.LogLevel;
   import org.apache.myrmidon.api.event.TaskEvent;
   import org.apache.myrmidon.interfaces.event.TaskEventManager;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.property.PropertyResolver;
   import org.apache.myrmidon.interfaces.property.PropertyStore;
   import org.apache.myrmidon.interfaces.service.AntServiceKernel;
  
  
  
  1.106     +16 -8     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.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- DefaultWorkspace.java	30 Jun 2002 10:18:59 -0000	1.105
  +++ DefaultWorkspace.java	30 Jun 2002 10:49:40 -0000	1.106
  @@ -12,11 +12,12 @@
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.service.ServiceException;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.workspace.ProjectRefs;
  @@ -169,15 +170,22 @@
           throws TaskException
       {
           final String key = Project.KEY + '-' + descriptor.toKey();
  -        final PropertyStore propertyStore =
  -            (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
  -        if( propertyStore.isPropertySet( key ) )
  +        try
           {
  -            return (Project)propertyStore.getProperty( key );
  +            final PropertyStore propertyStore =
  +                (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
  +            if( propertyStore.isPropertySet( key ) )
  +            {
  +                return (Project)propertyStore.getProperty( key );
  +            }
  +            else
  +            {
  +                return createProject( descriptor );
  +            }
           }
  -        else
  +        catch( ServiceException e )
           {
  -            return createProject( descriptor );
  +            throw new TaskException( e.getMessage(), e );
           }
       }
   
  
  
  
  1.17      +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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ProjectEntry.java	30 Jun 2002 10:18:59 -0000	1.16
  +++ ProjectEntry.java	30 Jun 2002 10:49:40 -0000	1.17
  @@ -10,7 +10,7 @@
   import java.util.HashMap;
   import java.util.Map;
   import java.util.Iterator;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.model.Target;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
  
  
  
  1.32      +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java
  
  Index: EmbeddedAnt.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- EmbeddedAnt.java	30 Jun 2002 06:57:56 -0000	1.31
  +++ EmbeddedAnt.java	30 Jun 2002 10:49:40 -0000	1.32
  @@ -23,7 +23,7 @@
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.event.TaskEventManager;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
   /**
  
  
  
  1.29      +2 -3      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java
  
  Index: Embeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Embeddor.java	30 Jun 2002 06:57:56 -0000	1.28
  +++ Embeddor.java	30 Jun 2002 10:49:40 -0000	1.29
  @@ -12,7 +12,6 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.event.TaskListener;
   import org.apache.myrmidon.api.metadata.ModelElement;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
  @@ -53,7 +52,7 @@
           throws Exception;
   
       /**
  -     * Creates an {@link ExecutionFrame} that can be used to execute projects.
  +     * Creates an {@link org.apache.myrmidon.interfaces.embeddor.ExecutionFrame} that can
be used to execute projects.
        * Note that the set of {@link Project} objects allows the model object used
        * by GUI to be the same model as used by the engine.
        *
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/ExecutionFrame.java
  
  Index: ExecutionFrame.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.interfaces.embeddor;
  
  import java.io.File;
  import org.apache.myrmidon.api.TaskContext;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * An Execution Frame represents the scope in which tasks are executed.
   * The scope may include an entire workspace, a project, target, or
   * individual task.
   *
   * <p>An Execution Frame bundles together all of the context required to
   * execute tasks - that is, a set of properties, a set of services, and
   * a logger.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/30 10:49:40 $
   */
  public interface ExecutionFrame
  {
      /** Role name for this interface. */
      String ROLE = ExecutionFrame.class.getName();
  
      /**
       * Returns the service in frame.
       */
      Object lookup( String role )
          throws TaskException;
  
      /**
       * Create a {@link org.apache.myrmidon.api.TaskContext} object for current frame.
       *
       * @param taskName the name of task
       * @param location the location of task
       * @return the new TaskContext
       */
      TaskContext createTaskContext( String taskName, String location )
          throws TaskException;
  
      /**
       * Create a child execution frame. The name of child frame
       * is this frame's name concaternated with "/" and the
       * specified name.
       *
       * <p>If partition is true then this frame is considered a
       * partitioning frame. A partitioning frame is one which
       * creates child instances of certain scoped data stores. These scoped
       * stores will inherit values from the parent object but any modifications
       * (ie additions or removals) will be local to this frame
       * (and child frames).</p>
       *
       * @param name the name of child frame relative to this frame.
       * @param baseDirectory the directory from which the child frame operates.
       *        If null will use this frame's base directory.
       * @return the new child ExecutionFrame.
       */
      ExecutionFrame createPartition( String name, File baseDirectory );
  
      ExecutionFrame createChildFrame( String name );
  }
  
  
  
  1.52      +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/AbstractComponentTest.java
  
  Index: AbstractComponentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/AbstractComponentTest.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- AbstractComponentTest.java	30 Jun 2002 09:58:15 -0000	1.51
  +++ AbstractComponentTest.java	30 Jun 2002 10:49:41 -0000	1.52
  @@ -29,7 +29,7 @@
   import org.apache.myrmidon.components.converter.DefaultMasterConverter;
   import org.apache.myrmidon.components.deployer.DefaultDeployer;
   import org.apache.myrmidon.components.event.DefaultTaskEventManager;
  -import org.apache.myrmidon.components.executor.DefaultExecutionFrame;
  +import org.apache.myrmidon.components.embeddor.DefaultExecutionFrame;
   import org.apache.myrmidon.components.executor.DefaultExecutor;
   import org.apache.myrmidon.components.extensions.DefaultExtensionManager;
   import org.apache.myrmidon.components.library.DefaultLibraryManager;
  @@ -43,7 +43,7 @@
   import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.event.TaskEventManager;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
   import org.apache.myrmidon.interfaces.library.LibraryManager;
  
  
  
  1.39      +2 -2      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
  
  Index: DefaultEmbeddorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- DefaultEmbeddorTest.java	30 Jun 2002 06:57:56 -0000	1.38
  +++ DefaultEmbeddorTest.java	30 Jun 2002 10:49:41 -0000	1.39
  @@ -18,7 +18,7 @@
   import org.apache.myrmidon.components.embeddor.DefaultEmbeddor;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.event.TaskEventManager;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.model.Project;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
  
  
  
  1.14      +2 -2      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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractContainerTask.java	30 Jun 2002 10:14:57 -0000	1.13
  +++ AbstractContainerTask.java	30 Jun 2002 10:49:41 -0000	1.14
  @@ -17,7 +17,7 @@
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.api.metadata.ModelException;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
  
  
  
  1.25      +2 -2      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/ExecuteTarget.java
  
  Index: ExecuteTarget.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/ExecuteTarget.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ExecuteTarget.java	27 Jun 2002 11:06:46 -0000	1.24
  +++ ExecuteTarget.java	30 Jun 2002 10:49:41 -0000	1.25
  @@ -14,7 +14,7 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.embeddor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
   /**
  
  
  

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