mcconnell 2003/07/26 04:10:12
Modified: meta/impl/src/java/org/apache/avalon/meta/info/builder
XMLTypeCreator.java
meta/impl/src/java/org/apache/avalon/meta/info/writer
XMLTypeWriter.java
meta/site/xdocs/tools/tags extension.xml stage.xml
meta/tools/src/java/org/apache/avalon/meta/info/ant
MetaTask.java
meta/tools/src/java/org/apache/avalon/meta/info/builder/tags
ExtensionTag.java StageTag.java
Log:
Improving documentation and adding additional legacy support to tag handlers
builders ad writers.
Revision Changes Path
1.9 +12 -11
avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java
Index: XMLTypeCreator.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLTypeCreator.java 24 Jul 2003 12:12:01 -0000 1.8
+++ XMLTypeCreator.java 26 Jul 2003 11:10:11 -0000 1.9
@@ -205,7 +205,7 @@
protected StageDescriptor buildPhase( Configuration config )
throws ConfigurationException
{
- if( config.getAttribute( "type", null ) != null )
+ if( config.getAttribute( "type", null ) != null ) // legacy
{
//
// legacy case
@@ -218,7 +218,8 @@
}
else
{
- String key = config.getAttribute( "key" );
+ String key = config.getAttribute( "key", null ); //legacy
+ if( key == null) config.getAttribute( "id" );
final Properties attributes =
buildAttributes( config.getChild( "attributes" ) );
return new StageDescriptor( key, attributes );
@@ -343,7 +344,7 @@
protected DependencyDescriptor buildDependency( final Configuration dependency )
throws ConfigurationException
{
- String role = dependency.getAttribute( "role", null );
+ String role = dependency.getAttribute( "role", null ); // legacy
if( role == null )
{
role = dependency.getAttribute( "key", null );
@@ -510,12 +511,8 @@
protected ExtensionDescriptor buildExtension( Configuration config )
throws ConfigurationException
{
- if( config.getAttribute( "type", null ) != null )
+ if( config.getAttribute( "type", null ) != null ) // legacy
{
- //
- // legacy case
- //
-
String urn = config.getAttribute( "type" );
final Properties attributes =
buildAttributes( config.getChild( "attributes" ) );
@@ -523,10 +520,14 @@
}
else
{
- String urn = config.getAttribute( "urn" );
+ String id = config.getAttribute( "urn", null ); // legacy
+ if( id == null )
+ {
+ id = config.getAttribute( "id" );
+ }
final Properties attributes =
buildAttributes( config.getChild( "attributes" ) );
- return new ExtensionDescriptor( urn, attributes );
+ return new ExtensionDescriptor( id, attributes );
}
}
1.11 +3 -3
avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java
Index: XMLTypeWriter.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLTypeWriter.java 24 Jul 2003 12:12:01 -0000 1.10
+++ XMLTypeWriter.java 26 Jul 2003 11:10:11 -0000 1.11
@@ -463,7 +463,7 @@
{
final StageDescriptor stage = stages[ i ];
writer.write( "\n <stage " );
- writer.write( "urn=\"" );
+ writer.write( "id=\"" );
writer.write( stage.getKey() );
final int count = stage.getAttributeNames().length;
@@ -503,7 +503,7 @@
final ExtensionDescriptor extension = extensions[ i ];
writer.write( "\n <extension " );
- writer.write( "key=\"" );
+ writer.write( "id=\"" );
writer.write( extension.getKey() );
final int count = extension.getAttributeNames().length;
1.5 +3 -3 avalon-sandbox/meta/site/xdocs/tools/tags/extension.xml
Index: extension.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/meta/site/xdocs/tools/tags/extension.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- extension.xml 26 Jul 2003 07:52:53 -0000 1.4
+++ extension.xml 26 Jul 2003 11:10:11 -0000 1.5
@@ -19,7 +19,7 @@
<table>
<tr><th>Attribute</th><th>Required</th><th>Description</th></tr>
<tr>
- <td><p>urn</p></td><td><p>yes</p></td>
+ <td><p>id</p></td><td><p>yes</p></td>
<td>
<p>A value (normally a urn) that identifies the extension.</p>
</td>
@@ -54,7 +54,7 @@
<name>handler</name>
</info>
<extensions>
- <extension type="urn:somewhere:demonstratable"/>
+ <extension id="urn:somewhere:demonstratable"/>
</extensions>
</type>
]]></source>
1.5 +5 -5 avalon-sandbox/meta/site/xdocs/tools/tags/stage.xml
Index: stage.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/meta/site/xdocs/tools/tags/stage.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- stage.xml 26 Jul 2003 07:52:53 -0000 1.4
+++ stage.xml 26 Jul 2003 11:10:11 -0000 1.5
@@ -11,16 +11,16 @@
<section name="Introduction">
<subsection name="Stage Tag">
-<p>A component type may declare a dependency on an arbitary number of lifecycle
stages. Each stage corresponds to a lifecycle extension that will be applied to the
component in the order corresponding to the ordering of stage tags. A container is
responsible for the construction and deployment of an extension stage handler (refered
to as an extension) capable of servicing the stage dependency.</p>
+<p>A component type may declare a dependency on an arbitary number of lifecycle
stages. Each stage corresponds to a lifecycle extension that will be applied to the
component in the order corresponding to the ordering of stage tags. A container is
responsible for the construction and deployment of an extension stage handler capable
of servicing the stage dependency.</p>
</subsection>
<subsection name="Attributes">
<table>
<tr><th>Attribute</th><th>Required</th><th>Description</th></tr>
<tr>
- <td><p>urn</p></td><td><p>yes</p></td>
+ <td><p>id</p></td><td><p>yes</p></td>
<td>
- <p>A value (normally a urn) that identifies an entension
+ <p>A value that identifies an entension
to be applied to the component during deployment.</p>
</td>
</tr>
@@ -55,7 +55,7 @@
<name>extended-component</name>
</info>
<stages>
- <stage type="urn:somewhere:demonstratable"/>
+ <stage id="urn:somewhere:demonstratable"/>
</stages>
</type>
]]></source>
1.8 +1 -2
avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/ant/MetaTask.java
Index: MetaTask.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/ant/MetaTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MetaTask.java 24 Jul 2003 12:17:58 -0000 1.7
+++ MetaTask.java 26 Jul 2003 11:10:11 -0000 1.8
@@ -63,7 +63,6 @@
import org.apache.avalon.meta.info.writer.XMLServiceWriter;
import org.apache.avalon.meta.info.writer.XMLTypeWriter;
import org.apache.avalon.meta.info.builder.tags.TypeTag;
-import org.apache.avalon.meta.info.builder.tags.legacy.FortressComponentTag;
import org.apache.avalon.meta.info.builder.tags.ServiceTag;
import org.apache.tools.ant.BuildException;
1.3 +28 -6
avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/ExtensionTag.java
Index: ExtensionTag.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/ExtensionTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExtensionTag.java 26 Jul 2003 07:52:53 -0000 1.2
+++ ExtensionTag.java 26 Jul 2003 11:10:11 -0000 1.3
@@ -73,7 +73,17 @@
/**
* The stage tag id parameter name.
*/
- public static final String ID_PARAM = "urn";
+ public static final String LEGACY_URN_PARAM = "urn";
+
+ /**
+ * The stage tag id parameter name.
+ */
+ public static final String LEGACY_KEY_PARAM = "key";
+
+ /**
+ * The stage tag id parameter name.
+ */
+ public static final String ID_PARAM = "id";
/**
* The extension tag constructor.
@@ -104,11 +114,23 @@
private ExtensionDescriptor getExtension( DocletTag tag )
{
String value = getNamedParameter( tag, TYPE_PARAM, null );
- if( value == null )
+ if( value != null )
+ {
+ final String type = resolveType( value );
+ return new ExtensionDescriptor( type );
+ }
+ else
{
- value = getNamedParameter( tag, ID_PARAM );
+ value = getNamedParameter( tag, LEGACY_KEY_PARAM, null );
+ if( value == null )
+ {
+ value = getNamedParameter( tag, LEGACY_URN_PARAM, null );
+ }
+ if( value == null )
+ {
+ value = getNamedParameter( tag, ID_PARAM );
+ }
+ return new ExtensionDescriptor( value );
}
- final String type = resolveType( value );
- return new ExtensionDescriptor( type );
}
}
1.3 +19 -6
avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/StageTag.java
Index: StageTag.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/StageTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StageTag.java 26 Jul 2003 07:52:53 -0000 1.2
+++ StageTag.java 26 Jul 2003 11:10:11 -0000 1.3
@@ -77,7 +77,12 @@
/**
* The stage tag id parameter name.
*/
- public static final String ID_PARAM = "urn";
+ public static final String LEGACY_URN_PARAM = "urn";
+
+ /**
+ * The stage tag id parameter name.
+ */
+ public static final String ID_PARAM = "id";
/**
* Stage tag constructor.
@@ -109,11 +114,19 @@
private StageDescriptor getStage( DocletTag tag )
{
String value = getNamedParameter( tag, TYPE_PARAM, null );
- if( value == null )
+ if( value != null )
+ {
+ final String type = resolveType( value );
+ return new StageDescriptor( type );
+ }
+ else
{
- value = getNamedParameter( tag, ID_PARAM );
+ value = getNamedParameter( tag, LEGACY_URN_PARAM, null );
+ if( value == null )
+ {
+ value = getNamedParameter( tag, ID_PARAM );
+ }
+ return new StageDescriptor( value );
}
- final String type = resolveType( value );
- return new StageDescriptor( type );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]