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/deployer DefaultTypeDeployer.java
Date Sun, 09 Jun 2002 13:25:40 GMT
donaldp     2002/06/09 06:25:40

  Modified:    container/src/java/org/apache/myrmidon/components/deployer
                        CompoundTypeDeployer.java
                        ConverterTypeDeployer.java DefaultDeployer.java
                        DefaultTypeLibraryDeployer.java
                        Resources.properties RoleDescriptorBuilder.java
                        TypeToConverterFactoryAdaptor.java
               container/src/java/org/apache/myrmidon/components/service
                        InstantiatingServiceManager.java
               container/src/java/org/apache/myrmidon/components/type
                        DefaultTypeManager.java
               container/src/java/org/apache/myrmidon/interfaces/deployer
                        DefaultTypeDeployer.java
  Log:
  Update deployment system to reflect changes in the way Roles are managed.
  
  Revision  Changes    Path
  1.8       +9 -4      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/CompoundTypeDeployer.java
  
  Index: CompoundTypeDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/CompoundTypeDeployer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CompoundTypeDeployer.java	27 May 2002 12:59:36 -0000	1.7
  +++ CompoundTypeDeployer.java	9 Jun 2002 13:25:40 -0000	1.8
  @@ -24,7 +24,7 @@
    * A type deployer that delegates to a type deployer per role.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.7 $ $Date: 2002/05/27 12:59:36 $
  + * @version $Revision: 1.8 $ $Date: 2002/06/09 13:25:40 $
    */
   class CompoundTypeDeployer
       implements TypeDeployer
  @@ -80,7 +80,7 @@
   
           // Use the deployer for the type's role, if any.  Otherwise use the
           // default deployer
  -        TypeDeployer deployer = findDeployer( roleName );
  +        final TypeDeployer deployer = findDeployer( roleName );
           deployer.deployType( namespace, typeDefinition );
       }
   
  @@ -94,7 +94,13 @@
           if( deployer == null )
           {
               // Lookup the role
  -            final RoleInfo role = m_roleManager.getRole( roleName );
  +            final RoleInfo role = m_roleManager.getRoleByShortName( roleName );
  +            if( null == role )
  +            {
  +                final String message =
  +                    REZ.getString( "missing-roleinfo.error", roleName );
  +                throw new ComponentException( message );
  +            }
   
               // Instantiate the custom type deployer for this role
               final String typeDeployerClassName = (String)role.getAttributes().get( RoleInfo.ATTRIBUTE_CUSTOM_TYPE_DEPLOYER
);
  @@ -118,7 +124,6 @@
               }
               m_deployers.put( roleName, deployer );
           }
  -
           return deployer;
       }
   }
  
  
  
  1.8       +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/ConverterTypeDeployer.java
  
  Index: ConverterTypeDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/ConverterTypeDeployer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConverterTypeDeployer.java	27 May 2002 02:17:45 -0000	1.7
  +++ ConverterTypeDeployer.java	9 Jun 2002 13:25:40 -0000	1.8
  @@ -17,14 +17,14 @@
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
   import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
  -import org.apache.aut.converter.ConverterFactory;
  +import org.apache.excalibur.converter.ConverterFactory;
   
   /**
    * A type deployer that deploys converters, registering them with the type
    * manager and the converter registry.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.7 $ $Date: 2002/05/27 02:17:45 $
  + * @version $Revision: 1.8 $ $Date: 2002/06/09 13:25:40 $
    */
   class ConverterTypeDeployer
       extends DefaultTypeDeployer
  
  
  
  1.47      +5 -7      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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- DefaultDeployer.java	27 May 2002 12:59:36 -0000	1.46
  +++ DefaultDeployer.java	9 Jun 2002 13:25:40 -0000	1.47
  @@ -7,19 +7,18 @@
    */
   package org.apache.myrmidon.components.deployer;
   
  -import org.apache.aut.converter.Converter;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.myrmidon.interfaces.deployer.DefaultTypeDeployer;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   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;
  @@ -29,7 +28,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.46 $ $Date: 2002/05/27 12:59:36 $
  + * @version $Revision: 1.47 $ $Date: 2002/06/09 13:25:40 $
    */
   public class DefaultDeployer
       extends AbstractLogEnabled
  @@ -57,8 +56,7 @@
           final DefaultTypeDeployer defaultDeployer = new DefaultTypeDeployer();
           m_typeDeployer = new CompoundTypeDeployer( defaultDeployer, serviceManager );
           final ConverterTypeDeployer converterDeployer = new ConverterTypeDeployer();
  -        m_typeDeployer.addDeployer( Converter.ROLE, converterDeployer );
  -
  +        m_typeDeployer.addDeployer( "converter", converterDeployer );
       }
   
       /**
  @@ -79,7 +77,7 @@
       {
           try
           {
  -            DefaultTypeLibraryDeployer deployment =
  +            final DefaultTypeLibraryDeployer deployment =
                   new DefaultTypeLibraryDeployer( m_roleRegistry,
                                                   m_typeDeployer,
                                                   namespace,
  
  
  
  1.9       +3 -2      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultTypeLibraryDeployer.java	23 May 2002 09:36:36 -0000	1.8
  +++ DefaultTypeLibraryDeployer.java	9 Jun 2002 13:25:40 -0000	1.9
  @@ -32,7 +32,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.8 $ $Date: 2002/05/23 09:36:36 $
  + * @version $Revision: 1.9 $ $Date: 2002/06/09 13:25:40 $
    *
    * @todo Keep track of which types have been deployed, and don't redeploy them.
    */
  @@ -304,7 +304,7 @@
           if( getLogger().isDebugEnabled() )
           {
               final String debugMessage =
  -                REZ.getString( "register-role.notice", roleInfo.getName(), roleInfo.getImplementationClass().getName()
);
  +                REZ.getString( "register-role.notice", roleInfo.getShortName(), roleInfo.getImplementationClass().getName()
);
               getLogger().debug( debugMessage );
           }
       }
  @@ -334,6 +334,7 @@
           }
           catch( final Exception e )
           {
  +            e.printStackTrace();
               final String message = REZ.getString( "deploy-types.error", descriptor.getUrl()
);
               throw new DeploymentException( message, e );
           }
  
  
  
  1.17      +2 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/Resources.properties,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Resources.properties	3 May 2002 06:56:10 -0000	1.16
  +++ Resources.properties	9 Jun 2002 13:25:40 -0000	1.17
  @@ -22,4 +22,5 @@
   multi-types-element.error=Library descriptor "{0}" contains multiple top-level <types/>
elements.
   service-descriptor-version.error=Service descriptor version {0} is incompatible with current
version {1}.
   build-service-descriptor.error=Could not build service descriptor from "{0}".
  -create-type-deployer.error=Could not create the type deployer for role "{0}".
  \ No newline at end of file
  +create-type-deployer.error=Could not create the type deployer for role "{0}".
  +missing-roleinfo.error=Unable to locate RoleInfo for role "{0}".
  \ No newline at end of file
  
  
  
  1.9       +3 -3      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/RoleDescriptorBuilder.java
  
  Index: RoleDescriptorBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/RoleDescriptorBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RoleDescriptorBuilder.java	22 May 2002 07:36:22 -0000	1.8
  +++ RoleDescriptorBuilder.java	9 Jun 2002 13:25:40 -0000	1.9
  @@ -20,7 +20,7 @@
    * Builds typelib role descriptors.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.8 $ $Date: 2002/05/22 07:36:22 $
  + * @version $Revision: 1.9 $ $Date: 2002/06/09 13:25:40 $
    */
   class RoleDescriptorBuilder
       implements DescriptorBuilder
  @@ -58,7 +58,7 @@
               for( int i = 0; i < types.length; i++ )
               {
                   final Configuration type = types[ i ];
  -                final String roleName = type.getAttribute( "name" );
  +                final String shortName = type.getAttribute( "name" );
                   final String className = type.getAttribute( "classname" );
                   final Class roleType = deployer.getClassLoader().loadClass( className );
                   final Map attrMap = new HashMap();
  @@ -71,7 +71,7 @@
                   attrMap.remove( "name" );
                   attrMap.remove( "classname" );
   
  -                final RoleInfo roleInfo = new RoleInfo( roleName, roleType, attrMap );
  +                final RoleInfo roleInfo = new RoleInfo( shortName, roleType, attrMap );
                   descriptor.addDefinition( roleInfo );
               }
   
  
  
  
  1.2       +3 -3      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/TypeToConverterFactoryAdaptor.java
  
  Index: TypeToConverterFactoryAdaptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/TypeToConverterFactoryAdaptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeToConverterFactoryAdaptor.java	27 May 2002 02:17:45 -0000	1.1
  +++ TypeToConverterFactoryAdaptor.java	9 Jun 2002 13:25:40 -0000	1.2
  @@ -7,15 +7,15 @@
    */
   package org.apache.myrmidon.components.deployer;
   
  -import org.apache.aut.converter.ConverterFactory;
  -import org.apache.aut.converter.Converter;
  +import org.apache.excalibur.converter.Converter;
  +import org.apache.excalibur.converter.ConverterFactory;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   
   /**
    * Adapts a TypeFactory into a ConverterFactory
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/05/27 02:17:45 $
  + * @version $Revision: 1.2 $ $Date: 2002/06/09 13:25:40 $
    */
   public class TypeToConverterFactoryAdaptor
       implements ConverterFactory
  
  
  
  1.10      +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/service/InstantiatingServiceManager.java
  
  Index: InstantiatingServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/service/InstantiatingServiceManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- InstantiatingServiceManager.java	19 May 2002 08:27:18 -0000	1.9
  +++ InstantiatingServiceManager.java	9 Jun 2002 13:25:40 -0000	1.10
  @@ -45,7 +45,7 @@
    * </ul>
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.9 $ $Date: 2002/05/19 08:27:18 $
  + * @version $Revision: 1.10 $ $Date: 2002/06/09 13:25:40 $
    */
   public class InstantiatingServiceManager
       extends AbstractLogEnabled
  @@ -189,7 +189,7 @@
               final Object service = factory.createService();
   
               // Check the service is assignable to the role type
  -            final RoleInfo roleInfo = m_roleManager.getRole( serviceRole );
  +            final RoleInfo roleInfo = m_roleManager.getRoleByShortName( serviceRole );
               final Class serviceType = roleInfo.getImplementationClass();
               if( serviceType != null && !serviceType.isInstance( service ) )
               {
  
  
  
  1.27      +3 -3      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java
  
  Index: DefaultTypeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultTypeManager.java	7 Jun 2002 05:44:53 -0000	1.26
  +++ DefaultTypeManager.java	9 Jun 2002 13:25:40 -0000	1.27
  @@ -26,7 +26,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.26 $ $Date: 2002/06/07 05:44:53 $
  + * @version $Revision: 1.27 $ $Date: 2002/06/09 13:25:40 $
    */
   public class DefaultTypeManager
       implements TypeRegistry, TypeManager, Serviceable, ScopedService
  @@ -82,7 +82,7 @@
       public void registerTypes( String roleName, String namespace, TypeFactory factory )
           throws TypeException
       {
  -        NamespaceAwareTypeFactory nsFactory = createFactory( roleName );
  +        final NamespaceAwareTypeFactory nsFactory = createFactory( roleName );
           nsFactory.registerTypes( namespace, factory );
       }
   
  @@ -146,7 +146,7 @@
           else
           {
               // Lookup the role type
  -            final RoleInfo role = m_roleManager.getRole( roleName );
  +            final RoleInfo role = m_roleManager.getRoleByInterface( roleName );
               if( role == null )
               {
                   final String message = REZ.getString( "unknown-role.error", roleName );
  
  
  
  1.5       +17 -2     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/DefaultTypeDeployer.java
  
  Index: DefaultTypeDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/DefaultTypeDeployer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultTypeDeployer.java	27 May 2002 08:30:30 -0000	1.4
  +++ DefaultTypeDeployer.java	9 Jun 2002 13:25:40 -0000	1.5
  @@ -12,18 +12,21 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeRegistry;
  +import org.apache.myrmidon.interfaces.role.RoleManager;
  +import org.apache.myrmidon.interfaces.role.RoleInfo;
   
   /**
    * A general-purpose type deployer, which registers the type with the type
    * manager.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.4 $ $Date: 2002/05/27 08:30:30 $
  + * @version $Revision: 1.5 $ $Date: 2002/06/09 13:25:40 $
    */
   public class DefaultTypeDeployer
       implements TypeDeployer, Serviceable
   {
       private TypeRegistry m_typeRegistry;
  +    private RoleManager m_roleManager;
   
       protected TypeRegistry getTypeRegistry()
       {
  @@ -34,6 +37,7 @@
           throws ServiceException
       {
           m_typeRegistry = (TypeRegistry)serviceManager.lookup( TypeRegistry.ROLE );
  +        m_roleManager = (RoleManager)serviceManager.lookup( RoleManager.ROLE );
       }
   
       /**
  @@ -46,6 +50,17 @@
           final String roleName = typeDefinition.getRole();
           final String typeName = typeDefinition.getName();
           final TypeFactory typeFactory = typeDefinition.getFactory();
  -        m_typeRegistry.registerType( roleName, namespace, typeName, typeFactory );
  +
  +        final String classname = getInterfaceName( roleName );
  +        m_typeRegistry.registerType( classname,
  +                                     namespace,
  +                                     typeName,
  +                                     typeFactory );
  +    }
  +
  +    protected String getInterfaceName( final String shortName )
  +    {
  +        final RoleInfo role = m_roleManager.getRoleByShortName( shortName );
  +        return role.getInterfaceName();
       }
   }
  
  
  

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