Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 4939 invoked from network); 4 Oct 2002 06:12:03 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 4 Oct 2002 06:12:03 -0000 Received: (qmail 15688 invoked by uid 97); 4 Oct 2002 06:12:56 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 15660 invoked by uid 97); 4 Oct 2002 06:12:56 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 15648 invoked by uid 97); 4 Oct 2002 06:12:55 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 4 Oct 2002 06:11:58 -0000 Message-ID: <20021004061158.4682.qmail@icarus.apache.org> From: donaldp@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder LegacyBlockInfoCreator.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: For additional commands, e-mail: