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-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder LegacyBlockInfoCreator.java
Date Fri, 04 Oct 2002 06:11:58 GMT
donaldp     2002/10/03 23:11:58

  Modified:    info/src/java/org/apache/avalon/framework/tools/infobuilder
                        LegacyBlockInfoCreator.java
  Log:
  Fix up some bugs and make it so that version attributes are only added to services if they
are explicitly declared
  
  Revision  Changes    Path
  1.6       +16 -14    jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoCreator.java
  
  Index: LegacyBlockInfoCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoCreator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LegacyBlockInfoCreator.java	2 Oct 2002 01:47:01 -0000	1.5
  +++ LegacyBlockInfoCreator.java	4 Oct 2002 06:11:58 -0000	1.6
  @@ -116,8 +116,7 @@
               buildComponentDescriptor( classname, configuration );
           final String implementationKey = descriptor.getImplementationKey();
   
  -        configuration = info.getChild( "services" );
  -        final ServiceDescriptor[] services = buildServices( configuration );
  +        final ServiceDescriptor[] services = buildServices( info );
   
           configuration = info.getChild( "dependencies" );
           final DependencyDescriptor[] dependencies =
  @@ -225,23 +224,22 @@
        * A utility method to build an array of {@link ServiceDescriptor}
        * objects from specified configuraiton.
        *
  -     * @param servicesSet the services configuration
  +     * @param info the services configuration
        * @return the created ServiceDescriptor
        * @throws ConfigurationException if an error occurs
        */
  -    private ServiceDescriptor[] buildServices( final Configuration servicesSet )
  +    private ServiceDescriptor[] buildServices( final Configuration info )
           throws ConfigurationException
       {
           final ArrayList services = new ArrayList();
   
  -        Configuration[] elements = servicesSet.getChildren( "service" );
  +        Configuration[] elements = info.getChild( "services" ).getChildren( "service" );
           for( int i = 0; i < elements.length; i++ )
           {
               final ServiceDescriptor service = buildService( elements[ i ], false );
               services.add( service );
           }
  -
  -        elements = servicesSet.getChildren( "management-access-points" );
  +        elements = info.getChild( "management-access-points" ).getChildren( "service" );
           for( int i = 0; i < elements.length; i++ )
           {
               final ServiceDescriptor service = buildService( elements[ i ], true );
  @@ -264,11 +262,16 @@
           throws ConfigurationException
       {
           final String implementationKey = service.getAttribute( "name" );
  -        final String version = service.getAttribute( "version", "1.0.0" );
  +        final String version = service.getAttribute( "version", null );
   
           final ArrayList attributeSet = new ArrayList();
  -        final Attribute attribute = createSimpleAttribute( "avalon", "version", version
);
  -        attributeSet.add( attribute );
  +        if( null != version )
  +        {
  +            final Attribute attribute =
  +                createSimpleAttribute( "avalon", "version", version );
  +            attributeSet.add( attribute );
  +        }
  +
           if( isManagement )
           {
               final Attribute mxAttribute =
  @@ -292,9 +295,8 @@
                                                             final Configuration config )
           throws ConfigurationException
       {
  -        final String name = config.getChild( "name" ).getValue( null );
           final String version = config.getChild( "version" ).getValue();
  -        final String schemaType = config.getChild( "schema-type" ).getValue();
  +        final String schemaType = config.getChild( "schema-type" ).getValue( null );
   
           final ArrayList attributeSet = new ArrayList();
           final Attribute attribute = createSimpleAttribute( "avalon", "version", version
);
  @@ -307,7 +309,7 @@
           }
   
           final Attribute[] attributes = (Attribute[])attributeSet.toArray( new Attribute[
attributeSet.size() ] );
  -        return new ComponentDescriptor( name, classname, attributes );
  +        return new ComponentDescriptor( classname, attributes );
       }
   
       /**
  
  
  

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