You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/06/04 04:02:55 UTC
cvs commit: avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder XMLTypeWriter.java
mcconnell 2003/06/03 19:02:55
Modified: merlin/merlin-smp/xdocs/tools/tags extension.xml stage.xml
merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder
XMLTypeWriter.java
Log:
Updates to meta-tools documentation from David Bernard and commmitted TypeWriter changes to support extension and stage handling.
Revision Changes Path
1.2 +3 -3 avalon-sandbox/merlin/merlin-smp/xdocs/tools/tags/extension.xml
Index: extension.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/tools/tags/extension.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- extension.xml 5 Apr 2003 09:04:16 -0000 1.1
+++ extension.xml 4 Jun 2003 02:02:54 -0000 1.2
@@ -22,7 +22,7 @@
*
* @avalon.meta.version 0.1
* @avalon.meta.name handler
- * @avalon.meta.extension type="org.apache.avalon.plyground.Demonstratable";
+ * @avalon.meta.extension type="org.apache.avalon.plyground.Demonstratable"
*/
public class DemoExtension
{
@@ -40,7 +40,7 @@
</info>
<extensions>
<extension type="org.apache.avalon.plyground.Demonstratable:1.0.0"/>
- </services>
+ </extensions>
</type>
]]></source>
1.3 +3 -3 avalon-sandbox/merlin/merlin-smp/xdocs/tools/tags/stage.xml
Index: stage.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/tools/tags/stage.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- stage.xml 7 Apr 2003 08:49:52 -0000 1.2
+++ stage.xml 4 Jun 2003 02:02:54 -0000 1.3
@@ -23,7 +23,7 @@
*
* @avalon.meta.version 0.1
* @avalon.meta.name extended-component
- * @avalon.meta.stage type="org.apache.avalon.playground.Demonstratable";
+ * @avalon.meta.stage type="org.apache.avalon.playground.Demonstratable"
*/
public class DemoComponent implements Demonstratable
{
@@ -41,7 +41,7 @@
</info>
<stages>
<stage type="org.apache.avalon.plyground.Demonstratable:1.0.0"/>
- </services>
+ </stages>
</type>
]]></source>
1.5 +83 -1 avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/XMLTypeWriter.java
Index: XMLTypeWriter.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/XMLTypeWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLTypeWriter.java 8 May 2003 03:02:40 -0000 1.4
+++ XMLTypeWriter.java 4 Jun 2003 02:02:54 -0000 1.5
@@ -61,6 +61,8 @@
import org.apache.avalon.meta.info.InfoDescriptor;
import org.apache.avalon.meta.info.LoggerDescriptor;
import org.apache.avalon.meta.info.ServiceDescriptor;
+import org.apache.avalon.meta.info.StageDescriptor;
+import org.apache.avalon.meta.info.ExtensionDescriptor;
import org.apache.avalon.meta.info.Type;
/**
@@ -97,6 +99,8 @@
writeContext( writer, type.getContext() );
writeServices( writer, type.getServices() );
writeDependencies( writer, type.getDependencies() );
+ writeStages( writer, type.getStages() );
+ writeExtensions( writer, type.getExtensions() );
writer.write( "\n</type>" );
writer.flush();
}
@@ -412,5 +416,83 @@
writer.write( "\" value=\"" );
writer.write( value );
writer.write( "\"/>" );
+ }
+
+ /**
+ * Write out xml representation of a set of stages.
+ *
+ * @param writer the writer
+ * @param stages the stages
+ * @throws IOException if unable to write xml
+ */
+ private void writeStages( final Writer writer,
+ final StageDescriptor[] stages )
+ throws IOException
+ {
+ if( 0 == stages.length )
+ {
+ return;
+ }
+
+ writer.write( "\n <stages>" );
+ for( int i = 0; i < stages.length; i++ )
+ {
+ final StageDescriptor stage = stages[ i ];
+ writer.write( "\n <stage " );
+ writer.write( "type=\"" );
+ writer.write( stage.getReference().toString() );
+
+ final int count = stage.getAttributeNames().length;
+ if( 0 == count )
+ {
+ writer.write( "\"/>" );
+ }
+ else
+ {
+ writer.write( "\">" );
+ writeAttributes( writer, stage );
+ writer.write( "\n </stage>" );
+ }
+ }
+ writer.write( "\n </stages>" );
+ }
+
+ /**
+ * Write out xml representation of a set of extensions.
+ *
+ * @param writer the writer
+ * @param extensions the extensions
+ * @throws IOException if unable to write xml
+ */
+ private void writeExtensions( final Writer writer,
+ final ExtensionDescriptor[] extensions )
+ throws IOException
+ {
+ if( 0 == extensions.length )
+ {
+ return;
+ }
+
+ writer.write( "\n <extensions>" );
+ for( int i = 0; i < extensions.length; i++ )
+ {
+ final ExtensionDescriptor extension = extensions[ i ];
+ writer.write( "\n <extension " );
+ writer.write( "type=\"" );
+ writer.write( extension.getReference().toString() );
+
+ final int count = extension.getAttributeNames().length;
+ if( 0 == count )
+ {
+ writer.write( "\"/>" );
+ }
+ else
+ {
+ writer.write( "\">" );
+ writeAttributes( writer, extension );
+ writer.write( "\n </extension>" );
+ }
+ }
+ writer.write( "\n </extensions>" );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org