Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2189 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro automation/control/src/main/net/dpml/control composition/api/src/main/net/dpml/composition/data composition/api/src/test/net/dpml/composition/data/test composition/builder/src/main/net/dpml/composition/builder composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/spi/src/main/net/dpml/composition/provider composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/system composition/testing/system/src/test/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/test system/impl system/impl/etc/main system/impl/src/main/net/dpml/system/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2189 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro automation/control/src/main/net/dpml/control composition/api/src/main/net/dpml/composition/data composition/api/src/test/net/dpml/composition/data/test composition/builder/src/main/net/dpml/composition/builder composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/spi/src/main/net/dpml/composition/provider composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/system composition/testing/system/src/test/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/test system/impl system/impl/etc/main system/impl/src/main/net/dpml/system/impl
  • Date: Sat, 02 Apr 2005 04:34:06 -0500

Author: mcconnell AT dpml.net
Date: Sat Apr 2 04:34:03 2005
New Revision: 2189

Added:

development/main/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java

development/main/metro/composition/control/src/main/net/dpml/composition/models/

development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeGizmoTestCase.java
- copied, changed from r2187,
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeTestCase.java

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/ContainerTestCase.java
- copied, changed from r2187,
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/SimpleTestCase.java

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/WidgetTestCase.java
Removed:

development/main/metro/composition/control/src/main/net/dpml/composition/control/ModelPerspective.java

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeTestCase.java

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/SimpleTestCase.java
Modified:

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java

development/main/metro/automation/control/src/main/net/dpml/control/Controller.java

development/main/metro/automation/control/src/main/net/dpml/control/Model.java

development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java

development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
development/main/metro/composition/testing/acme/build.xml

development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
development/main/metro/composition/testing/system/build.xml

development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
development/main/metro/composition/testing/unit/build.xml
development/main/metro/index.xml
development/main/metro/module.xml
development/main/metro/system/impl/build.xml
development/main/metro/system/impl/etc/main/system.properties

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
Log:
Incorporate classloader handling into the DefaultComponentModel (needs to be
moved down to DeploymentModel as a next step) allowing for the loading of
component parts that are not declared within a container. Updates to the
component factory in the activation project with better handling of
invocation handlers. Removeal of support for custom context types from the
metro activation model. Addition of support for component name and partition
lookup (recognition of urn:metro:name and urn:metro:partition and symbol
substitution). Addition of more testcases and some enhancements to related
controller work.

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
Sat Apr 2 04:34:03 2005
@@ -29,6 +29,7 @@
import net.dpml.meta.info.EntryDescriptor;

import net.dpml.composition.model.EntryModel;
+import net.dpml.composition.model.ComponentModel;

/**
* This makes a dynamic proxy for an object. The object can be represented
@@ -56,6 +57,11 @@
private final Map m_entries = new Hashtable();

/**
+ * The component model.
+ */
+ private final ComponentModel m_model;
+
+ /**
* The component type.
*/
private final Type m_type;
@@ -70,32 +76,30 @@
* @param type the component type
* @param map a map of context values keyed by entry key
*/
- public ContextInvocationHandler( Type type, Map map )
+ public ContextInvocationHandler( ComponentModel model )
throws NullPointerException
{
- assertNotNull( map, "map" );
- assertNotNull( type, "type" );
+ assertNotNull( model, "model" );

- m_map = map;
- m_type = type;
+ m_model = model;
+ m_map = model.getContextModel().getEntryModelMap();
+ m_type = model.getType();

- EntryDescriptor[] entries = type.getContext().getEntries();
+ EntryDescriptor[] entries = m_type.getContext().getEntries();
for( int i=0; i<entries.length; i++ )
{
EntryDescriptor p = entries[i];
String key = p.getKey();
boolean required = p.isRequired();
m_entries.put( key, p );
- if( required && ( false == map.containsKey( key ) ) )
+ if( required && ( false == m_map.containsKey( key ) ) )
{
final String error =
"The component type ["
- + type.getInfo().getClassname()
+ + m_type.getInfo().getClassname()
+ "] declares a required context entry under the key ["
+ key
- + "] however, no corresponding value has been supplied
within the context map.";
-
-System.out.println( "## MAP: " + map );
+ + "] however no corresponding value has been supplied
within the context map.";
throw new IllegalArgumentException( error );
}
}
@@ -158,6 +162,29 @@
else
{
Object value = model.getValue();
+ if( value instanceof String )
+ {
+ String v = (String) value;
+ if( v.startsWith( "urn:metro:" ) )
+ {
+ if( "urn:metro:name".equals( v ) )
+ {
+ return m_model.getName();
+ }
+ else if( "urn:metro:partition".equals( v ) )
+ {
+ return m_model.getPath();
+ }
+ else
+ {
+ final String error =
+ "Context entry urn ["
+ + v
+ + "] not recognized.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ }
return value;
}
}

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
Sat Apr 2 04:34:03 2005
@@ -105,7 +105,6 @@
public DefaultComponentFactory( ComponentModel model )
{
m_model = model;
-
m_logger = model.getLogger().getChildLogger( "lifecycle" );
}

@@ -133,7 +132,7 @@

try
{
- Object instance = incarnation();
+ Object instance = handleIncarnate();
if( getLogger().isDebugEnabled() )
{
final String message =
@@ -215,20 +214,19 @@
* Creation of a new instance including all deployment stage handling.
* @return the new instance
*/
- private Object incarnation() throws LifecycleException
+ private Object handleIncarnate() throws LifecycleException
{
Class clazz = m_model.getDeploymentClass();
final Logger logger = m_model.getLogger();
final Configuration config = m_model.getConfiguration();
final Parameters params = m_model.getParameters();
- final Class managerInterfaceClass =
getTargetServiceManagerInterface();
- final Object manager = getTargetServiceManager(
managerInterfaceClass );
- final Object context = getTargetContext();
- final Class contextClass = getContextCastingClass();

final Object instance =
- instantiate(
- clazz, logger, config, params, context, contextClass,
managerInterfaceClass, manager );
+ instantiate( clazz, logger, config, params );
+
+ //
+ // LEGACY: check for lifecycle artifact delivery interfaces
+ //

try
{
@@ -237,25 +235,23 @@
getLogger().debug( "applying logger" );
ContainerUtil.enableLogging( instance, logger );
}
-
if( instance instanceof Contextualizable )
{
getLogger().debug( "applying context" );
- ContainerUtil.contextualize( instance, (Context) context );
+ Context context = createClassicContext();
+ ContainerUtil.contextualize( instance, context );
}
-
if( instance instanceof Serviceable )
{
getLogger().debug( "applying service manager" );
- ContainerUtil.service( instance, (ServiceManager) manager );
+ ServiceManager manager = createServiceManager();
+ ContainerUtil.service( instance, manager );
}
-
if( instance instanceof Configurable )
{
getLogger().debug( "applying configuration" );
ContainerUtil.configure( instance, config );
}
-
if( instance instanceof Parameterizable )
{
getLogger().debug( "applying parameters" );
@@ -272,6 +268,10 @@
ContainerUtil.initialize( instance );
}

+ //
+ // execution stuff
+ //
+
if( Startable.class.isAssignableFrom( clazz ) )
{
getLogger().debug( "applying startup" );
@@ -297,200 +297,30 @@
return instance;
}

- private Class getContextCastingClass()
- throws LifecycleException
- {
- String casting = m_model.getContextModel().getCastingClassname();
-
- if( null == casting )
- {
- return Context.class;
- }
- else
- {
- try
- {
- return
m_model.getDeploymentClass().getClassLoader().loadClass( casting );
- }
- catch( Throwable e )
- {
- final String error =
- "Could not load the custom context casting class ["
- + casting
- + "].";
- throw new LifecycleException( error, e );
- }
- }
- }
-
- private Class getTargetServiceManagerInterface()
- throws LifecycleException
- {
- Class subject = m_model.getDeploymentClass();
- Class[] classes = subject.getClasses();
- Class inner = locateClass( "$Dependencies", classes );
- if( null != inner )
- {
- return inner;
- }
- else
- {
- return ServiceManager.class;
- }
- }
-
- private Object getTargetServiceManager( Class clazz )
+ private ServiceManager createServiceManager()
throws LifecycleException
{
DependencyModel[] dependencies = m_model.getDependencyModels();
- if( clazz == ServiceManager.class )
- {
- Logger logger = m_model.getLogger();
- return new DefaultServiceManager( logger, dependencies );
- }
- else
- {
- Hashtable map = new Hashtable();
- for( int i=0; i<dependencies.length; i++ )
- {
- DependencyModel dep = dependencies[i];
- String key = dep.getDependency().getKey();
- map.put( key, dep );
- }
- Type type = m_model.getType();
- InvocationHandler handler = new DependencyInvocationHandler(
type, map );
-
- ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
- return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
- }
+ Logger logger = m_model.getLogger();
+ return new DefaultServiceManager( logger, dependencies );
}

- private Object getTargetContext()
- throws LifecycleException
+ private Context createClassicContext()
{
ContextModel model = m_model.getContextModel();
- String casting = model.getCastingClassname();
- if( ( null != casting ) && casting.endsWith( "$Context" ) )
- {
- //
- // return a proxy
- //
-
- Map map = model.getEntryModelMap();
- Type type = m_model.getType();
- InvocationHandler handler = new ContextInvocationHandler( type,
map );
-
- Class inner = getInnerClass( "$Context" );
- if( null == inner )
- {
- final String error =
- "Unable to locate the Context inner class in component type
["
- + m_model.getDeploymentClass().getName()
- + "].";
- throw new IllegalStateException( error );
- }
-
- ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
- return Proxy.newProxyInstance( classloader, new Class[]{ inner
}, handler );
- }
- else
- {
- Class impl = getContextImplementationClass( model );
- return createComponentContext( impl, model.getContextMap() );
- }
- }
-
- private Class getInnerClass( String postfix )
- {
- Class subject = m_model.getDeploymentClass();
- Class[] classes = subject.getClasses();
- return locateClass( postfix, classes );
- }
-
- private Class locateClass( String postfix, Class[] classes )
- {
- for( int i=0; i<classes.length; i++ )
- {
- Class inner = classes[i];
- String name = inner.getName();
- if( name.endsWith( postfix ) )
- {
- return inner;
- }
- }
- return null;
- }
-
- private Class getContextImplementationClass( ContextModel model ) throws
LifecycleException
- {
- String classname = model.getImplementationClassname();
-
- if( null == classname )
- {
- return DefaultContext.class;
- }
- else
- {
- try
- {
- return
m_model.getDeploymentClass().getClassLoader().loadClass( classname );
- }
- catch( Throwable e )
- {
- final String error =
- "Could not load the custom context implementation class ["
- + classname
- + "].";
- throw new LifecycleException( error, e );
- }
- }
- }
-
- /**
- * Creates a component context instance.
- *
- * @return the context object compliant with the context casting
- * constraints declared by the component type
- * @exception LifecycleException if an error occurs while attempting to
- * construct the context instance
- */
- private Object createComponentContext( Class clazz, Map map )
- throws LifecycleException
- {
- //
- // its a custom context object so we need to create it
- // using the classic context object as the constructor
- // argument
- //
-
- try
- {
- Constructor constructor = clazz.getConstructor(
- new Class[]{ Map.class } );
- return constructor.newInstance( new Object[]{ map } );
- }
- catch( NoSuchMethodException e )
- {
- final String error =
- REZ.getString( "context.non-compliance-constructor.error",
clazz.getName() );
- throw new LifecycleException( error, e );
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
- throw new LifecycleException( error, e );
- }
+ Map map = model.getContextMap();
+ return new DefaultContext( map );
}

private Object instantiate(
- Class clazz, Logger logger, Configuration config, Parameters
params,
- Object context, Class contextClass, Class managerClass, Object
manager )
+ Class clazz, Logger logger, Configuration config, Parameters
params )
throws LifecycleException, NullArgumentException
{
Constructor constructor = getConstructor( clazz );

Class parts = getInnerClass( "$Parts" );
+ Class context = getInnerClass( "$Context" );
+ Class dependencies = getInnerClass( "$Dependencies" );

Class[] classes = constructor.getParameterTypes();
Object[] args = new Object[ classes.length ];
@@ -506,13 +336,21 @@
}
args[i] = logger;
}
- else if( ( null != contextClass ) &&
contextClass.isAssignableFrom( c ) )
+ else if( ( null != parts ) && parts.isAssignableFrom( c ) )
{
- if( null == context )
- {
- throw new NullArgumentException( "context" );
- }
- args[i] = context;
+ args[i] = newPartsInvocationHandler( parts );
+ }
+ else if( ( null != dependencies ) &&
dependencies.isAssignableFrom( c ) )
+ {
+ args[i] = newDependencyInvocationHandler( dependencies );
+ }
+ else if( ( null != context ) && context.isAssignableFrom( c ) )
+ {
+ args[i] = newContextInvocationHandler( context );
+ }
+ else if( Context.class.isAssignableFrom( c ) )
+ {
+ args[i] = createClassicContext();
}
else if( Configuration.class.isAssignableFrom( c ) )
{
@@ -530,21 +368,9 @@
}
args[i] = params;
}
- else if( ( null != manager ) && managerClass.isAssignableFrom( c
) )
- {
- args[i] = manager;
- }
else if( ServiceManager.class.isAssignableFrom( c ) )
{
- if( null == manager )
- {
- throw new NullArgumentException( "manager" );
- }
- args[i] = manager;
- }
- else if( ( null != parts ) && parts.isAssignableFrom( c ) )
- {
- args[i] = newPartsInvocationHandler( parts );
+ args[i] = createServiceManager();
}
else
{
@@ -564,14 +390,31 @@
return instantiateComponent( constructor, args );
}

- private Object newPartsInvocationHandler( Class parts ) throws
LifecycleException
+ private Object newContextInvocationHandler( Class clazz ) throws
LifecycleException
+ {
+ try
+ {
+ Type type = m_model.getType();
+ InvocationHandler handler = new ContextInvocationHandler(
m_model );
+ ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
+ return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error while attempting to construct the context
invocation handler.";
+ throw new LifecycleException( error, e );
+ }
+ }
+
+ private Object newPartsInvocationHandler( Class clazz ) throws
LifecycleException
{
try
{
Type type = m_model.getType();
InvocationHandler handler = new PartsInvocationHandler( type );
ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
- return Proxy.newProxyInstance( classloader, new Class[]{ parts
}, handler );
+ return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
}
catch( Throwable e )
{
@@ -581,6 +424,22 @@
}
}

+ private Object newDependencyInvocationHandler( Class clazz ) throws
LifecycleException
+ {
+ try
+ {
+ InvocationHandler handler = new DependencyInvocationHandler(
m_model );
+ ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
+ return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error while attempting to construct the
dependencies invocation handler.";
+ throw new LifecycleException( error, e );
+ }
+ }
+
private Constructor getConstructor( Class clazz ) throws
LifecycleException
{
Constructor[] constructors = clazz.getConstructors();
@@ -656,73 +515,25 @@
}
}

- private void applyContext(
- final Object instance, DeliveryDescriptor delivery, final Object
context )
- throws LifecycleException
+ private Class getInnerClass( String postfix )
{
- if( null == context ) return;
-
- final ContextModel model = m_model.getContextModel();
-
- if( delivery instanceof NativeDeliveryDescriptor )
- {
- getLogger().debug( "applying context" );
-
- //
- // its classic avalon
- //
+ Class subject = m_model.getDeploymentClass();
+ Class[] classes = subject.getClasses();
+ return locateClass( postfix, classes );
+ }

- if( context instanceof Context )
- {
- try
- {
- ContainerUtil.contextualize( instance, (Context) context
);
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString(
- "lifecycle.error.avalon-contextualization",
- m_model.getQualifiedName() );
- throw new LifecycleException( error, e );
- }
- }
- else
- {
- final String error =
- "Supplied context class ["
- + context.getClass().getName()
- + "] does not implement the Avalon Context interface.";
- throw new LifecycleException( error );
- }
- }
- else if( delivery instanceof StagedDeliveryDescriptor )
+ private Class locateClass( String postfix, Class[] classes )
+ {
+ for( int i=0; i<classes.length; i++ )
{
- getLogger().warn( "applying custom context: " +
delivery.getClass().getName() );
- final DeploymentModel provider = model.getProvider();
- try
- {
- ContextualizationHandler handler =
- (ContextualizationHandler) provider.resolve();
- handler.contextualize( instance, (Context) context );
- }
- catch( Throwable e )
+ Class inner = classes[i];
+ String name = inner.getName();
+ if( name.endsWith( postfix ) )
{
- final String error =
- REZ.getString(
- "lifecycle.error.custom-contextualization",
- m_model.getQualifiedName(),
- provider.toString() );
- throw new LifecycleException( error, e );
+ return inner;
}
}
- else
- {
- final String error =
- "Unrecognized delivery strategy: ["
- + delivery.getClass().getName()
- + "].";
- throw new IllegalStateException( error );
- }
+ return null;
}
+
}

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
Sat Apr 2 04:34:03 2005
@@ -77,11 +77,20 @@
* @param type the component type
* @param map a map of context values keyed by entry key
*/
- public DependencyInvocationHandler( Type type, Map map )
+ public DependencyInvocationHandler( ComponentModel model )
throws NullPointerException
{
- assertNotNull( map, "map" );
- assertNotNull( type, "type" );
+ assertNotNull( model, "model" );
+
+ Type type = model.getType();
+ DependencyModel[] dependencies = model.getDependencyModels();
+ Hashtable map = new Hashtable();
+ for( int i=0; i<dependencies.length; i++ )
+ {
+ DependencyModel dep = dependencies[i];
+ String key = dep.getDependency().getKey();
+ map.put( key, dep );
+ }

m_map = map;
m_type = type;

Modified:
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java
Sat Apr 2 04:34:03 2005
@@ -34,10 +34,12 @@
public interface Controller extends Control
{
/**
- * Return a management view of a part.
- * @param part the part to present
- * @return the management view
+ * Create and return a serializable model using a supplied classloader
and part
+ * datatype.
+ *
+ * @param part the immutable part datatype
+ * @return the mutable model
*/
- Model getModel( Part part ) throws DelegationException;
+ Model getModel( ClassLoader classloader, Part part ) throws
DelegationException;

}

Modified:
development/main/metro/automation/control/src/main/net/dpml/control/Model.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/Model.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/control/Model.java
Sat Apr 2 04:34:03 2005
@@ -30,7 +30,4 @@
public interface Model
{
String getName();
-
- void setName( String name );
-
}

Modified:
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java
Sat Apr 2 04:34:03 2005
@@ -47,11 +47,11 @@
void addModel( Model model );

/**
- * Return a management view of a part.
- * @param part the part to present
- * @return the management view
+ * Return a new model for tyhe supplied part.
+ * @param part the part datastructure
+ * @return the model
*/
- Model getModel( Part part ) throws DelegationException;
+ Model getModel( ClassLoader classloader, Part part ) throws
DelegationException;

/**
* Start the system.

Added:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
Sat Apr 2 04:34:03 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.data;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * Description of classloader.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ClasspathDirective.java 2119 2005-03-23 02:04:46Z
mcconnell AT dpml.net $
+ */
+public final class ClassLoaderDirective implements Serializable
+{
+ private static final ClasspathDirective[] EMPTY_CLASSPATH_ARRAY = new
ClasspathDirective[0];
+
+ /**
+ * The fileset directives
+ */
+ private ClasspathDirective[] m_classpaths;
+
+ /**
+ * Create a empty ClasspathDirective.
+ */
+ public ClassLoaderDirective()
+ {
+ this( EMPTY_CLASSPATH_ARRAY );
+ }
+
+ /**
+ * Create a ClassLoaderDirective instance.
+ *
+ * @param classpaths an array of classpath directives
+ */
+ public ClassLoaderDirective( final ClasspathDirective[] classpaths )
+ {
+ if( classpaths == null )
+ {
+ m_classpaths = EMPTY_CLASSPATH_ARRAY;
+ }
+ else
+ {
+ for( int i=0; i<classpaths.length; i++ )
+ {
+ ClasspathDirective d = classpaths[i];
+ if( null == d )
+ {
+ throw new NullPointerException( "classpaths (" + i + ")"
);
+ }
+ }
+ m_classpaths = classpaths;
+ }
+ }
+
+ /**
+ * Return the set of classpath directives.
+ *
+ * @return the classpath directive array
+ */
+ public ClasspathDirective[] getClasspathDirectives()
+ {
+ return m_classpaths;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else
+ {
+ if( other instanceof ClassLoaderDirective )
+ {
+ ClassLoaderDirective directive = (ClassLoaderDirective)
other;
+ if( getClasspathDirectives().length !=
directive.getClasspathDirectives().length )
+ {
+ return false;
+ }
+ else
+ {
+ ClasspathDirective[] mine = getClasspathDirectives();
+ ClasspathDirective[] yours =
directive.getClasspathDirectives();
+ for( int i=0; i<mine.length; i++ )
+ {
+ ClasspathDirective m = mine[i];
+ ClasspathDirective n = yours[i];
+ if( false == m.equals( n ) )
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Return the hashcode for the instance.
+ * @return the instance hashcode
+ */
+ public int hashCode()
+ {
+ int hash = 0;
+ for( int i=0; i<m_classpaths.length; i++ )
+ {
+ hash ^= m_classpaths[i].hashCode();
+ }
+ return hash;
+ }
+}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
Sat Apr 2 04:34:03 2005
@@ -47,7 +47,18 @@
*/
public ClasspathDirective()
{
- this( null, null );
+ this( null );
+ }
+
+ /**
+ * Create a ClasspathDirective instance.
+ *
+ * @param filesets the filesets to be included in a classloader
+ * @param uris the set of artifact uris
+ */
+ public ClasspathDirective( final URI[] uris )
+ {
+ this( null, uris );
}

/**

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
Sat Apr 2 04:34:03 2005
@@ -157,7 +157,7 @@
{
this(
name, DeploymentProfile.DEFAULT,
InfoDescriptor.UNDEFINED_COLLECTION, classname, null, null, null,
- null, null, null, Mode.IMPLICIT );
+ null, null, null, null, Mode.IMPLICIT );
}

/**
@@ -179,6 +179,7 @@
template.getParts(),
template.getParameters(),
template.getConfiguration(),
+ template.getClassLoaderDirective(),
Mode.EXPLICIT );
}

@@ -193,10 +194,11 @@
final Part[] parts,
final Parameters parameters,
final Configuration config,
+ final ClassLoaderDirective classloader,
final Mode mode )
throws NullArgumentException
{
- super( name, activation, mode, categories );
+ super( name, activation, mode, categories, classloader );

if( null == classname )
{

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
Sat Apr 2 04:34:03 2005
@@ -51,18 +51,10 @@
private static final DeploymentProfile[] EMPTY_PROFILES =
new DeploymentProfile[0];

- private static final ClasspathDirective EMPTY_CLASSPATH =
- new ClasspathDirective();
-

//--------------------------------------------------------------------------
// state

//--------------------------------------------------------------------------

- /**
- * The classpath directive.
- */
- private ClasspathDirective m_classpath;
-
/**
* The published service directives.
*/
@@ -97,21 +89,12 @@
*/
public ContainmentProfile(
final String name,
- final ClasspathDirective classpath,
+ final ClassLoaderDirective classloader,
final ServiceDirective[] exports,
final CategoriesDirective categories,
DeploymentProfile[] profiles )
{
- super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, categories );
-
- if( classpath == null )
- {
- m_classpath = EMPTY_CLASSPATH;
- }
- else
- {
- m_classpath = classpath;
- }
+ super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, categories,
classloader );

if( exports == null )
{
@@ -137,17 +120,6 @@

//--------------------------------------------------------------------------

/**
- * Return the classloader directive that describes the creation
- * arguments for the classloader required by this container.
- *
- * @return the classloader directive
- */
- public ClasspathDirective getClasspathDirective()
- {
- return m_classpath;
- }
-
- /**
* Return the set of service directives that describe the mapping
* between services exposrted by the container and its implementation
* model.
@@ -245,11 +217,6 @@
return false;
}
ContainmentProfile profile = (ContainmentProfile) other;
- if( false == m_classpath.equals( profile.getClasspathDirective() ) )
- {
- return false;
- }
-
if( getExportDirectives().length !=
profile.getExportDirectives().length )
{
return false;
@@ -298,7 +265,6 @@
public int hashCode()
{
int hash = super.hashCode();
- hash ^= m_classpath.hashCode();
for( int i=0; i<m_export.length; i++ )
{
hash ^= m_export[i].hashCode();

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
Sat Apr 2 04:34:03 2005
@@ -57,6 +57,9 @@
private static final CategoriesDirective EMPTY_CATEGORIES =
new CategoriesDirective();

+ private static final ClassLoaderDirective EMPTY_CLASSLOADER_DIRECTIVE =
+ new ClassLoaderDirective();
+

//--------------------------------------------------------------------------
// state

//--------------------------------------------------------------------------
@@ -82,6 +85,11 @@
*/
private final CategoriesDirective m_categories;

+ /**
+ * The classpath directive.
+ */
+ private ClassLoaderDirective m_classloader;
+

//--------------------------------------------------------------------------
// constructor

//--------------------------------------------------------------------------
@@ -96,6 +104,19 @@
public DeploymentProfile(
final String name, int activation, Mode mode, CategoriesDirective
categories )
{
+ this( name, activation, mode, categories, null );
+ }
+
+ /**
+ * Creation of a new deployment profile instance.
+ * @param name the profile name
+ * @param activation the activation policy
+ * @param mode the mode of depployment
+ * @param categories logging category directives
+ */
+ public DeploymentProfile(
+ final String name, int activation, Mode mode, CategoriesDirective
categories, ClassLoaderDirective classloader )
+ {
m_activation = activation;

if( null == categories )
@@ -124,6 +145,15 @@
{
m_name = name;
}
+
+ if( null == classloader )
+ {
+ m_classloader = EMPTY_CLASSLOADER_DIRECTIVE;
+ }
+ else
+ {
+ m_classloader = classloader;
+ }
}


//--------------------------------------------------------------------------
@@ -186,6 +216,17 @@
}

/**
+ * Return the classloader directive that describes the creation
+ * arguments for the classloader required by this profile.
+ *
+ * @return the classloader directive
+ */
+ public ClassLoaderDirective getClassLoaderDirective()
+ {
+ return m_classloader;
+ }
+
+ /**
* Returns a string representation of the profile.
* @return a string representation
*/
@@ -233,6 +274,10 @@
{
return false;
}
+ if( false == m_classloader.equals(
profile.getClassLoaderDirective() ) )
+ {
+ return false;
+ }
return true;
}
else
@@ -252,6 +297,7 @@
hash ^= m_activation;
hash ^= m_mode.hashCode();
hash ^= m_categories.hashCode();
+ hash ^= m_classloader.hashCode();
return hash;
}


Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
Sat Apr 2 04:34:03 2005
@@ -23,6 +23,7 @@

import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContextDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.DependencyDirective;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ImportDirective;
@@ -60,6 +61,7 @@
private String m_name;
private String m_classname;
private int m_collection;
+ private ClassLoaderDirective m_classpath;

public ComponentProfileTestCase( String name )
{
@@ -79,6 +81,7 @@
m_mode = Mode.IMPLICIT;
m_categories = new CategoriesDirective( new CategoryDirective[0] );
m_collection = InfoDescriptor.SOFT_COLLECTION;
+ m_classpath = null;
m_parts = new Part[0];
}

@@ -87,7 +90,7 @@
ComponentProfile profile = new ComponentProfile(
m_name, m_activation, m_collection, m_classname, m_categories,
m_context, m_dependencies, m_parts, m_parameters,
- m_configuration, m_mode );
+ m_configuration, m_classpath, m_mode );

assertEquals( "name", m_name, profile.getName() );
assertEquals( "collection", m_collection,
profile.getCollectionPolicy() );
@@ -105,7 +108,7 @@
ComponentProfile profile = new ComponentProfile(
m_name, m_activation, m_collection, m_classname, m_categories,
m_context, m_dependencies, m_parts, m_parameters,
- m_configuration, m_mode );
+ m_configuration, m_classpath, m_mode );
testSerialization( profile );
}


Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
Sat Apr 2 04:34:03 2005
@@ -22,7 +22,7 @@
import net.dpml.part.Part;

import net.dpml.composition.data.ServiceDirective;
-import net.dpml.composition.data.ClasspathDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContextDirective;
@@ -63,6 +63,7 @@
private String m_name;
private String m_classname;
private int m_collection;
+ private ClassLoaderDirective m_classpath;

private ComponentProfile m_componentOne;
private ComponentProfile m_componentTwo;
@@ -78,7 +79,7 @@
String name = "container";
ContainmentProfile profile = createContainmentProfile( name );
assertEquals( "name", name, profile.getName() );
- assertNotNull( "classpath", profile.getClasspathDirective() );
+ assertNotNull( "classloader", profile.getClassLoaderDirective() );
assertNotNull( "export", profile.getExportDirectives() );
assertNotNull( "profiles", profile.getProfiles() );
}
@@ -101,20 +102,21 @@
m_mode = Mode.IMPLICIT;
m_categories = new CategoriesDirective( new CategoryDirective[0] );
m_collection = InfoDescriptor.SOFT_COLLECTION;
+ m_classpath = new ClassLoaderDirective();
m_parts = new Part[0];
return new ComponentProfile(
name, m_activation, m_collection, m_classname, m_categories,
m_context, m_dependencies, m_parts, m_parameters,
- m_configuration, m_mode );
+ m_configuration, m_classpath, m_mode );
}

public ContainmentProfile createContainmentProfile( String name )
{
- ClasspathDirective classpath = null;
+ ClassLoaderDirective classloader = new ClassLoaderDirective();
ServiceDirective[] export = null;
CategoriesDirective categories = null;
DeploymentProfile[] components = new DeploymentProfile[]{
m_componentOne, m_componentTwo };
- return new ContainmentProfile( name, classpath, export, categories,
components );
+ return new ContainmentProfile( name, classloader, export,
categories, components );
}

}

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
Sat Apr 2 04:34:03 2005
@@ -51,6 +51,9 @@
import net.dpml.composition.data.ConstructorDirective;
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.DependencyDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
+import net.dpml.composition.data.FilesetDirective;
import net.dpml.composition.data.Parameter;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.Mode;
@@ -282,7 +285,8 @@

try
{
- ComponentProfile profile = buildComponentProfile( classloader );
+ ClassLoaderDirective cld = constructClassLoaderDirective();
+ ComponentProfile profile = buildComponentProfile( classloader,
cld );
URI uri = getDefinition().getArtifactURI( Part.ARTIFACT_TYPE );
if( null == m_output )
{
@@ -324,6 +328,56 @@
}
}

+ private ClassLoaderDirective constructClassLoaderDirective()
+ {
+ ArrayList list = new ArrayList();
+ URI[] uris = createURISequence( ResourceRef.API );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ uris = createURISequence( ResourceRef.SPI );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ uris = createURISequence( ResourceRef.IMPL );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ ClasspathDirective[] cps = (ClasspathDirective[]) list.toArray( new
ClasspathDirective[0] );
+ return new ClassLoaderDirective( cps );
+ }
+
+ private URI[] createURISequence( int category )
+ {
+ Definition def = getDefinition();
+ ArrayList list = new ArrayList();
+ final ResourceRef[] resources =
+ def.getResourceRefs( getProject(), Policy.RUNTIME, category, true
);
+ for( int i=0; i<resources.length; i++ )
+ {
+ final ResourceRef ref = resources[i];
+ final Policy policy = ref.getPolicy();
+ if( policy.isRuntimeEnabled() )
+ {
+ final Resource resource = getIndex().getResource( ref );
+ if( "jar".equals( resource.getInfo().getType() ) )
+ {
+ URI uri = resource.getArtifactURI( "jar" );
+ list.add( uri );
+ }
+ }
+ }
+ if( def.getInfo().isa( "jar" ) )
+ {
+ URI local = def.getArtifactURI( "jar" );
+ list.add( local );
+ }
+ return (URI[]) list.toArray( new URI[0] );
+ }
+
private File getOutputFile()
{
if( null != m_output )
@@ -390,10 +444,15 @@
// impl
//---------------------------------------------------------------------

-
private ComponentProfile buildComponentProfile( ClassLoader classloader
)
throws IntrospectionException, IOException, ClassNotFoundException
{
+ return buildComponentProfile( classloader, null );
+ }
+
+ private ComponentProfile buildComponentProfile( ClassLoader classloader,
ClassLoaderDirective cld )
+ throws IntrospectionException, IOException, ClassNotFoundException
+ {
log( "building component: " + getName() );

//
@@ -421,7 +480,7 @@

return new ComponentProfile(
name, activation, collection, classname, categories, context,
- dependencies, parts, parameters, configuration, mode );
+ dependencies, parts, parameters, configuration, cld, mode );
}

/**

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
Sat Apr 2 04:34:03 2005
@@ -47,6 +47,7 @@
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.ServiceDirective;
import net.dpml.composition.data.ClasspathDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.FilesetDirective;
import net.dpml.logging.data.CategoriesDirective;

@@ -81,7 +82,6 @@
private String m_key;
private String m_name;
private String m_classname;
- private ClassloaderDataType m_classpath;
private ServicesDataType m_services;

private File m_output;
@@ -120,21 +120,6 @@
return builder;
}

- public ClassloaderDataType createClassloader()
- {
- if( m_classpath == null )
- {
- m_classpath = new ClassloaderDataType();
- return m_classpath;
- }
- else
- {
- final String error =
- "Illegal attempt to create a duplicate classloader
declaration.";
- throw new BuildException( error, getLocation() );
- }
- }
-
public ServicesDataType createServices()
{
if( m_services == null )
@@ -241,23 +226,11 @@
{
String name = getName();
log( "building container: " + name );
- ClasspathDirective classpath = getClasspathDirective();
+ ClassLoaderDirective cld = getClassLoaderDirective();
ServiceDirective[] services = getServiceDirectives();
CategoriesDirective categories = new CategoriesDirective(); // TODO
DeploymentProfile[] profiles = buildDeploymentProfiles( classloader
);
- return new ContainmentProfile( name, classpath, services,
categories, profiles );
- }
-
- private ClasspathDirective getClasspathDirective()
- {
- if( null == m_classpath )
- {
- return constructClasspathDirective();
- }
- else
- {
- return m_classpath.getClasspathDirective();
- }
+ return new ContainmentProfile( name, cld, services, categories,
profiles );
}

private ServiceDirective[] getServiceDirectives()
@@ -322,11 +295,26 @@
return m_name;
}

- private ClasspathDirective constructClasspathDirective()
+ private ClassLoaderDirective getClassLoaderDirective()
{
- URI[] uris = createURISequence( ResourceRef.ANY ); // TODO: API,
SPI, IMPL spread
- FilesetDirective[] filesets = new FilesetDirective[0];
- return new ClasspathDirective( filesets, uris );
+ ArrayList list = new ArrayList();
+ URI[] uris = createURISequence( ResourceRef.API );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ uris = createURISequence( ResourceRef.SPI );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ uris = createURISequence( ResourceRef.IMPL );
+ if( uris.length > 0 )
+ {
+ list.add( new ClasspathDirective( uris ) );
+ }
+ ClasspathDirective[] cps = (ClasspathDirective[]) list.toArray( new
ClasspathDirective[0] );
+ return new ClassLoaderDirective( cps );
}

private URI[] createURISequence( int category )

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
Sat Apr 2 04:34:03 2005
@@ -38,6 +38,11 @@
import net.dpml.control.HandlerNotFoundException;
import net.dpml.control.PartNotFoundException;

+import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.models.StandardComponentModel;
+
+import net.dpml.logging.Logger;
+
/**
* A initial test controller.
*
@@ -56,9 +61,10 @@
// constructor
//--------------------------------------------------------------------

- public CompositionController()
+ public CompositionController( Logger logger )
{
- this( new ConsoleMonitor( "metro", false ) );
+ super();
+ m_monitor = new DefaultMonitor( logger );
}

public CompositionController( Monitor monitor )
@@ -90,38 +96,28 @@
}

/**
- * Return a management view of a part.
- * @param part the part to present
- * @return the management view
+ * Return the model for a supplied part.
+ * @param part the part datastructure
+ * @return the model
*/
- public Model getModel( Part part ) throws DelegationException
+ public Model getModel( ClassLoader classloader, Part part ) throws
DelegationException
{
- URI uri = part.getPartHandlerURI();
- if( getURI().equals( uri ) )
+ if( part instanceof ComponentProfile )
{
- return new ModelPerspective( part );
+ getMonitor().info( "creating model for " + part );
+ ComponentProfile profile = (ComponentProfile) part;
+ return createStandardComponentModel( classloader, profile );
}
else
{
- try
- {
- PartHandler handler = loadPartHandler( uri );
- Controller controller = handler.getController();
- return controller.getModel( part );
- }
- catch( HandlerNotFoundException e )
+ URI uri = part.getPartHandlerURI();
+ if( getURI().equals( uri ) )
{
- final String error =
- "Requested part handler ["
- + uri
- + "] not found.";
- throw new DelegationException( uri, error, e );
+ throw new UnsupportedOperationException(
part.getClass().getName() );
}
- catch( Throwable e )
+ else
{
- final String error =
- "Unexpected error raised by delegate while requesting part
model.";
- throw new DelegationException( uri, error, e );
+ return getForeignModel( classloader, part, uri );
}
}
}
@@ -130,11 +126,50 @@
// internal
//--------------------------------------------------------------------

+ /**
+ * Create a new serializable component model using a supplied classloader
+ * as the parent classloader for the classloader stack constructed for
+ * component instances.
+ */
+ private StandardComponentModel createStandardComponentModel( ClassLoader
classloader, ComponentProfile profile )
+ {
+ return new StandardComponentModel( classloader, profile );
+ }
+
protected Monitor getMonitor()
{
return m_monitor;
}

+ /**
+ * Return a management view of a part.
+ * @param part the part to present
+ * @return the management view
+ */
+ public Model getForeignModel( ClassLoader classloader, Part part, URI
uri ) throws DelegationException
+ {
+ try
+ {
+ PartHandler handler = loadPartHandler( uri );
+ Controller controller = handler.getController();
+ return controller.getModel( classloader, part );
+ }
+ catch( HandlerNotFoundException e )
+ {
+ final String error =
+ "Requested part handler ["
+ + uri
+ + "] not found.";
+ throw new DelegationException( uri, error, e );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error raised by delegate while requesting part
model.";
+ throw new DelegationException( uri, error, e );
+ }
+ }
+
//--------------------------------------------------------------------
// static utilities
//--------------------------------------------------------------------

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
Sat Apr 2 04:34:03 2005
@@ -39,6 +39,10 @@
import net.dpml.control.HandlerNotFoundException;
import net.dpml.control.PartNotFoundException;

+import net.dpml.system.SystemContext;
+
+import net.dpml.logging.Logger;
+
/**
* The CompositionManager is a top-level manager responsible for the
management
* of an arbitary collection of component models.
@@ -49,23 +53,26 @@
public class CompositionManager extends CompositionController implements
SystemManager
{
//--------------------------------------------------------------------
+ // static
+ //--------------------------------------------------------------------
+
+ private final ClassLoader CLASSLOADER = Logger.class.getClassLoader();
+
+ //--------------------------------------------------------------------
// state
//--------------------------------------------------------------------

+ private final SystemContext m_context;
private final Set m_models = Collections.synchronizedSet( new HashSet()
);

//--------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------

- public CompositionManager()
+ public CompositionManager( SystemContext context )
{
- this( new ConsoleMonitor( "metro", false ) );
- }
-
- public CompositionManager( Monitor monitor )
- {
- super( monitor );
+ super( new DefaultMonitor( context.getLogger() ) );
+ m_context = context;
}

//--------------------------------------------------------------------
@@ -87,7 +94,7 @@
throws IOException, DelegationException, PartNotFoundException
{
Part part = loadPart( uri );
- return addPart( part );
+ return installPart( part );
}

/**
@@ -123,15 +130,15 @@
}

/**
- * Add a part to the collection of parts managed by this controller.
+ * Install a part to the collection of parts managed by this manager.
*
* @param name the name identifying the part within the collection
* @param part the part to add
*/
- private Model addPart( Part part )
+ private Model installPart( Part part )
throws DelegationException
{
- Model model = getModel( part );
+ Model model = getModel( CLASSLOADER, part );
m_models.add( model );
return model;
}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java
Sat Apr 2 04:34:03 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.control;
+
+import net.dpml.logging.Logger;
+import net.dpml.control.Monitor;
+
+
+/**
+ * Monitor supplied to a startable controller.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class DefaultMonitor implements Monitor
+{
+ private Logger m_logger;
+
+ public DefaultMonitor( Logger logger )
+ {
+ m_logger = logger;
+ }
+
+ /**
+ * Log the supplied debug level message.
+ * @param mesage the message to log
+ */
+ public void debug( String message )
+ {
+ m_logger.debug( message );
+ }
+
+ /**
+ * Log the supplied info level message.
+ * @param mesage the message to log
+ */
+ public void info( String message )
+ {
+ m_logger.info( message );
+ }
+
+ /**
+ * Log the supplied info level message.
+ * @param mesage the message to log
+ */
+ public void warn( String message )
+ {
+ m_logger.warn( message );
+ }
+
+ /**
+ * Log the supplied error level message.
+ * @param mesage the message to log
+ * @param throwable the exception
+ */
+ public void error( String message, Throwable throwable )
+ {
+ m_logger.error( message, throwable );
+ }
+
+ /**
+ * Log the monitor of a normal termination.
+ * @param status TRUE if the monitor completed all scheduled activities
+ * without interruption
+ */
+ public void notifyCompletion( boolean status )
+ {
+ m_logger.debug( "completion notification (" + status + ")" );
+ }
+
+ /**
+ * Log the monitor of a runtime failure.
+ * @param throwable the failure cause
+ */
+ public void notifyFailure( Throwable throwable )
+ {
+ m_logger.warn( "failure notification", throwable );
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
Sat Apr 2 04:34:03 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.models;
+
+import java.io.Serializable;
+
+import net.dpml.part.Part;
+import net.dpml.control.Model;
+import net.dpml.composition.data.ComponentProfile;
+
+/**
+ * The implementation of the model of a composition.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class StandardComponentModel implements Model, Serializable
+{
+ private final ComponentProfile m_profile;
+ private final ClassLoader m_classloader;
+
+ public StandardComponentModel( ClassLoader classloader, ComponentProfile
profile )
+ {
+ m_classloader = classloader;
+ m_profile = profile;
+ }
+
+ public ClassLoader getParentClassLoader()
+ {
+ return m_classloader;
+ }
+
+ public String getName()
+ {
+ return m_profile.getName();
+ }
+
+}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
Sat Apr 2 04:34:03 2005
@@ -31,6 +31,8 @@
import net.dpml.configuration.ConfigurationException;
import net.dpml.configuration.impl.ConfigurationUtil;

+import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ConstructorDirective;
@@ -122,6 +124,7 @@
//

final Part[] parts = new Part[0];
+ final ClassLoaderDirective cld = new ClassLoaderDirective();

//
// create the profile
@@ -129,7 +132,7 @@

return new ComponentProfile(
name, activation, collection, classname, categories, context,
dependencies, parts,
- params, configuration, Mode.EXPLICIT );
+ params, configuration, cld, Mode.EXPLICIT );
}

/**

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
Sat Apr 2 04:34:03 2005
@@ -21,6 +21,7 @@
import java.util.ArrayList;

import net.dpml.composition.data.CompositionDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.DeploymentProfile;
@@ -93,13 +94,14 @@
createServiceDirectives( config.getChild( "services", false ) );

//
- // check for any legacy "implementation" tags and if it exists
- // then run with it, otherwise continue with the container defintion
+ // construct the classloader directive in a way that is backward
compatible
+ // (i.e. just a single classpath descriptor and no support for stack
based
+ // classloading)
//

Configuration classloader = config.getChild( "classloader", true );
- ClasspathDirective classpath =
- createClasspathDirective( classloader.getChild( "classpath", false
) );
+ ClassLoaderDirective cld =
+ createClassLoaderDirective( classloader.getChild( "classpath",
false ) );

//
// build any logging category directives
@@ -118,7 +120,7 @@
// return the containment profile
//

- return new ContainmentProfile( name, classpath, exports, categories,
profiles );
+ return new ContainmentProfile( name, cld, exports, categories,
profiles );
}

private boolean isaValidProfileRootName( String name )
@@ -141,17 +143,17 @@
}
}

- private ClasspathDirective createClasspathDirective( Configuration
config )
+ private ClassLoaderDirective createClassLoaderDirective( Configuration
config )
throws ConfigurationException
{
if( config == null )
{
- return null;
+ return new ClassLoaderDirective();
}
-
FilesetDirective[] filesets = createFilesetDirectives( config );
URI[] artifacts = createArtifactDirectives( config );
- return new ClasspathDirective( filesets, artifacts );
+ ClasspathDirective cpd = new ClasspathDirective( filesets, artifacts
);
+ return new ClassLoaderDirective( new ClasspathDirective[]{ cpd } );
}

private URI[] createArtifactDirectives( Configuration config )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
Sat Apr 2 04:34:03 2005
@@ -22,11 +22,9 @@

import java.net.URI;

-import net.dpml.composition.data.ClasspathDirective;
-
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.TypeRepository;
-
import net.dpml.composition.provider.ClassLoaderContext;

import net.dpml.context.impl.DefaultContext;
@@ -96,7 +94,7 @@
/**
* The classpath directive.
*/
- private final ClasspathDirective m_directive;
+ private final ClassLoaderDirective m_directive;

/**
* Implied url to include in the classpath.
@@ -122,7 +120,7 @@
*/
public DefaultClassLoaderContext(
Logger logger, SystemContext system,
- ClassLoader parent, ClasspathDirective directive )
+ ClassLoader parent, ClassLoaderDirective directive )
{
this( logger, system, parent, null, null, directive, null );
}
@@ -135,7 +133,7 @@
* @param parent the parent classloader
* @param types the parent type manager
* @param services the parent service manager
- * @param directive the classpath directive
+ * @param directive the classloader directive
* @param implied url array added though implication
* @exception NullArgumentException if any one of the logger, parent,
packages,
* directive or system arguments is null.
@@ -144,7 +142,7 @@
Logger logger, SystemContext system,
ClassLoader parent, TypeRepository types,
ServiceRepository services,
- ClasspathDirective directive,
+ ClassLoaderDirective directive,
URI[] implied )
throws NullArgumentException
{
@@ -256,7 +254,7 @@
*
* @return the classloader directive
*/
- public ClasspathDirective getClasspathDirective()
+ public ClassLoaderDirective getClassLoaderDirective()
{
return m_directive;
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
Sat Apr 2 04:34:03 2005
@@ -36,6 +36,7 @@

import java.util.jar.Manifest;

+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.FilesetDirective;
@@ -134,7 +135,7 @@
File base =
context.getBaseDirectory();

- ClasspathDirective directive = context.getClasspathDirective();
+ ClassLoaderDirective directive = context.getClassLoaderDirective();

URI[] implicit = context.getImplicitURIs();

@@ -280,8 +281,8 @@
Logger logger, ContainmentProfile profile, URI[] implied )
{
SystemContext system = m_context.getSystemContext();
- ClasspathDirective directive =
- profile.getClasspathDirective();
+ ClassLoaderDirective directive =
+ profile.getClassLoaderDirective();

return new DefaultClassLoaderContext(
logger, system, m_classLoader, m_types, m_services, directive,
implied );
@@ -357,11 +358,15 @@
}

private URI[] createClassPath(
- File base, ClasspathDirective directive, URI[] implicit )
+ File base, ClassLoaderDirective cld, URI[] implicit )
throws Exception
{
- ArrayList classpath = new ArrayList();
+ if( null == cld )
+ {
+ throw new NullPointerException( "cld" );
+ }

+ ArrayList classpath = new ArrayList();
if( implicit.length > 0 )
{
if( getLogger().isDebugEnabled() )
@@ -374,27 +379,30 @@
classpath.add( implicit[i] );
}
}
-
- File[] files =
- expandFileSetDirectives(
- base, directive.getFilesets() );
- addToClassPath( classpath, files );
-
- if( files.length > 0 )
+ ClasspathDirective[] cps = cld.getClasspathDirectives();
+ for( int i=0; i<cps.length; i++ )
{
- if( getLocalLogger().isDebugEnabled() )
+ ClasspathDirective directive = cps[i];
+ File[] files =
+ expandFileSetDirectives(
+ base, directive.getFilesets() );
+ addToClassPath( classpath, files );
+
+ if( files.length > 0 )
{
- getLogger().debug( "included entries: " + files.length );
+ if( getLocalLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "included entries: " + files.length );
+ }
}
- }

- URI[] artifacts = directive.getURIs();
- for( int i=0; i<artifacts.length; i++ )
- {
- URI artifact = artifacts[i];
- classpath.add( artifact );
+ URI[] artifacts = directive.getURIs();
+ for( int j=0; j<artifacts.length; j++ )
+ {
+ URI artifact = artifacts[j];
+ classpath.add( artifact );
+ }
}
-
return (URI[]) classpath.toArray( new URI[0] );
}


Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
Sat Apr 2 04:34:03 2005
@@ -19,15 +19,18 @@
package net.dpml.composition.model.impl;

import java.io.InputStream;
-
import java.lang.reflect.Constructor;
-
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;

import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.DependencyDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.Mode;
@@ -81,47 +84,51 @@
// static
// --------------------------------------------------------------

- private static final Resources REZ =
ResourceManager
-
.getPackageResources( DefaultComponentModel.class );
+ private static final Resources REZ =
+ ResourceManager.getPackageResources( DefaultComponentModel.class );
+
+ private static final Configuration EMPTY_CONFIGURATION =
+ new DefaultConfiguration( "configuration",
ComponentModel.class.getName() );

- private static final Configuration EMPTY_CONFIGURATION =
new DefaultConfiguration(
-
"configuration",
-
ComponentModel.class
-
.getName() );
+ private static final String AVALON_CONFIGURABLE_CLASSNAME =
+ "org.apache.avalon.framework.configuration.Configurable";

- private static final String AVALON_CONFIGURABLE_CLASSNAME =
"org.apache.avalon.framework.configuration.Configurable";
+ private static final String AVALON_CONFIGURATION_CLASSNAME =
+ "org.apache.avalon.framework.configuration.Configuration";

- private static final String AVALON_CONFIGURATION_CLASSNAME =
"org.apache.avalon.framework.configuration.Configuration";
+ private static final String AVALON_PARAMETERIZABLE_CLASSNAME =
+ "org.apache.avalon.framework.parameters.Parameterizable";

- private static final String AVALON_PARAMETERIZABLE_CLASSNAME =
"org.apache.avalon.framework.parameters.Parameterizable";
+ private static final String AVALON_PARAMETERS_CLASSNAME =
+ "org.apache.avalon.framework.parameters.Parameters";

- private static final String AVALON_PARAMETERS_CLASSNAME =
"org.apache.avalon.framework.parameters.Parameters";
+ private static final String SCHEMA_TAG_W3CSCHEMA = "xmlschema";

// --------------------------------------------------------------
// immutable state
// --------------------------------------------------------------

- private final ComponentContext m_context;
+ private final ComponentContext m_context;

- private final ContextModel m_contextModel;
+ private final ContextModel m_contextModel;

- private final DependencyModel[] m_dependencies;
+ private final DependencyModel[] m_dependencies;

- private final DefaultState m_assembly =
new DefaultState();
+ private final DefaultState m_assembly = new DefaultState();

// --------------------------------------------------------------
// mutable state
// --------------------------------------------------------------

- private Configuration m_config;
+ private Configuration m_config;

- private Parameters m_parameters;
+ private Parameters m_parameters;

- private boolean m_activation;
+ private boolean m_activation;

- private int m_collection;
+ private int m_collection;

- private static final String SCHEMA_TAG_W3CSCHEMA =
"xmlschema";
+ private ClassLoader m_classloader;

// --------------------------------------------------------------
// constructor
@@ -130,8 +137,7 @@
/**
* Creation of a new deployment model.
*
- * @param context
- * the deployment context
+ * @param context the deployment context
*/
public DefaultComponentModel( ComponentContext context ) throws
ModelException
{
@@ -139,10 +145,10 @@

m_context = context;
m_activation = getDefaultActivationPolicy();
+ m_classloader = context.getClassLoader();

final ComponentProfile profile = m_context.getComponentProfile();
setCollectionPolicy( profile.getCollectionPolicy() );
- ClassLoader classLoader = m_context.getClassLoader();
final Type type = m_context.getType();
if ( isConfigurable() )
{
@@ -502,11 +508,8 @@
{
try
{
- ClassLoader loader = m_context.getClassLoader();
- Class parameterizable = loader
- .loadClass( AVALON_PARAMETERIZABLE_CLASSNAME );
- Class parameters = loader
- .loadClass( AVALON_PARAMETERS_CLASSNAME );
+ Class parameterizable = m_classloader.loadClass(
AVALON_PARAMETERIZABLE_CLASSNAME );
+ Class parameters = m_classloader.loadClass(
AVALON_PARAMETERS_CLASSNAME );
return ( parameterizable
.isAssignableFrom( getDeploymentClass() ) ||
isaConstructorArg( parameters ) );
}
@@ -621,11 +624,8 @@
{
try
{
- ClassLoader loader = m_context.getClassLoader();
- Class configurable = loader
- .loadClass( AVALON_CONFIGURABLE_CLASSNAME );
- Class configuration = loader
- .loadClass( AVALON_CONFIGURATION_CLASSNAME );
+ Class configurable = m_classloader.loadClass(
AVALON_CONFIGURABLE_CLASSNAME );
+ Class configuration = m_classloader.loadClass(
AVALON_CONFIGURATION_CLASSNAME );
return ( configurable.isAssignableFrom( getDeploymentClass()
) || isaConstructorArg( configuration ) );
}
catch ( Throwable e )
@@ -801,14 +801,13 @@
// instad of generating each time
//

- ClassLoader classLoader = m_context.getClassLoader();
ArrayList list = new ArrayList();
ServiceDescriptor[] services = getServices();
for ( int i = 0; i < services.length; i++ )
{
final ServiceDescriptor service = services[i];
final String classname = service.getReference().getClassname();
- list.add( getComponentClass( classLoader, classname ) );
+ list.add( getComponentClass( m_classloader, classname ) );
}

return (Class[]) list.toArray( new Class[0] );

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
Sat Apr 2 04:34:03 2005
@@ -589,7 +589,8 @@
{
try
{
- CompositionController controller = new CompositionController();
+ Logger logger = getLogger();
+ CompositionController controller = new CompositionController(
logger );
Part part = controller.loadPart( uri );
if( part instanceof DeploymentProfile )
{

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
Sat Apr 2 04:34:03 2005
@@ -19,13 +19,16 @@
package net.dpml.composition.model.impl;

import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;

import net.dpml.composition.data.ComponentProfile;
-
+import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.DependencyGraph;
-
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.composition.provider.ComponentContext;

@@ -35,15 +38,15 @@
import net.dpml.lang.NullArgumentException;

import net.dpml.logging.Logger;
-
import net.dpml.logging.data.CategoriesDirective;
-
import net.dpml.logging.provider.LoggingManager;

import net.dpml.meta.info.Type;

import net.dpml.system.SystemContext;

+import net.dpml.transit.artifact.Handler;
+
/**
* A utility class that handles creation of a component model context.
*
@@ -137,7 +140,8 @@

Logger logger = logging.getLoggerForCategory( partition + name );
DependencyGraph graph = m_context.getDependencyGraph();
- ClassLoader classloader = m_context.getClassLoader();
+ ClassLoader parent = m_context.getClassLoader();
+ ClassLoader classloader = getClassLoader( parent, profile );
final File dir = new File( m_context.getWorkingDirectory(), name );
final File temp = new File( m_context.getTempDirectory(), name );

@@ -174,4 +178,50 @@
throw new ModelException( error, e );
}
}
+
+ private ClassLoader getClassLoader( ClassLoader parent, ComponentProfile
profile )
+ {
+ final ClassLoaderDirective cld = profile.getClassLoaderDirective();
+ final ClasspathDirective[] cpds = cld.getClasspathDirectives();
+ for( int i=0; i<cpds.length; i++ )
+ {
+ ClasspathDirective cpd = cpds[i];
+ URI[] uris = cpd.getURIs();
+ URL[] urls = urisToURLs( uris );
+ parent = new URLClassLoader( urls, parent );
+ }
+ return parent;
+ }
+
+ private URL[] urisToURLs( URI[] uris )
+ {
+ URL[] urls = new URL[ uris.length ];
+ for( int i=0; i<uris.length; i++ )
+ {
+ URI uri = uris[i];
+ urls[i] = uriToURL( uri );
+ }
+ return urls;
+ }
+
+ private URL uriToURL( URI uri )
+ {
+ try
+ {
+ if( "artifact".equals( uri.getScheme() ) )
+ {
+ String spec = uri.toString();
+ return new URL( null, spec, new Handler() );
+ }
+ else
+ {
+ return uri.toURL();
+ }
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException( e.toString() );
+ }
+ }
+
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
Sat Apr 2 04:34:03 2005
@@ -83,8 +83,6 @@

private final Map m_map = new Hashtable();

- //private final DeliveryDescriptor m_delivery;
-
//==============================================================
// constructor
//==============================================================

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
Sat Apr 2 04:34:03 2005
@@ -30,6 +30,7 @@
import java.util.Map;
import java.util.Set;

+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;

@@ -375,13 +376,12 @@

try
{
- ClasspathDirective classpathDirective =
- profile.getClasspathDirective();
+ ClassLoaderDirective cld =
+ profile.getClassLoaderDirective();

ClassLoaderContext classLoaderContext =
new DefaultClassLoaderContext(
- logger, m_context.getSystemContext(), root,
- classpathDirective );
+ logger, m_context.getSystemContext(), root, cld );

long now = System.currentTimeMillis();


Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
Sat Apr 2 04:34:03 2005
@@ -18,6 +18,11 @@

package net.dpml.composition.model.impl;

+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
@@ -33,6 +38,7 @@
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
import net.dpml.composition.model.ProfileUnknownException;
+import net.dpml.composition.model.TypeRuntimeException;

import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
@@ -44,6 +50,7 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Type;
+import net.dpml.meta.info.builder.TypeHolder;


/**
@@ -227,9 +234,56 @@
{
throw new NullArgumentException( "clazz" );
}
- return getType( clazz.getName() );
+ try
+ {
+ return getType( clazz.getName() );
+ }
+ catch( TypeUnknownException e )
+ {
+ Type type = loadDynamicType( clazz );
+ if( null == type )
+ {
+ throw e;
+ }
+ else
+ {
+ String classname = type.getInfo().getClassname();
+ m_profiles.put( classname, new ProfilePackage() ); // <----
TODO: check for serialized profiles
+ m_types.put( classname, type );
+ return type;
+ }
+ }
+ }
+
+ private Type loadDynamicType( Class clazz )
+ {
+ String path = clazz.getName().replace( '.', '/' ) + ".type";
+ URL url = clazz.getClassLoader().getResource( path );
+ if( null == url )
+ {
+ return null;
+ }
+ try
+ {
+ InputStream input = url.openStream();
+ ObjectInputStream stream = new ObjectInputStream( input );
+ TypeHolder holder = (TypeHolder) stream.readObject();
+ byte[] bytes = holder.getByteArray();
+ ByteArrayInputStream byteinput = new ByteArrayInputStream( bytes
);
+ ObjectInputStream bytestream = new ObjectInputStream( byteinput
);
+ return (Type) bytestream.readObject();
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error occured while attempting to load a type from
the path ["
+ + path
+ + "]";
+ throw new TypeRuntimeException( error, e );
+ }
}

+
/**
* Locate a {@link Type} instances associated with the
* supplied implementation classname.
@@ -260,6 +314,7 @@
}

Type type = (Type) m_types.get( classname );
+
if( type == null )
{
final String error =

Modified:
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
==============================================================================
---
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
(original)
+++
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
Sat Apr 2 04:34:03 2005
@@ -23,8 +23,7 @@

import net.dpml.system.SystemContext;

-import net.dpml.composition.data.ClasspathDirective;
-
+import net.dpml.composition.data.ClassLoaderDirective ;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.ServiceRepository;

@@ -73,12 +72,12 @@
ClassLoader getClassLoader();

/**
- * Return the path directive to be applied to the
+ * Return the classloader directive to be applied to the
* classloader model.
*
* @return the classloader directive
*/
- ClasspathDirective getClasspathDirective();
+ ClassLoaderDirective getClassLoaderDirective();

/**
* Return the type repository established by the parent classloader.

Modified: development/main/metro/composition/testing/acme/build.xml
==============================================================================
--- development/main/metro/composition/testing/acme/build.xml (original)
+++ development/main/metro/composition/testing/acme/build.xml Sat Apr 2
04:34:03 2005
@@ -14,6 +14,23 @@
<type class="net.dpml.composition.testing.CompositeGizmo"/>
</types>

+ <!-- experimental -->
+ <component xmlns="plugin:dpml/composition/dpml-composition-builder"
+ name="gizmo" class="net.dpml.composition.testing.CompositeGizmo">
+ <parts>
+ <component key="widget"
class="net.dpml.composition.testing.DefaultWidget">
+ <context>
+ <entry key="foo" value="bar"/>
+ <entry key="width" value="12"/>
+ <entry key="height" value="100"/>
+ <entry key="name" value="urn:metro:name"/>
+ <entry key="partition" value="urn:metro:partition"/>
+ <entry key="workingDirectory" value="acme/workspace"/>
+ </context>
+ </component>
+ </parts>
+ </component>
+
</target>

<!--

Modified:
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
==============================================================================
---
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
(original)
+++
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
Sat Apr 2 04:34:03 2005
@@ -56,6 +56,10 @@
{
m_context = context;
m_logger = logger;
+
+ String name = m_context.getName();
+ String partition = m_context.getPartition();
+ File work = m_context.getWorkingDirectory();
}

//------------------------------------------------------------------
@@ -74,13 +78,10 @@
+ width
+ " and a height of "
+ height );
-
- File work = m_context.getWorkingDirectory();
- m_logger.info( "working dir: " + work );
}

//------------------------------------------------------------------
- // facards
+ // concerns
//------------------------------------------------------------------

public interface Context

Modified: development/main/metro/composition/testing/system/build.xml
==============================================================================
--- development/main/metro/composition/testing/system/build.xml (original)
+++ development/main/metro/composition/testing/system/build.xml Sat Apr 2
04:34:03 2005
@@ -6,6 +6,7 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
+ <x:filter key="dpml-system-impl" feature="plugin"
token="SYSTEM-PLUGIN-URI"/>
<x:property key="dpml-composition-testing-acme" feature="uri"
type="part" name="acme.part"/>
<filter token="ACME-PART-URI" value="${acme.part}"/>
</target>

Modified:
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
==============================================================================
---
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
(original)
+++
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
Sat Apr 2 04:34:03 2005
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Stephen J. McConnell
+ * Copyright 2005 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,61 +19,111 @@
package net.dpml.composition.testing;

import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
+import java.io.IOException;
+
import java.net.URI;
+import java.net.URL;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import net.dpml.system.SystemCriteria;
+import net.dpml.system.SystemContext;
+import net.dpml.system.SystemContextFactory;
+
+import net.dpml.transit.artifact.Artifact;
+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;

import net.dpml.control.Model;

import net.dpml.composition.control.CompositionManager;

-import junit.framework.TestCase;
-

/**
- * Kernel testcase.
+ * Creation of a new system context from which we will create the model
management
+ * environment.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
- * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ * @version $Id: CompositionTestCase.java 363 2004-11-04 15:06:34Z mcconnell
$
*/
public class CompositionManagerTestCase extends TestCase
{
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------
// state
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------

private CompositionManager m_manager;
- private Model m_model;

- //--------------------------------------------------------------------
- // TestCase
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------
+ // setup
+ //------------------------------------------------------------------

public void setUp() throws Exception
{
- m_manager = new CompositionManager();
- m_model = m_manager.addPart( ACME_PART_URI );
- System.out.println( "#model: " + m_model );
+ SystemContext system = createSystemContext( new Hashtable() );
+ m_manager = new CompositionManager( system );
+ }
+
+ //------------------------------------------------------------------
+ // test
+ //------------------------------------------------------------------
+
+ public void testSomething() throws Exception
+ {
+ CompositionManager manager = getCompositionManager();
+ Model model = manager.addPart( ACME_PART_URI );
+ manager.list();
}

- public void testSetName() throws Exception
+ //------------------------------------------------------------------
+ // internal
+ //------------------------------------------------------------------
+
+ protected CompositionManager getCompositionManager()
{
- String name = "demo";
- m_model.setName( name );
- assertEquals( "name", name, m_model.getName() );
+ return m_manager;
}

- //--------------------------------------------------------------------
- // static utilities for testcase
- //--------------------------------------------------------------------
+ /**
+ * Setup the system context.
+ *
+ * @param map a map of supplimentary factory criteria that will be
+ * applied to the system context factory
+ */
+ private SystemContext createSystemContext( Map map )
+ throws Exception
+ {
+ ClassLoader classloader =
CompositionManagerTestCase.class.getClassLoader();
+ Repository repository = new StandardLoader();
+ SystemContextFactory factory =
+ (SystemContextFactory) repository.getPlugin( classloader,
SYSTEM_PLUGIN_URI, new Object[]{ map } );
+ SystemCriteria criteria = factory.createDefaultSystemCriteria();
+
+ File work = getWorkingDir();
+ criteria.setWorkingDirectory( work );
+ criteria.setAnchorDirectory( work );
+ return factory.createSystemContext( criteria );
+ }

- static
+ private File getWorkingDir()
{
- System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ String dir = System.getProperty( "project.test.dir" );
+ try
+ {
+ return new File( dir ).getCanonicalFile();
+ }
+ catch( IOException e )
+ {
+ return new File( dir );
+ }
}

private static final URI ACME_PART_URI = createStaticURI(
"@ACME-PART-URI@" );
+ private static final URI SYSTEM_PLUGIN_URI = createStaticURI(
"@SYSTEM-PLUGIN-URI@" );

private static URI createStaticURI( String path )
{

Modified: development/main/metro/composition/testing/unit/build.xml
==============================================================================
--- development/main/metro/composition/testing/unit/build.xml (original)
+++ development/main/metro/composition/testing/unit/build.xml Sat Apr 2
04:34:03 2005
@@ -16,7 +16,7 @@
Setup a container part to test basic context and dependency handling.
-->
<container xmlns="plugin:dpml/composition/dpml-composition-builder"
name="acme"
- dest="target/test/acme-classic.part">
+ dest="target/test/acme-container.part">
<component name="widget"
class="net.dpml.composition.testing.DefaultWidget">
<context>
<entry key="foo" value="bar"/>
@@ -35,27 +35,42 @@
</container>

<!--
- Setup a container dealing with experimental part handling. In the future
this
- will be updated so that no container is required and the component part
will
- be added directly.
+ Look dad - no container!
-->
- <container xmlns="plugin:dpml/composition/dpml-composition-builder"
- name="acme" dest="target/test/acme-composite.part">
- <component name="gizmo"
class="net.dpml.composition.testing.CompositeGizmo">
- <parts>
- <component key="widget"
class="net.dpml.composition.testing.DefaultWidget">
- <context>
+ <component xmlns="plugin:dpml/composition/dpml-composition-builder"
+ dest="target/test/acme-widget.part"
+ name="widget" class="net.dpml.composition.testing.DefaultWidget"
+ activation="true">
+ <context>
+ <entry key="foo" value="bar"/>
+ <entry key="width" value="12"/>
+ <entry key="height" value="100"/>
+ <entry key="name" value="urn:metro:name"/>
+ <entry key="partition" value="urn:metro:partition"/>
+ <entry key="workingDirectory" value="acme/workspace"/>
+ </context>
+ </component>
+
+ <!--
+ Setup a component dealing with experimental part handling.
+ -->
+ <component xmlns="plugin:dpml/composition/dpml-composition-builder"
+ name="gizmo"
+ class="net.dpml.composition.testing.CompositeGizmo"
+ dest="target/test/acme-gizmo.part">
+ <parts>
+ <component key="widget"
class="net.dpml.composition.testing.DefaultWidget">
+ <context>
<entry key="foo" value="bar"/>
<entry key="width" value="12"/>
<entry key="height" value="100"/>
<entry key="name" value="urn:metro:name"/>
<entry key="partition" value="urn:metro:partition"/>
<entry key="workingDirectory" value="acme/workspace"/>
- </context>
- </component>
- </parts>
- </component>
- </container>
+ </context>
+ </component>
+ </parts>
+ </component>

</target>


Copied:
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeGizmoTestCase.java
(from r2187,
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeTestCase.java)
==============================================================================
---
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeTestCase.java
(original)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/CompositeGizmoTestCase.java
Sat Apr 2 04:34:03 2005
@@ -25,15 +25,15 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.ContainmentModel;

-import net.dpml.exception.ExceptionHelper;
+import net.dpml.composition.testing.Gizmo;

/**
* The testcase validates the new metro component model part loading and
deployment
* (which is currently not operational).
*/
-public class CompositeTestCase extends CompositionTestCase
+public class CompositeGizmoTestCase extends CompositionTestCase
{
- private static final String FILENAME = "acme-composite.part";
+ private static final String FILENAME = "acme-gizmo.part";

private URI m_uri;

@@ -58,7 +58,7 @@
{
DeploymentModel test = getRoot().addModel( m_uri );
test.commission();
- Object object = test.resolve( false );
- test.release( object );
+ Gizmo gizmo = (Gizmo) test.resolve();
+ test.release( gizmo );
}
}

Copied:
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/ContainerTestCase.java
(from r2187,
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/SimpleTestCase.java)
==============================================================================
---
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/SimpleTestCase.java
(original)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/ContainerTestCase.java
Sat Apr 2 04:34:03 2005
@@ -30,9 +30,9 @@
/**
* The testcase validates the new metro container model part loading and
deployment.
*/
-public class SimpleTestCase extends CompositionTestCase
+public class ContainerTestCase extends CompositionTestCase
{
- private static final String FILENAME = "acme-classic.part";
+ private static final String FILENAME = "acme-container.part";

private URI m_uri;


Added:
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/WidgetTestCase.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/test/WidgetTestCase.java
Sat Apr 2 04:34:03 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.test;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.metro.unit.CompositionTestCase;
+import net.dpml.composition.model.DeploymentModel;
+import net.dpml.composition.testing.Widget;
+
+/**
+ * The testcase validates the new metro container model part loading and
deployment.
+ */
+public class WidgetTestCase extends CompositionTestCase
+{
+ private static final String FILENAME = "acme-widget.part";
+
+ private URI m_uri;
+
+ public void setUp() throws Exception
+ {
+ super.setupCompositionRoot();
+ File base = new File( System.getProperty( "project.test.dir" ) );
+ File file = new File( base, FILENAME );
+ m_uri = file.toURI();
+ }
+
+ public void tearDown() throws Exception
+ {
+ getRoot().decommission();
+ }
+
+ /**
+ * Validate that the hello component is deployable and resolvable.
+ * @exception if a deployment error occurs
+ */
+ public void testWidget() throws Throwable
+ {
+ DeploymentModel model = getRoot().addModel( m_uri );
+ model.commission();
+ Widget widget = (Widget) model.resolve();
+ widget.doWidgetTypeStuff();
+ model.release( widget );
+ }
+}

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Sat Apr 2 04:34:03 2005
@@ -480,12 +480,14 @@
<status>SNAPSHOT</status>
<types>
<type>jar</type>
+ <type>plugin</type>
</types>
</info>
<dependencies>
- <include key="dpml-transit-main"/>
- <include key="dpml-automation-control"/>
- <include key="dpml-composition-api"/>
+ <include key="dpml-transit-main" tag="api"/>
+ <include key="dpml-automation-control" tag="spi"/>
+ <include key="dpml-composition-api" tag="spi"/>
+ <include key="dpml-system-api" tag="spi"/>
</dependencies>
</project>

@@ -504,6 +506,7 @@
<include key="dpml-logging-api"/>
<include key="dpml-composition-control"/>
<include key="dpml-composition-testing-acme"/>
+ <include key="dpml-system-impl" runtime="false"/>
</dependencies>
<plugins>
<include key="dpml-composition-builder"/>
@@ -540,7 +543,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-composition-testing-acme" test="false"
runtime="true"/>
+ <include key="dpml-composition-testing-acme" runtime="true"/>
<include key="dpml-metro-unit"/>
</dependencies>
<plugins>

Modified: development/main/metro/module.xml
==============================================================================
--- development/main/metro/module.xml (original)
+++ development/main/metro/module.xml Sat Apr 2 04:34:03 2005
@@ -162,6 +162,9 @@
<package name="net.dpml.activity"/>
</group>
<group title="Protected API">
+ <package name="net.dpml.part"/>
+ <package name="net.dpml.control"/>
+ <package name="net.dpml.builder"/>
<package name="net.dpml.composition.data"/>
<package name="net.dpml.composition.event"/>
<package name="net.dpml.composition.info"/>
@@ -173,6 +176,7 @@
<package name="net.dpml.metro"/>
<package name="net.dpml.metro.unit"/>
<package name="net.dpml.meta.info.ant"/>
+ <package name="net.dpml.composition.builder"/>
</group>
<group title="Private API">
<package name="net.dpml.*"/>

Modified: development/main/metro/system/impl/build.xml
==============================================================================
--- development/main/metro/system/impl/build.xml (original)
+++ development/main/metro/system/impl/build.xml Sat Apr 2 04:34:03
2005
@@ -6,7 +6,7 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
- <x:filter key="dpml-logging-logkit-impl" feature="plugin"
token="DEFAULT_LOGGING_PLUGIN"/>
+ <x:filter key="dpml-logging-logkit-impl" feature="plugin"
token="DEFAULT-LOGGING-PLUGIN-SPEC"/>
<x:filter feature="plugin" token="SYSTEM_PLUGIN_URI"/>
</target>


Modified: development/main/metro/system/impl/etc/main/system.properties
==============================================================================
--- development/main/metro/system/impl/etc/main/system.properties
(original)
+++ development/main/metro/system/impl/etc/main/system.properties Sat
Apr 2 04:34:03 2005
@@ -1,12 +1,12 @@

#
-# Metro static parameters.
+# System context static parameters.
#
# The following parameters are the default properties used in
# the system context criteria creation phase.
#

-dpml.system.logging.artifact = @DEFAULT_LOGGING_PLUGIN@
+dpml.system.logging.artifact = @DEFAULT-LOGGING-PLUGIN-SPEC@
dpml.system.anchor = ${dpml.home}/lib

#

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
Sat Apr 2 04:34:03 2005
@@ -67,19 +67,6 @@
// constructors
//
------------------------------------------------------------------------

- /*
- DefaultSystemContext(
- final Repository repository, final LoggingManager logging,
- final Logger logger, final File home, final File work, final File
anchor, final File temp,
- final boolean info, final boolean debug, final boolean isolate,
String[] remainder,
- final Properties properties )
- throws NullArgumentException
- {
- this( repository, logging, logger, home, work, anchor, temp, info,
debug, isolate, false,
- remainder, properties );
- }
- */
-
DefaultSystemContext(
final Repository repository, final LoggingManager logging,
final Logger logger, final File home, final File work, final File
anchor, final File temp,

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
Sat Apr 2 04:34:03 2005
@@ -123,8 +123,14 @@
m_params = map;

Boolean debug = (Boolean) map.get( "urn:transit.debug.policy" );
- assertNotNull( "urn:transit.debug.policy", debug );
- m_DebugMode = debug.booleanValue();
+ if( null == debug )
+ {
+ m_DebugMode = false;
+ }
+ else
+ {
+ m_DebugMode = debug.booleanValue();
+ }

Options options = buildCommandLineOptions();
ArgumentHandler handler = new ArgumentHandler( args );
@@ -558,24 +564,6 @@
options.addOptionGroup( onlineMode );

//
- // timestamp switches
- //
-
- // timestamp options no longer relevant because they have been moved
- // to per host
- //
- //OptionGroup timestamp = new OptionGroup();
- //timestamp.addOption(
- // new Option( "fast", REZ.getString( "cli-fast-description" ) ) );
- //timestamp.addOption(
- // new Option( "snapshot", REZ.getString(
"cli-snapshot-description" ) ) );
- //timestamp.addOption(
- // new Option( "timestamp", REZ.getString(
"cli-timestamp-description" ) ) );
- //timestamp.addOption(
- // new Option( "overwrite", REZ.getString(
"cli-overwrite-description" ) ) );
- //options.addOptionGroup( timestamp );
-
- //
// parameters
//


Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
Sat Apr 2 04:34:03 2005
@@ -50,6 +50,8 @@
// static
//--------------------------------------------------------------

+ private static final String DEFAULT_LOGGING_PLUGIN_SPEC =
"@DEFAULT-LOGGING-PLUGIN-SPEC@";
+
public static final String[] KEYS =
new String[]{
SystemContext.LOGGING_IMPLEMENTATION_KEY,
@@ -366,9 +368,9 @@
{
try
{
- return file.toURL();
+ return file.toURI().toURL();
}
- catch( IOException e )
+ catch( Exception e )
{
final String error =
"Error while attempting to convert the file ["
@@ -403,7 +405,7 @@
Object object = get( SystemContext.LOGGING_IMPLEMENTATION_KEY );
if( null == object )
{
- return null;
+ return convertToURI( DEFAULT_LOGGING_PLUGIN_SPEC );
}
else if( object instanceof URI )
{



  • svn commit: r2189 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro automation/control/src/main/net/dpml/control composition/api/src/main/net/dpml/composition/data composition/api/src/test/net/dpml/composition/data/test composition/builder/src/main/net/dpml/composition/builder composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/spi/src/main/net/dpml/composition/provider composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/system composition/testing/system/src/test/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/test system/impl system/impl/etc/main system/impl/src/main/net/dpml/system/impl, mcconnell, 04/01/2005

Archive powered by MHonArc 2.6.24.

Top of Page