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/tools/xsl build.xsl
Date Thu, 25 Apr 2002 09:34:46 GMT
adammurdoch    02/04/25 02:34:46

  Modified:    .        build.xml
               buildtools/src/java/org/apache/myrmidon/build
                        ant-descriptor.j ant-roles.j
               container/src/java/org/apache/myrmidon/components/deployer
                        CompoundTypeDeployer.java
                        ConverterTypeDeployer.java DefaultDeployer.java
                        DefaultTypeLibraryDeployer.java
                        Resources.properties RoleDefinition.java
                        RoleDescriptorBuilder.java
               container/src/java/org/apache/myrmidon/interfaces/role
                        RoleInfo.java
               container/src/test/org/apache/myrmidon/components/configurer/test
                        DefaultConfigurerTestCase.java
               framework/src/java/org/apache/myrmidon/framework
                        DataType.java
               tools/xsl build.xsl
  Added:       container/src/java/org/apache/myrmidon/components/deployer
                        RoleDeployer.java
               container/src/java/org/apache/myrmidon/interfaces/deployer
                        DefaultTypeDeployer.java TypeDeployer.java
               framework/src/java/org/apache/myrmidon/framework
                        DataTypeDeployer.java TypeInstanceTaskFactory.java
  Removed:     container/src/java/org/apache/myrmidon/components/deployer
                        DefaultTypeDeployer.java TypeDeployer.java
  Log:
  Allow custom type deployers for a role:
  
  * Added RoleInfo.getAttributes(), to allow meta-info to be attached to a
    role definition.  It gets populated with the attributes from the <role>
    definition in ant-roles.xml.
  
  * Moved TypeDeployer and DefaultTypeDeployer to interfaces.deployer.
  
  * Added optional 'type-deployer' parameter to the @ant.role tag.
  
  * Added a type deployer for data-type role, which takes care of registering the
    TypeInstanceTask for each data-types.  The generated type descriptors no longer
    contain a task def for data-types.
  
  Revision  Changes    Path
  1.13      +3 -10     jakarta-ant-myrmidon/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/build.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- build.xml	25 Apr 2002 01:41:49 -0000	1.12
  +++ build.xml	25 Apr 2002 09:34:45 -0000	1.13
  @@ -3,14 +3,7 @@
       <property name="build.xsl" location="tools/xsl/build.xsl"/>
       <property name="buildfile.name" value="build.xml"/>
   
  -    <target name="main">
  -        <ant dir="buildtools" antfile="${buildfile.name}" inheritAll="false"/>
  -        <ant dir="api" antfile="${buildfile.name}" inheritAll="false"/>
  -        <ant dir="aut" antfile="${buildfile.name}" inheritAll="false"/>
  -        <ant dir="container" antfile="${buildfile.name}" inheritAll="false"/>
  -        <ant dir="framework" antfile="${buildfile.name}" inheritAll="false"/>
  -        <ant dir="antlib" antfile="${buildfile.name}" inheritAll="false"/>
  -    </target>
  +    <target name="main" depends="dist-lite" description="Creates a minimal distribution"/>
   
       <target name="build-files" description="Generates the project build files">
           <style in="buildtools/project.xml"
  @@ -72,12 +65,12 @@
               <param name="target" value="test"/>
           </antcall>
       </target>
  -    <target name="dist-lite" description="Creates a minimal distribution for all projects">
  +    <target name="dist-lite" description="Creates a minimal distribution">
           <antcall target="for-all-projects">
               <param name="target" value="dist-lite"/>
           </antcall>
       </target>
  -    <target name="dist" description="Creates a distribution for all projects">
  +    <target name="dist" description="Creates the distribution">
           <antcall target="for-all-projects">
               <param name="target" value="dist-lite"/>
           </antcall>
  
  
  
  1.2       +0 -2      jakarta-ant-myrmidon/buildtools/src/java/org/apache/myrmidon/build/ant-descriptor.j
  
  Index: ant-descriptor.j
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/buildtools/src/java/org/apache/myrmidon/build/ant-descriptor.j,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ant-descriptor.j	15 Apr 2002 09:55:44 -0000	1.1
  +++ ant-descriptor.j	25 Apr 2002 09:34:45 -0000	1.2
  @@ -13,8 +13,6 @@
         <XDtClass:ifHasClassTag tagName="ant.data-type">
           <data-type name="<XDtClass:classTagValue tagName="ant.data-type" paramName="name"/>"
                 classname="<XDtClass:fullClassName/>"/>
  -        <task name="<XDtClass:classTagValue tagName="ant.data-type" paramName="name"/>"
  -              classname="org.apache.myrmidon.framework.TypeInstanceTask"/>
         </XDtClass:ifHasClassTag>
       </XDtClass:forAllClasses>
   
  
  
  
  1.3       +3 -0      jakarta-ant-myrmidon/buildtools/src/java/org/apache/myrmidon/build/ant-roles.j
  
  Index: ant-roles.j
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/buildtools/src/java/org/apache/myrmidon/build/ant-roles.j,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ant-roles.j	24 Apr 2002 02:20:59 -0000	1.2
  +++ ant-roles.j	25 Apr 2002 09:34:45 -0000	1.3
  @@ -2,6 +2,9 @@
       <XDtClass:forAllClasses abstract="true">
         <XDtClass:ifHasClassTag tagName="ant.role" superclasses="false">
           <role name="<XDtClass:classTagValue tagName="ant.role" paramName="name"/>"
  +            <XDtClass:ifHasClassTag tagName="ant.role" paramName="type-deployer" superclasses="false">
  +              type-deployer="<XDtClass:classTagValue tagName="ant.role" paramName="type-deployer"/>"
  +            </XDtClass:ifHasClassTag>
                 classname="<XDtClass:fullClassName/>"/>
         </XDtClass:ifHasClassTag>
       </XDtClass:forAllClasses>
  
  
  
  1.2       +2 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompoundTypeDeployer.java	25 Apr 2002 01:41:49 -0000	1.1
  +++ CompoundTypeDeployer.java	25 Apr 2002 09:34:45 -0000	1.2
  @@ -10,13 +10,14 @@
   import java.util.Map;
   import java.util.HashMap;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
  +import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   
   /**
    * A type deployer that delegates to a type deployer per role.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/25 01:41:49 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/25 09:34:45 $
    */
   public class CompoundTypeDeployer
       implements TypeDeployer
  
  
  
  1.2       +3 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConverterTypeDeployer.java	25 Apr 2002 01:41:49 -0000	1.1
  +++ ConverterTypeDeployer.java	25 Apr 2002 09:34:45 -0000	1.2
  @@ -14,6 +14,8 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
   import org.apache.myrmidon.interfaces.deployer.ConverterDefinition;
  +import org.apache.myrmidon.interfaces.deployer.DefaultTypeDeployer;
  +import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
   
  @@ -22,7 +24,7 @@
    * manager and the converter registry.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/25 01:41:49 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/25 09:34:45 $
    */
   public class ConverterTypeDeployer
       extends DefaultTypeDeployer
  
  
  
  1.39      +11 -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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- DefaultDeployer.java	25 Apr 2002 01:41:49 -0000	1.38
  +++ DefaultDeployer.java	25 Apr 2002 09:34:45 -0000	1.39
  @@ -22,6 +22,7 @@
   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.DefaultTypeDeployer;
   import org.apache.myrmidon.interfaces.role.RoleRegistry;
   
   /**
  @@ -29,7 +30,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.38 $ $Date: 2002/04/25 01:41:49 $
  + * @version $Revision: 1.39 $ $Date: 2002/04/25 09:34:45 $
    */
   public class DefaultDeployer
       extends AbstractLogEnabled
  @@ -39,9 +40,9 @@
           ResourceManager.getPackageResources( DefaultDeployer.class );
   
       // The components used to deploy
  -    private RoleRegistry m_roleManager;
  +    private RoleRegistry m_roleDeployer;
       private ClassLoaderManager m_classLoaderManager;
  -    private CompoundTypeDeployer m_deployer;
  +    private CompoundTypeDeployer m_typeDeployer;
   
       /** Map from ClassLoader to the deployer for that class loader. */
       private final Map m_classLoaderDeployers = new HashMap();
  @@ -55,7 +56,6 @@
       public void service( final ServiceManager serviceManager )
           throws ServiceException
       {
  -        m_roleManager = (RoleRegistry)serviceManager.lookup( RoleRegistry.ROLE );
           m_classLoaderManager = (ClassLoaderManager)serviceManager.lookup( ClassLoaderManager.ROLE
);
   
           // Assemble the type deployer
  @@ -63,8 +63,12 @@
           defaultDeployer.service( serviceManager );
           final ConverterTypeDeployer converterDeployer = new ConverterTypeDeployer();
           converterDeployer.service( serviceManager );
  -        m_deployer = new CompoundTypeDeployer( defaultDeployer );
  -        m_deployer.addDeployer( Converter.ROLE, converterDeployer );
  +        m_typeDeployer = new CompoundTypeDeployer( defaultDeployer );
  +        m_typeDeployer.addDeployer( Converter.ROLE, converterDeployer );
  +
  +        // Assemble the role deployer
  +        final RoleRegistry roleRegistry = (RoleRegistry)serviceManager.lookup( RoleRegistry.ROLE
);
  +        m_roleDeployer = new RoleDeployer( roleRegistry, m_typeDeployer, serviceManager
);
       }
   
       /**
  @@ -127,7 +131,7 @@
           DefaultTypeLibraryDeployer deployment = (DefaultTypeLibraryDeployer)m_classLoaderDeployers.get(
loader );
           if( deployment == null )
           {
  -            deployment = new DefaultTypeLibraryDeployer( m_roleManager, m_deployer, loader
);
  +            deployment = new DefaultTypeLibraryDeployer( m_roleDeployer, m_typeDeployer,
loader );
               setupLogger( deployment );
               deployment.loadDescriptors( jarUrl );
               m_classLoaderDeployers.put( loader, deployment );
  
  
  
  1.2       +3 -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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultTypeLibraryDeployer.java	25 Apr 2002 01:41:49 -0000	1.1
  +++ DefaultTypeLibraryDeployer.java	25 Apr 2002 09:34:45 -0000	1.2
  @@ -22,6 +22,7 @@
   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.deployer.TypeDeployer;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleRegistry;
   import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
  @@ -32,7 +33,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/25 01:41:49 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/25 09:34:45 $
    */
   class DefaultTypeLibraryDeployer
       extends AbstractLogEnabled
  @@ -354,7 +355,7 @@
           final String role = roleDef.getRoleName();
           final String className = roleDef.getClassName();
           final Class type = m_classLoader.loadClass( className );
  -        final RoleInfo roleInfo = new RoleInfo( role, type, null );
  +        final RoleInfo roleInfo = new RoleInfo( role, type, roleDef.getAttributes() );
           m_roleRegistry.addRole( roleInfo );
   
           if( getLogger().isDebugEnabled() )
  @@ -400,7 +401,6 @@
       private void deployServices( final TypeDescriptor descriptor )
           throws DeploymentException
       {
  -
           try
           {
               if( getLogger().isDebugEnabled() )
  
  
  
  1.15      +1 -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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Resources.properties	25 Apr 2002 01:41:49 -0000	1.14
  +++ Resources.properties	25 Apr 2002 09:34:45 -0000	1.15
  @@ -23,4 +23,4 @@
   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
  
  
  
  1.3       +11 -1     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/RoleDefinition.java
  
  Index: RoleDefinition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/RoleDefinition.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleDefinition.java	24 Apr 2002 02:20:59 -0000	1.2
  +++ RoleDefinition.java	25 Apr 2002 09:34:45 -0000	1.3
  @@ -7,6 +7,8 @@
    */
   package org.apache.myrmidon.components.deployer;
   
  +import java.util.Map;
  +
   /**
    * A role definition.
    *
  @@ -15,13 +17,16 @@
   class RoleDefinition
   {
       private final String m_className;
  +    private final Map m_attributes;
       private final String m_roleName;
   
       public RoleDefinition( final String roleName,
  -                           final String className )
  +                           final String className,
  +                           final Map attributes )
       {
           m_roleName = roleName;
           m_className = className;
  +        m_attributes = attributes;
       }
   
       public String getRoleName()
  @@ -32,5 +37,10 @@
       public String getClassName()
       {
           return m_className;
  +    }
  +
  +    public Map getAttributes()
  +    {
  +        return m_attributes;
       }
   }
  
  
  
  1.7       +15 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RoleDescriptorBuilder.java	24 Apr 2002 02:20:59 -0000	1.6
  +++ RoleDescriptorBuilder.java	25 Apr 2002 09:34:45 -0000	1.7
  @@ -12,12 +12,15 @@
   import org.apache.avalon.framework.Version;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
  +import java.util.Map;
  +import java.util.Collections;
  +import java.util.HashMap;
   
   /**
    * Builds typelib role descriptors.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.6 $ $Date: 2002/04/24 02:20:59 $
  + * @version $Revision: 1.7 $ $Date: 2002/04/25 09:34:45 $
    */
   class RoleDescriptorBuilder
       implements DescriptorBuilder
  @@ -56,7 +59,17 @@
                   final Configuration type = types[ i ];
                   final String roleName = type.getAttribute( "name" );
                   final String className = type.getAttribute( "classname" );
  -                final RoleDefinition roleDef = new RoleDefinition( roleName, className
);
  +                final Map attrMap = new HashMap();
  +                final String[] attrs = type.getAttributeNames();
  +                for( int j = 0; j < attrs.length; j++ )
  +                {
  +                    String attr = attrs[ j ];
  +                    attrMap.put( attr, type.getAttribute( attr) );
  +                }
  +                attrMap.remove( "name" );
  +                attrMap.remove( "classname" );
  +
  +                final RoleDefinition roleDef = new RoleDefinition( roleName, className,
attrMap );
                   descriptor.addDefinition( roleDef );
               }
   
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/deployer/RoleDeployer.java
  
  Index: RoleDeployer.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.deployer;
  
  import org.apache.myrmidon.interfaces.role.RoleException;
  import org.apache.myrmidon.interfaces.role.RoleInfo;
  import org.apache.myrmidon.interfaces.role.RoleRegistry;
  import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  
  /**
   * Responsible for deploying roles, and instantiating custom type deployers
   * for roles.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/25 09:34:45 $
   */
  class RoleDeployer
      implements RoleRegistry
  {
      private static final Resources REZ =
          ResourceManager.getPackageResources( RoleDeployer.class );
  
      private final RoleRegistry m_roleRegistry;
      private final CompoundTypeDeployer m_typeDeployer;
      private final ServiceManager m_serviceManager;
  
      public RoleDeployer( final RoleRegistry roleRegistry,
                           final CompoundTypeDeployer typeDeployer,
                           final ServiceManager serviceManager )
      {
          m_roleRegistry = roleRegistry;
          m_typeDeployer = typeDeployer;
          m_serviceManager = serviceManager;
      }
  
      /**
       * Adds a role definition.
       */
      public void addRole( final RoleInfo role ) throws RoleException
      {
          // Instantiate the custom type deployer for this role
          final String typeDeployerClassName = (String)role.getAttributes().get( RoleInfo.ATTRIBUTE_CUSTOM_TYPE_DEPLOYER
);
          if( typeDeployerClassName != null )
          {
              try
              {
                  final Class typeDeployerClass = role.getImplementationClass().getClassLoader().loadClass(
typeDeployerClassName );
                  final TypeDeployer deployer = (TypeDeployer)typeDeployerClass.newInstance();
                  if( deployer instanceof Serviceable )
                  {
                      ( (Serviceable)deployer ).service( m_serviceManager );
                  }
                  m_typeDeployer.addDeployer( role.getName(), deployer );
              }
              catch( final Exception e )
              {
                  final String message = REZ.getString( "create-type-deployer.error", role.getName()
);
                  throw new RoleException( message, e );
              }
          }
  
          // Now add the role
          m_roleRegistry.addRole( role );
      }
  
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/DefaultTypeDeployer.java
  
  Index: DefaultTypeDeployer.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.deployer;
  
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
  import org.apache.myrmidon.interfaces.type.TypeFactory;
  import org.apache.myrmidon.interfaces.type.TypeManager;
  
  /**
   * 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.1 $ $Date: 2002/04/25 09:34:45 $
   */
  public class DefaultTypeDeployer
      implements TypeDeployer, Serviceable
  {
      private TypeManager m_typeManager;
  
      protected TypeManager getTypeManager()
      {
          return m_typeManager;
      }
  
      public void service( final ServiceManager serviceManager )
          throws ServiceException
      {
          m_typeManager = (TypeManager)serviceManager.lookup( TypeManager.ROLE );
      }
  
      /**
       * Deploys a type.
       */
      public void deployType( final TypeDefinition typeDefinition,
                              final TypeFactory typeFactory )
          throws Exception
      {
          final String roleName = typeDefinition.getRole();
          final String typeName = typeDefinition.getName();
          m_typeManager.registerType( roleName, typeName, typeFactory );
      }
  }
  
  
  
  1.6       +11 -35    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/deployer/TypeDeployer.java
  
  
  
  
  1.6       +36 -8     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/role/RoleInfo.java
  
  Index: RoleInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/role/RoleInfo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RoleInfo.java	24 Apr 2002 02:21:00 -0000	1.5
  +++ RoleInfo.java	25 Apr 2002 09:34:45 -0000	1.6
  @@ -7,22 +7,33 @@
    */
   package org.apache.myrmidon.interfaces.role;
   
  +import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Collections;
  +
   /**
    * A role definition.  Role definitions are immutable.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.5 $ $Date: 2002/04/24 02:21:00 $
  + * @version $Revision: 1.6 $ $Date: 2002/04/25 09:34:45 $
    */
   public final class RoleInfo
   {
       private final String m_name;
       private final Class m_type;
  -    private final String m_defaultType;
  +    private final Map m_attributes;
  +    private final Map m_readOnlyAttributes;
  +
  +    /** The type name of the default implementation for this role. */
  +    public static final String ATTRIBUTE_DEFAULT_TYPE = "default-type";
  +
  +    /** The classname of the custom type deployer for this role. */
  +    public static final String ATTRIBUTE_CUSTOM_TYPE_DEPLOYER = "type-deployer";
   
       /**
        * Creates a role definition.
        *
  -     * @see #RoleInfo( String, Class, String )
  +     * @see #RoleInfo( String, Class, Map )
        */
       public RoleInfo( final String name )
       {
  @@ -32,7 +43,7 @@
       /**
        * Creates a role definition.
        *
  -     * @see #RoleInfo( String, Class, String )
  +     * @see #RoleInfo( String, Class, Map )
        */
       public RoleInfo( final String name, final Class type )
       {
  @@ -44,15 +55,24 @@
        *
        * @param name The role name.
        * @param type The role implementation class.  May be null.
  -     * @param defaultType The default type name to use. May be null.
  +     * @param attributes Additional meta-information for the role.  May be null.
        */
       public RoleInfo( final String name,
                        final Class type,
  -                     final String defaultType )
  +                     final Map attributes )
       {
           m_name = name;
           m_type = type;
  -        m_defaultType = defaultType;
  +        if( attributes == null || attributes.size() == 0 )
  +        {
  +            m_attributes = Collections.EMPTY_MAP;
  +            m_readOnlyAttributes = Collections.EMPTY_MAP;
  +        }
  +        else
  +        {
  +            m_attributes = new HashMap( attributes );
  +            m_readOnlyAttributes = Collections.unmodifiableMap( m_attributes );
  +        }
       }
   
       /**
  @@ -104,6 +124,14 @@
        */
       public String getDefaultTypeName()
       {
  -        return m_defaultType;
  +        return (String)m_attributes.get( ATTRIBUTE_DEFAULT_TYPE );
  +    }
  +
  +    /**
  +     * Returns a read-only map of the attributes of this role.
  +     */
  +    public Map getAttributes()
  +    {
  +        return m_readOnlyAttributes;
       }
   }
  
  
  
  1.12      +5 -1      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java
  
  Index: DefaultConfigurerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultConfigurerTestCase.java	24 Apr 2002 02:21:00 -0000	1.11
  +++ DefaultConfigurerTestCase.java	25 Apr 2002 09:34:45 -0000	1.12
  @@ -8,6 +8,8 @@
   package org.apache.myrmidon.components.configurer.test;
   
   import java.io.File;
  +import java.util.Map;
  +import java.util.HashMap;
   import org.apache.aut.converter.lib.StringToIntegerConverter;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.ExceptionUtil;
  @@ -421,7 +423,9 @@
           final ModelElement child = new ModelElement( "prop-a", "test" );
           config.addChild( child );
   
  -        registerRole( new RoleInfo( "myrole1", MyRole1.class, "default-type" ) );
  +        final Map attributes = new HashMap();
  +        attributes.put( RoleInfo.ATTRIBUTE_DEFAULT_TYPE, "default-type" );
  +        registerRole( new RoleInfo( "myrole1", MyRole1.class, attributes ) );
           registerType( "myrole1", "default-type", MyType1.class );
   
           final ConfigTestInterfaceAdder test = new ConfigTestInterfaceAdder();
  
  
  
  1.3       +1 -0      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/DataType.java
  
  Index: DataType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/DataType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DataType.java	24 Apr 2002 02:21:01 -0000	1.2
  +++ DataType.java	25 Apr 2002 09:34:45 -0000	1.3
  @@ -13,6 +13,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @ant.role name="data-type"
  + *           type-deployer="org.apache.myrmidon.framework.DataTypeDeployer"
    */
   public interface DataType
   {
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/DataTypeDeployer.java
  
  Index: DataTypeDeployer.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.framework;
  
  import org.apache.myrmidon.interfaces.deployer.DefaultTypeDeployer;
  import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
  import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
  import org.apache.myrmidon.interfaces.type.TypeFactory;
  import org.apache.myrmidon.framework.TypeInstanceTaskFactory;
  import org.apache.myrmidon.api.Task;
  
  /**
   * A deployer for data-types.  Registers the type, and an instantiating
   * task with the same name.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/25 09:34:45 $
   */
  public class DataTypeDeployer
      extends DefaultTypeDeployer
      implements TypeDeployer
  {
      private TypeInstanceTaskFactory m_factory = new TypeInstanceTaskFactory();
  
      /**
       * Deploys a type.
       */
      public void deployType( final TypeDefinition typeDefinition,
                              final TypeFactory typeFactory )
          throws Exception
      {
          // Register the type itself
          super.deployType( typeDefinition, typeFactory );
  
          // Register the instantiating task
          getTypeManager().registerType( Task.ROLE, typeDefinition.getName(), m_factory );
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/TypeInstanceTaskFactory.java
  
  Index: TypeInstanceTaskFactory.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.framework;
  
  import org.apache.myrmidon.interfaces.type.TypeFactory;
  import org.apache.myrmidon.interfaces.type.TypeException;
  
  /**
   * A factory for data-type tasks.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/25 09:34:45 $
   */
  public class TypeInstanceTaskFactory
      implements TypeFactory
  {
      /**
       * Determines if this factory can create instances of a particular type.
       */
      public boolean canCreate( final String name )
      {
          // TODO - should return false some times.
          return true;
      }
  
      /**
       * Create a type instance based on name.
       */
      public Object create( final String name )
          throws TypeException
      {
          return new TypeInstanceTask();
      }
  }
  
  
  
  1.6       +0 -2      jakarta-ant-myrmidon/tools/xsl/build.xsl
  
  Index: build.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/tools/xsl/build.xsl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.xsl	25 Apr 2002 01:20:35 -0000	1.5
  +++ build.xsl	25 Apr 2002 09:34:45 -0000	1.6
  @@ -230,8 +230,6 @@
                               </antlib-descriptor>
                           </xsl:if>
   
  -                        <echo>fork = ${junit.fork}</echo>
  -
                           <junit fork="${{junit.fork}}"
                               haltonfailure="${{junit.failonerror}}"
                               failureProperty="tests.failed"
  
  
  

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