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/10/19 16:05:54 UTC
cvs commit: avalon/meta/impl/src/java/org/apache/avalon/meta/info/writer XMLTypeWriter.java
mcconnell 2003/10/19 07:05:54
Modified: meta/api/src/java/org/apache/avalon/meta/info
InfoDescriptor.java
meta/api/src/test/org/apache/avalon/meta/info/test
InfoDescriptorTestCase.java TypeTestCase.java
meta/impl/src/java/org/apache/avalon/meta/info/builder
XMLLegacyCreator.java XMLTypeCreator.java
meta/impl/src/java/org/apache/avalon/meta/info/writer
XMLTypeWriter.java
Log:
Housekeeping.
Revision Changes Path
1.7 +7 -30 avalon/meta/api/src/java/org/apache/avalon/meta/info/InfoDescriptor.java
Index: InfoDescriptor.java
===================================================================
RCS file: /home/cvs/avalon/meta/api/src/java/org/apache/avalon/meta/info/InfoDescriptor.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InfoDescriptor.java 19 Oct 2003 10:29:57 -0000 1.6
+++ InfoDescriptor.java 19 Oct 2003 14:05:54 -0000 1.7
@@ -145,39 +145,16 @@
//-------------------------------------------------------------------
/**
- * Creation of a new component descriptor using a supplied name, key, version
- * and attribute set.
+ * Creation of a new component descriptor using a classname.
*
* @param classname the implemetation classname
* @exception IllegalArgumentException if the implementation key is not a classname
*/
- public InfoDescriptor( final String classname )
- throws IllegalArgumentException
- {
- this( null, classname, null, null, null, null );
- }
-
- /**
- * Creation of a new info descriptor using a supplied name, key, version
- * and attribute set.
- *
- * @param name the component name
- * @param classname the implemetation classname
- * @param version the implementation version
- * @param attributes a set of attributes associated with the component type
- * @exception IllegalArgumentException if the implementation key is not a classname
- * @since 1.1
- */
- public InfoDescriptor( final String name,
- final String classname,
- final Version version,
- final String lifestyle,
- final String schema,
- final Properties attributes )
- throws IllegalArgumentException
- {
- this( name, classname, version, lifestyle, null, schema, attributes );
- }
+ //public InfoDescriptor( final String classname )
+ // throws IllegalArgumentException
+ //{
+ // this( null, classname, null, null, null, null, null);
+ //}
/**
* Creation of a new info descriptor using a supplied name, key, version
1.2 +10 -8 avalon/meta/api/src/test/org/apache/avalon/meta/info/test/InfoDescriptorTestCase.java
Index: InfoDescriptorTestCase.java
===================================================================
RCS file: /home/cvs/avalon/meta/api/src/test/org/apache/avalon/meta/info/test/InfoDescriptorTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InfoDescriptorTestCase.java 24 Sep 2003 08:15:15 -0000 1.1
+++ InfoDescriptorTestCase.java 19 Oct 2003 14:05:54 -0000 1.2
@@ -65,6 +65,7 @@
private final String m_classname = InfoDescriptorTestCase.class.getName();
private final Version m_version = Version.getVersion("1.2.3");
private final String m_lifestyle = InfoDescriptor.SINGLETON;
+ private final String m_collection = InfoDescriptor.LIBERAL_KEY;
private final String m_schema = "schema";
public InfoDescriptorTestCase ( String name )
@@ -75,7 +76,7 @@
protected Descriptor getDescriptor()
{
return new InfoDescriptor(
- m_name, m_classname, m_version, m_lifestyle, m_schema, getProperties());
+ m_name, m_classname, m_version, m_lifestyle, m_collection, m_schema, getProperties());
}
protected void checkDescriptor( Descriptor desc )
@@ -86,6 +87,7 @@
assertEquals( m_classname, info.getClassname() );
assertEquals( m_version, info.getVersion() );
assertEquals( m_lifestyle, info.getLifestyle() );
+ assertEquals( InfoDescriptor.getCollectionPolicy( m_collection ), info.getCollectionPolicy() );
assertEquals( m_schema, info.getConfigurationSchema() );
}
@@ -94,7 +96,7 @@
try
{
new InfoDescriptor(
- m_name, null, m_version, m_lifestyle, m_schema, getProperties() );
+ m_name, null, m_version, m_lifestyle, m_collection, m_schema, getProperties() );
fail("Did not throw the proper NullPointerException");
}
catch (NullPointerException npe)
@@ -105,7 +107,7 @@
try
{
new InfoDescriptor(
- m_name, "foo/fake/ClassName", m_version, m_lifestyle,
+ m_name, "foo/fake/ClassName", m_version, m_lifestyle, m_collection,
m_schema, getProperties());
fail("Did not throw the proper IllegalArgumentException");
}
@@ -117,22 +119,22 @@
try
{
new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.POOLED,
+ m_name, m_classname, m_version, InfoDescriptor.POOLED, m_collection,
m_schema, getProperties() );
new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.SINGLETON,
+ m_name, m_classname, m_version, InfoDescriptor.SINGLETON, m_collection,
m_schema, getProperties() );
new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.THREAD,
+ m_name, m_classname, m_version, InfoDescriptor.THREAD, m_collection,
m_schema, getProperties() );
new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.TRANSIENT,
+ m_name, m_classname, m_version, InfoDescriptor.TRANSIENT, m_collection,
m_schema, getProperties() );
// All these should pass.
new InfoDescriptor(
- m_name, m_classname, m_version, "Fake Lifestyle",
+ m_name, m_classname, m_version, "Fake Lifestyle", m_collection,
m_schema, getProperties() );
fail( "Did not throw the proper IllegalArgumentException" );
1.2 +6 -1 avalon/meta/api/src/test/org/apache/avalon/meta/info/test/TypeTestCase.java
Index: TypeTestCase.java
===================================================================
RCS file: /home/cvs/avalon/meta/api/src/test/org/apache/avalon/meta/info/test/TypeTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TypeTestCase.java 24 Sep 2003 08:15:21 -0000 1.1
+++ TypeTestCase.java 19 Oct 2003 14:05:54 -0000 1.2
@@ -85,7 +85,7 @@
{
m_reference = new ReferenceDescriptor(TypeTestCase.class.getName());
m_key = TypeTestCase.class.getName();
- m_descriptor = new InfoDescriptor(TypeTestCase.class.getName());
+ m_descriptor = createSimpleInfo(TypeTestCase.class.getName());
m_loggers = new CategoryDescriptor[] {
new CategoryDescriptor("name", new Properties())
};
@@ -167,5 +167,10 @@
assertEquals( "equality", type, serialized );
assertEquals( "hashcode", type.hashCode(), serialized.hashCode() );
+ }
+
+ private static InfoDescriptor createSimpleInfo( String classname )
+ {
+ return new InfoDescriptor( null, classname, null, null, null, null, null);
}
}
1.2 +2 -2 avalon/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java
Index: XMLLegacyCreator.java
===================================================================
RCS file: /home/cvs/avalon/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLLegacyCreator.java 24 Sep 2003 08:15:30 -0000 1.1
+++ XMLLegacyCreator.java 19 Oct 2003 14:05:54 -0000 1.2
@@ -202,7 +202,7 @@
buildAttributes( info.getChild( "attributes" ) );
final String lifestyle = InfoDescriptor.SINGLETON;
return new InfoDescriptor(
- name, classname, version, lifestyle, schema, attributes );
+ name, classname, version, lifestyle, null, schema, attributes );
}
private ContextDescriptor buildPhoenixContext()
1.5 +2 -3 avalon/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java
Index: XMLTypeCreator.java
===================================================================
RCS file: /home/cvs/avalon/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLTypeCreator.java 19 Oct 2003 06:09:32 -0000 1.4
+++ XMLTypeCreator.java 19 Oct 2003 14:05:54 -0000 1.5
@@ -462,8 +462,7 @@
final String lifestyle =
buildLifestyle( info, attributes );
final String collection =
- info.getAttribute( "collection", null );
-
+ info.getChild( "lifestyle" ).getAttribute( "collection", null );
return new InfoDescriptor(
name, classname, version, lifestyle, collection, schema, attributes );
}
1.4 +3 -2 avalon/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java
Index: XMLTypeWriter.java
===================================================================
RCS file: /home/cvs/avalon/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLTypeWriter.java 19 Oct 2003 06:09:32 -0000 1.3
+++ XMLTypeWriter.java 19 Oct 2003 14:05:54 -0000 1.4
@@ -161,7 +161,8 @@
}
writer.write(
- "\n <lifestyle collection=\"" + info.getCollectionPolicy()
+ "\n <lifestyle collection=\""
+ + InfoDescriptor.getCollectionPolicyKey( info.getCollectionPolicy() )
+ "\">" );
writer.write( info.getLifestyle() );
writer.write( "</lifestyle>" );
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org