Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2267 - in development/main/metro: . automation/control/src/main/net/dpml/automation/control composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit

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: r2267 - in development/main/metro: . automation/control/src/main/net/dpml/automation/control composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit
  • Date: Mon, 11 Apr 2005 20:56:58 -0400

Author: mcconnell AT dpml.net
Date: Mon Apr 11 20:56:57 2005
New Revision: 2267

Added:

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

development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
- copied, changed from r2260,
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java

development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
- copied, changed from r2261,
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java

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

development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/SimpleWidget.java
- copied, changed from r2262,
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetValue.java
Removed:

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

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

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

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

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

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

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

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

development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetValue.java
Modified:

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

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.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/ContextInvocationHandler.java

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

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

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

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

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

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

development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
development/main/metro/composition/testing/acme/build.xml
development/main/metro/composition/testing/unit/build.xml
development/main/metro/module.xml
Log:
Improvement to model internals - separation and simplification of internal
concerns.

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Disposable.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Disposable.java
Mon Apr 11 20:56:57 2005
@@ -0,0 +1,37 @@
+/*
+ * 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.automation.control;
+
+import java.net.URI;
+
+import net.dpml.automation.part.Part;
+
+/**
+ * Common interface implemented by disposable objects.
+ *
+ * @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 interface Disposable
+{
+ /**
+ * Dispose of the object.
+ */
+ void dispose();
+}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
Mon Apr 11 20:56:57 2005
@@ -24,11 +24,11 @@
import java.lang.reflect.UndeclaredThrowableException;
import java.lang.reflect.Method;

+import net.dpml.automation.control.Disposable;
import net.dpml.automation.control.LifecycleException;

-import net.dpml.composition.models.StandardComponentModel;
-
-import net.dpml.logging.Logger;
+import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.Holder;

/**
* The ApplianceInvocationHandler class represents an instance of a
component.
@@ -38,8 +38,8 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
*/
-public final class ApplianceInvocationHandler
- implements InvocationHandler
+final class ApplianceInvocationHandler
+ implements InvocationHandler, Disposable
{
//-------------------------------------------------------------------
// state

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
Mon Apr 11 20:56:57 2005
@@ -30,7 +30,7 @@
* @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 CompositionClassLoader extends URLClassLoader
+class CompositionClassLoader extends URLClassLoader
{
//--------------------------------------------------------------------
// state

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
Mon Apr 11 20:56:57 2005
@@ -49,6 +49,8 @@
import net.dpml.automation.control.PartNotFoundException;
import net.dpml.automation.control.EntryNotFoundException;
import net.dpml.automation.control.ControlException;
+import net.dpml.automation.control.Disposable;
+
import net.dpml.automation.model.ModelException;
import net.dpml.automation.model.Model;

@@ -56,8 +58,10 @@
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ValueDirective;
-import net.dpml.composition.models.StandardComponentModel;
+
+import net.dpml.composition.models.CompositionModel;
import net.dpml.composition.models.ValueModel;
+import net.dpml.composition.models.Holder;

import net.dpml.system.SystemContext;

@@ -72,6 +76,12 @@
public class CompositionController extends CompositionPartHandler implements
Controller
{
//--------------------------------------------------------------------
+ // static
+ //--------------------------------------------------------------------
+
+ public static final String SELF = "self";
+
+ //--------------------------------------------------------------------
// state
//--------------------------------------------------------------------

@@ -79,21 +89,21 @@
private final SystemContext m_system;
private final LifecycleHandler m_factory;
private final LifestyleHandler m_handler;
- private final URI m_partition; // the root
+ private final URI m_partition;

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

- public CompositionController( Monitor monitor, SystemContext system, URI
partition )
+ CompositionController( Monitor monitor, SystemContext system, URI
partition )
{
super();
m_monitor = monitor;
m_system = system;
m_partition = partition;

+ m_handler = new LifestyleHandler( monitor );
m_factory = new LifecycleHandler( monitor, system );
- m_handler = new LifestyleHandler( monitor, m_factory );
}

//--------------------------------------------------------------------
@@ -196,9 +206,9 @@

public Entry getEntry( Model model, URI uri ) throws
EntryNotFoundException
{
- if( model instanceof StandardComponentModel )
+ if( model instanceof CompositionModel )
{
- StandardComponentModel standard = (StandardComponentModel) model;
+ CompositionModel standard = (CompositionModel) model;
return standard.getEntry( uri );
}
else
@@ -238,7 +248,8 @@
* @param key the key to assign to the model
* @return the model
*/
- public Model getModel( Model model, ClassLoader classloader, Part part,
String key ) throws DelegationException, ModelException
+ public Model getModel( Model model, ClassLoader classloader, Part part,
String key )
+ throws DelegationException, ModelException
{
if( part instanceof ComponentProfile )
{
@@ -248,11 +259,11 @@
ClassLoader parent = getClassLoader( partition, classloader,
profile );
if( null == model )
{
- return new StandardComponentModel( this, partition, parent,
profile, key );
+ return new CompositionModel( this, partition, parent,
profile, key );
}
else
{
- return new StandardComponentModel( this, model, partition,
parent, profile, key );
+ return new CompositionModel( this, model, partition, parent,
profile, key );
}
}
else if( part instanceof ValueDirective )
@@ -350,17 +361,14 @@
*/
public Entry create( Model model ) throws Exception
{
- if( model instanceof StandardComponentModel )
+ if( model instanceof CompositionModel )
{
- StandardComponentModel standard = (StandardComponentModel) model;
+ CompositionModel standard = (CompositionModel) model;
return getHolder( standard, null );
}
else if( model instanceof ValueModel )
{
- ValueModel value = (ValueModel) model;
- URI uri = value.getURI();
- Object v = value.getValue();
- return new ValueHolder( uri, v );
+ return model;
}
else
{
@@ -377,9 +385,9 @@
*/
public Entry create( Model model, Object key ) throws Exception
{
- if( model instanceof StandardComponentModel )
+ if( model instanceof CompositionModel )
{
- StandardComponentModel standard = (StandardComponentModel) model;
+ CompositionModel standard = (CompositionModel) model;
return getHolder( standard, key );
}
else
@@ -397,11 +405,12 @@
*/
public Object resolve( Model model ) throws Exception
{
- if( model instanceof StandardComponentModel )
+ if( model instanceof CompositionModel )
{
- StandardComponentModel standard = (StandardComponentModel) model;
+ CompositionModel standard = (CompositionModel) model;
Holder holder = getHolder( standard, null );
- return holder.newProxy();
+ InvocationHandler handler = new ApplianceInvocationHandler(
holder );
+ return holder.getProxy( handler );
}
else if( model instanceof ValueModel )
{
@@ -432,11 +441,12 @@
{
throw new NullPointerException( "key" );
}
- if( model instanceof StandardComponentModel )
+ if( model instanceof CompositionModel )
{
- StandardComponentModel componentModel = (StandardComponentModel)
model;
+ CompositionModel componentModel = (CompositionModel) model;
Holder holder = getHolder( componentModel , key );
- return holder.newProxy();
+ InvocationHandler handler = new ApplianceInvocationHandler(
holder );
+ return holder.getProxy( handler );
}
else
{
@@ -467,6 +477,32 @@
}
}

+ public Object incarnate( Holder holder ) throws LifecycleException,
InvocationTargetException
+ {
+ return m_factory.incarnate( holder );
+ }
+
+ public void etherialize( Object instance )
+ {
+ if( null == instance )
+ {
+ return;
+ }
+ else if( Proxy.isProxyClass( instance.getClass() ) )
+ {
+ Object handler = Proxy.getInvocationHandler( instance );
+ if( handler instanceof Disposable )
+ {
+ Disposable disposable = (Disposable) handler;
+ disposable.dispose();
+ }
+ }
+ else
+ {
+ m_factory.etherialize( instance );
+ }
+ }
+
//--------------------------------------------------------------------
// CompositionController
//--------------------------------------------------------------------
@@ -480,7 +516,7 @@
return this;
}

- public Logger getLogChannel( StandardComponentModel model )
+ public Logger getLogChannel( CompositionModel model )
{
URI uri = model.getURI();
String path = model.getURI().getSchemeSpecificPart();
@@ -488,7 +524,7 @@
return Logger.getLogger( channel );
}

- public Object getLoggingChannel( StandardComponentModel model )
+ public Object getLoggingChannel( CompositionModel model )
{
URI uri = model.getURI();
String path = model.getURI().getSchemeSpecificPart();
@@ -521,7 +557,7 @@
// private
//--------------------------------------------------------------------

- private Holder getHolder( StandardComponentModel model, Object key )
throws LifecycleException, InvocationTargetException
+ private Holder getHolder( CompositionModel model, Object key ) throws
LifecycleException, InvocationTargetException
{
if( null == key )
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
Mon Apr 11 20:56:57 2005
@@ -34,8 +34,10 @@
import net.dpml.automation.model.ModelException;
import net.dpml.automation.model.Model;

-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.CompositionModel;
import net.dpml.composition.models.ValueModel;
+import net.dpml.composition.models.Holder;
+
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.ImportDirective;
import net.dpml.composition.data.ValueDirective;
@@ -51,7 +53,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
*/
-public class ContextInvocationHandler
+class ContextInvocationHandler
implements InvocationHandler
{
//-------------------------------------------------------------------
@@ -78,7 +80,7 @@
* @param system the system context
* @param model the component model
*/
- public ContextInvocationHandler( SystemContext system, Holder holder )
+ ContextInvocationHandler( SystemContext system, Holder holder )
throws LifecycleException, ModelException
{
m_system = system;
@@ -89,7 +91,7 @@
// implementation
//-------------------------------------------------------------------

- StandardComponentModel getComponentModel()
+ CompositionModel getModel()
{
return m_holder.getModel();
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
Mon Apr 11 20:56:57 2005
@@ -34,9 +34,11 @@
import net.dpml.automation.model.ModelException;
import net.dpml.automation.model.Model;

-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.CompositionModel;
import net.dpml.composition.models.ValueModel;
import net.dpml.composition.models.EntryTable;
+import net.dpml.composition.models.Holder;
+
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.ImportDirective;
import net.dpml.composition.data.ValueDirective;
@@ -52,7 +54,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
*/
-public final class ContextManagerInvocationHandler extends
ContextInvocationHandler
+final class ContextManagerInvocationHandler extends ContextInvocationHandler
{
//-------------------------------------------------------------------
// constructor
@@ -64,7 +66,7 @@
* @param system the system context
* @param model the component model
*/
- public ContextManagerInvocationHandler(
+ ContextManagerInvocationHandler(
SystemContext system, Holder holder )
throws LifecycleException, ModelException
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
Mon Apr 11 20:56:57 2005
@@ -29,7 +29,8 @@
import net.dpml.automation.control.LifecycleRuntimeException;
import net.dpml.automation.control.Monitor;

-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.Holder;

import net.dpml.meta.info.Type;

@@ -46,7 +47,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: LifestyleManager.java 259 2004-10-30 07:24:40Z mcconnell $
*/
-public class LifecycleHandler
+class LifecycleHandler
{
public static Class getInnerClass( Class subject, String postfix )
{
@@ -71,7 +72,7 @@
private final Monitor m_monitor;
private final SystemContext m_system;

- public LifecycleHandler( Monitor monitor, SystemContext system )
+ LifecycleHandler( Monitor monitor, SystemContext system )
{
m_monitor = monitor;
m_system = system;
@@ -93,7 +94,7 @@
+ "].";
getMonitor().debug( message );
}
- StandardComponentModel model = holder.getModel();
+ CompositionModel model = holder.getModel();
URI uri = holder.getURI();

Class subject = model.getDeploymentClass();

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
Mon Apr 11 20:56:57 2005
@@ -23,7 +23,8 @@
import net.dpml.automation.control.LifecycleException;
import net.dpml.automation.control.Monitor;

-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.Holder;

/**
* A lifestyle handler provides support for the aquisition and release
@@ -34,17 +35,13 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: LifestyleManager.java 259 2004-10-30 07:24:40Z mcconnell $
*/
-public class LifestyleHandler
+class LifestyleHandler
{
- public static final String SELF = "self";
-
- private final LifecycleHandler m_handler;
private Monitor m_monitor;

- public LifestyleHandler( Monitor monitor, LifecycleHandler handler )
+ LifestyleHandler( Monitor monitor )
{
m_monitor = monitor;
- m_handler = handler;
}

/**
@@ -53,7 +50,7 @@
* @param model the model from which new or existing instances will be
resolved
* @return the key to the resolved instance
*/
- public Holder aquire( StandardComponentModel model ) throws
LifecycleException, InvocationTargetException
+ public Holder aquire( CompositionModel model ) throws
LifecycleException, InvocationTargetException
{
final String lifestyle = model.getLifestylePolicy();
if( getMonitor().isDebugEnabled() )
@@ -70,7 +67,7 @@
{
synchronized( model )
{
- Holder holder = new Holder( m_monitor, m_handler, model,
null );
+ Holder holder = new Holder( m_monitor, model, null );
Object key = holder.getKey();
if( getMonitor().isDebugEnabled() )
{
@@ -80,7 +77,7 @@
+ "].";
getMonitor().debug( message );
}
- model.put( holder );
+ model.getInstanceTable().add( holder );
return holder;
}
}
@@ -92,7 +89,7 @@
{
synchronized( model )
{
- String key = SELF;
+ String key = CompositionController.SELF;
return aquire( model, key );
}
}
@@ -115,9 +112,9 @@
* @param model the model from which new or existing instances will be
resolved
* @return the key to the resolved instance
*/
- public Holder aquire( StandardComponentModel model, Object key ) throws
LifecycleException, InvocationTargetException
+ public Holder aquire( CompositionModel model, Object key ) throws
LifecycleException, InvocationTargetException
{
- Holder holder = model.get( key );
+ Holder holder = model.getInstanceTable().get( key );
if( null == holder )
{
if( getMonitor().isDebugEnabled() )
@@ -128,7 +125,7 @@
+ "].";
getMonitor().debug( message );
}
- holder = new Holder( m_monitor, m_handler, model, key );
+ holder = new Holder( m_monitor, model, key );
if( getMonitor().isDebugEnabled() )
{
final String message =
@@ -137,7 +134,7 @@
+ "].";
getMonitor().debug( message );
}
- model.put( holder );
+ model.getInstanceTable().add( holder );
}
else
{
@@ -153,7 +150,7 @@
return holder;
}

- public void release( StandardComponentModel model, Object key )
+ public void release( CompositionModel model, Object key )
{
final String lifestyle = model.getLifestylePolicy();
if( getMonitor().isDebugEnabled() )
@@ -166,7 +163,7 @@
+ "].";
getMonitor().debug( message );
}
- model.remove( key );
+ model.getInstanceTable().remove( key );
}

private Monitor getMonitor()

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
Mon Apr 11 20:56:57 2005
@@ -35,7 +35,8 @@
import net.dpml.automation.control.DelegationException;
import net.dpml.automation.model.Model;

-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.Holder;

import net.dpml.system.SystemContext;

@@ -54,7 +55,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
*/
-public final class PartsInvocationHandler
+final class PartsInvocationHandler
implements InvocationHandler
{
//-------------------------------------------------------------------
@@ -80,7 +81,7 @@
*
* @param model the component model
*/
- public PartsInvocationHandler( SystemContext system, Holder holder )
+ PartsInvocationHandler( SystemContext system, Holder holder )
throws NullPointerException
{
m_holder = holder;
@@ -116,7 +117,7 @@
}
}

- StandardComponentModel getComponentModel()
+ CompositionModel getComponentModel()
{
return m_holder.getModel();
}
@@ -215,9 +216,9 @@
+ "] is not an interface.";
throw new IllegalStateException( error );
}
- if( provider instanceof StandardComponentModel )
+ if( provider instanceof CompositionModel )
{
- StandardComponentModel standard =
(StandardComponentModel) provider;
+ CompositionModel standard = (CompositionModel) provider;
Controller controller = standard.getController();
Holder holder = (Holder) controller.create( standard );
SystemContext system = getSystemContext();

Copied:
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
(from r2260,
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java)
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
Mon Apr 11 20:56:57 2005
@@ -45,9 +45,8 @@
import net.dpml.composition.data.ValueDirective;
import net.dpml.composition.data.DependencyDirective;
import net.dpml.composition.data.ReferenceDirective;
-import net.dpml.composition.control.CompositionClassLoader;
+
import net.dpml.composition.control.CompositionController;
-import net.dpml.composition.control.Holder;

import net.dpml.meta.info.Type;
import net.dpml.meta.info.ServiceDescriptor;
@@ -61,21 +60,19 @@
* @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 extends AbstractModel implements Model,
Serializable
+public class CompositionModel extends AbstractModel implements Model,
Serializable
{
+ private final List m_errors = new LinkedList();
+
private final ComponentProfile m_profile;
private final ClassLoader m_classloader;
private final URI m_partition;
- private final PartsModel m_parts;
+ private final EntryTable m_parts;
private final EntryTable m_context;
- private final List m_errors = new LinkedList();
-
+ private final InstanceTable m_instances;
private final Class m_class;
private final Type m_type;
private final Class[] m_interfaces;
-
- private final Map m_holders = new WeakHashMap();
-
private final String m_lifestyle;
private final URI m_uri;

@@ -88,7 +85,7 @@
* @param profile the component profile from which initial default values
are established
* @param name the name of the model
*/
- public StandardComponentModel(
+ public CompositionModel(
CompositionController controller, URI partition, ClassLoader
classloader, ComponentProfile profile, String name )
throws DelegationException, ModelException
{
@@ -112,7 +109,7 @@
* @param profile the component profile from which initial default values
are established
* @param name the name of the model
*/
- public StandardComponentModel(
+ public CompositionModel(
CompositionController controller, Model parent, URI partition,
ClassLoader classloader,
ComponentProfile profile, String name )
throws DelegationException, ModelException
@@ -125,6 +122,9 @@

m_uri = CompositionController.createURI( partition, name );
m_class = loadComponentClass( classloader, profile );
+ m_parts = new EntryTable( this, parent );
+ m_context = new EntryTable( this, parent );
+ m_instances = new InstanceTable( this );
m_type = controller.loadType( m_class );

//
@@ -159,14 +159,13 @@
//

URI uri = getURI();
- m_parts = new PartsModel( controller, this, uri, classloader );
PartReference[] parts = profile.getParts();
for( int i=0; i<parts.length; i++ )
{
PartReference reference = parts[i];
String key = reference.getKey();
Part part = reference.getPart();
- m_parts.addPartToCollection( key, part, false );
+ getPartsTable().addEntry( key, part );
}

//
@@ -177,7 +176,6 @@
// that will be used to construct a context entry model.
//

- m_context = new EntryTable( this, parent );
ContextDirective context = profile.getContextDirective();
EntryDescriptor[] entries = m_type.getContext().getEntries();
for( int i=0; i<entries.length; i++ )
@@ -306,31 +304,40 @@
}

public Entry getEntry( URI uri ) throws EntryNotFoundException,
InvalidQueryException
- {
- Entry model = null;
- final String scheme = uri.getScheme();
- final String path = uri.getSchemeSpecificPart();
- if( "parts".equals( scheme ) )
+ {
+ if( null == uri )
{
- model = getPartsModel().getEntry( path );
+ throw new NullPointerException( "uri" );
}
- else if( "context".equals( scheme ) )
+ final String path = uri.getSchemeSpecificPart();
+ EntryTable table = getTable( uri );
+ Entry entry = table.getEntry( path );
+ if( null == entry )
{
- model = getContextTable().getEntry( path );
+ URI ref = getURI();
+ throw new EntryNotFoundException( ref, uri );
}
else
{
- URI ref = getURI();
- throw new InvalidQueryException( ref, uri );
+ return entry;
}
- if( null == model )
+ }
+
+ public EntryTable getTable( URI uri )
+ {
+ final String scheme = uri.getScheme();
+ if( "context".equals( scheme ) )
{
- URI ref = getURI();
- throw new EntryNotFoundException( ref, uri );
+ return getContextTable();
+ }
+ else if( "parts".equals( scheme ) )
+ {
+ return getPartsTable();
}
else
{
- return model;
+ URI ref = getURI();
+ throw new InvalidQueryException( ref, uri );
}
}

@@ -339,39 +346,14 @@
return m_context;
}

- public PartsModel getPartsModel()
+ public EntryTable getPartsTable()
{
return m_parts;
}

- public void put( Holder holder )
- {
- m_holders.put( holder, this );
- }
-
- public Holder get( Object key )
- {
- Holder[] holders = (Holder[]) m_holders.keySet().toArray( new
Holder[0] );
- for( int i=0; i<holders.length; i++ )
- {
- Holder holder = holders[i];
- if( key.equals( holder.getKey() ) )
- {
- return holder;
- }
- }
- return null;
- }
-
- public Holder[] list()
- {
- return (Holder[]) m_holders.keySet().toArray( new Holder[0] );
- }
-
- public void remove( Object key )
+ public InstanceTable getInstanceTable()
{
- Holder holder = get( key );
- m_holders.remove( holder );
+ return m_instances;
}

private Class loadComponentClass( ClassLoader classloader,
ComponentProfile profile )
@@ -409,8 +391,9 @@
}
else
{
+ URI uri = getURI();
Throwable[] issues = getIssues();
- throw new InvalidModelException( this, issues );
+ throw new InvalidModelException( uri, issues );
}
}


Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
Mon Apr 11 20:56:57 2005
@@ -33,18 +33,17 @@
import net.dpml.automation.model.ServiceClassNotFoundException;
import net.dpml.automation.model.TypeClassNotFoundException;
import net.dpml.automation.model.PartClassNotFoundException;
+
import net.dpml.automation.control.EntryNotFoundException;
import net.dpml.automation.control.Controller;
import net.dpml.automation.control.DelegationException;
+
import net.dpml.automation.part.Part;

import net.dpml.composition.data.ReferenceDirective;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.DependencyDirective;
-import net.dpml.composition.control.CompositionClassLoader;
-import net.dpml.composition.control.CompositionController;
-import net.dpml.composition.control.Holder;

import net.dpml.meta.info.Type;
import net.dpml.meta.info.ServiceDescriptor;
@@ -60,7 +59,7 @@
public class EntryTable
{
private final Map m_entries = new Hashtable();
- private final StandardComponentModel m_model;
+ private final CompositionModel m_model;
private final Model m_parent;

/**
@@ -73,7 +72,7 @@
* @param profile the component profile from which initial default values
are established
*/
public EntryTable(
- StandardComponentModel model, Model parent )
+ CompositionModel model, Model parent )
throws DelegationException, ModelException
{
m_model = model;
@@ -109,13 +108,13 @@
{
ReferenceDirective ref = (ReferenceDirective) part;
URI uri = ref.getURI();
- if( null == m_parent )
+ if( null == parent )
{
final String error =
"The entry ["
+ key
+ "] in the component ["
- + getComponentModel().getURI()
+ + getModel().getURI()
+ "] is requesting a reference to a part ["
+ uri
+ "] which cannot be resolved as the component has no
enclosing parent.";
@@ -125,7 +124,7 @@
{
try
{
- Entry model =
getComponentModel().getController().getEntry( parent, uri );
+ Entry model = getModel().getController().getEntry(
parent, uri );
addEntry( key, model );
}
catch( EntryNotFoundException e )
@@ -144,7 +143,7 @@
"Could not add part under the key ["
+ key
+ "] in the model ["
- + getComponentModel().getURI()
+ + getModel().getURI()
+ "] due to an unexpected error when invoking the
query ["
+ uri
+ "].";
@@ -154,8 +153,8 @@
}
else
{
- ClassLoader classloader = getComponentModel().getClassLoader();
- Model model = getComponentModel();
+ ClassLoader classloader = getModel().getClassLoader();
+ Model model = getModel();
Controller controller = model.getController();
Entry entry = controller.getModel( model, classloader, part, key
);
addEntry( key, entry );
@@ -228,7 +227,7 @@
}
}

- private StandardComponentModel getComponentModel()
+ private CompositionModel getModel()
{
return m_model;
}

Copied:
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
(from r2261,
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java)
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
Mon Apr 11 20:56:57 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.composition.control;
+package net.dpml.composition.models;

import java.net.URI;
import java.lang.reflect.InvocationHandler;
@@ -32,8 +32,7 @@
import net.dpml.automation.control.ControlRuntimeException;
import net.dpml.automation.control.Monitor;

-import net.dpml.composition.models.EntryTable;
-import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.control.CompositionController;

/**
* A lifestyle handler provides support for the aquisition and release
@@ -50,20 +49,18 @@

private final Object m_key;
private final Monitor m_monitor;
- private final StandardComponentModel m_model;
+ private final CompositionModel m_model;
private final URI m_uri;
- private final LifecycleHandler m_factory;
private final ContextMap m_context;
private final Object m_instance;

private boolean m_disposed = false;

public Holder(
- Monitor monitor, LifecycleHandler factory, StandardComponentModel
model, Object key )
+ Monitor monitor, CompositionModel model, Object key )
throws LifecycleException, InvocationTargetException
{
m_monitor = monitor;
- m_factory = factory;
m_model = model;

if( null == key )
@@ -76,13 +73,13 @@
}

//
- // Create a uri identifying the instance. If the instance key is
LifestyleHandler.SELF then
+ // Create a uri identifying the instance. If the instance key is
CompositionController.SELF then
// we use the model's uri, otherwise the key is assigned as the
fragment part of the uri using the model
// uri as the base.
//

URI base = model.getURI();
- if( LifestyleHandler.SELF.equals( key ) )
+ if( CompositionController.SELF.equals( key ) )
{
m_uri = base;
}
@@ -93,7 +90,7 @@
}

m_context = new ContextMap( model );
- m_instance = factory.incarnate( this );
+ m_instance = model.getCompositionController().incarnate( this );
}

public Object getKey()
@@ -101,57 +98,82 @@
return m_key;
}

- public StandardComponentModel getModel()
+ public CompositionModel getModel()
{
return m_model;
}

+ /**
+ * Return a uri identifiying the instance. The scheme specific part of
the
+ * uri will correspond to the model uri. If the instance identity is not
equal
+ * to CompositionModel#SELF then the uri will be supplimented with the
fragment
+ * corresponding to the instance identity.
+ *
+ * @return the instance uri
+ * @see #getKey
+ */
public URI getURI()
{
return m_uri;
}

- public Object newProxy() throws Exception
- {
- synchronized( m_proxies )
- {
- InvocationHandler handler = new ApplianceInvocationHandler( this
);
- Class subject = m_model.getDeploymentClass();
- ClassLoader classloader = subject.getClassLoader();
- Class[] interfaces = m_model.getServiceClasses();
- Object proxy = Proxy.newProxyInstance( classloader, interfaces,
handler );
- m_proxies.put( proxy, this );
- return proxy;
- }
- }
-
+ /**
+ * Create, register and return a proxy to the instance managed by this
+ * holder. The implementation will register the proxy as a weak reference
+ * key in an internal table of proxies.
+ *
+ * @param handler the invocation handler from which a proxy will be
created
+ * @return the proxy reflecting the service interfaces declared by the
component type
+ */
+ public Object getProxy( InvocationHandler handler )
+ {
+ CompositionModel model = getModel();
+ ClassLoader classloader = model.getClassLoader();
+ Class[] interfaces = model.getServiceClasses();
+ Object proxy = Proxy.newProxyInstance( classloader, interfaces,
handler );
+ m_proxies.put( proxy, this );
+ return proxy;
+ }
+
+ /**
+ * Unsupported operated.
+ * @param value ignored
+ * @return nothing
+ * @exception UnsupportedOperationException is always thrown
+ */
public Object setValue( Object value )
{
throw new UnsupportedOperationException( "setValue/1" );
}

+ /**
+ * Return the implementation instance managed by this holder.
+ * @return the implementation instance
+ */
public Object getValue()
{
return m_instance;
}

+ /**
+ * Returns an map containing context values keyed by context entry key
that
+ * override the default model context entry mapping. The context map is
used
+ * by context managers to handle per-instance context customization.
+ *
+ * @return the context map for the instance managed by this holder
+ */
public ContextMap getContextMap()
{
return m_context;
}

- public void release( Object proxy )
- {
- synchronized( m_proxies )
- {
- m_proxies.remove( proxy );
- if( m_proxies.isEmpty() )
- {
- dispose();
- }
- }
- }
-
+ /**
+ * Disposal set the disposed flag on this holder to true and triggers
+ * etherialization of any proxy references that this holder has relative
+ * to the instance it is managing. On completing the implementation will
+ * remove the instance for the model's instance table and trigger instance
+ * etherialization.
+ */
public void dispose()
{
if( m_disposed )
@@ -161,21 +183,39 @@
synchronized( m_proxies )
{
m_disposed = true;
+ CompositionModel model = getModel();
+ CompositionController controller =
model.getCompositionController();
Object[] proxies = (Object[]) m_proxies.keySet().toArray( new
Object[0] );
for( int i=0; i<proxies.length; i++ )
{
Object proxy = proxies[i];
- Object handler = Proxy.getInvocationHandler( proxy );
- if( handler instanceof ApplianceInvocationHandler )
- {
- ApplianceInvocationHandler aic =
- (ApplianceInvocationHandler) handler;
- aic.dispose();
- }
+ controller.etherialize( proxy );
}
m_proxies.clear();
- m_model.remove( this );
- m_factory.etherialize( m_instance );
+ model.getInstanceTable().remove( this );
+ controller.etherialize( m_instance );
+ }
+ }
+
+ /**
+ * Called by a proxy as a result of finalization or explicit disposal
request.
+ * If there are no further proxies to this instance then the
implementation
+ * will invoke self disposal.
+ *
+ * @param proxy the proxy to remove from the set of proxies referncing the
+ * instance handled by this holder
+ * @see #dispose
+ */
+
+ public void release( Object proxy )
+ {
+ synchronized( m_proxies )
+ {
+ m_proxies.remove( proxy );
+ if( m_proxies.isEmpty() )
+ {
+ dispose();
+ }
}
}

@@ -184,6 +224,10 @@
return getURI().toString();
}

+ /**
+ * Finalization of the holder automaticaly triggers self disposal.
+ * @see #dispose
+ */
protected void finalize()
{
dispose();
@@ -207,9 +251,9 @@

public static class ContextMap extends Hashtable
{
- private StandardComponentModel m_model;
+ private CompositionModel m_model;

- public ContextMap( StandardComponentModel model )
+ public ContextMap( CompositionModel model )
{
m_model = model;
}
@@ -228,7 +272,7 @@
}
}

- private StandardComponentModel getModel()
+ private CompositionModel getModel()
{
return m_model;
}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java
Mon Apr 11 20:56:57 2005
@@ -0,0 +1,143 @@
+/*
+ * 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 java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * The parts model is a model of the set of parts maintained by a parent
model.
+ *
+ * @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 InstanceTable implements Serializable
+{
+ private final Map m_holders = new WeakHashMap();
+ private final CompositionModel m_model;
+
+ /**
+ * Creation of a new entry table.
+ *
+ * @param model the model
+ * @param parent the enclosing parent model
+ * @param partition the enclosing component uri
+ * @param classloader the classloader established as the parent for the
parts
+ * @param profile the component profile from which initial default values
are established
+ */
+ public InstanceTable( CompositionModel model )
+ {
+ m_model = model;
+ }
+
+ public void add( Holder holder )
+ {
+ if( null == holder )
+ {
+ throw new NullPointerException( "holder" );
+ }
+ m_holders.put( holder, m_model );
+ }
+
+ public Holder get( Object key )
+ {
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ synchronized( m_holders )
+ {
+ Holder[] holders = (Holder[]) m_holders.keySet().toArray( new
Holder[0] );
+ for( int i=0; i<holders.length; i++ )
+ {
+ Holder holder = holders[i];
+ if( key.equals( holder.getKey() ) )
+ {
+ return holder;
+ }
+ }
+ return null;
+ }
+ }
+
+ private Holder[] list()
+ {
+ return (Holder[]) m_holders.keySet().toArray( new Holder[0] );
+ }
+
+ public void remove( Object key )
+ {
+ synchronized( m_holders )
+ {
+ Holder holder = get( key );
+ if( null != holder )
+ {
+ m_holders.remove( holder );
+ }
+ }
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( false == ( other instanceof InstanceTable ) )
+ {
+ return false;
+ }
+ else
+ {
+ InstanceTable table = (InstanceTable) other;
+ if( false == m_model.equals( table.m_model ) )
+ {
+ return false;
+ }
+ Holder[] mine = list();
+ Holder[] yours = table.list();
+ if( mine.length != yours.length )
+ {
+ return false;
+ }
+ for( int i=0; i<mine.length; i++ )
+ {
+ Holder holder = mine[i];
+ if( false == holder.equals( yours[i] ) )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ public int hashCode()
+ {
+ int hash = m_model.hashCode();
+ Holder[] holders = list();
+ for( int i=0; i<holders.length; i++ )
+ {
+ Holder holder = holders[i];
+ hash ^= holder.hashCode();
+ }
+ return hash;
+ }
+}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
Mon Apr 11 20:56:57 2005
@@ -18,6 +18,8 @@

package net.dpml.composition.models;

+import java.net.URI;
+
import net.dpml.automation.model.ModelRuntimeException;

/**
@@ -30,9 +32,9 @@
{
private Throwable[] m_issues;

- public InvalidModelException( StandardComponentModel model, Throwable[]
issues )
+ public InvalidModelException( URI uri, Throwable[] issues )
{
- super( buildMessage( model, issues ) );
+ super( buildMessage( uri, issues ) );
m_issues = issues;
}

@@ -41,11 +43,11 @@
return m_issues;
}

- private static String buildMessage( StandardComponentModel model,
Throwable[] issues )
+ private static String buildMessage( URI uri, Throwable[] issues )
{
final String error =
"The component model ["
- + model.getURI()
+ + uri
+ "] contains "
+ issues.length
+ " unresolved ";

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
Mon Apr 11 20:56:57 2005
@@ -29,6 +29,7 @@

import net.dpml.composition.data.ValueDirective;
import net.dpml.composition.data.ValueDirective.Value;
+
import net.dpml.composition.control.CompositionController;

import net.dpml.meta.info.EntryDescriptor;

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 Mon Apr 11
20:56:57 2005
@@ -10,9 +10,9 @@
<!-- create the component types -->
<types xmlns="plugin:dpml/composition/dpml-composition-builder">
<type class="net.dpml.composition.testing.WidgetComponent"/>
- <type class="net.dpml.composition.testing.GizmoComponent"/>
- <type class="net.dpml.composition.testing.WidgetValue"/>
+ <type class="net.dpml.composition.testing.SimpleWidget"/>
<type class="net.dpml.composition.testing.BadWidget"/>
+ <type class="net.dpml.composition.testing.GizmoComponent"/>
<type class="net.dpml.composition.testing.AcmeContainer"/>
</types>


Copied:
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/SimpleWidget.java
(from r2262,
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetValue.java)
==============================================================================
---
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetValue.java
(original)
+++
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/SimpleWidget.java
Mon Apr 11 20:56:57 2005
@@ -19,7 +19,6 @@
package net.dpml.composition.testing;

import java.util.logging.Logger;
-import java.util.logging.Handler;

/**
* Component implementation that demonstrates the use of a context
inner-class.
@@ -27,7 +26,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: CompositionTestCase.java 1393 2005-01-06 10:27:10Z niclas $
*/
-public class WidgetValue implements Widget
+public class SimpleWidget implements Widget
{
//------------------------------------------------------------------
// state
@@ -39,7 +38,7 @@
// constructor
//------------------------------------------------------------------

- public WidgetValue( Logger logger )
+ public SimpleWidget( Logger logger )
{
m_logger = logger;
}

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 Mon Apr 11
20:56:57 2005
@@ -47,9 +47,9 @@
this example is the usage of a reference element as the mechanisms
to wire the context 'widget' part into the context supplied to the
'gizmo' component. Wiring of dependencies is explicit and handled
- by the reference element within Gizm's context. The reference element
- declares the the context entry for the key 'widget', supplied to
- Gizmo shall be the slected from the 'parts' of the enclosing component
+ by the reference element within Gizmo's context. The reference element
+ declares that the context entry for the key 'widget', supplied to
+ Gizmo shall be the selected from the 'parts' of the enclosing component
using the name 'widget' (where the uri is in the form [scope]:[name] and
scope may be one of 'context' or 'parts' refering respectivly to the
enclosing components parts or context).
@@ -81,18 +81,16 @@

<!--
Composite component example.
- Instead of using a component to fulfill a dependnecy we are using a
simple
- constructed value along the lines of values we add to context entries.
- In this example we are using the same composite component - demonstrating
- the complete separation of requirement (provided by class introspection)
from
- the solution (provided in the directives generated here).
+ Using the same container as above, the following example demonstrates
the
+ replacement of the DefaultWidget component with an alternative
implementation
+ using the SimpleWidget type.
-->
<component dest="target/test/acme-test-container.part"
xmlns="plugin:dpml/composition/dpml-composition-builder"
class="net.dpml.composition.testing.AcmeContainer"
name="acme">
<parts>
- <component name="widget"
class="net.dpml.composition.testing.WidgetValue"/>
+ <component name="widget"
class="net.dpml.composition.testing.SimpleWidget"/>
<component name="gizmo"
class="net.dpml.composition.testing.GizmoComponent">
<context>
<value key="color" value="red"/>

Modified: development/main/metro/module.xml
==============================================================================
--- development/main/metro/module.xml (original)
+++ development/main/metro/module.xml Mon Apr 11 20:56:57 2005
@@ -169,6 +169,8 @@
<package name="net.dpml.composition.event"/>
<package name="net.dpml.composition.info"/>
<package name="net.dpml.composition.model"/>
+ <package name="net.dpml.composition.models"/>
+ <package name="net.dpml.composition.control"/>
<package name="net.dpml.logging.data"/>
<package name="net.dpml.meta.info"/>
</group>



  • svn commit: r2267 - in development/main/metro: . automation/control/src/main/net/dpml/automation/control composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit, mcconnell, 04/11/2005

Archive powered by MHonArc 2.6.24.

Top of Page