ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/deployer/test DefaultDeployerTestCase.java
Date Mon, 24 Jun 2002 00:53:44 GMT
adammurdoch    2002/06/23 17:53:44

  Modified:    antlib/src/java/org/apache/antlib/runtime
                        AbstractTypeLibTask.java
               container/src/java/org/apache/myrmidon/components/deployer
                        DefaultDeployer.java
                        DefaultTypeLibraryDeployer.java
               container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               container/src/java/org/apache/myrmidon/interfaces/deployer
                        Deployer.java
               container/src/test/org/apache/myrmidon/components/deployer/test
                        DefaultDeployerTestCase.java
  Removed:     container/src/java/org/apache/myrmidon/interfaces/deployer
                        TypeLibraryDeployer.java
  Log:
  Moved methods from TypeLibDeployer back to Deployer, and get rid of TypeLibDeployer.
  
  Revision  Changes    Path
  1.2       +6 -8      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/runtime/AbstractTypeLibTask.java
  
  Index: AbstractTypeLibTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/runtime/AbstractTypeLibTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractTypeLibTask.java	12 May 2002 11:18:39 -0000	1.1
  +++ AbstractTypeLibTask.java	24 Jun 2002 00:53:43 -0000	1.2
  @@ -7,13 +7,12 @@
    */
   package org.apache.antlib.runtime;
   
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.myrmidon.interfaces.library.Library;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
  -import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.myrmidon.interfaces.library.Library;
   
   /**
    * An abstract task to import types from a typelib.
  @@ -97,16 +96,15 @@
               }
   
               final Deployer deployer = (Deployer)getService( Deployer.class );
  -            final TypeLibraryDeployer typeDeployer = deployer.createDeployer( library,
m_namespace );
               if( null == m_role )
               {
                   // Deploy everything in the typelib
  -                typeDeployer.deployAll();
  +                deployer.deployTypes( library, m_namespace );
               }
               else
               {
                   // Deploy the specified type
  -                typeDeployer.deployType( m_role, m_name );
  +                deployer.deployType( library, m_namespace, m_role, m_name );
               }
           }
           catch( final Exception e )
  
  
  
  1.49      +28 -4     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java
  
  Index: DefaultDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- DefaultDeployer.java	13 Jun 2002 07:27:01 -0000	1.48
  +++ DefaultDeployer.java	24 Jun 2002 00:53:43 -0000	1.49
  @@ -18,7 +18,6 @@
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   import org.apache.myrmidon.interfaces.library.Library;
   import org.apache.myrmidon.interfaces.role.RoleRegistry;
   import org.apache.myrmidon.interfaces.service.ScopedService;
  @@ -71,8 +70,8 @@
        * Returns the deployer for a library, creating the deployer if
        * necessary.
        */
  -    public TypeLibraryDeployer createDeployer( final Library library,
  -                                               final String namespace )
  +    private DefaultTypeLibraryDeployer createDeployer( final Library library,
  +                                                       final String namespace )
           throws DeploymentException
       {
           try
  @@ -92,6 +91,31 @@
               final String message = REZ.getString( "deploy-from-library.error", library.getName()
);
               throw new DeploymentException( message, e );
           }
  +    }
  +
  +    /**
  +     * Deploys all the types from a library.
  +     */
  +    public void deployTypes( final Library library,
  +                             final String namespace )
  +        throws DeploymentException
  +    {
  +        final DefaultTypeLibraryDeployer deployer = createDeployer( library, namespace
);
  +        deployer.deployAll();
  +    }
  +
  +    /**
  +     * Deploys a single type from a library.
  +     *
  +     */
  +    public void deployType( final Library library,
  +                            final String namespace,
  +                            final String role,
  +                            final String typeName )
  +        throws DeploymentException
  +    {
  +        final DefaultTypeLibraryDeployer deployer = createDeployer( library, namespace
);
  +        deployer.deployType( role, typeName );
       }
   
       /**
  
  
  
  1.12      +1 -3      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/DefaultTypeLibraryDeployer.java
  
  Index: DefaultTypeLibraryDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/DefaultTypeLibraryDeployer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultTypeLibraryDeployer.java	23 Jun 2002 08:26:31 -0000	1.11
  +++ DefaultTypeLibraryDeployer.java	24 Jun 2002 00:53:43 -0000	1.12
  @@ -21,7 +21,6 @@
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
   import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleRegistry;
   import org.apache.myrmidon.interfaces.type.ClassLoaderTypeFactory;
  @@ -38,7 +37,6 @@
    */
   class DefaultTypeLibraryDeployer
       extends AbstractLogEnabled
  -    implements TypeLibraryDeployer
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultTypeLibraryDeployer.class );
  
  
  
  1.104     +6 -10     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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- DefaultEmbeddor.java	21 Jun 2002 08:05:34 -0000	1.103
  +++ DefaultEmbeddor.java	24 Jun 2002 00:53:44 -0000	1.104
  @@ -31,17 +31,16 @@
   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.deployer.DefaultDeployer;
   import org.apache.myrmidon.components.executor.DefaultExecutionFrame;
  +import org.apache.myrmidon.components.property.DefaultPropertyStore;
  +import org.apache.myrmidon.components.role.DefaultRoleManager;
   import org.apache.myrmidon.components.service.InstantiatingServiceManager;
   import org.apache.myrmidon.components.type.DefaultTypeManager;
   import org.apache.myrmidon.components.workspace.DefaultWorkspace;
  -import org.apache.myrmidon.components.role.DefaultRoleManager;
  -import org.apache.myrmidon.components.property.DefaultPropertyStore;
  -import org.apache.myrmidon.components.deployer.DefaultDeployer;
   import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.library.Library;
  @@ -214,9 +213,7 @@
           final ClassLoader containerClassLoader = getClass().getClassLoader();
           final Library containerLib =
               m_libraryManager.createLibrary( containerClassLoader );
  -        final TypeLibraryDeployer containerTypeDeployer =
  -            m_deployer.createDeployer( containerLib, CONTAINER_TYPE_NAMESPACE );
  -        containerTypeDeployer.deployAll();
  +        m_deployer.deployTypes( containerLib, CONTAINER_TYPE_NAMESPACE );
   
           // Deploy all core type libraries in the lib directory
           final Library[] coreLibs = m_libraryManager.getCoreLibraries();
  @@ -242,8 +239,7 @@
                   getLogger().debug( message );
               }
   
  -            final TypeLibraryDeployer libDeployer = m_deployer.createDeployer( library,
library.getName() );
  -            libDeployer.deployAll();
  +            m_deployer.deployTypes( library, library.getName() );
           }
       }
   
  
  
  
  1.15      +15 -6     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/Deployer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Deployer.java	23 May 2002 09:36:36 -0000	1.14
  +++ Deployer.java	24 Jun 2002 00:53:44 -0000	1.15
  @@ -22,15 +22,24 @@
       String ROLE = Deployer.class.getName();
   
       /**
  -     * Creates a deployer for a library.
  -     *
  +     * Deploys all the types from a library.
  +     * @param library The library to deploy from.
  +     * @param namespace The namespace to deploy into.  Use null to deploy into
  +     *        the default namespace.
  +     */
  +    void deployTypes( Library library, String namespace )
  +        throws DeploymentException;
  +
  +    /**
  +     * Deploys a single type from a library.
        * @param library The library to deploy from.
        * @param namespace The namespace to deploy into.  Use null to deploy into
        *        the default namespace.
  -     * @return The deployer for this type library.
  -     * @throws DeploymentException if an error occurs.
  +     * @param role The role name.
  +     * @param typeName The type name.
  +     *
        */
  -    TypeLibraryDeployer createDeployer( Library library, String namespace )
  +    void deployType( Library library, String namespace, String role, String typeName )
           throws DeploymentException;
   
       /**
  
  
  
  1.16      +4 -6      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/deployer/test/DefaultDeployerTestCase.java
  
  Index: DefaultDeployerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/deployer/test/DefaultDeployerTestCase.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultDeployerTestCase.java	9 Jun 2002 13:13:54 -0000	1.15
  +++ DefaultDeployerTestCase.java	24 Jun 2002 00:53:44 -0000	1.16
  @@ -17,7 +17,6 @@
   import org.apache.myrmidon.components.deployer.DefaultDeployer;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   import org.apache.myrmidon.interfaces.library.Library;
   import org.apache.myrmidon.interfaces.library.LibraryManager;
   import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
  @@ -77,15 +76,14 @@
       /**
        * Create the test deployer
        */
  -    private TypeLibraryDeployer getTestDeployer()
  +    private Library getTestLib()
           throws Exception
       {
           registerRole( TestDataType.INFO );
   
           final File file = getTestResource( "test.atl" );
           final LibraryManager libraryManager = (LibraryManager)getServiceManager().lookup(
LibraryManager.ROLE );
  -        final Library library = libraryManager.createLibrary( new File[]{file} );
  -        return m_deployer.createDeployer( library, TEST_NAMESPACE );
  +        return libraryManager.createLibrary( new File[]{file} );
       }
   
       /**
  @@ -149,14 +147,14 @@
        */
       public void testLibDescriptor() throws Exception
       {
  -        final TypeLibraryDeployer typeDeployer = getTestDeployer();
  +        final Library testLib = getTestLib();
   
           // Make sure the test types have not been deployed.  Do this after
           // the deployer has been created
           assertTypesNotRegistered();
   
           // Deploy all the types from the descriptor
  -        typeDeployer.deployAll();
  +        m_deployer.deployTypes( testLib, TEST_NAMESPACE );
   
           // Make sure the test types have been deployed
           assertTypesRegistered();
  
  
  

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