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/factories VfsManager.java
Date Sun, 30 Jun 2002 11:09:12 GMT
donaldp     2002/06/30 04:09:11

  Modified:    antlib/src/java/org/apache/antlib/runtime
                        TypeAvailableCondition.java
               container/src/java/org/apache/myrmidon/components/builder
                        MasterProjectBuilder.java
               container/src/java/org/apache/myrmidon/components/configurer
                        DefaultConfigurer.java
               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/type
                        DefaultTypeManager.java
               container/src/java/org/apache/myrmidon/interfaces/type
                        TypeManager.java TypeRegistry.java
               container/src/test/org/apache/myrmidon/components
                        AbstractComponentTest.java
               container/src/test/org/apache/myrmidon/components/deployer/test
                        DefaultDeployerTestCase.java
               container/src/test/org/apache/myrmidon/components/type/test
                        DefaultTypeManagerTestCase.java
               framework/src/java/org/apache/myrmidon/framework
                        AbstractContainerTask.java
               framework/src/java/org/apache/myrmidon/framework/factories
                        VfsManager.java
  Log:
  Move getFactory(String roleName) from TypeManager to TypeRegistry. Replaced with
  
  newInstance(String rolename,String typename);
  
  Which is more suited to the way it was being used.
  
  Revision  Changes    Path
  1.6       +4 -4      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java
  
  Index: TypeAvailableCondition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/runtime/TypeAvailableCondition.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TypeAvailableCondition.java	25 Jun 2002 07:35:31 -0000	1.5
  +++ TypeAvailableCondition.java	30 Jun 2002 11:09:10 -0000	1.6
  @@ -15,7 +15,7 @@
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
  -import org.apache.myrmidon.interfaces.type.TypeManager;
  +import org.apache.myrmidon.interfaces.type.TypeRegistry;
   
   /**
    * A condition that evaluates to true if a particular type is available.
  @@ -88,8 +88,8 @@
               }
   
               // Lookup the type
  -            final TypeManager typeManager = (TypeManager)context.getService( TypeManager.class
);
  -            final TypeFactory typeFactory = typeManager.getFactory( role );
  +            final TypeRegistry typeRegistry = (TypeRegistry)context.getService( TypeRegistry.class
);
  +            final TypeFactory typeFactory = typeRegistry.getFactory( role );
   
               // Check if the type is available
               return typeFactory.canCreate( m_typeName );
  
  
  
  1.5       +4 -4      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/MasterProjectBuilder.java
  
  Index: MasterProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/MasterProjectBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MasterProjectBuilder.java	25 Jun 2002 11:16:47 -0000	1.4
  +++ MasterProjectBuilder.java	30 Jun 2002 11:09:11 -0000	1.5
  @@ -17,7 +17,6 @@
   import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.builder.ProjectException;
   import org.apache.myrmidon.interfaces.model.Project;
  -import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
  @@ -92,7 +91,8 @@
       private ProjectBuilder createProjectBuilder( final String type )
           throws Exception
       {
  -        final TypeFactory factory = m_typeManager.getFactory( ProjectBuilder.ROLE );
  -        return (ProjectBuilder)factory.create( type );
  +        return
  +            (ProjectBuilder)m_typeManager.
  +            newInstance( ProjectBuilder.ROLE, type );
       }
   }
  
  
  
  1.60      +5 -10     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java
  
  Index: DefaultConfigurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- DefaultConfigurer.java	27 Jun 2002 05:13:34 -0000	1.59
  +++ DefaultConfigurer.java	30 Jun 2002 11:09:11 -0000	1.60
  @@ -21,7 +21,6 @@
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
  -import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   
   /**
  @@ -566,9 +565,8 @@
               if( typeName != null )
               {
                   // Create the instance
  -                final TypeFactory factory =
  -                    typeManager.getFactory( roleInfo.getInterfaceName() );
  -                return factory.create( typeName );
  +                final String roleName = roleInfo.getInterfaceName();
  +                return typeManager.newInstance( roleName, typeName );
               }
           }
   
  @@ -599,11 +597,8 @@
           final RoleInfo roleInfo = roleManager.getRoleByInterface( type.getName() );
           if( roleInfo != null )
           {
  -            final TypeFactory factory = typeManager.getFactory( roleInfo.getInterfaceName()
);
  -            if( factory.canCreate( name ) )
  -            {
  -                return factory.create( name );
  -            }
  +            final String roleName = roleInfo.getInterfaceName();
  +            return typeManager.newInstance( roleName, name );
           }
           throw new NoSuchPropertyException();
       }
  
  
  
  1.114     +3 -5      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.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- DefaultEmbeddor.java	30 Jun 2002 10:49:40 -0000	1.113
  +++ DefaultEmbeddor.java	30 Jun 2002 11:09:11 -0000	1.114
  @@ -48,7 +48,6 @@
   import org.apache.myrmidon.interfaces.service.ServiceFactory;
   import org.apache.myrmidon.interfaces.service.ServiceRegistry;
   import org.apache.myrmidon.interfaces.type.TypeException;
  -import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  @@ -168,9 +167,8 @@
       {
           final TypeManager typeManager =
               (TypeManager)getService( context, TypeManager.class );
  -        final TypeFactory factory =
  -            typeManager.getFactory( TaskListener.ROLE );
  -        return (TaskListener)factory.create( name );
  +        return (TaskListener)typeManager.
  +            newInstance( TaskListener.ROLE, name );
       }
   
       /**
  
  
  
  1.52      +2 -3      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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- DefaultExecutor.java	27 Jun 2002 05:13:34 -0000	1.51
  +++ DefaultExecutor.java	30 Jun 2002 11:09:11 -0000	1.52
  @@ -159,8 +159,7 @@
           try
           {
               final TypeManager typeManager = (TypeManager)context.getService( TypeManager.class
);
  -            final TypeFactory factory = typeManager.getFactory( Task.ROLE );
  -            return (Task)factory.create( name );
  +            return (Task)typeManager.newInstance( Task.ROLE, name );
           }
           catch( final Exception te )
           {
  
  
  
  1.31      +7 -4      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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- DefaultTypeManager.java	30 Jun 2002 06:23:30 -0000	1.30
  +++ DefaultTypeManager.java	30 Jun 2002 11:09:11 -0000	1.31
  @@ -81,9 +81,12 @@
           nsFactory.registerType( namespace, shorthandName, factory );
       }
   
  -    /**
  -     * @see TypeManager#getFactory( String )
  -     */
  +    public Object newInstance( String roleName, String shortTypeName )
  +        throws TypeException
  +    {
  +        return getFactory( roleName ).create( shortTypeName );
  +    }
  +
       public TypeFactory getFactory( final String roleName )
           throws TypeException
       {
  
  
  
  1.19      +7 -5      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/type/TypeManager.java
  
  Index: TypeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/type/TypeManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TypeManager.java	30 Jun 2002 10:52:45 -0000	1.18
  +++ TypeManager.java	30 Jun 2002 11:09:11 -0000	1.19
  @@ -25,13 +25,15 @@
       char NAMESPACE_SEPARATOR = '.';
   
       /**
  -     * Returns the factory for a role.
  +     * Create a new instance of specified type.
        *
        * @param roleName The role for the type.
  -     * @return The TypeFactory for the named role.
  -     * @throws TypeException If the rolename is invalid.
  +     * @param shortTypeName The name under which type is registered.
  +     * @return The newly created instance of type.
  +     * @throws TypeException If the rolename is invalid or unable
  +     *         to create instance.
        */
  -    TypeFactory getFactory( String roleName )
  +    Object newInstance( String roleName, String shortTypeName )
           throws TypeException;
   
       TypeManager getChildTypeManager();
  
  
  
  1.2       +11 -1     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/type/TypeRegistry.java
  
  Index: TypeRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/type/TypeRegistry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeRegistry.java	27 May 2002 08:30:30 -0000	1.1
  +++ TypeRegistry.java	30 Jun 2002 11:09:11 -0000	1.2
  @@ -46,4 +46,14 @@
                          String shorthandName,
                          TypeFactory factory )
           throws TypeException;
  +
  +    /**
  +     * Returns the factory for a role.
  +     *
  +     * @param roleName The role for the type.
  +     * @return The TypeFactory for the named role.
  +     * @throws TypeException If the rolename is invalid.
  +     */
  +    TypeFactory getFactory( String roleName )
  +        throws TypeException;
   }
  
  
  
  1.53      +12 -1     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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- AbstractComponentTest.java	30 Jun 2002 10:49:41 -0000	1.52
  +++ AbstractComponentTest.java	30 Jun 2002 11:09:11 -0000	1.53
  @@ -231,6 +231,17 @@
           return (TypeManager)lookup( TypeManager.ROLE );
       }
   
  +
  +    /**
  +     * Returns the type manager.
  +     */
  +    protected TypeRegistry getTypeRegistry()
  +        throws Exception
  +    {
  +        return (TypeRegistry)lookup( TypeRegistry.ROLE );
  +    }
  +
  +
       /**
        * Utility method to create a task context.
        */
  
  
  
  1.19      +2 -2      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultDeployerTestCase.java	30 Jun 2002 09:58:15 -0000	1.18
  +++ DefaultDeployerTestCase.java	30 Jun 2002 11:09:11 -0000	1.19
  @@ -192,7 +192,7 @@
           TypeFactory typeFactory;
           try
           {
  -            typeFactory = getTypeManager().getFactory( role );
  +            typeFactory = getTypeRegistry().getFactory( role );
           }
           catch( final Exception e )
           {
  @@ -232,7 +232,7 @@
           throws Exception
       {
           // Shorthand name
  -        final TypeFactory typeFactory = getTypeManager().getFactory( role );
  +        final TypeFactory typeFactory = getTypeRegistry().getFactory( role );
           Object result = typeFactory.create( typeName );
           assertTrue( implClass.isInstance( result ) );
   
  
  
  
  1.11      +29 -29    jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/type/test/DefaultTypeManagerTestCase.java
  
  Index: DefaultTypeManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/type/test/DefaultTypeManagerTestCase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultTypeManagerTestCase.java	30 Jun 2002 09:58:15 -0000	1.10
  +++ DefaultTypeManagerTestCase.java	30 Jun 2002 11:09:11 -0000	1.11
  @@ -59,13 +59,13 @@
       public void testRegister() throws Exception
       {
           // Make sure it's not there to start with.
  -        assertCantCreate( m_typeManager, TEST_ROLE, TYPE_NAME1 );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1 );
   
           // Register a type with no namespace
           registerType( m_typeRegistry, TEST_ROLE, null, TYPE_NAME1, TYPE_CLASS1 );
   
           // Lookup the type with the shortname
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME1, TYPE_CLASS1 );
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1, TYPE_CLASS1 );
       }
   
       public void testRegisterNS() throws Exception
  @@ -73,15 +73,15 @@
           String qname = makeQName( TEST_NAMESPACE, TYPE_NAME1 );
   
           // Check pre-registration.
  -        assertCantCreate( m_typeManager, TEST_ROLE, TYPE_NAME1 );
  -        assertCantCreate( m_typeManager, TEST_ROLE, qname );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1 );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, qname );
   
           // Register a type under a namespace
           registerType( m_typeRegistry, TEST_ROLE, TEST_NAMESPACE, TYPE_NAME1, TYPE_CLASS1
);
   
           // Lookup the type with the shortName and qname.
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME1, TYPE_CLASS1 );
  -        assertCreate( m_typeManager, TEST_ROLE, qname, TYPE_CLASS1 );
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1, TYPE_CLASS1 );
  +        assertCreate( m_typeRegistry, TEST_ROLE, qname, TYPE_CLASS1 );
       }
   
       public void testLookupUnknown() throws Exception
  @@ -89,7 +89,7 @@
           // Unknown role.
           try
           {
  -            m_typeManager.getFactory( UNKNOWN_ROLE );
  +            m_typeRegistry.getFactory( UNKNOWN_ROLE );
               fail( "Lookup unknown role should fail." );
           }
           catch( TypeException te )
  @@ -99,26 +99,26 @@
           }
   
           // Unknown type name for known role.
  -        assertCantCreate( m_typeManager, TEST_ROLE, UNKNOWN_TYPE );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, UNKNOWN_TYPE );
       }
   
       public void testLookupUnknownQName() throws Exception
       {
           // Unknown qualified type name for known role.
           String qname = makeQName( TEST_NAMESPACE, UNKNOWN_TYPE );
  -        assertCantCreate( m_typeManager, TEST_ROLE, qname );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, qname );
   
           // Register Type1 with no namespace,
           // and try to look it up with a namespace - can't be found.
           qname = makeQName( TEST_NAMESPACE, TYPE_NAME1 );
           registerType( m_typeRegistry, TEST_ROLE, null, TYPE_NAME1, TYPE_CLASS1 );
  -        assertCantCreate( m_typeManager, TEST_ROLE, qname );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, qname );
   
           // Register Type2 with a namespace,
           // and try to look it up with a different namespace - cant' be found.
           qname = makeQName( TEST_NAMESPACE, TYPE_NAME2 );
           registerType( m_typeRegistry, TEST_ROLE, "another-namespace", TYPE_NAME2, TYPE_CLASS2
);
  -        assertCantCreate( m_typeManager, TEST_ROLE, qname );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, qname );
       }
   
       public void testNamespaceSeparation() throws Exception
  @@ -131,13 +131,13 @@
           registerType( m_typeRegistry, TEST_ROLE, ns2, TYPE_NAME1, TYPE_CLASS2 );
   
           // Check that we can create using the qnames.
  -        assertCreate( m_typeManager, TEST_ROLE, makeQName( ns1, TYPE_NAME1 ), TYPE_CLASS1
);
  -        assertCreate( m_typeManager, TEST_ROLE, makeQName( ns2, TYPE_NAME1 ), TYPE_CLASS2
);
  +        assertCreate( m_typeRegistry, TEST_ROLE, makeQName( ns1, TYPE_NAME1 ), TYPE_CLASS1
);
  +        assertCreate( m_typeRegistry, TEST_ROLE, makeQName( ns2, TYPE_NAME1 ), TYPE_CLASS2
);
   
           // Try to create with short name (ambiguous)
           String message = REZ.getString( "ambiguous-type-name.error",
                                           TYPE_NAME1 );
  -        assertCantCreate( m_typeManager, TEST_ROLE, TYPE_NAME1, message );
  +        assertCantCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1, message );
       }
   
       public void testChildIndependence() throws Exception
  @@ -289,8 +289,8 @@
           m_typeRegistry.registerTypes( TEST_ROLE, groupNs, factory );
   
           // Check that the types are available.
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME1, groupClass );
  -        assertCreate( m_typeManager, TEST_ROLE,
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1, groupClass );
  +        assertCreate( m_typeRegistry, TEST_ROLE,
                         makeQName( groupNs, TYPE_NAME1), groupClass );
   
           // Now register a single type over these registrations
  @@ -298,14 +298,14 @@
                         TYPE_NAME1, individualClass );
   
           // With shortname only, should get individually registered type (more specific)
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME1, individualClass );
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME1, individualClass );
           // With FQNames, should be able to access either.
  -        assertCreate( m_typeManager, TEST_ROLE,
  +        assertCreate( m_typeRegistry, TEST_ROLE,
                         makeQName( groupNs, TYPE_NAME1 ), groupClass );
  -        assertCreate( m_typeManager, TEST_ROLE,
  +        assertCreate( m_typeRegistry, TEST_ROLE,
                         makeQName( individualNs, TYPE_NAME1 ), individualClass );
           // Typename2 isn't overridden, so should still access the group type
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME2, groupClass );
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME2, groupClass );
   
   
   
  @@ -314,8 +314,8 @@
           // Register a type individually under the group Namespace.
           registerType( m_typeRegistry, TEST_ROLE, groupNs, TYPE_NAME2, individualClass );
           // This type should be available both FQ and shortname.
  -        assertCreate( m_typeManager, TEST_ROLE, TYPE_NAME2, individualClass );
  -        assertCreate( m_typeManager, TEST_ROLE,
  +        assertCreate( m_typeRegistry, TEST_ROLE, TYPE_NAME2, individualClass );
  +        assertCreate( m_typeRegistry, TEST_ROLE,
                         makeQName( groupNs, TYPE_NAME2 ), individualClass );
       }
   
  @@ -345,13 +345,13 @@
        * Checks that the named type can be created by the TypeManager provided,
        * and that the returned type is of the correct class.
        */
  -    private void assertCreate( final TypeManager typeManager,
  +    private void assertCreate( final TypeRegistry typeRegistry,
                                  final String roleName,
                                  final String typeName,
                                  final Class expectedClass )
           throws Exception
       {
  -        TypeFactory factory = typeManager.getFactory( roleName );
  +        TypeFactory factory = typeRegistry.getFactory( roleName );
           boolean canCreate = factory.canCreate( typeName );
           assertTrue( "Could not create: " + typeName, canCreate );
   
  @@ -363,26 +363,26 @@
        * Checks that the named type cannot be created by the TypeManager provided,
        * failing with a "no factory" error.
        */
  -    private void assertCantCreate( final TypeManager typeManager,
  +    private void assertCantCreate( final TypeRegistry typeRegistry,
                                      final String roleName,
                                      final String typeName )
           throws Exception
       {
           final String message = REZ.getString( "no-factory.error", typeName );
  -        assertCantCreate( typeManager, roleName, typeName, message );
  +        assertCantCreate( typeRegistry, roleName, typeName, message );
       }
   
       /**
        * Checks that the named type cannot be created by the TypeManager provided,
        * failing with the specified error message.
        */
  -    private void assertCantCreate( final TypeManager typeManager,
  +    private void assertCantCreate( final TypeRegistry typeRegistry,
                                      final String roleName,
                                      final String typeName,
                                      final String errorMessage )
           throws TypeException
       {
  -        TypeFactory factory = typeManager.getFactory( roleName );
  +        TypeFactory factory = typeRegistry.getFactory( roleName );
           assertTrue( !factory.canCreate( typeName ) );
   
           try
  
  
  
  1.15      +6 -26     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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractContainerTask.java	30 Jun 2002 10:49:41 -0000	1.14
  +++ AbstractContainerTask.java	30 Jun 2002 11:09:11 -0000	1.15
  @@ -21,8 +21,6 @@
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
  -import org.apache.myrmidon.interfaces.type.TypeException;
  -import org.apache.myrmidon.interfaces.type.TypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeManager;
   
   /**
  @@ -183,7 +181,7 @@
           try
           {
               final RoleInfo role = getRoleByType( roleType );
  -            return newInstance( role.getShortName(), typeName );
  +            return newInstance( role.getInterfaceName(), typeName );
           }
           catch( Exception e )
           {
  @@ -196,19 +194,19 @@
       /**
        * Create an instance of type with specified type and in specified role.
        */
  -    protected final Object newInstance( final String shortName,
  +    protected final Object newInstance( final String roleName,
                                           final String typeName )
           throws TaskException
       {
           try
           {
  -            final TypeFactory typeFactory = getTypeFactory( shortName );
  -            return typeFactory.create( typeName );
  +            final TypeManager typeManager = (TypeManager)getService( TypeManager.class
);
  +            return typeManager.newInstance( roleName, typeName );
           }
           catch( final Exception e )
           {
               final String message =
  -                REZ.getString( "container.no-create-type.error", shortName, typeName );
  +                REZ.getString( "container.no-create-type.error", roleName, typeName );
               throw new TaskException( message, e );
           }
       }
  @@ -228,23 +226,5 @@
               throw new TaskException( message );
           }
           return role;
  -    }
  -
  -    /**
  -     * Locates a type factory.
  -     */
  -    private final TypeFactory getTypeFactory( final String shortName )
  -        throws TaskException
  -    {
  -        try
  -        {
  -            final TypeManager typeManager = (TypeManager)getService( TypeManager.class
);
  -            return typeManager.getFactory( shortName );
  -        }
  -        catch( final TypeException te )
  -        {
  -            final String message = REZ.getString( "container.no-factory.error", shortName
);
  -            throw new TaskException( message, te );
  -        }
       }
   }
  
  
  
  1.3       +10 -8     jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/factories/VfsManager.java
  
  Index: VfsManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/factories/VfsManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VfsManager.java	17 Jun 2002 07:19:45 -0000	1.2
  +++ VfsManager.java	30 Jun 2002 11:09:11 -0000	1.3
  @@ -17,7 +17,7 @@
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.myrmidon.interfaces.type.TypeFactory;
  -import org.apache.myrmidon.interfaces.type.TypeManager;
  +import org.apache.myrmidon.interfaces.type.TypeRegistry;
   
   /**
    * The myrmidon FileSystemManager implementation.
  @@ -29,17 +29,18 @@
       extends DefaultFileSystemManager
       implements Serviceable, Initializable
   {
  -    private static final Resources REZ
  -        = ResourceManager.getPackageResources( VfsManager.class );
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( VfsManager.class );
   
  -    private TypeManager m_typeManager;
  +    private TypeRegistry m_typeRegistry;
   
       /**
        * Locate the services used by this service.
        */
  -    public void service( final ServiceManager serviceManager ) throws ServiceException
  +    public void service( final ServiceManager serviceManager )
  +        throws ServiceException
       {
  -        m_typeManager = (TypeManager)serviceManager.lookup( TypeManager.ROLE );
  +        m_typeRegistry = (TypeRegistry)serviceManager.lookup( TypeRegistry.ROLE );
       }
   
       /**
  @@ -47,7 +48,8 @@
        */
       public void initialize() throws Exception
       {
  -        final TypeFactory factory = m_typeManager.getFactory( FileProvider.ROLE );
  +        final TypeFactory factory =
  +            m_typeRegistry.getFactory( FileProvider.ROLE );
   
           // TODO - make this list configurable
   
  
  
  

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