Skip to Content.
Sympa Menu

notify-dpml - r861 - in trunk/main: metro metro/model/src/main/net/dpml/metro/model metro/part/api/src/main/net/dpml/part metro/runtime/src/main/net/dpml/metro/runtime metro/test metro/test/src/main/net/dpml/test/app metro/test/src/main/net/dpml/test/composite metro/test/src/test/net/dpml/metro/runtime/test planet/http/demo/src/main/net/dpml/http/demo

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r861 - in trunk/main: metro metro/model/src/main/net/dpml/metro/model metro/part/api/src/main/net/dpml/part metro/runtime/src/main/net/dpml/metro/runtime metro/test metro/test/src/main/net/dpml/test/app metro/test/src/main/net/dpml/test/composite metro/test/src/test/net/dpml/metro/runtime/test planet/http/demo/src/main/net/dpml/http/demo
  • Date: Thu, 5 Jan 2006 23:35:49 +0100

Author: mcconnell
Date: 2006-01-05 23:35:45 +0100 (Thu, 05 Jan 2006)
New Revision: 861

Added:
trunk/main/metro/part/api/src/main/net/dpml/part/Manager.java
trunk/main/metro/part/api/src/main/net/dpml/part/Parts.java
trunk/main/metro/part/api/src/main/net/dpml/part/UnknownPartException.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsManager.java
trunk/main/metro/test/src/main/net/dpml/test/composite/PartsComponent.java

trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/PartsTestCase.java
Removed:
trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
Modified:

trunk/main/metro/model/src/main/net/dpml/metro/model/MutableContextModel.java
trunk/main/metro/module.xml
trunk/main/metro/part/api/src/main/net/dpml/part/Provider.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
trunk/main/metro/test/build.xml
trunk/main/metro/test/src/main/net/dpml/test/app/Demo.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java

trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java

trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/StateTestCase.java
trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
Log:
Updates to the internal parts management model enabling explicit access to
the component manager against which we can apply and resolve context, and
access the provider.

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/model/MutableContextModel.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/model/MutableContextModel.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/model/src/main/net/dpml/metro/model/MutableContextModel.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -46,7 +46,7 @@

/**
* Apply an array of tagged directive as an atomic operation.
Application of
- * directives to the context model is atomic such that changes all
applied under a
+ * directives to the context model is atomic such that changes are
applied under a
* 'all-or-nothing' policy.
*
* @param directives an array of part references

Modified: trunk/main/metro/module.xml
===================================================================
--- trunk/main/metro/module.xml 2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/metro/module.xml 2006-01-05 22:35:45 UTC (rev 861)
@@ -145,6 +145,7 @@
<include ref="dpml/util/dpml-logging-api"/>
<include ref="dpml/util/dpml-configuration-api"/>
<include ref="dpml/util/dpml-parameters-api"/>
+ <include ref="dpml/metro/dpml-part-api"/>
</dependencies>
<dependencies scope="test">
<include key="dpml-metro-tools"/>

Deleted: trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -1,54 +0,0 @@
-/*
- * 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.part;
-
-import java.util.Map;
-
-/**
- * The Context interfaces is a local interface implementated by part handlers
- * that is exposed to a container during subsidiary part management. Its
primary
- * function to to provide a standard access mechanisms to a mutable context
map.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface Context
-{
- /**
- * Return a mutible context map.
- *
- * @return the context map
- */
- Map getContextMap();
-
- /**
- * Add a context listener to the component provider.
- * @param listener the context listener to add
- * @exception NullPointerException if the supplied listener argument is
null
- */
- void addContextListener( ContextListener listener ) throws
NullPointerException;
-
- /**
- * Remove a context listener from the component provider.
- * @param listener the context listener to remove
- * @exception NullPointerException if the supplied listener argument is
null
- */
- void removeContextListener( ContextListener listener ) throws
NullPointerException;
-}
-

Added: trunk/main/metro/part/api/src/main/net/dpml/part/Manager.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/Manager.java
2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/Manager.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ * 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.part;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+/**
+ * Local interface through which a component implementation may
+ * interact with subsidary parts.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Manager
+{
+ /**
+ * Return a mutible context map.
+ *
+ * @return the context map
+ */
+ Map getContextMap();
+
+ /**
+ * Return a reference to a managed provider.
+ * @return the service provider
+ * @exception InvocationTargetException if the component instantiation
process
+ * is on demand and an target invocation error occurs
+ * @exception ControlException if the component could not be established
due to a controller
+ * related error
+ */
+ Provider getProvider() throws ControlException,
InvocationTargetException;
+}
+

Added: trunk/main/metro/part/api/src/main/net/dpml/part/Parts.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/Parts.java 2006-01-05
08:21:51 UTC (rev 860)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/Parts.java 2006-01-05
22:35:45 UTC (rev 861)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ * 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.part;
+
+/**
+ * Local interface through which a component implementation may
+ * interact with subsidary parts.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Parts
+{
+ /**
+ * Return the array of keys used to idenetity internal parts.
+ * @return the part key array
+ */
+ String[] getKeys();
+
+ /**
+ * Return a component manager.
+ * @return the local component manager
+ */
+ Manager getManager( String key ) throws UnknownPartException;
+
+ boolean isCommissioned();
+
+ /**
+ * Initiate the oprdered activation of all internal parts.
+ * @exception ControlException if an activation error occurs
+ * @exception InvocationTargetException if the component declares
activation on startup
+ * and a implementation source exception occured
+ * @exception RemoteException if a remote exception occurs
+ */
+ void commission() throws ControlException;
+
+ /**
+ * Initiate deactivation of all internal parts.
+ */
+ void decommission();
+}
+

Modified: trunk/main/metro/part/api/src/main/net/dpml/part/Provider.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/Provider.java
2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/Provider.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -59,7 +59,7 @@
* @exception RemoteException if a remote I/O error occurs
*/
void removeStateListener( StateListener listener ) throws
RemoteException;
-
+
/**
* Return the runtime value associated with this instance.
* @param isolate if TRUE the value returned is a proxy exposing the
@@ -78,7 +78,8 @@
* @exception InvocationTargetException if an invocation error occurs
* @exception RemoteException if a remote I/O error occurs
*/
- State apply( String key ) throws UnknownTransitionException,
InvocationTargetException, RemoteException;
+ State apply( String key )
+ throws UnknownTransitionException, InvocationTargetException,
RemoteException;

/**
* Invoke an operation on the instance.
@@ -89,6 +90,7 @@
* @exception InvocationTargetException if an invocation error occurs
* @exception RemoteException if a remote I/O error occurs
*/
- Object exec( String name, Object[] args ) throws
UnknownOperationException, InvocationTargetException, RemoteException;
+ Object exec( String name, Object[] args )
+ throws UnknownOperationException, InvocationTargetException,
RemoteException;

}

Added:
trunk/main/metro/part/api/src/main/net/dpml/part/UnknownPartException.java
===================================================================
---
trunk/main/metro/part/api/src/main/net/dpml/part/UnknownPartException.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/part/api/src/main/net/dpml/part/UnknownPartException.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -0,0 +1,48 @@
+/*
+ * 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.part;
+
+import java.net.URI;
+
+/**
+ * Exception thrown when a component request an unknown part.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class UnknownPartException extends IllegalArgumentException
+{
+ /**
+ * Serial version identifier.
+ */
+ static final long serialVersionUID = 1L;
+
+ private String m_type;
+
+ /**
+ * Creation of a new <tt>UnknownPartException</tt>.
+ * @param key the part key
+ */
+ public UnknownPartException( String key )
+ {
+ super( key );
+ }
+}
+
+

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -45,6 +45,7 @@

import net.dpml.parameters.Parameters;

+import net.dpml.part.Parts;
import net.dpml.part.Directive;
import net.dpml.part.Component;
import net.dpml.part.Model;
@@ -102,7 +103,7 @@
* @param model the managed context
* @return the runtime handler
*/
- public ComponentHandler createComponentHandler( ComponentModel model )
+ public ComponentHandler createComponentHandler( ComponentModel model )
throws ControlException
{
ClassLoader anchor = Thread.currentThread().getContextClassLoader();
return createComponentHandler( anchor, model );
@@ -164,7 +165,7 @@
* @param context the managed context
* @return the runtime handler
*/
- ComponentHandler createComponentHandler( ClassLoader anchor,
ComponentModel context )
+ ComponentHandler createComponentHandler( ClassLoader anchor,
ComponentModel context ) throws ControlException
{
return createComponentHandler( null, anchor, context );
}
@@ -177,7 +178,7 @@
* @return the runtime handler
*/
ComponentHandler createComponentHandler(
- Component parent, ClassLoader anchor, ComponentModel context )
+ Component parent, ClassLoader anchor, ComponentModel context ) throws
ControlException
{
try
{
@@ -192,7 +193,7 @@
{
final String error =
"Creation of a new component handler failed due to an remote
exception.";
- throw new ControllerRuntimeException( error, e );
+ throw new ControllerException( error, e );
}
}

@@ -201,7 +202,7 @@
ComponentHandler handler = provider.getComponentHandler();
Class subject = handler.getImplementationClass();
Constructor constructor = getConstructor( subject );
- Class parts = getInnerClass( subject, "$Parts" );
+ Class parts = getPartsClass( subject );
Class contextInnerClass = getInnerClass( subject, "$Context" );
Class[] classes = constructor.getParameterTypes();
Object[] args = new Object[ classes.length ];
@@ -242,7 +243,7 @@
{
args[i] = createContextInvocationHandler( provider,
contextInnerClass );
}
- else if( ( null != parts ) && parts.isAssignableFrom( c ) )
+ else if( parts.isAssignableFrom( c ) )
{
args[i] = createPartsInvocationHandler( handler, parts );
}
@@ -453,6 +454,19 @@
}
}

+ private Class getPartsClass( Class subject )
+ {
+ Class clazz = getInnerClass( subject, "$Parts" );
+ if( null == clazz )
+ {
+ return Parts.class;
+ }
+ else
+ {
+ return clazz;
+ }
+ }
+
private Class getInnerClass( Class subject, String postfix )
{
Class[] classes = subject.getClasses();
@@ -529,9 +543,10 @@
private Object createPartsInvocationHandler( ComponentHandler handler,
Class clazz )
throws ControlException
{
+ PartsManager manager = handler.getPartsManager();
try
{
- InvocationHandler invocationHandler = new
PartsInvocationHandler( handler );
+ InvocationHandler invocationHandler = new
PartsInvocationHandler( manager );
ClassLoader classloader = clazz.getClassLoader();
return Proxy.newProxyInstance( classloader, new Class[]{clazz},
invocationHandler );
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -42,6 +42,7 @@

import net.dpml.logging.Logger;

+import net.dpml.part.Parts;
import net.dpml.part.ActivationPolicy;
import net.dpml.part.Component;
import net.dpml.part.ControlException;
@@ -50,11 +51,12 @@
import net.dpml.part.Service;
import net.dpml.part.ServiceNotFoundException;
import net.dpml.part.Version;
-import net.dpml.part.Context;
+import net.dpml.part.Manager;
import net.dpml.part.ModelEvent;
import net.dpml.part.ModelListener;
import net.dpml.part.ContextEvent;
import net.dpml.part.ContextListener;
+import net.dpml.part.UnknownPartException;

import net.dpml.state.State;

@@ -105,7 +107,7 @@
* @see ComponentModel
* @see Provider
*/
-public class ComponentHandler extends UnicastEventSource implements
Component, Context, Disposable, ModelListener
+public class ComponentHandler extends UnicastEventSource implements
Component, Manager, Disposable, ModelListener
{

//--------------------------------------------------------------------------
// immutable state
@@ -127,8 +129,10 @@

private final Map m_map = new Hashtable(); // symbolic value map
private final Map m_cache = new Hashtable(); // context entry/value cache
- private final Map m_handlers = new Hashtable(); // part handlers
+ //private final Map m_handlers = new Hashtable(); // part handlers

+ private final PartsManager m_parts;
+

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

//--------------------------------------------------------------------------
@@ -142,7 +146,7 @@
ComponentHandler(
final Component parent, final ClassLoader classloader, final Logger
logger,
final ComponentController control, final ComponentModel model )
- throws RemoteException
+ throws RemoteException, ControlException
{
super();

@@ -166,7 +170,7 @@
final String error =
"Unable to load component class: "
+ classname;
- throw new ControllerRuntimeException( error, e );
+ throw new ControllerException( error, e );
}

try
@@ -178,7 +182,7 @@
final String error =
"Unable to load component type: "
+ classname;
- throw new ControllerRuntimeException( error, e );
+ throw new ControllerException( error, e );
}

m_graph = m_type.getStateGraph();
@@ -192,7 +196,7 @@
final String error =
"Unable to load a service class declared in component type: "
+ classname;
- throw new ControllerRuntimeException( error, e );
+ throw new ControllerException( error, e );
}

try
@@ -204,7 +208,7 @@
final String error =
"Internal error while attempting to construct the component
uri using the path ["
+ m_path + "]";
- throw new ControllerRuntimeException( error, e );
+ throw new ControllerException( error, e );
}

String name = model.getName();
@@ -241,37 +245,7 @@
// need to establish all of the component parts that are children of
this
// component.

- String[] keys = m_model.getPartKeys();
- for( int i=0; i<keys.length; i++ )
- {
- String key = keys[i];
- try
- {
- ComponentModel context = model.getComponentModel( key );
- Component handler = control.createComponentHandler( this,
classloader, context );
- m_handlers.put( key, handler );
- }
- catch( UnknownKeyException e )
- {
- final String error =
- "Invalid part key ["
- + key
- + "] in component ["
- + m_path
- + "]";
- throw new ControllerRuntimeException( error, e );
- }
- catch( Exception e )
- {
- final String error =
- "Internal error while attempting to create a subsidiary
part ["
- + key
- + "] in component ["
- + m_path
- + "]";
- throw new ControllerRuntimeException( error, e );
- }
- }
+ m_parts = new PartsManager( control, this, logger );

getLogger().debug( "component controller [" + this + "] established"
);
}
@@ -281,7 +255,7 @@

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

/**
- * Notification from the compoent model of a chanhge to the model.
+ * Notification from the component model of a change to the model.
* @param event the model change event
*/
public void modelChanged( ModelEvent event )
@@ -293,7 +267,7 @@
}


//--------------------------------------------------------------------------
- // Context
+ // Manager

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

/**
@@ -307,25 +281,21 @@
}

/**
- * Add a context listener to the component provider.
- * @param listener the context listener to add
- * @exception NullPointerException if the supplied listener argument is
null
+ * Return an <tt>Provider</tt> holder. The value returned will be a
function
+ * of the lifestyle policy implemented by the component.
+ *
+ * @return the <tt>Provider</tt> manager
+ * @exception InvocationTargetException if the request triggers the
construction
+ * of a new provider instance and the provider raises an error during
creation
+ * or activation
+ * @exception ControlException if a control related error occurs
*/
- public void addContextListener( ContextListener listener ) throws
NullPointerException
+ public Provider getProvider() throws InvocationTargetException,
ControlException
{
- super.addListener( listener );
+ activate();
+ return m_holder.getProvider();
}

- /**
- * Remove a context listener from the component provider.
- * @param listener the context listener to remove
- * @exception NullPointerException if the supplied listener argument is
null
- */
- public void removeContextListener( ContextListener listener ) throws
NullPointerException
- {
- super.removeListener( listener );
- }
-

//--------------------------------------------------------------------------
// Component

//--------------------------------------------------------------------------
@@ -358,7 +328,9 @@
+ service.getServiceClass().getName()
+ "]." );
}
- Component[] components = (Component[]) m_handlers.values().toArray(
new Component[0] );
+
+ Component[] components = m_parts.getComponents();
+ //Component[] components = (Component[])
m_handlers.values().toArray( new Component[0] );
for( int i=0; i<components.length; i++ )
{
Component component = components[i];
@@ -465,16 +437,18 @@
m_holder.getProvider();
}

+ m_parts.commission();
+
//
// activate the children
//

- Component[] components = (Component[])
m_handlers.values().toArray( new Component[0] );
- for( int i=0; i<components.length; i++ )
- {
- Component component = components[i];
- component.activate();
- }
+ //Component[] components = (Component[])
m_handlers.values().toArray( new Component[0] );
+ //for( int i=0; i<components.length; i++ )
+ //{
+ // Component component = components[i];
+ // component.activate();
+ //}

m_active = true;
}
@@ -517,59 +491,35 @@
// deactivate all of the subsidiary components
//

- try
- {
- Component[] components = (Component[])
m_handlers.values().toArray( new Component[0] );
- for( int i=0; i<components.length; i++ )
- {
- Component component = components[i];
- try
- {
- component.deactivate();
- }
- catch( RemoteException e )
- {
- final String message =
- "Ignoring remote exception raised during
deactivation.";
- getLogger().warn( message, e );
- }
- }
- }
- finally
- {
- m_active = false;
- }
+ m_parts.decommission();
+
+ //try
+ //{
+ // Component[] components = (Component[])
m_handlers.values().toArray( new Component[0] );
+ // for( int i=0; i<components.length; i++ )
+ // {
+ // Component component = components[i];
+ // try
+ // {
+ // component.deactivate();
+ // }
+ // catch( RemoteException e )
+ // {
+ // final String message =
+ // "Ignoring remote exception raised during
deactivation.";
+ // getLogger().warn( message, e );
+ // }
+ // }
+ //}
+ //finally
+ //{
+ // m_active = false;
+ //}
+
+ m_active = false;
}

/**
- * Return an <tt>Provider</tt> holder. The value returned will be a
function
- * of the lifestyle policy implemented by the component.
- *
- * @return the <tt>Provider</tt> manager
- * @exception InvocationTargetException if the request triggers the
construction
- * of a new provider instance and the provider raises an error during
creation
- * or activation
- * @exception ControlException if a control related error occurs
- */
- public Provider getProvider() throws InvocationTargetException,
ControlException
- {
- if( isActive() )
- {
- return m_holder.getProvider();
- }
- else
- {
- activate();
- return m_holder.getProvider();
- //final String error =
- // "Component handler ["
- // + this
- // + "] is not active.";
- //throw new ControllerException( error );
- }
- }
-
- /**
* Return the array of services provider by the handler.
* @return the service array
*/
@@ -619,6 +569,11 @@
// ComponentHandler

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

+ PartsManager getPartsManager()
+ {
+ return m_parts;
+ }
+
/**
* Add a property change listener. This method is used by a provider
* to register a component implement property change listener. The
component
@@ -659,8 +614,11 @@
* @exception UnknownKeyException if the key does not match
* any of the internal components managed by this component
*/
- Component getPartHandler( String key ) throws UnknownKeyException
+ Component getPartHandler( String key ) throws UnknownPartException
{
+ return (Component) m_parts.getManager( key );
+
+ /*
Component handler = (Component) m_handlers.get( key );
if( null == handler )
{
@@ -670,6 +628,7 @@
{
return handler;
}
+ */
}

Object getContextValue( String key ) throws ControlException

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -22,10 +22,11 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

-import net.dpml.part.Context;
+import net.dpml.part.Manager;
import net.dpml.part.Component;
+import net.dpml.part.Provider;
+import net.dpml.part.Parts;

-
/**
* Invoication handler for the Context inner class. The invocation handler
is
* responsible for the supply of values based on request invocations applied
to
@@ -43,7 +44,7 @@
/**
* The component.
*/
- private final ComponentHandler m_handler;
+ private final PartsManager m_manager;

//-------------------------------------------------------------------
// constructor
@@ -54,20 +55,15 @@
*
* @param handler the component handler
*/
- PartsInvocationHandler( ComponentHandler handler )
+ PartsInvocationHandler( PartsManager manager )
{
- m_handler = handler;
+ m_manager = manager;
}

//-------------------------------------------------------------------
// implementation
//-------------------------------------------------------------------

- private ComponentHandler getComponentHandler()
- {
- return m_handler;
- }
-
/**
* Invoke the specified method on underlying object.
* This is called by the proxy object.
@@ -85,12 +81,16 @@
{
return method.invoke( this, args );
}
+ else if( Parts.class == source )
+ {
+ return method.invoke( m_manager, args );
+ }

int semantic = getPartSemantic( method );
String postfix = getPartPostfix( method );
String key = getPartKey( method, semantic );

- Component handler = getComponentHandler().getPartHandler( key );
+ Manager manager = m_manager.getManager( key );

if( GET == semantic )
{
@@ -100,14 +100,13 @@
{
try
{
- handler.activate();
- return handler.getProvider().getValue( false );
+ return manager.getProvider().getValue( false );
}
catch( ClassCastException e )
{
final String error =
"Component handler ["
- + handler
+ + manager
+ "] could not be cast to an approriate service
class.";
throw new IllegalStateException( error );
}
@@ -119,8 +118,7 @@
if( ( Boolean.TYPE == argClass ) || ( Boolean.class ==
argClass ) )
{
boolean policy = getBooleanValue( arg );
- handler.activate();
- return handler.getProvider().getValue( policy );
+ return manager.getProvider().getValue( policy );
}
else
{
@@ -142,30 +140,33 @@
}
else if( COMPONENT_KEY.equals( postfix ) )
{
- return handler; // wrap in a proxy ?
- }
- else if( MAP_KEY.equals( postfix ) )
- {
- if( handler instanceof Context )
+ if( manager instanceof Component )
{
- Context context = (Context) handler;
- return context.getContextMap();
+ return (Component) manager;
}
else
{
final String error =
- "Component implementation ["
- + handler.getClass().getName()
+ "Manager implementation ["
+ + manager.getClass().getName()
+ "] does not implement "
- + Context.class.getName()
+ + Component.class.getName()
+ ".";
throw new IllegalStateException( error );
}
}
- else if( INSTANCE_KEY.equals( postfix ) )
+ else if( MANAGER_KEY.equals( postfix ) )
{
- return handler.getProvider();
+ return manager;
}
+ else if( MAP_KEY.equals( postfix ) )
+ {
+ return manager.getContextMap();
+ }
+ else if( PROVIDER_KEY.equals( postfix ) )
+ {
+ return manager.getProvider();
+ }
else
{
final String error =
@@ -236,9 +237,9 @@
{
return MAP_KEY;
}
- if( name.endsWith( INSTANCE_KEY ) )
+ if( name.endsWith( PROVIDER_KEY ) )
{
- return INSTANCE_KEY;
+ return PROVIDER_KEY;
}
else
{
@@ -265,13 +266,20 @@
String substring = name.substring( 0, j );
return formatKey( substring, 3 );
}
- else if( name.endsWith( INSTANCE_KEY ) )
+ else if( name.endsWith( PROVIDER_KEY ) )
{
- int n = INSTANCE_KEY.length();
+ int n = PROVIDER_KEY.length();
int j = name.length() - n;
String substring = name.substring( 0, j );
return formatKey( substring, 3 );
}
+ else if( name.endsWith( MANAGER_KEY ) )
+ {
+ int n = MANAGER_KEY.length();
+ int j = name.length() - n;
+ String substring = name.substring( 0, j );
+ return formatKey( substring, 3 );
+ }
else
{
return formatKey( name, 3 );
@@ -329,5 +337,6 @@
public static final String RELEASE_KEY = "release";
public static final String COMPONENT_KEY = "Component";
public static final String MAP_KEY = "Map";
- public static final String INSTANCE_KEY = "Provider";
-}
+ public static final String PROVIDER_KEY = "Provider";
+ public static final String MANAGER_KEY = "Manager";
+}
\ No newline at end of file

Added:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsManager.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsManager.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsManager.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -0,0 +1,273 @@
+/*
+ * 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.metro.runtime;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
+import java.rmi.RemoteException;
+import java.util.EventObject;
+import java.util.EventListener;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.metro.model.ComponentModel;
+
+import net.dpml.part.Provider;
+import net.dpml.part.Component;
+import net.dpml.part.ControlException;
+import net.dpml.part.Parts;
+import net.dpml.part.Manager;
+import net.dpml.part.UnknownPartException;
+
+import net.dpml.transit.model.UnknownKeyException;
+
+/**
+ * Default implementation of the local Parts interface.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+class PartsManager implements Parts
+{
+ //-------------------------------------------------------------------
+ // state
+ //-------------------------------------------------------------------
+
+ /**
+ * The component handler.
+ */
+ private final ComponentHandler m_handler;
+
+ /**
+ * The logging channel.
+ */
+ private final Logger m_logger;
+
+ /**
+ * The internal map of component handlers.
+ */
+ private final Map m_handlers = new Hashtable();
+
+ private boolean m_commissioned = false;
+
+ //-------------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------------
+
+ /**
+ * Create a new instance handler.
+ *
+ * @param handler the component handler
+ * @param logger the logging channel
+ */
+ PartsManager( ComponentController control, ComponentHandler handler,
Logger logger )
+ throws ControlException, RemoteException
+ {
+ m_handler = handler;
+ m_logger = logger;
+
+ ClassLoader classloader = handler.getClassLoader();
+ ComponentModel model = handler.getComponentModel();
+ String[] keys = model.getPartKeys();
+ for( int i=0; i<keys.length; i++ )
+ {
+ String key = keys[i];
+ try
+ {
+ ComponentModel m = model.getComponentModel( key );
+ Component h = control.createComponentHandler( handler,
classloader, m );
+ m_handlers.put( key, h );
+ }
+ catch( UnknownKeyException e )
+ {
+ final String error =
+ "Invalid part key ["
+ + key
+ + "] in component ["
+ + handler
+ + "]";
+ throw new ControllerRuntimeException( error, e );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while attempting to create a subsidiary
part ["
+ + key
+ + "] in component ["
+ + handler
+ + "]";
+ throw new ControllerRuntimeException( error, e );
+ }
+ }
+ }
+
+ private ComponentModel getComponentModel()
+ {
+ return m_handler.getComponentModel();
+ }
+
+ //-------------------------------------------------------------------
+ // Parts
+ //-------------------------------------------------------------------
+
+ /**
+ * Return the array of keys used to idenetity internal parts.
+ * @return the part key array
+ */
+ public String[] getKeys()
+ {
+ return (String[]) m_handlers.keySet().toArray( new String[0] );
+ }
+
+ /**
+ * Return a component manager.
+ * @return the local component manager
+ */
+ public synchronized Manager getManager( String key ) throws
UnknownPartException
+ {
+ if( m_handlers.containsKey( key ) )
+ {
+ return (Manager) m_handlers.get( key );
+ }
+ else
+ {
+ throw new UnknownPartException( key );
+ }
+ }
+
+ public boolean isCommissioned()
+ {
+ return m_commissioned;
+ }
+
+ /**
+ * Initiate the ordered activation of all internal parts.
+ * @exception ControlException if an activation error occurs
+ * @exception InvocationTargetException if the component declares
activation on startup
+ * and a implementation source exception occured
+ * @exception RemoteException if a remote exception occurs
+ */
+ public synchronized void commission() throws ControlException
+ {
+ if( m_commissioned )
+ {
+ final String error =
+ "Illegal attempt to commission a part manager that is already
commissioned."
+ + "Component: " + m_handler;
+ throw new IllegalStateException( error );
+ }
+
+ getLogger().debug( "commissioning" );
+ ArrayList list = new ArrayList();
+ Component[] components = getComponents();
+ ControlException exception = null;
+ for( int i=0; i<components.length; i++ )
+ {
+ Component component = components[i];
+ try
+ {
+ component.activate();
+ list.add( component );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Error during the commission of the internal parts of a
component."
+ + "\nEnclosing Component: " + m_handler
+ + "\nInternal Part: " + component;
+ exception = new ControllerException( error, e );
+ break;
+ }
+ }
+
+ if( null != exception )
+ {
+ Component[] selection = (Component[]) list.toArray( new
Component[0] );
+ decommission( selection );
+ throw exception;
+ }
+ else
+ {
+ m_commissioned = true;
+ }
+ }
+
+ /**
+ * Initiate deactivation of all internal parts.
+ */
+ public synchronized void decommission()
+ {
+ if( !m_commissioned )
+ {
+ final String error =
+ "Illegal attempt to decommission a part manager that is
already decommissioned."
+ + "Component: " + m_handler;
+ throw new IllegalStateException( error );
+ }
+
+ getLogger().debug( "decommissioning" );
+ Component[] components = getComponents();
+ decommission( components );
+ }
+
+ /**
+ * Initiate deactivation of all internal parts.
+ */
+ private void decommission( Component[] components )
+ {
+ try
+ {
+ int n = components.length -1;
+ for( int i=n; i>-1; i-- )
+ {
+ Component component = components[i];
+ try
+ {
+ component.deactivate();
+ }
+ catch( RemoteException e )
+ {
+ final String message =
+ "Ignoring remote exception raised during
deactivation.";
+ getLogger().warn( message, e );
+ }
+ }
+ }
+ finally
+ {
+ m_commissioned = false;
+ }
+ }
+
+ Component[] getComponents()
+ {
+ return (Component[]) m_handlers.values().toArray( new Component[0] );
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+}

Modified: trunk/main/metro/test/build.xml
===================================================================
--- trunk/main/metro/test/build.xml 2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/metro/test/build.xml 2006-01-05 22:35:45 UTC (rev 861)
@@ -137,6 +137,15 @@
</component>
</parts>
</type>
+ <type class="net.dpml.test.composite.PartsComponent" name="parent">
+ <parts>
+ <component type="net.dpml.test.composite.ChildComponent"
key="child" activation="false">
+ <context>
+ <entry key="color" method="BLUE"/>
+ </context>
+ </component>
+ </parts>
+ </type>
</types>

<c:component dest="target/test/composite.part" test="true"
activation="false"
@@ -146,6 +155,13 @@
</context>
</c:component>

+ <c:component dest="target/test/parts.part" test="true" activation="false"
+ type="net.dpml.test.composite.PartsComponent" collection="hard">
+ <context>
+ <entry key="color" method="RED"/>
+ </context>
+ </c:component>
+
<!-- create the lifecycle managed component -->

<c:type class="net.dpml.test.lifecycle.StartableComponent"
name="lifecycle">

Modified: trunk/main/metro/test/src/main/net/dpml/test/app/Demo.java
===================================================================
--- trunk/main/metro/test/src/main/net/dpml/test/app/Demo.java 2006-01-05
08:21:51 UTC (rev 860)
+++ trunk/main/metro/test/src/main/net/dpml/test/app/Demo.java 2006-01-05
22:35:45 UTC (rev 861)
@@ -20,6 +20,9 @@

import net.dpml.logging.Logger;

+import net.dpml.part.Parts;
+import net.dpml.part.Manager;
+
/**
* The demo class is used to aggregate a collection of components and
* provide some hooks for the testcase.
@@ -29,25 +32,6 @@
*/
public class Demo
{
- /**
- * The parts interface is used within the implementation to
- * access subsystem.
- */
- public interface Parts
- {
- /**
- * Return the server implementation.
- * @return the server
- */
- DefaultServer getServer();
-
- /**
- * Return the listener implementation.
- * @return the listener
- */
- DefaultListener getListener();
- }
-
private final Parts m_parts;
private final Logger m_logger;

@@ -68,10 +52,22 @@
* @param message the notification message
* @return the number of notify messages fired to the listener
*/
- public int test( String message )
+ public int test( String message ) throws Exception
{
m_logger.debug( "test: " + message );
- m_parts.getServer().triggerNotify( message );
- return m_parts.getListener().getCount();
+ getServer().triggerNotify( message );
+ return getListener().getCount();
}
+
+ DefaultServer getServer() throws Exception
+ {
+ Manager manager = m_parts.getManager( "server" );
+ return (DefaultServer) manager.getProvider().getValue( false );
+ }
+
+ DefaultListener getListener() throws Exception
+ {
+ Manager manager = m_parts.getManager( "listener" );
+ return (DefaultListener) manager.getProvider().getValue( false );
+ }
}

Added:
trunk/main/metro/test/src/main/net/dpml/test/composite/PartsComponent.java
===================================================================
---
trunk/main/metro/test/src/main/net/dpml/test/composite/PartsComponent.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/test/src/main/net/dpml/test/composite/PartsComponent.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ * 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.test.composite;
+
+import java.awt.Color;
+import java.util.Map;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.test.ColorManager;
+
+import net.dpml.part.Parts;
+import net.dpml.part.Manager;
+
+/**
+ * This component declares an inner Parts interface through which
+ * it accesses a map of the context infomation of a subsidiary component
+ * named 'child'. The subsidiary component is defined and established
+ * within the component types definition (see build file for details).
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PartsComponent implements ColorManager
+{
+ //------------------------------------------------------------------
+ // concerns
+ //------------------------------------------------------------------
+
+ /**
+ * The construction criteria.
+ */
+ public interface Context
+ {
+ /**
+ * Return the assigned color.
+ * @return the color value
+ */
+ Color getColor();
+ }
+
+ //------------------------------------------------------------------
+ // state
+ //------------------------------------------------------------------
+
+ /**
+ * The logging channel.
+ */
+ private final Logger m_logger;
+
+ /**
+ * The assigned context instance.
+ */
+ private final Context m_context;
+
+ /**
+ * The assigned part manager.
+ */
+ private final Parts m_parts;
+
+ //------------------------------------------------------------------
+ // constructor
+ //------------------------------------------------------------------
+
+ /**
+ * Creation of a new composite component instance.
+ * @param logger the assingned logging channel
+ * @param context a context implementation
+ * @param parts the parts manager
+ */
+ public PartsComponent( final Logger logger, final Context context, final
Parts parts )
+ {
+ logger.debug( "instantiation" );
+
+ m_context = context;
+ m_logger = logger;
+ m_parts = parts;
+
+ Manager manager = parts.getManager( "child" );
+ Map map = manager.getContextMap();
+ map.put( "color", context.getColor() );
+ }
+
+ //------------------------------------------------------------------
+ // Example
+ //------------------------------------------------------------------
+
+ /**
+ * Return the color value assigned to the component context.
+ * @return the color value
+ */
+ public Color getColor()
+ {
+ return m_context.getColor();
+ }
+
+ //------------------------------------------------------------------
+ // Validation
+ //------------------------------------------------------------------
+
+ /**
+ * Return the child component for evaluation by the testcase.
+ * @return the child
+ */
+ public ChildComponent getChild() throws Exception
+ {
+ Manager manager = m_parts.getManager( "child" );
+ return (ChildComponent) manager.getProvider().getValue( false );
+ }
+
+ //------------------------------------------------------------------
+ // internal
+ //------------------------------------------------------------------
+
+ /**
+ * Return the assigned logging channel.
+ * @return the logging channel
+ */
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+}

Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -26,7 +26,6 @@
import net.dpml.part.Controller;
import net.dpml.part.Component;
import net.dpml.part.Provider;
-import net.dpml.part.Context;

import net.dpml.test.app.Demo;


Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -27,7 +27,7 @@
import net.dpml.part.Controller;
import net.dpml.part.Component;
import net.dpml.part.Provider;
-import net.dpml.part.Context;
+import net.dpml.part.Manager;

import net.dpml.test.ColorManager;
import net.dpml.test.composite.ChildComponent;
@@ -74,7 +74,7 @@
public void testOverloadedComposite() throws Exception
{
Component component = CONTROLLER.createComponent( m_uri );
- ((Context)component).getContextMap().put( "color", Color.YELLOW );
+ ((Manager)component).getContextMap().put( "color", Color.YELLOW );
Provider instance = component.getProvider();
CompositeComponent parent = (CompositeComponent) instance.getValue(
false );
Color color = parent.getColor();

Added:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/PartsTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/PartsTestCase.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/PartsTestCase.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ * 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.metro.runtime.test;
+
+import java.awt.Color;
+import java.io.File;
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import net.dpml.part.Controller;
+import net.dpml.part.Component;
+import net.dpml.part.Provider;
+
+import net.dpml.test.ColorManager;
+import net.dpml.test.composite.ChildComponent;
+import net.dpml.test.composite.PartsComponent;
+
+/**
+ * Contains a series of tests applied to the composite component.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PartsTestCase extends TestCase
+{
+ private static final Controller CONTROLLER = Controller.STANDARD;
+
+ private URI m_uri;
+
+ public void setUp() throws Exception
+ {
+ final String path = "parts.part";
+ final File test = new File( System.getProperty( "project.test.dir" )
);
+ m_uri = new File( test, path ).toURI();
+ }
+
+ /**
+ * Validate composite instantiation and in particular that the color
+ * assigned to the child component has been overriden by the parent.
+ */
+ public void testComposite() throws Exception
+ {
+ Component component = CONTROLLER.createComponent( m_uri );
+ assertNotNull( "component", component );
+ Provider instance = component.getProvider();
+ PartsComponent parent = (PartsComponent) instance.getValue( false );
+ Color color = parent.getColor();
+ ChildComponent child = parent.getChild();
+ Color c = child.getColor();
+ assertEquals( "color", color, c );
+ }
+
+ /**
+ * Validate composite instantiation with an overloader parent context.
+ */
+ /*
+ public void testOverloadedComposite() throws Exception
+ {
+ Component component = CONTROLLER.createComponent( m_uri );
+ ((Context)component).getContextMap().put( "color", Color.YELLOW );
+ Provider instance = component.getProvider();
+ CompositeComponent parent = (CompositeComponent) instance.getValue(
false );
+ Color color = parent.getColor();
+ assertEquals( "parent-color", Color.YELLOW, color );
+ ChildComponent child = parent.getChild();
+ Color c = child.getColor();
+ assertEquals( "color", color, c );
+ }
+ */
+
+ static
+ {
+ System.setProperty(
+ "java.util.logging.config.class",
+ System.getProperty(
+ "java.util.logging.config.class",
+ "net.dpml.transit.util.ConfigurationHandler" ) );
+ }
+}

Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/StateTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/StateTestCase.java
2006-01-05 08:21:51 UTC (rev 860)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/StateTestCase.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -26,7 +26,6 @@
import net.dpml.part.Controller;
import net.dpml.part.Component;
import net.dpml.part.Provider;
-import net.dpml.part.Context;

import net.dpml.test.state.Service;
import net.dpml.test.state.ManagedComponent;

Modified: trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
===================================================================
--- trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
2006-01-05 08:21:51 UTC (rev 860)
+++ trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
2006-01-05 22:35:45 UTC (rev 861)
@@ -63,7 +63,7 @@

private final Logger m_logger;
private final Parts m_parts;
-
+
/**
* Creation of the HTTP Demo Component.
* @param logger the assigned logging channel
@@ -79,6 +79,9 @@
m_parts.getSocketListener();
}

+ /**
+ * Return
+ */
private Logger getLogger()
{
return m_logger;




  • r861 - in trunk/main: metro metro/model/src/main/net/dpml/metro/model metro/part/api/src/main/net/dpml/part metro/runtime/src/main/net/dpml/metro/runtime metro/test metro/test/src/main/net/dpml/test/app metro/test/src/main/net/dpml/test/composite metro/test/src/test/net/dpml/metro/runtime/test planet/http/demo/src/main/net/dpml/http/demo, mcconnell at BerliOS, 01/05/2006

Archive powered by MHonArc 2.6.24.

Top of Page