donaldp 2002/09/07 22:21:46
Modified: info/src/java/org/apache/avalon/framework/tools/infobuilder
XMLInfoCreator.java
Log:
The attributes of xml are the
* most salient
* uniquely identifiying
of information.
This essentially means that almost all data derived from content is removed.
Revision Changes Path
1.5 +15 -17
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java
Index: XMLInfoCreator.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLInfoCreator.java 8 Sep 2002 04:44:36 -0000 1.4
+++ XMLInfoCreator.java 8 Sep 2002 05:21:46 -0000 1.5
@@ -90,6 +90,9 @@
}
Configuration configuration = null;
+ configuration = info.getChild( "component" );
+ final ComponentDescriptor descriptor = buildComponentDescriptor(
configuration );
+ final String implementationKey = descriptor.getImplementationKey();
configuration = info.getChild( "loggers" );
final LoggerDescriptor[] loggers = buildLoggers( configuration );
@@ -101,17 +104,14 @@
final ServiceDescriptor[] services = buildServices( configuration );
configuration = info.getChild( "dependencies" );
- final DependencyDescriptor[] dependencies = buildDependencies( classname,
configuration );
-
- configuration = info.getChild( "component" );
- final ComponentDescriptor descriptor =
- buildComponentDescriptor( classname, configuration );
+ final DependencyDescriptor[] dependencies =
+ buildDependencies( implementationKey, configuration );
if( getLogger().isDebugEnabled() )
{
final String message =
REZ.getString( "builder.created-info.notice",
- classname,
+ implementationKey,
new Integer( services.length ),
new Integer( dependencies.length ),
new Integer( context.getEntrys().length ),
@@ -201,14 +201,14 @@
throws ConfigurationException
{
final String implementationKey =
- dependency.getChild( "service-ref" ).getAttribute( "type" );
+ dependency.getAttribute( "type" );
final boolean optional =
dependency.getAttributeAsBoolean( "optional", false );
final Properties attributes =
buildAttributes( dependency.getChild( "attributes" ) );
- String key = dependency.getChild( "key" ).getValue( null );
+ String key = dependency.getAttribute( "key", null );
//default to name of service if key unspecified
if( null == key )
@@ -330,8 +330,7 @@
private ServiceDescriptor buildService( final Configuration service )
throws ConfigurationException
{
- final Configuration serviceRef = service.getChild( "service-ref" );
- final String implementationKey = serviceRef.getAttribute( "type" );
+ final String implementationKey = service.getAttribute( "type" );
final Properties attributes =
buildAttributes( service.getChild( "attributes" ) );
return new ServiceDescriptor( implementationKey, attributes );
@@ -366,19 +365,18 @@
* A utility method to build a {@link ComponentDescriptor}
* object from specified configuraiton data and classname.
*
- * @param classname The classname of Component (used to create descriptor)
* @param component the Component Configuration
* @return the created ComponentDescriptor
* @throws ConfigurationException if an error occurs
*/
- private ComponentDescriptor buildComponentDescriptor( final String classname,
- final Configuration
component )
+ private ComponentDescriptor buildComponentDescriptor( final Configuration
component )
throws ConfigurationException
{
- final String name = component.getChild( "name" ).getValue( null );
- final Properties attributes =
+ final String name = component.getAttribute( "name", null );
+ final String type = component.getAttribute( "type" );
+ final Properties attributes =
buildAttributes( component.getChild( "attributes" ) );
- return new ComponentDescriptor( name, classname, attributes );
+ return new ComponentDescriptor( name, type, attributes );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>