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/07 19:41:36 UTC
cvs commit: avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl DefaultContainmentModel.java Resources.properties
mcconnell 2003/10/07 10:41:36
Modified: merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java Resources.properties
Log:
Housekeeping.
Revision Changes Path
1.3 +47 -10 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultContainmentModel.java 4 Oct 2003 11:53:04 -0000 1.2
+++ DefaultContainmentModel.java 7 Oct 2003 17:41:36 -0000 1.3
@@ -291,14 +291,8 @@
}
else if( profile instanceof NamedDeploymentProfile )
{
- NamedDeploymentProfile holder = (NamedDeploymentProfile) profile;
- final String classname = holder.getClassname();
- final String key = holder.getKey();
- TypeRepository repository =
- m_context.getClassLoaderModel().getTypeRepository();
- Type type = repository.getType( classname );
- DeploymentProfile template = repository.getProfile( type, key );
- DeploymentProfile deployment = new DeploymentProfile( profile.getName(), template );
+ DeploymentProfile deployment =
+ createDeploymentProfile( (NamedDeploymentProfile) profile );
model = createDeploymentModel( deployment );
}
else if( profile instanceof BlockIncludeDirective )
@@ -954,7 +948,7 @@
/**
* Return the set of service export mappings
- * @return the block implementation model
+ * @return the set of export directives published by the model
*/
public ServiceDirective[] getExportDirectives()
{
@@ -963,6 +957,7 @@
/**
* Return the set of service export directives for a supplied class.
+ * @param clazz a cleaa identifying the directive
* @return the export directives
*/
public ServiceDirective getExportDirective( Class clazz )
@@ -974,16 +969,58 @@
// implementation
//==============================================================
+ /**
+ * Conver a classic url to a jar url. TIf the supplied url protocol is not
+ * the "jar" protocol, a ne url is created by prepending jar: and adding the
+ * trailing "!/".
+ * @param url the url to convert
+ * @return the converted url
+ * @exception MalformedURLException if something goes wrong
+ */
private URL convertToJarURL( URL url ) throws MalformedURLException
{
if( url.getProtocol().equals( "jar" ) ) return url;
return new URL( "jar:" + url.toString() + "!/" );
}
+ /**
+ * Return a simple string represention of the containment model.
+ * @return the string representation
+ */
public String toString()
{
return "[containment model: " + getQualifiedName() + "]";
}
-
+ /**
+ * Create a full deployment profile using a supplied named profile reference.
+ * @param profile the named profile reference directive
+ * @return the deployment profile
+ * @exception ModelException if an error occurs during profile creation
+ */
+ private DeploymentProfile createDeploymentProfile( NamedDeploymentProfile profile )
+ throws ModelException
+ {
+ try
+ {
+ NamedDeploymentProfile holder = (NamedDeploymentProfile) profile;
+ final String classname = holder.getClassname();
+ final String key = holder.getKey();
+ TypeRepository repository =
+ m_context.getClassLoaderModel().getTypeRepository();
+ Type type = repository.getType( classname );
+ DeploymentProfile template = repository.getProfile( type, key );
+ return new DeploymentProfile( profile.getName(), template );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ REZ.getString(
+ "containment.model.create.deployment.error",
+ profile.getKey(),
+ getPath(),
+ profile.getClassname() );
+ throw new ModelException( error, e );
+ }
+ }
}
1.2 +2 -0 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Resources.properties
Index: Resources.properties
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Resources.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resources.properties 24 Sep 2003 09:32:16 -0000 1.1
+++ Resources.properties 7 Oct 2003 17:41:36 -0000 1.2
@@ -24,6 +24,8 @@
containment.context.temp.not-a-directory.error=Supplied temp dir is not a directory: {0}
containment.add=installing: {0}
containment.model.create.error=Unexpected error while attempting to build a model within the containment context [{0}] for a dependency [{1}].
+containment.model.create.deployment.error=Unexpected error while attempting to build a deployment profile from the template [{0}] within the containment context [{1}] for a component type [{2}].
+
# DefaultDeploymentModel
# ======================
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org