donaldp 2002/11/15 14:41:26 Modified: info/src/java/org/apache/avalon/framework/tools/infobuilder LegacyBlockInfoReader.java info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data component3-info.xml Removed: info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data service1-info.xml Log: Bring legacy descriptor support more into line with new schema element changes. Revision Changes Path 1.4 +24 -10 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoReader.java Index: LegacyBlockInfoReader.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoReader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LegacyBlockInfoReader.java 15 Nov 2002 22:31:14 -0000 1.3 +++ LegacyBlockInfoReader.java 15 Nov 2002 22:41:26 -0000 1.4 @@ -114,15 +114,37 @@ getLogger().debug( message ); } + configuration = info.getChild( "block" ); + final SchemaDescriptor schema = buildSchema( configuration ); + return new ComponentInfo( descriptor, services, new LoggerDescriptor[ 0 ], buildPhoenixContext(), - new SchemaDescriptor( "", "", "", new Attribute[ 0 ] ), + schema, dependencies ); } /** + * A utility method to build a descriptor for SchemaDescriptor, + * + * @return the a descriptor for the SchemaDescriptor, + */ + private SchemaDescriptor buildSchema( Configuration configuration ) + { + String category = ""; + String schemaType = + configuration.getChild( "schema-type" ).getValue( "" ); + if( !"".equals( schemaType ) ) + { + //TODO: Map phoenix type to uri space when figured out + category = "configuration"; + } + + return new SchemaDescriptor( category, "", schemaType, new Attribute[ 0 ] ); + } + + /** * A utility method to build a descriptor for Phoenixs BlockContext * object, * @@ -279,17 +301,9 @@ throws ConfigurationException { final String version = config.getChild( "version" ).getValue(); - final String schemaType = config.getChild( "schema-type" ).getValue( null ); - final ArrayList attributeSet = new ArrayList(); final Attribute attribute = createSimpleAttribute( "avalon", "version", version ); attributeSet.add( attribute ); - if( null != schemaType ) - { - final Attribute schemaAttribute = - createSimpleAttribute( "phoenix", "schema-type", schemaType ); - attributeSet.add( schemaAttribute ); - } final Attribute[] attributes = (Attribute[])attributeSet.toArray( new Attribute[ attributeSet.size() ] ); return new ComponentDescriptor( classname, attributes ); 1.2 +2 -3 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component3-info.xml Index: component3-info.xml =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component3-info.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- component3-info.xml 4 Oct 2002 06:10:35 -0000 1.1 +++ component3-info.xml 15 Nov 2002 22:41:26 -0000 1.2 @@ -10,9 +10,6 @@ <attribute name="avalon"> <param name="version" value="1.0"/> </attribute> - <attribute name="phoenix"> - <param name="schema-type" value="rlng"/> - </attribute> </component> <context type="org.apache.avalon.phoenix.BlockContext"/> @@ -29,5 +26,7 @@ <dependencies> <dependency type="org.apache.avalon.cornerstone.services.threads.ThreadManager"/> </dependencies> + + <schema category="configuration" type="rlng"/> </component-info>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>