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/07/27 13:50:05 UTC
cvs commit: avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/builder ProfilePackageCreator.java
mcconnell 2003/07/27 04:50:05
Modified: merlin/composition/src/java/org/apache/avalon/composition/data/builder
ProfilePackageBuilder.java
SerializedProfilePackageCreator.java
XMLContainmentProfileCreator.java
XMLDeploymentProfileCreator.java
XMLProfileCreator.java
XMLProfilePackageCreator.java
merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
DefaultTypeRepository.java
merlin/composition-spi/src/java/org/apache/avalon/composition/data/builder
ProfilePackageCreator.java
Log:
Improve name defaults for auto-generated deployment profiles.
Revision Changes Path
1.2 +13 -8 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/ProfilePackageBuilder.java
Index: ProfilePackageBuilder.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/ProfilePackageBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProfilePackageBuilder.java 17 Jul 2003 21:21:56 -0000 1.1
+++ ProfilePackageBuilder.java 27 Jul 2003 11:50:04 -0000 1.2
@@ -81,15 +81,16 @@
/**
* Create a {@link ProfilePackage} from a type.
*
- * @param type the compoent type meta-info descriptor
+ * @param name the component type name
+ * @param type the component type meta-info descriptor
* @param classloader the classloader
* @return the profile package
* @exception Exception if a error occurs during package creation
*/
- public ProfilePackage createProfilePackage( Class clazz )
+ public ProfilePackage createProfilePackage( String name, Class clazz )
throws Exception
{
- ProfilePackage profiles = m_serial.createProfilePackage( clazz );
+ ProfilePackage profiles = m_serial.createProfilePackage( name, clazz );
if( profiles != null )
{
return profiles;
@@ -104,12 +105,12 @@
if( stream == null )
{
DeploymentProfile profile =
- new DeploymentProfile( "default", classname );
+ new DeploymentProfile( name, classname );
return new ProfilePackage( new DeploymentProfile[]{ profile } );
}
else
{
- return buildFromXMLDescriptor( classname, stream );
+ return buildFromXMLDescriptor( name, classname, stream );
}
}
}
@@ -128,14 +129,18 @@
/**
* Build CompositionProfile from an XML descriptor.
*
+ * @param name the type name
+ * @param classname the type classname
+ * @param inputStream the input stream for the profile
* @throws Exception if an error occurs
*/
- private ProfilePackage buildFromXMLDescriptor( String classname, InputStream inputStream )
+ private ProfilePackage buildFromXMLDescriptor(
+ final String name, final String classname, InputStream inputStream )
throws Exception
{
final InputSource inputSource = new InputSource( inputStream );
Configuration config = ConfigurationBuilder.build( inputSource );
- return m_xml.createProfilePackage( classname, config );
+ return m_xml.createProfilePackage( name, classname, config );
}
}
1.2 +4 -3 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/SerializedProfilePackageCreator.java
Index: SerializedProfilePackageCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/SerializedProfilePackageCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SerializedProfilePackageCreator.java 17 Jul 2003 21:21:56 -0000 1.1
+++ SerializedProfilePackageCreator.java 27 Jul 2003 11:50:05 -0000 1.2
@@ -69,11 +69,12 @@
/**
* Create a {@link ProfilePackage} from a class.
*
- * @param clazz the component type class
+ * @param name the component profile name (ignored)
+ * @param clazz the component profile class
* @return the profile package
* @exception Exception if a error occurs during package creation
*/
- public ProfilePackage createProfilePackage( Class clazz )
+ public ProfilePackage createProfilePackage( String name, Class clazz )
throws Exception
{
final String classname = clazz.getName();
1.3 +2 -2 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
Index: XMLContainmentProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLContainmentProfileCreator.java 26 Jul 2003 16:27:14 -0000 1.2
+++ XMLContainmentProfileCreator.java 27 Jul 2003 11:50:05 -0000 1.3
@@ -114,7 +114,7 @@
// build the containment description
//
- final String name = getName( config );
+ final String name = getName( null, config, "untitled" );
DependencyDescriptor[] imports =
getDependencies( config.getChild( "dependencies", false ) );
ServiceDirective[] exports =
1.4 +5 -4 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java
Index: XMLDeploymentProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLDeploymentProfileCreator.java 25 Jul 2003 06:14:04 -0000 1.3
+++ XMLDeploymentProfileCreator.java 27 Jul 2003 11:50:05 -0000 1.4
@@ -77,7 +77,7 @@
throws Exception
{
String classname = config.getAttribute( "class", null );
- return createDeploymentProfile( classname, config );
+ return createDeploymentProfile( null, classname, config );
}
/**
@@ -86,10 +86,11 @@
* @param config the configuration
* @return the deployment profile
*/
- public DeploymentProfile createDeploymentProfile( String classname, Configuration config )
+ public DeploymentProfile createDeploymentProfile(
+ String base, String classname, Configuration config )
throws Exception
{
- final String name = getName( config );
+ final String name = getName( base, config, "untitled" );
return createDeploymentProfile( classname, config, name );
}
1.2 +12 -3 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java
Index: XMLProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLProfileCreator.java 17 Jul 2003 21:21:56 -0000 1.1
+++ XMLProfileCreator.java 27 Jul 2003 11:50:05 -0000 1.2
@@ -69,9 +69,18 @@
*
* @param config a configuration fragment describing the profile.
*/
- protected String getName( Configuration config )
+ protected String getName(
+ final String base, final Configuration config, final String defaultName )
{
- return config.getAttribute( "name", "untitled" );
+ final String name = config.getAttribute( "name", defaultName );
+ if( base == null )
+ {
+ return name;
+ }
+ else
+ {
+ return base + "-" + name;
+ }
}
/**
1.2 +4 -3 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfilePackageCreator.java
Index: XMLProfilePackageCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfilePackageCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLProfilePackageCreator.java 17 Jul 2003 21:21:56 -0000 1.1
+++ XMLProfilePackageCreator.java 27 Jul 2003 11:50:05 -0000 1.2
@@ -79,7 +79,8 @@
* @param config the configuration
* @return the profile package
*/
- public ProfilePackage createProfilePackage( String classname, Configuration config )
+ public ProfilePackage createProfilePackage(
+ final String base, String classname, Configuration config )
throws MetaDataException
{
ArrayList list = new ArrayList();
@@ -94,7 +95,7 @@
{
list.add(
DEPLOYMENT_CREATOR.createDeploymentProfile(
- classname, child ) );
+ base, classname, child ) );
}
catch( Throwable e )
{
1.17 +11 -3 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DefaultContainmentModel.java 27 Jul 2003 03:15:36 -0000 1.16
+++ DefaultContainmentModel.java 27 Jul 2003 11:50:05 -0000 1.17
@@ -418,10 +418,11 @@
//
// if an existing model exists return it
//
-
+System.out.println("1");
Model[] models = getModels();
ModelSelector modelSelector = new DefaultModelSelector();
Model model = modelSelector.select( models, dependency );
+System.out.println("2");
if( model != null ) return model;
//
@@ -429,18 +430,23 @@
// we could use to construct the model
//
+System.out.println("3");
TypeRepository repository =
m_context.getClassLoaderModel().getTypeRepository();
+System.out.println("4");
ArrayList list = new ArrayList();
try
{
Type[] types = repository.getTypes( dependency );
+System.out.println("5: " + types.length );
for( int i=0; i<types.length; i++ )
{
+System.out.println("5.1");
Profile[] profiles = repository.getProfiles( types[i] );
+System.out.println("5.2: " + profiles.length );
for( int j=0; j<profiles.length; j++ )
{
- list.add( profiles[i] );
+ list.add( profiles[j] );
}
}
@@ -452,9 +458,11 @@
// DependencyDirective instead of the descriptor.
//
+System.out.println("6");
Profile[] collection = (Profile[]) list.toArray( new Profile[0] );
ProfileSelector selector = new DefaultProfileSelector();
Profile profile = selector.select( collection, dependency );
+System.out.println("7: " + profile );
if( profile != null ) return addProfile( profile );
return null;
}
@@ -505,7 +513,7 @@
Profile[] profiles = repository.getProfiles( types[i] );
for( int j=0; j<profiles.length; j++ )
{
- list.add( profiles[i] );
+ list.add( profiles[j] );
}
}
1.12 +3 -2 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultTypeRepository.java
Index: DefaultTypeRepository.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultTypeRepository.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DefaultTypeRepository.java 27 Jul 2003 03:15:36 -0000 1.11
+++ DefaultTypeRepository.java 27 Jul 2003 11:50:05 -0000 1.12
@@ -169,11 +169,12 @@
while( iterator.hasNext() )
{
Type type = (Type) iterator.next();
+ final String name = type.getInfo().getName();
final String classname = type.getInfo().getClassname();
Class clazz = m_classloader.loadClass( classname );
ProfilePackage pack =
- PACKAGE_BUILDER.createProfilePackage( clazz );
+ PACKAGE_BUILDER.createProfilePackage( name, clazz );
m_profiles.put( classname, pack );
int n = pack.getDeploymentProfiles().length;
1.2 +2 -2 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/builder/ProfilePackageCreator.java
Index: ProfilePackageCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/builder/ProfilePackageCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProfilePackageCreator.java 17 Jul 2003 21:22:00 -0000 1.1
+++ ProfilePackageCreator.java 27 Jul 2003 11:50:05 -0000 1.2
@@ -70,7 +70,7 @@
* @return the profile package
* @exception Exception if a error occurs during package creation
*/
- ProfilePackage createProfilePackage( Class clazz )
+ ProfilePackage createProfilePackage( String name, Class clazz )
throws Exception;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org