avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/infobuilder BlockInfoBuilder.java Resources.properties
Date Sat, 17 Aug 2002 02:34:44 GMT
donaldp     2002/08/16 19:34:44

  Modified:    src/java/org/apache/avalon/phoenix/tools/infobuilder
                        BlockInfoBuilder.java Resources.properties
  Removed:     src/java/org/apache/avalon/phoenix/tools/export
                        GenericBlockContext.java package.html
  Log:
  Revert changes that were -1'ed.
  
  Revision  Changes    Path
  1.23      +21 -109   jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/infobuilder/BlockInfoBuilder.java
  
  Index: BlockInfoBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/infobuilder/BlockInfoBuilder.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- BlockInfoBuilder.java	16 Aug 2002 13:37:31 -0000	1.22
  +++ BlockInfoBuilder.java	17 Aug 2002 02:34:44 -0000	1.23
  @@ -24,8 +24,7 @@
    * objects from Configuration objects. The format for Configuration object
    * is specified in the BlockInfo specification.
    *
  - * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
  + * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
    */
   public final class BlockInfoBuilder
  @@ -52,45 +51,19 @@
               getLogger().debug( message );
           }
   
  -        final boolean flag = info.getName().equals("type");
  -
  -        if( flag )
  -        {
  -            if( info.getChild("stages", false ) != null )
  -            {
  -                final String error = REZ.getString( "unsupported.stages", classname );
  -
  -                throw new IllegalArgumentException( error );
  -            }
  -            if( info.getChild("extensions", false ) != null )
  -            {
  -                final String error = REZ.getString( "unsupported.extensions", classname
);
  -
  -                throw new IllegalArgumentException( error );
  -            }
  -        }
  -
           Configuration configuration = null;
   
           configuration = info.getChild( "services" );
  -        final ServiceDescriptor[] services = buildServices( configuration, flag );
  +        final ServiceDescriptor[] services = buildServices( configuration );
   
           configuration = info.getChild( "management-access-points" );
  -        final ServiceDescriptor[] management = buildServices( configuration, flag );
  +        final ServiceDescriptor[] management = buildServices( configuration );
   
           configuration = info.getChild( "dependencies" );
  -        final DependencyDescriptor[] dependencies = buildDependencies( classname, configuration,
flag );
  +        final DependencyDescriptor[] dependencies = buildDependencies( classname, configuration
);
   
  -        if( flag )
  -        {
  -            configuration = info.getChild( "component" );
  -        }
  -        else
  -        {
  -            configuration = info.getChild( "block" );
  -        }
  -
  -        final BlockDescriptor descriptor = buildBlockDescriptor( classname, configuration,
flag );
  +        configuration = info.getChild( "block" );
  +        final BlockDescriptor descriptor = buildBlockDescriptor( classname, configuration
);
   
           if( getLogger().isDebugEnabled() )
           {
  @@ -110,13 +83,11 @@
        *
        * @param classname The classname of Block (used for logging purposes)
        * @param configuration the dependencies configuration
  -     * @param flag if TRUE build dependencies using the Avalon Type DTD
        * @return the created DependencyDescriptor
        * @throws ConfigurationException if an error occurs
        */
       private DependencyDescriptor[] buildDependencies( final String classname,
  -                                                      final Configuration configuration,
  -                                                      final boolean flag )
  +                                                      final Configuration configuration
)
           throws ConfigurationException
       {
           final Configuration[] elements = configuration.getChildren( "dependency" );
  @@ -125,7 +96,7 @@
           for( int i = 0; i < elements.length; i++ )
           {
               final DependencyDescriptor dependency =
  -                buildDependency( classname, elements[ i ], flag );
  +                buildDependency( classname, elements[ i ] );
               dependencies.add( dependency );
           }
   
  @@ -138,25 +109,14 @@
        *
        * @param classname The classname of Block (used for logging purposes)
        * @param dependency the dependency configuration
  -     * @param flag if TRUE build dependency using the Avalon Type DTD
        * @return the created DependencyDescriptor
        * @throws ConfigurationException if an error occurs
        */
       private DependencyDescriptor buildDependency( final String classname,
  -                                                  final Configuration dependency,
  -                                                  final boolean flag )
  +                                                  final Configuration dependency )
           throws ConfigurationException
       {
  -        ServiceDescriptor service;
  -        if( flag )
  -        {
  -            service = buildService( dependency.getChild( "reference" ), flag );
  -        }
  -        else
  -        {
  -            service = buildService( dependency.getChild( "service" ), flag );
  -        }
  -
  +        final ServiceDescriptor service = buildService( dependency.getChild( "service"
) );
           String role = dependency.getChild( "role" ).getValue( null );
   
           //default to name of service if role unspecified
  @@ -184,10 +144,9 @@
        *
        * @param servicesSet the services configuration
        * @return the created ServiceDescriptor
  -     * @param flag if TRUE build services using the Avalon Type DTD
        * @throws ConfigurationException if an error occurs
        */
  -    private ServiceDescriptor[] buildServices( final Configuration servicesSet, boolean
flag )
  +    private ServiceDescriptor[] buildServices( final Configuration servicesSet )
           throws ConfigurationException
       {
           final Configuration[] elements = servicesSet.getChildren( "service" );
  @@ -195,7 +154,7 @@
   
           for( int i = 0; i < elements.length; i++ )
           {
  -            final ServiceDescriptor service = buildService( elements[ i ], flag );
  +            final ServiceDescriptor service = buildService( elements[ i ] );
               services.add( service );
           }
   
  @@ -208,27 +167,15 @@
        *
        * @param service the service Configuration
        * @return the created ServiceDescriptor
  -     * @param flag if TRUE build service using the Avalon Type DTD
        * @throws ConfigurationException if an error occurs
        */
  -    private ServiceDescriptor buildService( final Configuration service, boolean flag )
  +    private ServiceDescriptor buildService( final Configuration service )
           throws ConfigurationException
       {
  -        if( flag )
  -        {
  -            Configuration ref = service.getChild("reference");
  -            final String name = ref.getAttribute( "type" );
  -            final String versionString = ref.getAttribute( "version", "1.0" );
  -            final Version version = buildVersion( versionString );
  -            return new ServiceDescriptor( name, version );
  -        }
  -        else
  -        {
  -            final String name = service.getAttribute( "name" );
  -            final String versionString = service.getAttribute( "version", "1.0" );
  -            final Version version = buildVersion( versionString );
  -            return new ServiceDescriptor( name, version );
  -        }
  +        final String name = service.getAttribute( "name" );
  +        final String versionString = service.getAttribute( "version", "1.0" );
  +        final Version version = buildVersion( versionString );
  +        return new ServiceDescriptor( name, version );
       }
   
       /**
  @@ -241,13 +188,11 @@
        *
        * @param classname The classname of Block (used to create descriptor)
        * @param block the Block Configuration
  -     * @param flag if TRUE build descriptor using the Avalon Type DTD
        * @return the created BlockDescriptor
        * @throws ConfigurationException if an error occurs
        */
       private BlockDescriptor buildBlockDescriptor( final String classname,
  -                                                  final Configuration block,
  -                                                  final boolean flag )
  +                                                  final Configuration block )
           throws ConfigurationException
       {
           if( 0 == block.getChildren().length )
  @@ -259,44 +204,11 @@
               return null;
           }
   
  -        final Version version = buildVersion( block.getChild( "version" ).getValue() );
           final String name = block.getChild( "name" ).getValue( null );
  -
  -        String schemaType;
  -        if( flag )
  -        {
  -             schemaType = getSchemaAttribute( block.getChild( "attributes" ) );
  -        }
  -        else
  -        {
  -             schemaType = block.getChild( "schema-type" ).getValue( null );
  -        }
  +        final Version version = buildVersion( block.getChild( "version" ).getValue() );
  +        final String schemaType = block.getChild( "schema-type" ).getValue( null );
   
           return new BlockDescriptor( name, classname, schemaType, version );
  -    }
  -
  -    /**
  -     * A utility method to get a schema attribute from a configuration.
  -     *
  -     * @param config a configuration representing an Attributes element
  -     * @return the schema name (possible null if undefined)
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private String getSchemaAttribute( Configuration config ) throws ConfigurationException
  -    {
  -        final Configuration[] attributes = config.getChildren( "attribute" );
  -
  -        for( int i = 0; i < attributes.length; i++ )
  -        {
  -            final Configuration attribute = attributes[i];
  -
  -            if( attribute.getAttribute( "key" ).equals( "phoenix:schema-type" ) )
  -            {
  -                return attribute.getAttribute( "value" );
  -            }
  -        }
  -
  -        return null;
       }
   
       /**
  
  
  
  1.5       +0 -2      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/infobuilder/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/infobuilder/Resources.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resources.properties	16 Aug 2002 13:37:31 -0000	1.4
  +++ Resources.properties	17 Aug 2002 02:34:44 -0000	1.5
  @@ -1,5 +1,3 @@
  -unsupported.stages=Blocks declaring stage dependecies are not supported. Class: {0}
  -unsupported.extensions=Blocks declaring extension dependecies are not supported. Class:
{0}
   blockinfo-created=Constructed BlockInfo object for class {0}. BlockInfo contains {1} services
and {2} dependencies.
   missing-block=Warning: Unspecified <block/> section in BlockInfo for class {0}.
   redundent-role=Warning: BlockInfo for class {0} redundently specifies role name "{1}" in
dependency when it is identical to the name of service. It is recomended that the <role/>
section be elided.
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message