mcconnell 2003/06/14 04:13:54
Modified: merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
XMLContainerCreator.java
Log:
Updated to enable the declaration of a container name as part of an import directive.
Revision Changes Path
1.3 +17 -16
avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/XMLContainerCreator.java
Index: XMLContainerCreator.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/XMLContainerCreator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLContainerCreator.java 12 Jun 2003 18:56:19 -0000 1.2
+++ XMLContainerCreator.java 14 Jun 2003 11:13:54 -0000 1.3
@@ -134,16 +134,16 @@
* Create a [EMAIL PROTECTED] ContainmentProfile} instances from
* the supplied parameters
*
- * @param url the base url
+ * @param url the base url against which relative urls will be resolved
* @param engine the classloader
* @param type the component type
* @param services virtual service provided by the block
* @param dependencies virtual block dependencies
- * @param config the block implementation profile
+ * @param config the block implementation directive
* @param targets the block override targets
* @param name the block name
- * @return the profile
- * @exception Exception if an error occurs during descriptor creation
+ * @return the containment profile
+ * @exception Exception if an error occurs during creation of the directive
*/
public ContainmentProfile createContainmentProfile(
final URL url,
@@ -278,7 +278,7 @@
/**
* Creation of a containment directive from an <include> directive.
*
- * @param base the base url
+ * @param base the base url from which relative urls will be resolved
* @param parent the parent classloader
* @param config the include directive
* @param targets the parent container targets
@@ -314,7 +314,14 @@
throw new IllegalArgumentException( error );
}
- final String name =
block.getChild("info").getChild("name").getValue("block");
+ //
+ // get the name to assign to the block from the include using
+ // the block name as the default value
+ //
+
+ final String name = config.getAttribute(
+ "name", block.getChild("info").getChild("name").getValue("block") );
+
Targets candidates = targets.getTargets( name );
final String configPath = config.getAttribute( "config", null );
@@ -330,7 +337,7 @@
newTargets = candidates;
}
- return createBlockProfile( base, source, parent, block, newTargets );
+ return createBlockProfile( name, base, source, parent, block,
newTargets );
}
catch( Throwable ce )
{
@@ -344,6 +351,7 @@
/**
* Create of a containment profile based on a supplied <block> directive.
*
+ * @param name the assigned block name
* @param base the base url
* @param parent the parent classloader
* @param config the block configuration
@@ -352,16 +360,10 @@
* @exception ContainerException if a profile creation error occurs
*/
private ContainmentProfile createBlockProfile(
- URL base, URL source, EngineClassLoader parent, Configuration config, Targets
targets )
+ String name, URL base, URL source, EngineClassLoader parent, Configuration
config, Targets targets )
throws ContainerException
{
//
- // get the block name
- //
-
- final String name =
config.getChild("info").getChild("name").getValue("block");
-
- //
// get the block implementation
//
@@ -965,5 +967,4 @@
}
}
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]