mcconnell 2002/09/10 23:51:22
Modified: meta/src/java/org/apache/excalibur/meta
ConfigurationBuilder.java type.dtd
meta/src/java/org/apache/excalibur/meta/info/builder
XMLTypeCreator.java
Log:
Updated to provide enhanced attribute management (attribute values may be declare
either as a string in value="xxx" or as part of the body as in <attribute
key="my-key">Xxxx</attribute>. Also dropped support for containerkit DTD given recent
changes on the API and reluctance to maintain support until such time that a common
framework level meta-info DTD is established.
Revision Changes Path
1.4 +1 -4
jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/ConfigurationBuilder.java
Index: ConfigurationBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/ConfigurationBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConfigurationBuilder.java 7 Sep 2002 01:19:23 -0000 1.3
+++ ConfigurationBuilder.java 11 Sep 2002 06:51:22 -0000 1.4
@@ -34,9 +34,6 @@
new DTDInfo( "-//AVALON/Component Type DTD Version 1.1//EN",
"http://jakarta.apache.org/avalon/dtds/type_1_1.dtd",
"org/apache/excalibur/meta/type.dtd" ),
- new DTDInfo( "-//AVALON/Component Info DTD Version 1.0//EN",
- "http://jakarta.apache.org/avalon/dtds/componentinfo_1_0.dtd",
- "org/apache/excalibur/meta/componentinfo.dtd" ),
new DTDInfo( "-//PHOENIX/Block Info DTD Version 1.0//EN",
"http://jakarta.apache.org/avalon/dtds/phoenix/blockinfo_1.0.dtd",
"org/apache/excalibur/meta/blockinfo.dtd" ),
1.2 +2 -2
jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/type.dtd
Index: type.dtd
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/type.dtd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- type.dtd 20 Aug 2002 16:06:45 -0000 1.1
+++ type.dtd 11 Sep 2002 06:51:22 -0000 1.2
@@ -78,7 +78,7 @@
reference the reference to service.
attributes Optional attributes about service
-->
-<!ENTITY % ref "(service-ref|reference)">
+<!ENTITY % ref "(reference)">
<!ELEMENT service (%ref;,attributes?) >
<!--
@@ -186,7 +186,7 @@
key the key for attribute.
value the value of attribute.
-->
-<!ELEMENT attribute EMPTY >
+<!ELEMENT attribute (#PCDATA) >
<!ATTLIST attribute
key CDATA #REQUIRED
value CDATA #REQUIRED
1.3 +13 -18
jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java
Index: XMLTypeCreator.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLTypeCreator.java 21 Aug 2002 03:34:32 -0000 1.2
+++ XMLTypeCreator.java 11 Sep 2002 06:51:22 -0000 1.3
@@ -93,14 +93,11 @@
final String topLevelName = info.getName();
if( !topLevelName.equals( "type" ) )
{
- if( !topLevelName.equals( "component-info" ) )
- {
- final String message =
- REZ.getString( "builder.bad-toplevel-element.error",
+ final String message =
+ REZ.getString( "builder.bad-toplevel-element.error",
classname,
topLevelName );
- throw new ConfigurationException( message );
- }
+ throw new ConfigurationException( message );
}
Configuration configuration = null;
@@ -266,11 +263,7 @@
// try both merlin and containerkit variants for this attribute
//
- Configuration serviceRef = dependency.getChild( "service-ref", false );
- if( serviceRef == null )
- {
- serviceRef = dependency.getChild( "reference" );
- }
+ Configuration serviceRef = serviceRef = dependency.getChild( "reference" );
final ReferenceDescriptor service =
buildReferenceDescriptor( serviceRef );
final boolean optional =
@@ -280,6 +273,7 @@
String role = dependency.getChild( "role" ).getValue( null );
//default to name of service if role unspecified
+
if( null == role )
{
role = service.getClassname();
@@ -288,6 +282,7 @@
{
//If role is specified and it is the same as
//service name then warn that it is redundent.
+
if( role.equals( service.getClassname() ) )
{
final String message =
@@ -399,11 +394,7 @@
protected ServiceDescriptor buildService( final Configuration service )
throws ConfigurationException
{
- Configuration serviceRef = service.getChild( "service-ref", false );
- if( serviceRef == null )
- {
- serviceRef = service.getChild( "reference" );
- }
+ Configuration serviceRef = service.getChild( "reference" );
final ReferenceDescriptor designator = buildReferenceDescriptor( serviceRef
);
final Properties attributes =
buildAttributes( service.getChild( "attributes" ) );
@@ -426,7 +417,11 @@
{
Configuration child = children[ i ];
final String key = child.getAttribute( "key" );
- final String value = child.getAttribute( "value" );
+ String value = child.getAttribute( "value", null );
+ if( value == null )
+ {
+ value = child.getValue();
+ }
attributes.setProperty( key, value );
}
return attributes;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>