Skip to Content.
Sympa Menu

notify-dpml - r1990 - in trunk/main/metro: appliance/src/main/dpml/station/info appliance/src/main/dpml/station/util appliance/src/main/net/dpml/station appliance/src/test/net/dpml/appliance connector/src/main/dpml/station/connector main/src/main/dpml/metro/console part/src/main/dpml/appliance part/src/main/dpml/lang part/src/main/dpml/state part/src/main/net/dpml/annotation part/src/main/net/dpml/appliance part/src/main/net/dpml/lang part/src/main/net/dpml/runtime part/src/test/dpml/lang part/src/test/net/dpml/runtime part/src/test/net/dpml/runtime/composition part/src/test/net/dpml/runtime/context part/src/test/net/dpml/runtime/isolation part/src/test/net/dpml/runtime/lifecycle part/src/test/net/dpml/runtime/lifestyle part/src/test/net/dpml/runtime/profile part/src/test/net/dpml/runtime/service part/src/test/org/acme station/src/main/dpml/station/console testing/plus/src/main/org/acme/reference testing/plus/src/test/net/dpml/part/composition testing/sample/src/main/org/acme tes! ting/test/src/test/net/dpml/test

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: r1990 - in trunk/main/metro: appliance/src/main/dpml/station/info appliance/src/main/dpml/station/util appliance/src/main/net/dpml/station appliance/src/test/net/dpml/appliance connector/src/main/dpml/station/connector main/src/main/dpml/metro/console part/src/main/dpml/appliance part/src/main/dpml/lang part/src/main/dpml/state part/src/main/net/dpml/annotation part/src/main/net/dpml/appliance part/src/main/net/dpml/lang part/src/main/net/dpml/runtime part/src/test/dpml/lang part/src/test/net/dpml/runtime part/src/test/net/dpml/runtime/composition part/src/test/net/dpml/runtime/context part/src/test/net/dpml/runtime/isolation part/src/test/net/dpml/runtime/lifecycle part/src/test/net/dpml/runtime/lifestyle part/src/test/net/dpml/runtime/profile part/src/test/net/dpml/runtime/service part/src/test/org/acme station/src/main/dpml/station/console testing/plus/src/main/org/acme/reference testing/plus/src/test/net/dpml/part/composition testing/sample/src/main/org/acme tes! ting/test/src/test/net/dpml/test
  • Date: Wed, 25 Apr 2007 08:38:11 +0200

Author: mcconnell
Date: 2007-04-25 08:38:01 +0200 (Wed, 25 Apr 2007)
New Revision: 1990

Removed:
trunk/main/metro/part/src/test/org/acme/Parameterizable.java
Modified:

trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
trunk/main/metro/appliance/src/main/dpml/station/info/EntryDescriptor.java

trunk/main/metro/appliance/src/main/dpml/station/info/IncludeDescriptor.java
trunk/main/metro/appliance/src/main/dpml/station/info/InfoDescriptor.java
trunk/main/metro/appliance/src/main/dpml/station/info/PlanDescriptor.java

trunk/main/metro/appliance/src/main/dpml/station/info/ProcessDescriptor.java
trunk/main/metro/appliance/src/main/dpml/station/util/LoggingServer.java

trunk/main/metro/appliance/src/main/net/dpml/station/ApplianceContentHandler.java
trunk/main/metro/appliance/src/main/net/dpml/station/Application.java

trunk/main/metro/appliance/src/main/net/dpml/station/CompositeAppliance.java

trunk/main/metro/appliance/src/main/net/dpml/station/PlanContentHandler.java
trunk/main/metro/appliance/src/main/net/dpml/station/Station.java

trunk/main/metro/appliance/src/test/net/dpml/appliance/AbstractTestCase.java

trunk/main/metro/appliance/src/test/net/dpml/appliance/ApplianceDescriptorTestCase.java

trunk/main/metro/appliance/src/test/net/dpml/appliance/PlanDescriptorTestCase.java

trunk/main/metro/connector/src/main/dpml/station/connector/LocalConnector.java
trunk/main/metro/main/src/main/dpml/metro/console/Main.java
trunk/main/metro/part/src/main/dpml/appliance/AbstractAppliance.java
trunk/main/metro/part/src/main/dpml/appliance/ApplianceHelper.java
trunk/main/metro/part/src/main/dpml/appliance/StandardAppliance.java
trunk/main/metro/part/src/main/dpml/lang/Classpath.java
trunk/main/metro/part/src/main/dpml/lang/Construct.java
trunk/main/metro/part/src/main/dpml/lang/ContextInvocationHandler.java
trunk/main/metro/part/src/main/dpml/lang/DOM3DocumentBuilder.java
trunk/main/metro/part/src/main/dpml/lang/DOMInput.java
trunk/main/metro/part/src/main/dpml/lang/Info.java
trunk/main/metro/part/src/main/dpml/lang/Part.java
trunk/main/metro/part/src/main/dpml/lang/Value.java
trunk/main/metro/part/src/main/dpml/lang/ValueDecoder.java
trunk/main/metro/part/src/main/dpml/state/StateDecoder.java
trunk/main/metro/part/src/main/net/dpml/annotation/Component.java
trunk/main/metro/part/src/main/net/dpml/appliance/Appliance.java
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceConnector.java

trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceContentManager.java
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceException.java
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceManager.java
trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategy.java
trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
trunk/main/metro/part/src/main/net/dpml/lang/Buffer.java
trunk/main/metro/part/src/main/net/dpml/lang/ClassLoaderHelper.java
trunk/main/metro/part/src/main/net/dpml/lang/DecodingException.java
trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
trunk/main/metro/part/src/main/net/dpml/lang/PartContentManager.java
trunk/main/metro/part/src/main/net/dpml/lang/ServiceRegistry.java
trunk/main/metro/part/src/main/net/dpml/lang/SimpleServiceRegistry.java
trunk/main/metro/part/src/main/net/dpml/lang/StandardServiceRegistry.java
trunk/main/metro/part/src/main/net/dpml/lang/Strategy.java
trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
trunk/main/metro/part/src/main/net/dpml/lang/TypeCastException.java
trunk/main/metro/part/src/main/net/dpml/runtime/Component.java
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentException.java

trunk/main/metro/part/src/main/net/dpml/runtime/ComponentInvocationHandler.java
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentListener.java
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategy.java

trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
trunk/main/metro/part/src/main/net/dpml/runtime/ContextDirective.java

trunk/main/metro/part/src/main/net/dpml/runtime/ContextInvocationHandler.java
trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
trunk/main/metro/part/src/main/net/dpml/runtime/Directive.java
trunk/main/metro/part/src/main/net/dpml/runtime/LifestyleHandler.java

trunk/main/metro/part/src/main/net/dpml/runtime/MissingContextEntryException.java
trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
trunk/main/metro/part/src/main/net/dpml/runtime/PartsInvocationHandler.java
trunk/main/metro/part/src/main/net/dpml/runtime/Provider.java
trunk/main/metro/part/src/main/net/dpml/runtime/ProviderEvent.java
trunk/main/metro/part/src/main/net/dpml/runtime/Query.java
trunk/main/metro/part/src/main/net/dpml/runtime/StandardProvider.java
trunk/main/metro/part/src/main/net/dpml/runtime/Status.java
trunk/main/metro/part/src/test/dpml/lang/ConstructTestCase.java
trunk/main/metro/part/src/test/dpml/lang/ContextTestCase.java
trunk/main/metro/part/src/test/net/dpml/runtime/AbstractTestCase.java

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

trunk/main/metro/part/src/test/net/dpml/runtime/composition/ControllerTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/composition/GenericTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/composition/LookupTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/composition/SelectTestCase.java
trunk/main/metro/part/src/test/net/dpml/runtime/context/ArrayTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/context/ContextualTestCase.java
trunk/main/metro/part/src/test/net/dpml/runtime/context/MapTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/isolation/SampleTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/lifecycle/StateTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/SingletonTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/TransientTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/profile/ProfileTestCase.java

trunk/main/metro/part/src/test/net/dpml/runtime/service/ForeignTestCase.java
trunk/main/metro/part/src/test/org/acme/ArrayWidget.java
trunk/main/metro/part/src/test/org/acme/CompositeComponent.java
trunk/main/metro/part/src/test/org/acme/ContextualWidget.java
trunk/main/metro/part/src/test/org/acme/ControllerComponent.java
trunk/main/metro/part/src/test/org/acme/DefaultGizmo.java
trunk/main/metro/part/src/test/org/acme/DefaultWidget.java
trunk/main/metro/part/src/test/org/acme/ForeignWidget.java
trunk/main/metro/part/src/test/org/acme/GenericComponent.java
trunk/main/metro/part/src/test/org/acme/Gizmo.java
trunk/main/metro/part/src/test/org/acme/GizmoAdapter.java
trunk/main/metro/part/src/test/org/acme/MapWidget.java
trunk/main/metro/part/src/test/org/acme/Sample.java
trunk/main/metro/part/src/test/org/acme/SelectComponent.java
trunk/main/metro/part/src/test/org/acme/StandaloneWidget.java
trunk/main/metro/part/src/test/org/acme/StandaloneWidgetAdapter.java
trunk/main/metro/part/src/test/org/acme/StateWidget.java
trunk/main/metro/part/src/test/org/acme/Widget.java
trunk/main/metro/part/src/test/org/acme/WidgetUsingGizmo.java
trunk/main/metro/station/src/main/dpml/station/console/Main.java

trunk/main/metro/station/src/main/dpml/station/console/StationNotBoundException.java

trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java

trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java

trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
trunk/main/metro/testing/sample/src/main/org/acme/AnotherContext.java
trunk/main/metro/testing/sample/src/main/org/acme/Hello.java
trunk/main/metro/testing/sample/src/main/org/acme/HelloComponent.java
trunk/main/metro/testing/sample/src/main/org/acme/HelloConfiguration.java
trunk/main/metro/testing/test/src/test/net/dpml/test/LocalTestCase.java
trunk/main/metro/testing/test/src/test/net/dpml/test/PlanTestCase.java
Log:
housekeeping (including completion of checkstyle clean-up)

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
===================================================================
---
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/dpml/station/info/ApplianceDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -43,11 +43,26 @@
private final URI m_codebase;
private final URI m_uri;

+ /**
+ * Creation of a new appliance descriptor.
+ * @param element the DOM element defining the appliance
+ * @param resolver the property resolver to use
+ * @param uri from which the element was established
+ * @exception DecodingException if a error occurs during the decoding
phase
+ */
public ApplianceDescriptor( Element element, Resolver resolver, URI uri
) throws DecodingException
{
this( element, resolver, uri, false );
}

+ /**
+ * Creation of a new appliance descriptor.
+ * @param element the DOM element defining the appliance
+ * @param resolver the property resolver to use
+ * @param uri from which the element was established
+ * @param nested true if this appliance is nested within a plan
+ * @exception DecodingException if a error occurs during the decoding
phase
+ */
public ApplianceDescriptor( Element element, Resolver resolver, URI uri,
boolean nested ) throws DecodingException
{
super( element, resolver );

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/EntryDescriptor.java
===================================================================
---
trunk/main/metro/appliance/src/main/dpml/station/info/EntryDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/dpml/station/info/EntryDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,9 +20,6 @@

import dpml.util.ElementHelper;

-import java.net.URI;
-
-import net.dpml.lang.DecodingException;
import net.dpml.util.Resolver;

import org.w3c.dom.Element;
@@ -38,6 +35,11 @@
private final String m_key;
private final Element m_element;

+ /**
+ * Creation of a new entry descriptor.
+ * @param element the DOM element defining the entry
+ * @param resolver the symbol resolver
+ */
public EntryDescriptor( Element element, Resolver resolver )
{
m_element = element;

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/IncludeDescriptor.java
===================================================================
---
trunk/main/metro/appliance/src/main/dpml/station/info/IncludeDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/dpml/station/info/IncludeDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -28,7 +28,7 @@
import org.w3c.dom.Element;

/**
- * Immutable datastructure used to describe an deployment scenario.
+ * Include datastructure.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -37,6 +37,12 @@
{
private final URI m_uri;

+ /**
+ * Creation of an include descriptor.
+ * @param element the element defining the included description
+ * @param resolver the symbol resolver
+ * @exception DecodingException if an error occurs during the decoding
phase
+ */
public IncludeDescriptor( Element element, Resolver resolver ) throws
DecodingException
{
super( element, resolver );
@@ -106,13 +112,9 @@
{
return false;
}
- else if( !m_uri.equals( entry.m_uri ) )
- {
- return false;
- }
else
{
- return true;
+ return m_uri.equals( entry.m_uri );
}
}
}

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/InfoDescriptor.java
===================================================================
--- trunk/main/metro/appliance/src/main/dpml/station/info/InfoDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/appliance/src/main/dpml/station/info/InfoDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -27,7 +27,7 @@
import org.w3c.dom.Element;

/**
- * Application info description.
+ * Appliance info description.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -70,6 +70,12 @@
}
}

+ /**
+ * Creation of a new info descriptor.
+ * @param name the name
+ * @param title a short title
+ * @param description a description
+ */
public InfoDescriptor( String name, String title, String description )
{
m_name = name;

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/PlanDescriptor.java
===================================================================
--- trunk/main/metro/appliance/src/main/dpml/station/info/PlanDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/appliance/src/main/dpml/station/info/PlanDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -41,6 +41,13 @@
private final EntryDescriptor[] m_entries;
private final URI m_codebase;

+ /**
+ * Creation of a new plan descriptor.
+ * @param element the element defining the plan
+ * @param resolver the symbol resolver
+ * @param codebase the uri used to establish the plan element
+ * @exception IOException if an IO error occurs
+ */
public PlanDescriptor( Element element, Resolver resolver, URI codebase
) throws IOException
{
m_element = element;

Modified:
trunk/main/metro/appliance/src/main/dpml/station/info/ProcessDescriptor.java
===================================================================
---
trunk/main/metro/appliance/src/main/dpml/station/info/ProcessDescriptor.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/dpml/station/info/ProcessDescriptor.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -27,7 +27,6 @@
import java.util.List;
import java.util.ArrayList;

-import net.dpml.lang.DecodingException;
import net.dpml.util.Resolver;

import org.w3c.dom.Element;

Modified:
trunk/main/metro/appliance/src/main/dpml/station/util/LoggingServer.java
===================================================================
--- trunk/main/metro/appliance/src/main/dpml/station/util/LoggingServer.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/appliance/src/main/dpml/station/util/LoggingServer.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -45,18 +45,21 @@
private static final String LOG_SERVER_PORT_KEY =
"dpml.station.logging.port";
private static final int DEFAULT_LOG_SERVER_PORT = 2020;

- private static LoggingServer SERVER;
+ private static LoggingServer m_SERVER;

+ /**
+ * Log server initialization.
+ */
public static void init()
{
- if( null == SERVER )
+ if( null == m_SERVER )
{
try
{
- SERVER = new LoggingServer();
- SERVER.setDaemon( true );
- SERVER.setName( "DPML Logging Server" );
- SERVER.start();
+ m_SERVER = new LoggingServer();
+ m_SERVER.setDaemon( true );
+ m_SERVER.setName( "DPML Logging Server" );
+ m_SERVER.start();
}
catch( Throwable e )
{

Modified:
trunk/main/metro/appliance/src/main/net/dpml/station/ApplianceContentHandler.java
===================================================================
---
trunk/main/metro/appliance/src/main/net/dpml/station/ApplianceContentHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/net/dpml/station/ApplianceContentHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,51 +20,32 @@

import dpml.lang.DOM3DocumentBuilder;
import dpml.util.SimpleResolver;
-import dpml.util.ElementHelper;
import dpml.util.DefaultLogger;
-import dpml.station.util.LoggingServer;

-import java.io.File;
import java.io.IOException;
-import java.io.FileNotFoundException;
import java.lang.management.ManagementFactory;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
-import java.net.MalformedURLException;
-import java.rmi.Remote;
-import java.util.Properties;
-import java.util.Map;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;

import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;

import net.dpml.transit.Artifact;
import net.dpml.transit.ContentHandler;
-import net.dpml.transit.ContentManager;
import net.dpml.lang.DecodingException;
import net.dpml.util.Logger;
import net.dpml.util.Resolver;

import net.dpml.appliance.Appliance;
-import net.dpml.appliance.ApplianceException;
import net.dpml.appliance.ApplianceManager;
import net.dpml.appliance.ApplianceContentManager;
import net.dpml.appliance.ApplianceFactory;

import dpml.station.info.ApplianceDescriptor;
-import dpml.station.info.InfoDescriptor;
-import dpml.station.info.ProcessDescriptor;

import org.w3c.dom.Element;
import org.w3c.dom.Document;
@@ -113,11 +94,18 @@
return handler;
}

+ /**
+ * Creation of a new applicance content handler.
+ */
public ApplianceContentHandler()
{
this( LOGGER );
}

+ /**
+ * Creation of a new applicance content handler.
+ * @param logger the assigned logging channel
+ */
protected ApplianceContentHandler( Logger logger )
{
logger.debug( "instantiating" );
@@ -140,6 +128,10 @@
}
*/

+ /**
+ * Return the set of applicance managers established by the handler.
+ * @return the appliance managers
+ */
public ApplianceManager[] getApplianceManagers()
{
return MANAGERS.toArray( new ApplianceManager[0] );

Modified:
trunk/main/metro/appliance/src/main/net/dpml/station/Application.java
===================================================================
--- trunk/main/metro/appliance/src/main/net/dpml/station/Application.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/appliance/src/main/net/dpml/station/Application.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -23,48 +23,29 @@
import dpml.station.connector.LocalConnector;
import dpml.station.info.ApplianceDescriptor;
import dpml.station.util.OutputStreamReader;
-import dpml.station.util.StreamReader;
import dpml.station.util.LoggingServer;

import java.io.IOException;
-import java.io.FileNotFoundException;
import java.io.File;
-import java.lang.management.ManagementFactory;
import java.net.URI;
-import java.net.URL;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import java.util.Set;
-import java.util.Hashtable;
import java.util.Properties;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;
-import java.rmi.ConnectException;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;

-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;
-
import net.dpml.appliance.Appliance;
import net.dpml.appliance.ApplianceException;
import net.dpml.appliance.ApplianceListener;
-import net.dpml.appliance.ApplianceEvent;

import net.dpml.util.Logger;

-import net.dpml.lang.DuplicateKeyException;
-import net.dpml.lang.Strategy;
-import net.dpml.runtime.Status;
-
/**
* Process configuration and management support class.
*

Modified:
trunk/main/metro/appliance/src/main/net/dpml/station/CompositeAppliance.java
===================================================================
---
trunk/main/metro/appliance/src/main/net/dpml/station/CompositeAppliance.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/net/dpml/station/CompositeAppliance.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -31,16 +31,12 @@

import java.io.IOException;
import java.net.URI;
-import java.net.URL;
-import java.rmi.Remote;
import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
import java.util.concurrent.TimeUnit;
import java.util.ArrayList;

import net.dpml.appliance.Appliance;
import net.dpml.appliance.ApplianceException;
-import net.dpml.appliance.ApplianceListener;
import net.dpml.appliance.ApplianceEvent;
import net.dpml.appliance.ApplianceManager;

@@ -48,7 +44,6 @@

import net.dpml.state.State;

-import net.dpml.transit.Artifact;
import net.dpml.util.Logger;

import org.w3c.dom.Element;

Modified:
trunk/main/metro/appliance/src/main/net/dpml/station/PlanContentHandler.java
===================================================================
---
trunk/main/metro/appliance/src/main/net/dpml/station/PlanContentHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/main/net/dpml/station/PlanContentHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,33 +19,18 @@
package net.dpml.station;

import dpml.lang.DOM3DocumentBuilder;
+import dpml.station.info.PlanDescriptor;
import dpml.util.SimpleResolver;
-import dpml.util.ElementHelper;
import dpml.util.DefaultLogger;

-import dpml.station.info.EntryDescriptor;
-import dpml.station.info.PlanDescriptor;
-
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
-import java.lang.management.ManagementFactory;
-import java.util.Hashtable;

-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;
-
import net.dpml.appliance.Appliance;
-import net.dpml.appliance.ApplianceFactory;
-
import net.dpml.lang.DecodingException;
-
import net.dpml.transit.Artifact;
-import net.dpml.transit.ContentHandler;
-
import net.dpml.util.Resolver;
import net.dpml.util.Logger;

@@ -68,6 +53,9 @@
private static final DOM3DocumentBuilder DOCUMENT_BUILDER =
new DOM3DocumentBuilder();

+ /**
+ * Creation of a new plan content handler.
+ */
public PlanContentHandler()
{
super( LOGGER );
@@ -177,6 +165,13 @@
}
}

+ /**
+ * Creation of a new appliance using a supplied key and appliance uri.
+ * @param key the appliance key
+ * @param uri an artifact uri referencing an appliance datastructure
+ * @return the new appliance
+ * @exception IOException if an IO error occurs
+ */
public static Appliance newAppliance( String key, URI uri ) throws
IOException
{
URL url = Artifact.toURL( uri );

Modified: trunk/main/metro/appliance/src/main/net/dpml/station/Station.java
===================================================================
--- trunk/main/metro/appliance/src/main/net/dpml/station/Station.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/appliance/src/main/net/dpml/station/Station.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,7 +18,6 @@

package net.dpml.station;

-import java.rmi.Remote;
import java.rmi.RemoteException;

import net.dpml.appliance.Appliance;
@@ -32,10 +31,22 @@
//public interface Station extends Remote
public interface Station extends Appliance
{
+ /**
+ * Constant key for the station registry name.
+ */
static final String STATION_CONNECTOR_KEY = "dpml.station.key";
+
+ /**
+ * Constant key for the station jmx uri value.
+ */
static final String STATION_JMX_URI_KEY = "dpml.station.jmx.uri";
+
//static final String STATION_RMI_PORT = "dpml.station.rmi.port";

+ /**
+ * Stutdown the station.
+ * @exception RemoteException if RMI remote exception occurs
+ */
void shutdown() throws RemoteException;
}


Modified:
trunk/main/metro/appliance/src/test/net/dpml/appliance/AbstractTestCase.java
===================================================================
---
trunk/main/metro/appliance/src/test/net/dpml/appliance/AbstractTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/test/net/dpml/appliance/AbstractTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -27,9 +27,6 @@

import junit.framework.TestCase;

-import net.dpml.lang.Strategy;
-import net.dpml.lang.TypeCastException;
-
import net.dpml.station.ApplianceContentHandler;
import net.dpml.station.PlanContentHandler;

@@ -50,7 +47,7 @@
URL url = file.toURI().toURL();
URLConnection connection = url.openConnection();
ApplianceContentHandler handler = new ApplianceContentHandler();
- return (ApplianceDescriptor) handler.getContent( connection, new
Class[]{ ApplianceDescriptor.class } );
+ return (ApplianceDescriptor) handler.getContent( connection, new
Class[]{ApplianceDescriptor.class} );
}

PlanDescriptor loadPlanDescriptor( String path ) throws Exception
@@ -61,6 +58,6 @@
URL url = file.toURI().toURL();
URLConnection connection = url.openConnection();
PlanContentHandler handler = new PlanContentHandler();
- return (PlanDescriptor) handler.getContent( connection, new Class[]{
PlanDescriptor.class } );
+ return (PlanDescriptor) handler.getContent( connection, new
Class[]{PlanDescriptor.class} );
}
}

Modified:
trunk/main/metro/appliance/src/test/net/dpml/appliance/ApplianceDescriptorTestCase.java
===================================================================
---
trunk/main/metro/appliance/src/test/net/dpml/appliance/ApplianceDescriptorTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/test/net/dpml/appliance/ApplianceDescriptorTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -31,6 +31,10 @@
*/
public class ApplianceDescriptorTestCase extends AbstractTestCase
{
+ /**
+ * Test the integrity of an appliance descriptor.
+ * @exception Exception if an error occurs
+ */
public void testApplianceDescriptor() throws Exception
{
ApplianceDescriptor application = loadApplianceDescriptor(
"appliance.xml" );

Modified:
trunk/main/metro/appliance/src/test/net/dpml/appliance/PlanDescriptorTestCase.java
===================================================================
---
trunk/main/metro/appliance/src/test/net/dpml/appliance/PlanDescriptorTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/appliance/src/test/net/dpml/appliance/PlanDescriptorTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,10 +21,6 @@
import dpml.station.info.PlanDescriptor;
import dpml.station.info.EntryDescriptor;

-import java.net.URI;
-import java.util.Properties;
-import java.util.Map;
-
/**
* Scenario descriptor testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
@@ -32,6 +28,10 @@
*/
public class PlanDescriptorTestCase extends AbstractTestCase
{
+ /**
+ * Test integrity of the plan title.
+ * @exception Exception if an error occurs
+ */
public void testScenarioTitle() throws Exception
{
PlanDescriptor scenario = loadPlanDescriptor( "plan.xml" );
@@ -39,6 +39,10 @@
assertEquals( "title", "Plan Demo", title );
}

+ /**
+ * Test integrity of the plan entry uris.
+ * @exception Exception if an error occurs
+ */
public void testPlanURIs() throws Exception
{
PlanDescriptor scenario = loadPlanDescriptor( "plan.xml" );

Modified:
trunk/main/metro/connector/src/main/dpml/station/connector/LocalConnector.java
===================================================================
---
trunk/main/metro/connector/src/main/dpml/station/connector/LocalConnector.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/connector/src/main/dpml/station/connector/LocalConnector.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -39,6 +39,10 @@
private Appliance m_appliance;
private Monitor m_monitor;

+ /**
+ * Creation of a new local connector.
+ * @exception RemoteException if a remote error occurs
+ */
public LocalConnector() throws RemoteException
{
super();
@@ -61,6 +65,13 @@
}
}

+ /**
+ * Wait for the specified time for appliance registration.
+ * @param units the time units
+ * @param timeout the number of units
+ * @return the registered appliance
+ * @exception IOException if an IO or timout error occurs
+ */
public Appliance getAppliance( TimeUnit units, int timeout ) throws
IOException
{
synchronized( m_lock )
@@ -100,23 +111,33 @@
}
}

+ /**
+ * Thread monitor.
+ */
private class Monitor extends Thread
{
private int m_timeout;
private TimeUnit m_units;

+ /**
+ * Creation of a new timout monitor.
+ * @param units the units of time
+ * @param timeout the timeout value
+ */
public Monitor( TimeUnit units, int timeout )
{
m_timeout = timeout;
m_units = units;
}

+ /**
+ * Run the timeout thread.
+ */
public void run()
{
try
{
m_units.sleep( m_timeout );
- //Thread.currentThread().sleep( m_timeout );
}
catch( InterruptedException e )
{

Modified: trunk/main/metro/main/src/main/dpml/metro/console/Main.java
===================================================================
--- trunk/main/metro/main/src/main/dpml/metro/console/Main.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/main/src/main/dpml/metro/console/Main.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -36,21 +36,14 @@
import dpml.cli.validation.URIValidator;
import dpml.cli.validation.NumberValidator;

-import dpml.util.PropertyResolver;
-import dpml.util.DefaultLogger;
import dpml.util.PID;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
import java.net.MalformedURLException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
import java.rmi.NotBoundException;
-import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.util.Properties;
@@ -58,26 +51,18 @@
import java.util.Set;
import java.util.EnumSet;
import java.util.Collections;
-import java.util.concurrent.TimeUnit;

import javax.tools.Tool;
import javax.lang.model.SourceVersion;

-import net.dpml.annotation.Context;
import net.dpml.annotation.Component;

import net.dpml.appliance.Appliance;
import net.dpml.appliance.ApplianceError;
-import net.dpml.appliance.ApplianceException;
import net.dpml.appliance.ApplianceListener;
import net.dpml.appliance.ApplianceEvent;
import net.dpml.appliance.ApplianceConnector;

-import net.dpml.lang.Strategy;
-import net.dpml.lang.ServiceRegistry;
-import net.dpml.lang.SimpleServiceRegistry;
-import net.dpml.lang.DuplicateKeyException;
-
import net.dpml.runtime.ComponentListener;
import net.dpml.runtime.ComponentEvent;
import net.dpml.runtime.ProviderEvent;
@@ -85,9 +70,6 @@

import net.dpml.transit.Artifact;
import net.dpml.transit.InvalidArtifactException;
-import net.dpml.transit.ContentHandler;
-import net.dpml.transit.Transit;
-
import net.dpml.util.Logger;

import static net.dpml.annotation.LifestylePolicy.SINGLETON;
@@ -120,32 +102,6 @@
* type of the target application. Normally this plugin is activated as
a
* consequence of invoking the <tt>metro</tt> commandline handler (which
is
* the default haviour of the <tt>station</tt> when deployment local
processes).
- * The following command list help about the <tt>metro</tt> commandline
handler:
- * <pre>$ metro help
-Usage:
-metro <uri> [-server] | -help
-options
- <uri> Application codebase part uri.
- -command Enables command mode.
- -help Prints command help and exits.
- -version Prints version info and exits.
- * </pre>
- * An example commandline and resulting log of an application launch
- * using <tt>metro</tt> is show below:
- * <pre>
-$ metro -command link:part:dpml/metro/dpml-metro-sample
-
-[2756 ] [INFO ] (dpml.metro): commissioning hello
-[2756 ] [INFO ] (hello): pid: [2756]
-[2756 ] [INFO ] (hello): message: Hello
-[2756 ] [INFO ] (hello): port: 0
-[2756 ] [INFO ] (hello): target:
artifact:jar:dpml/metro/dpml-metro-sample#SNAPSHOT
-[2756 ] [INFO ] (hello): starting
-[2756 ] [INFO ] (hello): started
-[2756 ] [INFO ] (dpml.metro): decommissioning hello
-[2756 ] [INFO ] (hello): stopping
-[2756 ] [INFO ] (hello): stopped
- * </pre>
*
* @param logger the assigned logging channel
* @exception Exception if an error occurs
@@ -157,6 +113,10 @@
Appliance.class.getClassLoader() );
}

+ /**
+ * Return the source version supported by this tool.
+ * @return the supported source versions as a set
+ */
public Set<SourceVersion> getSourceVersions()
{
return Collections.unmodifiableSet(
@@ -167,6 +127,11 @@

/**
* Run the Metro tool.
+ * @param in the input stream
+ * @param out the output stream
+ * @param err the error stream
+ * @param arguments a sequence of command handler arguments
+ * @return the command handler execution result value
*/
public int run( InputStream in, OutputStream out, OutputStream err,
String... arguments )
{
@@ -233,14 +198,17 @@
String error =
"Invalid uri: ["
+ uri
- + "] (" + e.getMessage() +
- "), expected format:
'scheme:type:[group[/group[/...]]/name[#<version>].";
+ + "] (" + e.getMessage()
+ + "), expected format:
'scheme:type:[group[/group[/...]]/name[#<version>].";
m_logger.error( error );
return -1;
}
catch( TooManyArgumentsException e )
{
- m_logger.error( "Error: " + e.getMessage() );
+ final String error =
+ "Error: "
+ + e.getMessage();
+ m_logger.error( error );
return -1;
}
finally
@@ -430,6 +398,9 @@
return properties;
}

+ /**
+ * Internal component monitor.
+ */
private class InternalComponentMonitor implements ComponentListener
{
/**
@@ -529,6 +500,9 @@
}
}

+ /**
+ * Local appliance listener.
+ */
private class LocalApplianceListener implements ApplianceListener
{
public void applianceChanged( final ApplianceEvent event )

Modified: trunk/main/metro/part/src/main/dpml/appliance/AbstractAppliance.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/appliance/AbstractAppliance.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/appliance/AbstractAppliance.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,43 +19,19 @@
package dpml.appliance;

import java.io.IOException;
-import java.lang.management.ManagementFactory;
import java.net.URI;
-import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
-import java.util.List;
-import java.util.LinkedList;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;

-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;
-
import net.dpml.appliance.Appliance;
import net.dpml.appliance.ApplianceListener;
import net.dpml.appliance.ApplianceEvent;
-import net.dpml.appliance.ApplianceException;
-import net.dpml.appliance.ApplianceManager;

-import net.dpml.lang.Strategy;
-
-import net.dpml.runtime.Component;
-import net.dpml.runtime.ComponentEvent;
-import net.dpml.runtime.ComponentListener;
-import net.dpml.runtime.Provider;
-import net.dpml.runtime.ProviderEvent;
-import net.dpml.runtime.Status;
-
-import net.dpml.state.State;
-import net.dpml.state.StateEvent;
-import net.dpml.state.StateListener;
-
import net.dpml.util.Logger;

/**
@@ -65,6 +41,10 @@
*/
public abstract class AbstractAppliance extends UnicastRemoteObject
{
+ /**
+ * Set a shutdown hook to handle decommissioning of the supplied
appliance.
+ * @param appliance the appliance to decomission on shutdown
+ */
protected void setShutdownHook( final Appliance appliance )
{
Runtime.getRuntime().addShutdownHook(
@@ -92,6 +72,12 @@

private boolean m_commissioned = false;

+ /**
+ * Creation of a new abstract appliance.
+ * @param logger the assigned logging channel
+ * @param uri the uri defining the appliance data-source
+ * @exception IOException if an IO error occurs
+ */
public AbstractAppliance( final Logger logger, final URI uri ) throws
IOException
{
super();
@@ -115,6 +101,10 @@
m_logger = logger;
}

+ /**
+ * Return the codebase uri.
+ * @return the codebase uri
+ */
public String getCodebaseURI()
{
return m_codebase.toASCIIString();
@@ -147,6 +137,10 @@
m_listeners.remove( listener );
}

+ /**
+ * Returns the commissioned state of the appliance.
+ * @return TRUE if the appliance is commissioned
+ */
public boolean isCommissioned()
{
synchronized( this )
@@ -155,6 +149,10 @@
}
}

+ /**
+ * Commission the appliance.
+ * @exception IOException if an IO error occurs during appliance
commissioning
+ */
public void commission() throws IOException
{
synchronized( this )
@@ -163,11 +161,21 @@
}
}

+ /**
+ * Decomission the appliance.
+ * @exception RemoteException if an IO error occurs during appliance
decommissioning
+ */
public void decommission() throws RemoteException
{
decommission( 10, TimeUnit.SECONDS );
}

+ /**
+ * Decomission the appliance using the supplied timeout constraint.
+ * @param timeout the timeout duration
+ * @param units the timeout units of measurement
+ * @exception RemoteException if an IO error occurs during appliance
decommissioning
+ */
protected void decommission( long timeout, TimeUnit units ) throws
RemoteException
{
synchronized( this )
@@ -198,11 +206,19 @@
}
}

+ /**
+ * Return the assigned logging channel.
+ * @return the logging channel
+ */
protected Logger getLogger()
{
return m_logger;
}

+ /**
+ * Process an appliance event.
+ * @param event the event
+ */
protected void processEvent( ApplianceEvent event )
{
Logger logger= getLogger();
@@ -212,6 +228,9 @@
}
}

+ /**
+ * Appliance event dispatch handler.
+ */
private static class ApplianceEventDistatcher implements Runnable
{
private Logger m_logger;
@@ -225,6 +244,9 @@
m_event = event;
}

+ /**
+ * Run the dispatch thread.
+ */
public void run()
{
try

Modified: trunk/main/metro/part/src/main/dpml/appliance/ApplianceHelper.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/appliance/ApplianceHelper.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/appliance/ApplianceHelper.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -40,14 +40,32 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public class ApplianceHelper
+public final class ApplianceHelper
{
+ private ApplianceHelper()
+ {
+ // disabled
+ }
+
+ /**
+ * Creation of a new appliance instance.
+ * @param uri the appliance uri
+ * @return the new appliance
+ * @exception IOException if an error occurs during appliance creation
+ */
public static Appliance newAppliance( URI uri ) throws IOException
{
String partition = getPartition();
return newAppliance( partition, uri );
}

+ /**
+ * Creation of a new appliance instance.
+ * @param partition the partition name under which the appliance will be
created
+ * @param uri the appliance uri
+ * @return the new appliance
+ * @exception IOException if an error occurs during appliance creation
+ */
public static Appliance newAppliance( String partition, URI uri ) throws
IOException
{
if( null == partition )

Modified: trunk/main/metro/part/src/main/dpml/appliance/StandardAppliance.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/appliance/StandardAppliance.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/appliance/StandardAppliance.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,31 +21,13 @@
import dpml.state.NullState;

import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.URI;
-import java.rmi.Remote;
import java.rmi.RemoteException;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;

-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;
-
import net.dpml.appliance.Appliance;
-import net.dpml.appliance.ApplianceListener;
import net.dpml.appliance.ApplianceEvent;
-import net.dpml.appliance.ApplianceException;
import net.dpml.appliance.ApplianceManager;

-import net.dpml.lang.Strategy;
-
import net.dpml.runtime.Component;
import net.dpml.runtime.ComponentEvent;
import net.dpml.runtime.ComponentListener;
@@ -54,8 +36,6 @@
import net.dpml.runtime.Status;

import net.dpml.state.State;
-import net.dpml.state.StateEvent;
-import net.dpml.state.StateListener;

import net.dpml.util.Logger;

@@ -72,6 +52,12 @@
private Provider m_provider;
private Object m_instance;

+ /**
+ * Creation of a new appliance.
+ * @param logger the assigned logging channel
+ * @param component the component to manage as an appliance
+ * @exception IOException if an IO error occurs
+ */
public StandardAppliance(
final Logger logger, final Component component ) throws IOException
{
@@ -86,6 +72,7 @@
/**
* Return the current state of the instance.
* @return the current state
+ * @exception RemoteException if a remote IO error occurs
*/
public State getState() throws RemoteException
{
@@ -99,6 +86,11 @@
}
}

+ /**
+ * Return the appliance name
+ * @return the name
+ * @exception RemoteException if a remote IO error occurs
+ */
public String getName() throws RemoteException
{
return m_component.getName();
@@ -108,7 +100,7 @@
* Return a value assignable to the supplied remote type or null if the
type
* cannot be resolved from this strategy.
* @param c the target class
- * @return an instance of the class or null
+ * @return an instance of the class or null if the class is not recognized
* @exception IOException if an IO error occurs
*/
public <T>T getContentForClass( Class<T> c ) throws IOException
@@ -130,7 +122,10 @@
}
}

-
+ /**
+ * Commission the appliance.
+ * @exception IOException if an eror occurs during commissioning
+ */
public void commission() throws IOException
{
synchronized( m_component )
@@ -145,6 +140,12 @@
}
}

+ /**
+ * Decommission the appliance.
+ * @param timeout the timeout duration
+ * @param units the units of measurement
+ * @exception RemoteException if a remoting error occurs
+ */
protected void decommission( long timeout, TimeUnit units ) throws
RemoteException
{
synchronized( m_component )
@@ -189,6 +190,9 @@
}
*/

+ /**
+ * An internal component listener.
+ */
private class InternalComponentListener implements ComponentListener
{
private Appliance m_appliance;

Modified: trunk/main/metro/part/src/main/dpml/lang/Classpath.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/Classpath.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/Classpath.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -18,21 +18,10 @@

package dpml.lang;

-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
import java.net.URI;
import java.util.Arrays;

-import javax.xml.XMLConstants;
-
import dpml.util.Category;
-import net.dpml.lang.Strategy;
-import net.dpml.lang.Buffer;
-
-import net.dpml.util.Logger;
-
import dpml.util.ObjectUtils;

/**

Modified: trunk/main/metro/part/src/main/dpml/lang/Construct.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/Construct.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/Construct.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -177,11 +177,23 @@
m_compound = true;
}

+ /**
+ * Encode the construct to XML.
+ * @param buffer the buffer to encode to
+ * @exception IOException if an IO error occurs
+ */
public void encode( Buffer buffer ) throws IOException
{
encode( buffer, "param", null );
}

+ /**
+ * Encode the construct to XML.
+ * @param buffer the buffer to encode to
+ * @param label the element name
+ * @param key the key associated with the value
+ * @exception IOException if an IO error occurs
+ */
public void encode( Buffer buffer, String label, String key ) throws
IOException
{
buffer.nl( "<" + label );

Modified:
trunk/main/metro/part/src/main/dpml/lang/ContextInvocationHandler.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/ContextInvocationHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/ContextInvocationHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -27,8 +27,6 @@

import net.dpml.annotation.Context;

-import dpml.lang.Value;
-
/**
* Invocation handler utility for a Context class.
*

Modified: trunk/main/metro/part/src/main/dpml/lang/DOM3DocumentBuilder.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/DOM3DocumentBuilder.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/DOM3DocumentBuilder.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -24,9 +24,6 @@
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
-import java.net.URISyntaxException;
-import java.util.Hashtable;
-import java.util.Map;
import java.util.ArrayList;
import java.util.ServiceLoader;
import java.io.InputStream;
@@ -35,9 +32,6 @@
import java.io.OutputStream;
import java.io.FileNotFoundException;

-import javax.xml.XMLConstants;
-
-import net.dpml.lang.PartError;
import net.dpml.lang.DecodingException;

import net.dpml.transit.Artifact;
@@ -115,6 +109,12 @@
return parse( connection );
}

+ /**
+ * Parse an xml schema document.
+ * @param connection the document url connection
+ * @return the validated document
+ * @exception IOException if an IO error occurs
+ */
public Document parse( URLConnection connection ) throws IOException
{
if( null == connection )
@@ -211,7 +211,7 @@
*/
private static class InternalResourceResolver implements
LSResourceResolver
{
- private static StandardNamespaceResolver RESOLVER =
+ private static final StandardNamespaceResolver RESOLVER =
new StandardNamespaceResolver();

private final Logger m_logger;

Modified: trunk/main/metro/part/src/main/dpml/lang/DOMInput.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/DOMInput.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/DOMInput.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -78,6 +78,8 @@
* <br>If the application knows the character encoding of the byte stream,
* it should set the encoding property. Setting the encoding in this way
* will override any encoding specified in the XML declaration itself.
+ *
+ * @return the byte stream
*/
public InputStream getByteStream()
{
@@ -93,10 +95,12 @@
* <br>If the application knows the character encoding of the byte stream,
* it should set the encoding property. Setting the encoding in this way
* will override any encoding specified in the XML declaration itself.
+ *
+ * @param input the input byte stream
*/
- public void setByteStream( InputStream byteStream )
+ public void setByteStream( InputStream input )
{
- m_byteStream = byteStream;
+ m_byteStream = input;
}

/**
@@ -106,6 +110,8 @@
* <br>If a character stream is specified, the parser will ignore any byte
* stream and will not attempt to open a URI connection to the system
* identifier.
+ *
+ * @return the character stream
*/
public Reader getCharacterStream()
{
@@ -118,10 +124,12 @@
* <br>If a character stream is specified, the parser will ignore any byte
* stream and will not attempt to open a URI connection to the system
* identifier.
+ *
+ * @param reader the character stream reader
*/
- public void setCharacterStream( Reader characterStream )
+ public void setCharacterStream( Reader reader )
{
- m_reader = characterStream;
+ m_reader = reader;
}

/**
@@ -130,6 +138,8 @@
* <br>If string data is available in the input source, the parser will
* ignore the character stream and the byte stream and will not attempt
* to open a URI connection to the system identifier.
+ *
+ * @return the string data
*/
public String getStringData()
{
@@ -142,10 +152,12 @@
* <br>If string data is available in the input source, the parser will
* ignore the character stream and the byte stream and will not attempt
* to open a URI connection to the system identifier.
+ *
+ * @param data the data
*/
- public void setStringData( String stringData )
+ public void setStringData( String data )
{
- m_data = stringData;
+ m_data = data;
}

/**
@@ -157,6 +169,8 @@
* by means of this attribute will override any encoding specified in
* the XML claration or the Text Declaration, or an encoding obtained
* from a higher level protocol, such as HTTP .
+ *
+ * @return the encoding
*/
public String getEncoding()
{
@@ -172,6 +186,8 @@
* by means of this attribute will override any encoding specified in
* the XML claration or the Text Declaration, or an encoding obtained
* from a higher level protocol, such as HTTP .
+ *
+ * @param encoding the encoding
*/
public void setEncoding( String encoding )
{
@@ -182,6 +198,8 @@
* The public identifier for this input source. The public identifier is
* always optional: if the application writer includes one, it will be
* provided as part of the location information.
+ *
+ * @return the public id
*/
public String getPublicId()
{
@@ -191,10 +209,12 @@
* The public identifier for this input source. The public identifier is
* always optional: if the application writer includes one, it will be
* provided as part of the location information.
+ *
+ * @param id the public id
*/
- public void setPublicId( String publicId )
+ public void setPublicId( String id )
{
- m_publicId = publicId;
+ m_publicId = id;
}

/**
@@ -210,11 +230,14 @@
* setting the encoding attribute.
* <br>If the system ID is a relative URI reference (see section 5 in ),
* the behavior is implementation dependent.
+ *
+ * @return the system id
*/
public String getSystemId()
{
return m_systemId;
}
+
/**
* The system identifier, a URI reference , for this input source. The
* system identifier is optional if there is a byte stream or a
@@ -228,16 +251,20 @@
* setting the encoding attribute.
* <br>If the system ID is a relative URI reference (see section 5 in ),
* the behavior is implementation dependent.
+ *
+ * @param id the system id
*/
- public void setSystemId( String systemId )
+ public void setSystemId( String id )
{
- m_systemId = systemId;
+ m_systemId = id;
}

/**
- * The base URI to be used (see section 5.1.4 in ) for resolving relative
+ * The base URI to be used (see section 5.1.4 in ) for resolving relative
* URIs to absolute URIs. If the baseURI is itself a relative URI, the
* behavior is implementation dependent.
+ *
+ * @return the base uri
*/
public String getBaseURI()
{
@@ -248,16 +275,20 @@
* The base URI to be used (see section 5.1.4 in ) for resolving relative
* URIs to absolute URIs. If the baseURI is itself a relative URI, the
* behavior is implementation dependent.
+ *
+ * @param base the base uri
*/
- public void setBaseURI( String baseURI )
+ public void setBaseURI( String base )
{
- m_base = baseURI;
+ m_base = base;
}

/**
* If set to true, assume that the input is certified (see section 2.13
* in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>]) when
* parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>].
+ *
+ * @return the certified text flag
*/
public boolean getCertifiedText()
{
@@ -268,9 +299,11 @@
* If set to true, assume that the input is certified (see section 2.13
* in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>]) when
* parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML
1.1</a>].
+ *
+ * @param flag the certified text flag
*/
- public void setCertifiedText( boolean certifiedText )
+ public void setCertifiedText( boolean flag )
{
- m_certified = certifiedText;
+ m_certified = flag;
}
}

Modified: trunk/main/metro/part/src/main/dpml/lang/Info.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/Info.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/Info.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -18,19 +18,10 @@

package dpml.lang;

-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
import java.net.URI;
-import java.util.Arrays;

-import javax.xml.XMLConstants;
-
-import net.dpml.util.Logger;
import dpml.util.ObjectUtils;

-
/**
* Part info description.
*

Modified: trunk/main/metro/part/src/main/dpml/lang/Part.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/Part.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/Part.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -18,21 +18,16 @@

package dpml.lang;

-import dpml.util.ObjectUtils;
-
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.management.ManagementFactory;
import java.net.URI;
-import java.util.Arrays;
import java.util.Hashtable;

import javax.management.MBeanServer;
import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.management.InstanceAlreadyExistsException;

import javax.xml.XMLConstants;

@@ -44,8 +39,6 @@
import net.dpml.lang.SimpleServiceRegistry;
import net.dpml.lang.PartManager;

-import net.dpml.util.Logger;
-
/**
* Part datastructure.
*
@@ -210,6 +203,11 @@
return strategy.getInstance( Object.class );
}

+ /**
+ * Save the part to a supplied output stream.
+ * @param output the output stream
+ * @exception IOException if an IO error occurs
+ */
public void save( OutputStream output ) throws IOException
{
final Writer writer = new OutputStreamWriter( output );

Modified: trunk/main/metro/part/src/main/dpml/lang/Value.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/Value.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/Value.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -61,8 +61,20 @@
*/
Object resolve( Class<?> type, Map<String,Object> map ) throws Exception;

+ /**
+ * Encode the value to a buffer.
+ * @param buffer the buffer
+ * @exception IOException if an IO error occurs
+ */
void encode( Buffer buffer ) throws IOException;

+ /**
+ * Encode the value to a buffer.
+ * @param buffer the buffer
+ * @param label the element name
+ * @param key the value key
+ * @exception IOException if an IO error occurs
+ */
void encode( Buffer buffer, String label, String key ) throws
IOException;

}

Modified: trunk/main/metro/part/src/main/dpml/lang/ValueDecoder.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/lang/ValueDecoder.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/lang/ValueDecoder.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -18,8 +18,6 @@

package dpml.lang;

-import dpml.lang.Construct;
-
import dpml.util.ElementHelper;

import net.dpml.util.Resolver;

Modified: trunk/main/metro/part/src/main/dpml/state/StateDecoder.java
===================================================================
--- trunk/main/metro/part/src/main/dpml/state/StateDecoder.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/dpml/state/StateDecoder.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -28,7 +28,11 @@

import dpml.util.ElementHelper;

-import net.dpml.state.*;
+import net.dpml.state.State;
+import net.dpml.state.Action;
+import net.dpml.state.TriggerPolicy;
+import net.dpml.state.ApplyAction;
+import net.dpml.state.ExecAction;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

Modified: trunk/main/metro/part/src/main/net/dpml/annotation/Component.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/annotation/Component.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/annotation/Component.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -32,10 +32,43 @@
@Retention( RetentionPolicy.RUNTIME )
public @interface Component
{
+ /**
+ * Declaration of the component name. QAs a general rule it is recommended
+ * that component names should be restricted to short names without
periods or
+ * spaces (such as 'widget', 'gizmo', etc.). Component names are used in
the
+ * construction of composite names that fully qualify the component
within the
+ * runtime and serve as logging category names. If undefined, a "" name
value
+ * is declared in which case a container may resolve a name based on the
component
+ * classname.
+ */
String name() default "";
+
+ /**
+ * Declaration of an explicit component lifestyle policy. If undefined
the
+ * default policy is LifestylePolicy.THREAD.
+ */
LifestylePolicy lifestyle() default LifestylePolicy.THREAD;
+
+ /**
+ * Declaration of an explicit component collection policy. If undefined
the
+ * default policy is CollectionPolicy.HARD.
+ */
CollectionPolicy collection() default CollectionPolicy.HARD;
+
+ /**
+ * Declaration of an alternative lifestyle graph via a URI. If undefined
the
+ * default semantics are derived from a graph definition colocated with
the class
+ * using the resource path <classname>.xgraph.
+ */
String lifecycle() default "";
+
+ /**
+ * Declaration of an alternative component runtime handler uri.
+ */
String handlerURI() default "link:part:dpml/metro/dpml-lang-component";
+
+ /**
+ * Declaration of an alternative component runtime strategy handler
classname.
+ */
String handlerClassname() default
"net.dpml.runtime.ComponentStrategyHandler";
}

Modified: trunk/main/metro/part/src/main/net/dpml/appliance/Appliance.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/appliance/Appliance.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/appliance/Appliance.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.rmi.Remote;
import java.rmi.RemoteException;
-import java.util.concurrent.TimeUnit;

import net.dpml.state.State;

@@ -37,6 +36,7 @@
/**
* Return the current state of the instance.
* @return the current state
+ * @exception RemoteException if a RMI remoting exception occurs
*/
State getState() throws RemoteException;

@@ -72,11 +72,26 @@
* @exception RemoteException if a RMI error occurs
*/
Appliance[] getChildren() throws RemoteException;
-
+
+ /**
+ * Get the appliance name.
+ * @return the name
+ * @exception RemoteException if a RMI error occurs
+ */
String getName() throws RemoteException;

+ /**
+ * Get the appliance codebase uri.
+ * @return the uri as a string
+ * @exception RemoteException if a RMI error occurs
+ */
String getCodebaseURI() throws RemoteException;

+ /**
+ * Get the commissioned state of the appliance.
+ * @return TRUE if the appliance is commissioned
+ * @exception RemoteException if a RMI error occurs
+ */
boolean isCommissioned() throws RemoteException;
}


Modified:
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceConnector.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceConnector.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceConnector.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -40,6 +40,7 @@
* Retrieve the connected appliance.
* @param units the timout units
* @param timeout duration (in units) to wait for a connection
+ * @return the appliance
* @exception IOException if an I/O error occurs
*/
Appliance getAppliance( TimeUnit units, int timeout ) throws IOException;

Modified:
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceContentManager.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceContentManager.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceContentManager.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -31,5 +31,9 @@
@MXBean
public interface ApplianceContentManager extends ContentManager
{
+ /**
+ * Return an array of appliance managers.
+ * @return the appliance manager array
+ */
ApplianceManager[] getApplianceManagers();
}

Modified:
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceException.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,8 +18,6 @@

package net.dpml.appliance;

-import java.io.IOException;
-
import net.dpml.lang.DecodingException;

import org.w3c.dom.Element;

Modified:
trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceManager.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceManager.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/appliance/ApplianceManager.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -34,6 +34,7 @@
/**
* Returns the codebase URI as a string.
* @return the codebase uri
+ * @exception RemoteException if a RMI error occurs
*/
String getCodebaseURI() throws RemoteException;
}

Modified: trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategy.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategy.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategy.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,14 +19,8 @@
package net.dpml.lang;

import java.io.IOException;
-import java.io.Writer;
import java.net.URL;

-import net.dpml.state.StateListener;
-
-import net.dpml.util.Logger;
-import dpml.lang.Disposable;
-
/**
* Simple resource deployment strategy.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
@@ -60,11 +54,19 @@
m_path = path;
}

+ /**
+ * Return the strategy name.
+ * @return the name
+ */
public String getName()
{
return m_urn;
}

+ /**
+ * Return the strategy priority.
+ * @return the priority value
+ */
public int getPriority()
{
return 0;
@@ -121,11 +123,24 @@
return m_path;
}

+ /**
+ * Return true if the strategy is a candidate for the supplied class.
+ * This calss will always throw a UnsupportedOperationException (anltib
+ * support is not applicable).
+ *
+ * @param type a service type
+ * @return the supported status flag
+ */
public boolean isaCandidate( Class<?> type )
{
throw new UnsupportedOperationException();
}

+ /**
+ * Strategy initialization (not used).
+ *
+ * @param registry a service registry
+ */
public void initialize( ServiceRegistry registry )
{
// not required

Modified:
trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/AntlibStrategyHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,26 +19,12 @@
package net.dpml.lang;

import dpml.util.ElementHelper;
-import dpml.util.DefaultLogger;
-import dpml.util.StandardClassLoader;
-import dpml.util.SystemClassLoader;
-import dpml.util.Category;

-import dpml.lang.Classpath;
-import dpml.lang.ValueDecoder;
-import dpml.lang.Value;
-
-import net.dpml.runtime.ComponentStrategyHandler;
-
import java.io.IOException;
-import java.io.Writer;
-import java.net.URI;

-import net.dpml.util.Logger;
import net.dpml.util.Resolver;

import org.w3c.dom.Element;
-import org.w3c.dom.TypeInfo;

/**
* Antlib strategy handler implementation.
@@ -48,13 +34,29 @@
*/
public class AntlibStrategyHandler implements StrategyHandler
{
+ /**
+ * Antlib strategy namespace constant.
+ */
public static final String NAMESPACE = "dpml:antlib";

+ /**
+ * Creation of a new antlib strategy.
+ * @param c the target class
+ * @return the strategy instance
+ * @exception IOException if an IO error occurs
+ */
public Strategy newStrategy( Class<?> c ) throws IOException
{
return newStrategy( c, null );
}

+ /**
+ * Creation of a new antlib strategy.
+ * @param c the target class
+ * @param name the name to assign to the strategy
+ * @return the strategy instance
+ * @exception IOException if an IO error occurs
+ */
public Strategy newStrategy( Class<?> c, String name ) throws IOException
{
throw new UnsupportedOperationException( "newStrategy" );
@@ -65,7 +67,9 @@
* @param classloader the classloader
* @param element the DOM element definining the deployment strategy
* @param resolver symbolic property resolver
+ * @param partition the enclosing partition
* @param query the query fragment (ignored)
+ * @param validate the validation policy
* @return the strategy definition
* @exception IOException if an I/O error occurs
*/

Modified: trunk/main/metro/part/src/main/net/dpml/lang/Buffer.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/Buffer.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/Buffer.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -41,7 +41,7 @@
* @param pad the current offset
* @exception NullPointerException of the writer or namespace arguments
are null
*/
- public Buffer( final Writer writer, final String namespace, final String
pad )
+ public Buffer( final Writer writer, final String namespace, final String
pad ) throws NullPointerException
{
if( null == writer )
{
@@ -63,62 +63,119 @@
m_writer = writer;
}

+ /**
+ * Get the current namespace.
+ * @return the namespace
+ */
public String getEnclosingNamespace()
{
return m_namespace;
}

+ /**
+ * Get the space indent offset.
+ * @return the offset value
+ */
public String getOffset()
{
return m_pad;
}

+ /**
+ * Write a value to the buffer.
+ * @param value the value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void write( String value ) throws IOException
{
m_writer.write( value );
}

+ /**
+ * Write an int value to the buffer.
+ * @param n the int value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void write( int n ) throws IOException
{
m_writer.write( n );
}

+ /**
+ * Write an character array value to the buffer.
+ * @param array the array value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void write( char[] array ) throws IOException
{
m_writer.write( array );
}

+ /**
+ * Write a value to the buffer following a nl character.
+ * @param value the value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void nl( String value ) throws IOException
{
m_writer.write( "\n" + m_pad + value );
}

+ /**
+ * Write an int value to the buffer following a nl character.
+ * @param n the int value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void nl( int n ) throws IOException
{
m_writer.write( "\n" + m_pad + n );
}

+ /**
+ * Write an character array value to the buffer following a nl character.
+ * @param array the array value to write to the buffer
+ * @exception IOException if an IO error occurs
+ */
public void nl( char[] array ) throws IOException
{
m_writer.write( "\n" + m_pad );
m_writer.write( array );
}

+ /**
+ * Indent the current offset value by 2 space characters.
+ * @return a buffer
+ */
public Buffer indent()
{
return indent( " " );
}

+ /**
+ * Indent the current offset value by a supplied value.
+ * @param indent the indent value
+ * @return a new buffer
+ */
public Buffer indent( String indent )
{
return new Buffer( m_writer, m_namespace, m_pad + indent );
}

+ /**
+ * Test id the supplied namespace is the current namesapce.
+ * @param namespace to namespace to compare with the current namespace
+ * @return true if the namesapce is current
+ */
public boolean isNamespace( String namespace )
{
return m_namespace.equals( namespace );
}

+ /**
+ * Creation of a new buffer mapped to the supplied namespace.
+ * @param namespace the namespace
+ * @return a buffer
+ */
public Buffer namespace( String namespace )
{
if( m_namespace.equals( namespace ) )

Modified: trunk/main/metro/part/src/main/net/dpml/lang/ClassLoaderHelper.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/ClassLoaderHelper.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/ClassLoaderHelper.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,32 +19,29 @@
package net.dpml.lang;

import dpml.lang.ValueDecoder;
+import dpml.lang.Classpath;
import dpml.util.StandardClassLoader;
-import dpml.util.SystemClassLoader;
+import dpml.util.Category;
+import dpml.util.DefaultLogger;

import java.io.IOException;
-import java.io.Writer;
import java.net.URI;

-import dpml.lang.Classpath;
-import dpml.util.Category;
-
import net.dpml.util.Logger;
-import net.dpml.util.Resolver;
-import dpml.util.ElementHelper;
-import dpml.util.DefaultLogger;

-import org.w3c.dom.Element;
-import org.w3c.dom.TypeInfo;
-
/**
* Interace implemented by part strategy handlers.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-class ClassLoaderHelper
+final class ClassLoaderHelper
{
+ private ClassLoaderHelper()
+ {
+ // disabled
+ }
+
private static final ValueDecoder VALUE_DECODER = new ValueDecoder();

private static final Logger LOGGER = new DefaultLogger( "dpml.lang" );

Modified: trunk/main/metro/part/src/main/net/dpml/lang/DecodingException.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/DecodingException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/DecodingException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -173,7 +173,7 @@
if( Artifact.isRecognized( uri ) )
{
URL url = Artifact.toURL( uri );
- File file = (File) url.getContent( new Class[]{ File.class }
);
+ File file = (File) url.getContent( new Class[]{File.class} );
return file.getCanonicalPath();
}
return null;

Modified: trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/PartContentHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -29,7 +29,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.lang.management.ManagementFactory;
-import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.Hashtable;
import java.util.ServiceLoader;
@@ -37,7 +36,6 @@

import javax.management.MBeanServer;
import javax.management.ObjectName;
-import javax.management.MBeanException;
import javax.management.InstanceAlreadyExistsException;

import net.dpml.annotation.Component;
@@ -45,13 +43,9 @@
import net.dpml.appliance.Appliance;
import net.dpml.appliance.ApplianceFactory;

-import net.dpml.lang.PartManager;
-import net.dpml.lang.PartContentManager;
-
import net.dpml.runtime.ComponentStrategyHandler;

import net.dpml.transit.Artifact;
-import net.dpml.transit.Transit;
import net.dpml.transit.ContentHandler;

import net.dpml.util.Logger;
@@ -90,8 +84,6 @@
private static final DOM3DocumentBuilder DOCUMENT_BUILDER =
new DOM3DocumentBuilder();

- private static final ClassLoaderHelper CLASSLOADER_HELPER = new
ClassLoaderHelper();
-
private static final ComponentStrategyHandler STANDARD_STRATEGY_HANDLER
=
new ComponentStrategyHandler();

@@ -159,6 +151,7 @@
* </ul>
*
* @param element the strategy element
+ * @return the strategy handler
* @exception Exception if loading error occurs
*/
public static StrategyHandler getStrategyHandler( Element element )
throws Exception
@@ -245,6 +238,12 @@
}
}

+ /**
+ * Load a strategy handler.
+ *
+ * @param classname the strategy handler service implementation class
+ * @exception Exception if part loading error occurs
+ */
static StrategyHandler getStrategyHandler( String classname ) throws
Exception
{
ServiceLoader<StrategyHandler> handlers = ServiceLoader.load(
StrategyHandler.class );
@@ -262,6 +261,10 @@
// constructor

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

+ /**
+ * Creation of a new part content handler.
+ * @exception Exception if an error occurs
+ */
public PartContentHandler() throws Exception
{
String flag = System.getProperty( "dpml.jmx.enabled", "false" );
@@ -344,6 +347,10 @@
// ContentManager

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

+ /**
+ * Return the part managers handled by the content handler.
+ * @return the part manager array
+ */
public PartManager[] getPartManagers()
{
ArrayList<PartManager> list = new ArrayList<PartManager>();
@@ -525,7 +532,7 @@
Resolver resolver = new SimpleResolver();
Info info = getInfo( uri, element );
Classpath classpath = getClasspath( element );
- ClassLoader classloader = CLASSLOADER_HELPER.newClassLoader(
anchor, uri, classpath );
+ ClassLoader classloader = ClassLoaderHelper.newClassLoader(
anchor, uri, classpath );
ClassLoader context =
Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader( classloader );
try
@@ -560,14 +567,7 @@

private static boolean isNamespaceRecognized( String namespace )
{
- if( NAMESPACE.equals( namespace ) )
- {
- return true;
- }
- else
- {
- return false;
- }
+ return NAMESPACE.equals( namespace );
}

private static Info getInfo( URI uri, Element root )

Modified: trunk/main/metro/part/src/main/net/dpml/lang/PartContentManager.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/PartContentManager.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/PartContentManager.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -31,5 +31,9 @@
@MXBean
public interface PartContentManager extends ContentManager
{
+ /**
+ * Return the array of part managers.
+ * @return the part manager array
+ */
PartManager[] getPartManagers();
}

Modified: trunk/main/metro/part/src/main/net/dpml/lang/ServiceRegistry.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/ServiceRegistry.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/ServiceRegistry.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,13 +19,18 @@
package net.dpml.lang;

/**
- * Component interface.
+ * Service registry interface.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public interface ServiceRegistry
{
+ /**
+ * Lookup a service implementing the supplied service type.
+ * @param service a class identifying the service type
+ * @return an instance of the service type or null if unresolved
+ */
<T>T lookup( Class<T> service );
}


Modified:
trunk/main/metro/part/src/main/net/dpml/lang/SimpleServiceRegistry.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/SimpleServiceRegistry.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/SimpleServiceRegistry.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,10 +18,6 @@

package net.dpml.lang;

-import java.util.ServiceLoader;
-
-import net.dpml.lang.ServiceRegistry;
-
/**
* Simple service registry implementation that selects the first service
* that is type assignable from the list of service instance supplied to
@@ -64,6 +60,8 @@
* match is found and a parent registry has been delclared, the lookup
* request is passed onto the parent registry, otherwise null is
* returned.
+ * @param type the service type
+ * @return an instance of the type or null if the type could not be
resolved
*/
public <T>T lookup( Class<T> type )
{

Modified:
trunk/main/metro/part/src/main/net/dpml/lang/StandardServiceRegistry.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/StandardServiceRegistry.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/StandardServiceRegistry.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -55,6 +55,8 @@
* match is found and a parent registry has been delclared, the lookup
* request is passed onto the parent registry, otherwise null is
* returned.
+ * @param type the service type to locate
+ * @return an instance of the type or null if unresolvable
*/
public <T>T lookup( Class<T> type )
{

Modified: trunk/main/metro/part/src/main/net/dpml/lang/Strategy.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/Strategy.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/Strategy.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -21,28 +21,17 @@
import dpml.lang.Part;

import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
-import java.util.ServiceLoader;

-import javax.xml.XMLConstants;
-
import net.dpml.transit.Artifact;
import net.dpml.transit.Transit;

-import net.dpml.runtime.ComponentStrategyHandler;
import net.dpml.util.Logger;

import dpml.util.DefaultLogger;
-import dpml.util.ElementHelper;

-import org.w3c.dom.Element;
-import org.w3c.dom.TypeInfo;
-
/**
* Abstract component deployment strategy.
*

Modified: trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/StrategyHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,11 +19,7 @@
package net.dpml.lang;

import java.io.IOException;
-import java.io.Writer;

-import dpml.lang.Classpath;
-
-import net.dpml.util.Logger;
import net.dpml.util.Resolver;

import org.w3c.dom.Element;
@@ -39,6 +35,7 @@
/**
* Creation of a new strategy handler for the supplied implementation
class.
* @param c the component implementation class
+ * @return a new strategy
* @exception IOException if an I/O error occurs
*/
Strategy newStrategy( Class<?> c ) throws IOException;
@@ -47,6 +44,7 @@
* Creation of a new strategy handler for the supplied implementation
class.
* @param c the component implementation class
* @param name the component name
+ * @return a new strategy
* @exception IOException if an I/O error occurs
*/
Strategy newStrategy( Class<?> c, String name ) throws IOException;

Modified: trunk/main/metro/part/src/main/net/dpml/lang/TypeCastException.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/lang/TypeCastException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/lang/TypeCastException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -50,16 +50,28 @@
m_type = type;
}

+ /**
+ * Get the base class.
+ * @return the class
+ */
public Class getBase()
{
return m_base;
}

+ /**
+ * Get the type class.
+ * @return the type
+ */
public Class getType()
{
return m_type;
}

+ /**
+ * Get the reported type cast error.
+ * @return the reported error
+ */
public String getReport()
{
return StandardClassLoader.toString( m_base, m_type );

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/Component.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/Component.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/Component.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,8 +18,6 @@

package net.dpml.runtime;

-import java.util.concurrent.TimeUnit;
-
/**
* Component interface.
*

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentException.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ComponentException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ComponentException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,12 +20,7 @@

import net.dpml.lang.DecodingException;

-import dpml.util.ElementHelper;
-
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;

/**
* Component related exception.

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentInvocationHandler.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentInvocationHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentInvocationHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,12 +21,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;

-import net.dpml.annotation.Services;
-
-import dpml.lang.Disposable;
-
/**
* Invocation handler supporting instance isolation relative to services
* declared by a target implementation class.

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentListener.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ComponentListener.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ComponentListener.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -31,8 +31,7 @@
/**
* Notify the listener of an event within the component.
*
- * @param event the comnponent event
- * @exception RemoteException if a remote transport error occurs
+ * @param event the component event
*/
void componentChanged( final ComponentEvent event );
}

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategy.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategy.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategy.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,25 +19,15 @@
package net.dpml.runtime;

import dpml.appliance.StandardAppliance;
-import dpml.lang.Value;
import dpml.lang.Disposable;
import dpml.state.StateDecoder;
import dpml.util.DefaultLogger;

import java.io.IOException;
-import java.io.Writer;
import java.io.File;
import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URL;
-import java.util.ServiceLoader;
import java.util.WeakHashMap;
import java.util.Hashtable;
import java.util.Map;
@@ -47,7 +37,6 @@
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;

-import net.dpml.annotation.Activation;
import net.dpml.annotation.CollectionPolicy;
import net.dpml.annotation.LifestylePolicy;
import net.dpml.annotation.ActivationPolicy;
@@ -58,10 +47,8 @@
import net.dpml.lang.ServiceRegistry;
import net.dpml.lang.StandardServiceRegistry;
import net.dpml.lang.Strategy;
-import net.dpml.lang.TypeCastException;

import net.dpml.state.State;
-import net.dpml.state.StateMachine;

import net.dpml.transit.Artifact;

@@ -157,11 +144,19 @@
m_handler = getLifestyleHandler( m_lifestyle );
}

+ /**
+ * Get the component name.
+ * @return the name
+ */
public String getName()
{
return m_name;
}

+ /**
+ * Get the component priority.
+ * @return the priority
+ */
public int getPriority()
{
return m_priority;
@@ -199,6 +194,10 @@
return m_map;
}

+ /**
+ * Get a runtime provider for this component.
+ * @return the provider
+ */
public Provider getProvider()
{
synchronized( m_handler )
@@ -207,6 +206,10 @@
}
}

+ /**
+ * Release a provider back to the component.
+ * @param provider the provider to release
+ */
public void release( Provider provider )
{
synchronized( m_handler )
@@ -215,6 +218,10 @@
}
}

+ /**
+ * Initialize the component with a supplied service registry.
+ * @param registry the service registry
+ */
public void initialize( ServiceRegistry registry ) // TODO: parts
initialization should occur here?
{
if( m_logger.isTraceEnabled() )
@@ -224,11 +231,21 @@
m_registry = registry;
}

+ /**
+ * Test if this component model can handle the supplied service type.
+ * @param type the service type
+ * @return true if the component is type compatible
+ */
public boolean isaCandidate( Class<?> type )
{
return type.isAssignableFrom( m_class );
}

+ /**
+ * Get a service reference for the supplied type.
+ * @param service the service type
+ * @return a service instance or null if unresolvable
+ */
public <T>T lookup( Class<T> service )
{
if( m_logger.isTraceEnabled() )
@@ -287,11 +304,19 @@
}
}

+ /**
+ * Terminate the component model.
+ */
public void terminate()
{
terminate( 10, TimeUnit.SECONDS );
}

+ /**
+ * Terminate the component model using a supplied timeout criteria.
+ * @param timeout the timeout duration
+ * @param units the measurement units
+ */
void terminate( long timeout, TimeUnit units )
{
synchronized( this )
@@ -327,6 +352,9 @@
* is resolved by the parent component. The parent evaluates off of its
* internal parts for a component implementing the service and if found,
* the instance is returned.
+ * @param class the requested class
+ * @param type the return type
+ * @exception Exception if an error occurs
*/
<T>T getService( Class<?> clazz, Class<T> type ) throws Exception //
TODO: ensure we don't evaluate the requestor
{
@@ -428,6 +456,11 @@
return new DefaultLogger( path );
}

+ /**
+ * Return an instance of the requested class.
+ * @param clazz the class
+ * @return the instance
+ */
public <T>T getInstance( Class<T> clazz )
{
if( clazz.equals( Component.class ) )
@@ -446,6 +479,12 @@
}
}

+ /**
+ * Return an instance of the requested class.
+ * @param c the class
+ * @return the instance
+ * @exception IOException if an error occurs
+ */
public <T>T getContentForClass( Class<T> c ) throws IOException
{
if( c.isAssignableFrom( m_class ) )
@@ -476,6 +515,12 @@
}
}

+ /**
+ * Encode the component model to the supplied buffer.
+ * @param buffer the endoding buffer
+ * @param key the component key
+ * @exception IOException if an error occurs
+ */
public void encode( Buffer buffer, String key ) throws IOException
{
String name = getComponentName();
@@ -713,7 +758,7 @@
private final WeakHashMap<Provider,Void> m_providers =
new WeakHashMap<Provider,Void>(); // per thread instances

- synchronized protected Provider initialValue()
+ protected synchronized Provider initialValue()
{
ComponentStrategy strategy = getComponentStrategy();
Provider provider = new StandardProvider( strategy );
@@ -861,6 +906,9 @@
return getComponentPath();
}

+ /**
+ * Component event dispatcher.
+ */
private static class ComponentEventDistatcher implements Runnable
{
private Logger m_logger;
@@ -874,6 +922,9 @@
m_event = event;
}

+ /**
+ * Run the dispatch thread.
+ */
public void run()
{
try

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/ComponentStrategyHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,24 +18,17 @@

package net.dpml.runtime;

-import dpml.lang.Classpath;
import dpml.lang.DOM3DocumentBuilder;
-import dpml.lang.Value;
import dpml.util.StandardClassLoader;
import dpml.util.ElementHelper;
import dpml.util.DefaultLogger;

import java.io.IOException;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URL;
-import java.util.Map;
import java.lang.reflect.Constructor;

import net.dpml.lang.DecodingException;
import net.dpml.lang.Strategy;
import net.dpml.lang.StrategyHandler;
-import net.dpml.lang.Buffer;

import net.dpml.annotation.Activation;
import net.dpml.annotation.ActivationPolicy;
@@ -45,7 +38,6 @@
import net.dpml.util.Resolver;
import net.dpml.util.Logger;

-import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
@@ -56,15 +48,31 @@
*/
public class ComponentStrategyHandler implements StrategyHandler
{
+ /**
+ * Constant XSD namespace value.
+ */
public static final String NAMESPACE = "dpml:metro";

private static final DOM3DocumentBuilder BUILDER = new
DOM3DocumentBuilder();

+ /**
+ * Creation of a new component strategy handler for a supplied class.
+ * @param c the implementation class
+ * @return the new strategy handler
+ * @exception IOException if an error occurs in strategy creation
+ */
public Strategy newStrategy( Class<?> c ) throws IOException
{
return newStrategy( c, null );
}

+ /**
+ * Creation of a new component strategy handler for a supplied class.
+ * @param c the implementation class
+ * @param name the strategy instance name
+ * @return the new strategy handler
+ * @exception IOException if an error occurs in strategy creation
+ */
public Strategy newStrategy( Class<?> c, String name ) throws IOException
{
String spec = getComponentName( c, name );
@@ -76,6 +84,13 @@
CollectionPolicy.HARD, context, parts );
}

+ /**
+ * Creation of a new component strategy handler for a supplied class.
+ * @param c the implementation class
+ * @param name the strategy instance name
+ * @return the new strategy handler
+ * @exception IOException if an error occurs in strategy creation
+ */
public Component newComponent( Class<?> c, String name ) throws
IOException
{
return (Component) newStrategy( c, name );
@@ -88,6 +103,7 @@
* @param resolver symbolic property resolver
* @param partition the enclosing partition
* @param query the query fragment to applied to the component context
definition
+ * @param validate the validation policy
* @return the strategy definition
* @exception IOException if an I/O error occurs
*/

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ContextDirective.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ContextDirective.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ContextDirective.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,13 +19,10 @@
package net.dpml.runtime;

import java.io.IOException;
-import java.io.Writer;
import java.util.Map;
import java.util.Hashtable;
-import java.beans.Expression;
import java.lang.reflect.Constructor;

-import dpml.lang.Construct;
import dpml.lang.ValueDecoder;

import dpml.lang.Value;
@@ -41,6 +38,7 @@
import org.w3c.dom.Element;

/**
+ * Internal context directive.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -191,7 +189,10 @@
return null;
}

- private static abstract class AbstractResolvable implements Resolvable,
Encodable
+ /**
+ * Abstract base class for a resolvable instance.
+ */
+ private abstract static class AbstractResolvable implements Resolvable,
Encodable
{
private final Element m_element;

@@ -200,12 +201,19 @@
m_element = element;
}

+ /**
+ * Return the defining element.
+ * @return the element
+ */
public Element getElement()
{
return m_element;
}
}

+ /**
+ * Value wrapper.
+ */
static class ValueWrapper extends AbstractResolvable
{
private final Value m_value;
@@ -233,6 +241,9 @@
}
}

+ /**
+ * Map wrapper.
+ */
static class MapWrapper extends AbstractResolvable
{
private final Map<String,Value> m_values;
@@ -287,6 +298,9 @@
}
}

+ /**
+ * Lookup wrapper.
+ */
static class Lookup extends AbstractResolvable
{
private final Class m_class;

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ContextInvocationHandler.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/ContextInvocationHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/ContextInvocationHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,14 +20,12 @@

import java.util.Map;
import java.beans.Introspector;
-import java.beans.Expression;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import net.dpml.annotation.Context;
import net.dpml.runtime.Directive.Resolvable;
-import dpml.lang.Value;

import org.w3c.dom.Element;


Modified: trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -79,7 +79,7 @@
}
catch( MissingContextEntryException mcee )
{
- if( !optional )
+ if( !optional && validate )
{
final String error =
"Non optional context entry ["
@@ -91,14 +91,7 @@
+ "] within ["
+ path
+ "] is undefined.";
- if( validate )
- {
- throw new ComponentException( error );
- }
- else
- {
- // m_logger.warn( error );
- }
+ throw new ComponentException( error );
}
}
}
@@ -122,7 +115,7 @@
{
m_map.put( key, value );
}
- else if( !optional )
+ else if( !optional && validate )
{
final String error =
"No solution declared for the context entry ["
@@ -134,14 +127,7 @@
+ "] within the component model ["
+ path
+ "].";
- if( validate )
- {
- throw new MissingContextEntryException( error );
- }
- else
- {
- // m_logger.validate( error );
- }
+ throw new MissingContextEntryException( error );
}
}
}

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/Directive.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/Directive.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/Directive.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,20 +19,22 @@
package net.dpml.runtime;

import java.io.IOException;
-import java.io.Writer;

import net.dpml.lang.Buffer;

import org.w3c.dom.Element;

/**
- * Exception to indicate an error arrising from the use of a duplicate key.
+ * Internal utility interfaces.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
abstract class Directive
{
+ /**
+ * Internal interface for encodable entries.
+ */
public interface Encodable
{
Element getElement();
@@ -40,6 +42,9 @@
void encode( Buffer buffer, String key ) throws IOException;
}

+ /**
+ * Internal interface for resolvable entries.
+ */
public interface Resolvable extends Encodable
{
<T>T resolve( ComponentStrategy parent, Class<T> clazz ) throws
Exception;

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/LifestyleHandler.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/LifestyleHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/LifestyleHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,18 +21,9 @@
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ServiceLoader;

import net.dpml.annotation.CollectionPolicy;

-import net.dpml.state.State;
-import net.dpml.state.StateMachine;
-
-import net.dpml.util.Logger;
import dpml.util.DefaultLogger;

/**

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/MissingContextEntryException.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/MissingContextEntryException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/MissingContextEntryException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,14 +18,7 @@

package net.dpml.runtime;

-import net.dpml.lang.DecodingException;
-
-import dpml.util.ElementHelper;
-
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;

/**
* Exception thrown if a solution for a required context entry is not found.

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/PartsDirective.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,9 +19,7 @@
package net.dpml.runtime;

import dpml.util.ElementHelper;
-import dpml.util.DefaultLogger;

-import java.io.Writer;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
@@ -39,7 +37,6 @@
import net.dpml.lang.PartContentHandler;

import net.dpml.util.Resolver;
-import net.dpml.util.Logger;

import org.w3c.dom.Element;


Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/PartsInvocationHandler.java
===================================================================
---
trunk/main/metro/part/src/main/net/dpml/runtime/PartsInvocationHandler.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/main/net/dpml/runtime/PartsInvocationHandler.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,13 +18,10 @@

package net.dpml.runtime;

-import java.util.Map;
import java.beans.Introspector;
-import java.beans.Expression;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import java.lang.reflect.TypeVariable;

import net.dpml.annotation.Parts;


Modified: trunk/main/metro/part/src/main/net/dpml/runtime/Provider.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/Provider.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/Provider.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -49,6 +49,7 @@

/**
* Return a fully commissioned instance.
+ * @param type the instance return type
* @return the instance
*/
<T>T getInstance( Class<T> type );

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/ProviderEvent.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ProviderEvent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ProviderEvent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -44,16 +44,31 @@
m_action = action;
}

+ /**
+ * Get the provider initiating the event.
+ *
+ * @return the source provider
+ */
public Provider getProvider()
{
return m_provider;
}

+ /**
+ * Get the event status.
+ *
+ * @return the event status
+ */
public Status getStatus()
{
return m_action;
}

+ /**
+ * Return a string representation of the event.
+ *
+ * @return the event as a string
+ */
public String toString()
{
String id = super.toString();

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/Query.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/Query.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/Query.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -100,6 +100,9 @@
}
}

+ /**
+ * Binding between a key and a resolvable instance.
+ */
private static class Binding
{
private final String m_key;

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/StandardProvider.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/StandardProvider.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/StandardProvider.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -29,9 +29,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
-import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import java.util.ServiceLoader;

import net.dpml.annotation.Services;
import net.dpml.annotation.LifestylePolicy;

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/Status.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/Status.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/Status.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -25,8 +25,23 @@
*/
public enum Status
{
+ /**
+ * Creation status constant.
+ */
CREATION,
+
+ /**
+ * Incarnation status constant.
+ */
INCARNATION,
+
+ /**
+ * Etherialization status constant.
+ */
ETHERIALIZATION,
+
+ /**
+ * Termination status constant.
+ */
TERMINATION,
}

Modified: trunk/main/metro/part/src/test/dpml/lang/ConstructTestCase.java
===================================================================
--- trunk/main/metro/part/src/test/dpml/lang/ConstructTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/dpml/lang/ConstructTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -25,8 +25,6 @@
import java.util.Hashtable;
import java.util.Arrays;

-import dpml.lang.Value;
-
/**
* Construct testcase.
*
@@ -35,6 +33,9 @@
*/
public class ConstructTestCase extends AbstractTestCase
{
+ /**
+ * Testcase setup.
+ */
public void setUp()
{
ClassLoader loader = ConstructTestCase.class.getClassLoader();

Modified: trunk/main/metro/part/src/test/dpml/lang/ContextTestCase.java
===================================================================
--- trunk/main/metro/part/src/test/dpml/lang/ContextTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/dpml/lang/ContextTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -25,11 +25,6 @@

import junit.framework.TestCase;

-//import net.dpml.lang.Plugin;
-import net.dpml.lang.ServiceRegistry;
-import net.dpml.lang.SimpleServiceRegistry;
-
-import org.acme.Sample;
import org.acme.Sample.Context;
import org.acme.Sample.AnotherContext;
import org.acme.Sample.Negation;

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/AbstractTestCase.java
===================================================================
--- trunk/main/metro/part/src/test/net/dpml/runtime/AbstractTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/net/dpml/runtime/AbstractTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -39,11 +39,26 @@
"net.dpml.runtime.ComponentStrategyHandler" );
}

+ /**
+ * Utility operation to load a type.
+ * @param type the type to load
+ * @param path the relative path to the part definition
+ * @return the type
+ * @exception Exception if an error occurs
+ */
protected <T>T load( Class<T> type, String path ) throws Exception
{
return load( type, path, null );
}

+ /**
+ * Utility operation to load a type.
+ * @param type the type to load
+ * @param path the relative path to the part definition
+ * @param name the part name to assign
+ * @return the type
+ * @exception Exception if an error occurs
+ */
protected <T>T load( Class<T> type, String path, String name ) throws
Exception
{
ClassLoader classloader = getClass().getClassLoader();

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/composition/CompositeTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/composition/CompositeTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/composition/CompositeTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -23,12 +23,16 @@
import org.acme.CompositeComponent;

/**
- *
+ * Composite testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class CompositeTestCase extends AbstractTestCase
{
+ /**
+ * Validatethe composite.xml example.
+ * @exception Exception if an error occurs
+ */
public void testComponent() throws Exception
{
CompositeComponent component =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/composition/ControllerTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/composition/ControllerTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/composition/ControllerTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -23,12 +23,16 @@
import org.acme.ControllerComponent;

/**
- *
+ * Controller testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ControllerTestCase extends AbstractTestCase
{
+ /**
+ * Validatethe controller.xml example.
+ * @exception Exception if an error occurs
+ */
public void testComponent() throws Exception
{
ControllerComponent component =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/composition/GenericTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/composition/GenericTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/composition/GenericTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,9 +18,6 @@

package net.dpml.runtime.composition;

-import java.awt.Color;
-import java.io.File;
-
import net.dpml.runtime.AbstractTestCase;

import net.dpml.runtime.Provider;
@@ -31,12 +28,16 @@
import org.acme.GenericComponent;

/**
- *
+ * Generic testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class GenericTestCase extends AbstractTestCase
{
+ /**
+ * Validate the generic.xml example.
+ * @exception Exception if an error occurs
+ */
public void testComponent() throws Exception
{
GenericComponent component =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/composition/LookupTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/composition/LookupTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/composition/LookupTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -23,12 +23,16 @@
import org.acme.CompositeComponent;

/**
- *
+ * Lookup testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class LookupTestCase extends AbstractTestCase
{
+ /**
+ * Validate the lookup.xml example.
+ * @exception Exception if an error occurs
+ */
public void testComponent() throws Exception
{
CompositeComponent component =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/composition/SelectTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/composition/SelectTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/composition/SelectTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -28,12 +28,16 @@
import org.acme.Gizmo;

/**
- *
+ * Select testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class SelectTestCase extends AbstractTestCase
{
+ /**
+ * Validate part selection by return type.
+ * @exception Exception if an error occurs
+ */
public void testSelectionByServiceReturnType() throws Exception
{
SelectComponent.Parts parts = getParts();
@@ -41,6 +45,10 @@
assertEquals( "size-widget", 2, widgets.length );
}

+ /**
+ * Validate part selection by type argument.
+ * @exception Exception if an error occurs
+ */
public void testSelectionByServiceCriteria() throws Exception
{
SelectComponent.Parts parts = getParts();
@@ -54,6 +62,10 @@
assertEquals( "gizmo-providers", 1, gizmoProviders.length );
}

+ /**
+ * Validate part selection of all components.
+ * @exception Exception if an error occurs
+ */
public void testAllSelectionCriteria() throws Exception
{
SelectComponent.Parts parts = getParts();

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/context/ArrayTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/context/ArrayTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/context/ArrayTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,21 +21,24 @@
import net.dpml.runtime.AbstractTestCase;

import org.acme.ArrayWidget;
-import org.acme.Widget;

/**
- *
+ * Context array testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ArrayTestCase extends AbstractTestCase
{
+ /**
+ * Validate array context argument.
+ * @exception Exception if an error occurs
+ */
public void testEquality() throws Exception
{
ArrayWidget widget =
load( ArrayWidget.class, "array.xml", "array" );

- char[] chars = new char[]{ 'h','e','l','l','o'};
+ char[] chars = new char[]{'h','e','l','l','o'};
char[] result = widget.getContext().getMessage();
assertEquals( "length", chars.length, result.length );
for( int i=0; i<chars.length; i++ )

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/context/ContextualTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/context/ContextualTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/context/ContextualTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -23,15 +23,18 @@
import net.dpml.runtime.AbstractTestCase;

import org.acme.ContextualWidget;
-import org.acme.Widget;

/**
- *
+ * Context handling test case.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ContextualTestCase extends AbstractTestCase
{
+ /**
+ * Validate context entries in contextual.xml.
+ * @exception Exception if an error occurs
+ */
public void testEquality() throws Exception
{
ContextualWidget widget =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/context/MapTestCase.java
===================================================================
--- trunk/main/metro/part/src/test/net/dpml/runtime/context/MapTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/net/dpml/runtime/context/MapTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -25,15 +25,18 @@
import net.dpml.runtime.AbstractTestCase;

import org.acme.MapWidget;
-import org.acme.Widget;

/**
- *
+ * Map based context entry testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class MapTestCase extends AbstractTestCase
{
+ /**
+ * Validate a simple map.
+ * @exception Exception if an error occurs
+ */
public void testSimpleMap() throws Exception
{
MapWidget widget =
@@ -45,6 +48,10 @@
assertEquals( "foo", "bar", value );
}

+ /**
+ * Validate a map with a qualified implementation class.
+ * @exception Exception if an error occurs
+ */
public void testQualifiedMap() throws Exception
{
MapWidget widget =
@@ -56,6 +63,10 @@
assertEquals( "ping", "pong", ping );
}

+ /**
+ * Validate a typed map.
+ * @exception Exception if an error occurs
+ */
public void testColors() throws Exception
{
MapWidget widget =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/isolation/SampleTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/isolation/SampleTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/isolation/SampleTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -26,12 +26,16 @@
import org.acme.Widget;

/**
- *
+ * Isolation testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class SampleTestCase extends AbstractTestCase
{
+ /**
+ * Validate normal usage.
+ * @exception Exception if an error occurs
+ */
public void testNormalUsage() throws Exception
{
Widget widget =
@@ -41,6 +45,10 @@
assertEquals( "message", "Hello", message );
}

+ /**
+ * Validate without isolation.
+ * @exception Exception if an error occurs
+ */
public void testNoIsolation() throws Exception
{
Widget widget =
@@ -48,6 +56,10 @@
assertFalse( "isa-proxy", Proxy.isProxyClass( widget.getClass() ) );
}

+ /**
+ * Validate with isolation.
+ * @exception Exception if an error occurs
+ */
public void testWithIsolation() throws Exception
{
Widget widget =

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/lifecycle/StateTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/lifecycle/StateTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/lifecycle/StateTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,23 +18,24 @@

package net.dpml.runtime.lifecycle;

-import java.util.concurrent.TimeUnit;
-
import net.dpml.runtime.AbstractTestCase;

import net.dpml.runtime.Component;
import net.dpml.runtime.Provider;

import org.acme.StateWidget;
-import org.acme.Widget;

/**
- *
+ * Lifecycle testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class StateTestCase extends AbstractTestCase
{
+ /**
+ * Validate component lifecycle.
+ * @exception Exception if an error occurs
+ */
public void testLifecycle() throws Exception
{
Component component = load( Component.class, "state.xml", "state" );

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/SingletonTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/SingletonTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/SingletonTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -26,12 +26,16 @@
import org.acme.Widget;

/**
- *
+ * Singleton testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class SingletonTestCase extends AbstractTestCase
{
+ /**
+ * Validate singleton equality.
+ * @exception Exception if an error occurs
+ */
public void testEquality() throws Exception
{
Component component = load( Component.class, "singleton.xml",
"singleton" );

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/TransientTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/TransientTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/lifestyle/TransientTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,19 +21,22 @@
import net.dpml.annotation.LifestylePolicy;
import net.dpml.runtime.AbstractTestCase;

-import net.dpml.runtime.Component;
import net.dpml.runtime.ComponentStrategy;

import org.acme.DefaultWidget;
import org.acme.Widget;

/**
- *
+ * Transitent testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class TransientTestCase extends AbstractTestCase
{
+ /**
+ * Validate transient inequality.
+ * @exception Exception if an error occurs
+ */
public void testEquality() throws Exception
{
ComponentStrategy component = load( ComponentStrategy.class,
"transient.xml", "transient" );

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/profile/ProfileTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/profile/ProfileTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/profile/ProfileTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -25,12 +25,16 @@
import org.acme.Widget;

/**
- *
+ * Profile test case.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ProfileTestCase extends TestCase
{
+ /**
+ * Validate service loading.
+ * @exception Exception if an error occurs
+ */
public void testServiceLoading() throws Exception
{
Widget widget = getWidget();
@@ -39,6 +43,11 @@
assertEquals( "message", "Batman", message );
}

+ /**
+ * Utility to load a Widget service.
+ * @return the widget
+ * @exception Exception if an error occurs
+ */
public Widget getWidget() throws Exception
{
ServiceLoader<Widget> loaders = ServiceLoader.load( Widget.class );

Modified:
trunk/main/metro/part/src/test/net/dpml/runtime/service/ForeignTestCase.java
===================================================================
---
trunk/main/metro/part/src/test/net/dpml/runtime/service/ForeignTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/part/src/test/net/dpml/runtime/service/ForeignTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -26,18 +26,26 @@
import org.acme.ForeignWidget;

/**
- *
+ * Foreign service testcase.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ForeignTestCase extends AbstractTestCase
{
+ /**
+ * Validate component via part using foreign.xml.
+ * @exception Exception if an error occurs
+ */
public void testComponentViaPart() throws Exception
{
Widget widget = load( Widget.class, "foreign.xml", "foreign" );
assertEquals( "message", "42", widget.getMessage() );
}

+ /**
+ * Validate component via class.
+ * @exception Exception if an error occurs
+ */
public void testComponentViaClass() throws Exception
{
Strategy strategy = Strategy.load( ForeignWidget.class, null,
"foreign" );

Modified: trunk/main/metro/part/src/test/org/acme/ArrayWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/ArrayWidget.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/ArrayWidget.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -18,41 +18,75 @@

package org.acme;

-import net.dpml.annotation.Services;
-
import net.dpml.util.Logger;

/**
+ * Array test component.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ArrayWidget implements Widget
{
+ /**
+ * Array component deployment context.
+ */
public interface Context
{
+ /**
+ * Get a character array.
+ * @return the character array
+ */
char[] getMessage();
}

private Context m_context;

+ /**
+ * Construct a new array widget instance.
+ * @param logger the assigned logging channel
+ * @param context the assigned deployment context
+ */
public ArrayWidget( Logger logger, Context context )
{
m_context = context;
logger.info( getMessage() );
}

+ /**
+ * Return a message constructed from the context character array.
+ * @return the message
+ */
public String getMessage()
{
return new String( m_context.getMessage() );
}

+ /**
+ * Return the context value (normally private but exposed here
+ * for testcase access).
+ * @return the context
+ */
public Context getContext()
{
return m_context;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_context.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/CompositeComponent.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/CompositeComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/CompositeComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,32 +21,70 @@
import net.dpml.util.Logger;

/**
+ * Example component containing an internal parts defintion.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class CompositeComponent
{
+ /**
+ * Definition of the internal parts.
+ */
public interface Parts
{
+ /**
+ * Return the service assigned to the 'widget' key within the
+ * parts of the component.
+ * @return the named component
+ */
Widget getWidget();
+
+ /**
+ * Return the service assigned to the 'gizmo' key within the
+ * parts of the component.
+ * @return the named component
+ */
Gizmo getGizmo();
}

private final Parts m_parts;

+ /**
+ * Creation of a new component using the supplied logger and parts
implementation.
+ * @param logger a container supplied logging channel
+ * @param parts a container supplied implementation of the parts interface
+ */
public CompositeComponent( Logger logger, Parts parts )
{
logger.info( "instantiated" );
m_parts = parts;
}

+ /**
+ * Return the parts implementation for the testcase.
+ * @return the part implementation
+ */
public Parts getParts()
{
return m_parts;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_parts.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/ContextualWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/ContextualWidget.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/ContextualWidget.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,14 +20,13 @@

import java.awt.Color;

-import static net.dpml.annotation.LifestylePolicy.TRANSIENT;
-
import net.dpml.annotation.Component;
import net.dpml.annotation.Services;

import net.dpml.util.Logger;

/**
+ * A sample component declaring a context interface wherein an entry return
type is another context interface.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -35,50 +34,115 @@
@Services( Widget.class )
public class ContextualWidget implements Widget
{
+ /**
+ * A context interface containing a nested context interface as a return
type.
+ */
public interface Context
{
+ /**
+ * A simple optional string entry.
+ * @param value the default value
+ * @return the resolved value
+ */
String getMessage( String value );
+
+ /**
+ * A non-optional entry with a return type corresponding to a context
interface.
+ * @return the container resolved implementation of the ColorManager
contract
+ */
ColorManager getColors();
+
+ /**
+ * A non-optional int array entry.
+ * @return the array value
+ */
int[] getNumbers();
}

private final Context m_context;

+ /**
+ * Creation of the componet.
+ * @param logger the container supplied logging channel
+ * @param context the deployment context
+ */
public ContextualWidget( Logger logger, Context context )
{
logger.info( "instantiated" );
m_context = context;
}

+ /**
+ * Return the message.
+ * @return the message
+ */
public String getMessage()
{
return m_context.getMessage( "Hello" );
}

+ /**
+ * Return the primary color from the nested context.
+ * @return the primary color
+ */
public Color getPrimary()
{
return m_context.getColors().getPrimary();
}

+ /**
+ * Return the secondary color from the nested context.
+ * @return the secondary color
+ */
public Color getSecondary()
{
return m_context.getColors().getSecondary();
}

+ /**
+ * Return the array of int values.
+ * @return the array
+ */
public int[] getNumbers()
{
return m_context.getNumbers();
}

+ /**
+ * The nested context interface defintion.
+ */
@net.dpml.annotation.Context
public interface ColorManager
{
+ /**
+ * Get the primary color.
+ * @return the primary color
+ */
Color getPrimary();
+
+ /**
+ * Get the secondary color.
+ * @return the secondary color
+ */
Color getSecondary();
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_context.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/ControllerComponent.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/ControllerComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/ControllerComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -24,32 +24,68 @@
import net.dpml.runtime.Provider;

/**
+ * Sample component that uses an explicit custom parts interface using the
+ * Parts annotation.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ControllerComponent
{
+ /**
+ * A parts interface asserted using the parts annotation.
+ */
@Parts
public interface ControllerParts
{
+ /**
+ * Get a subcomponent by name.
+ * @return the component named widget.
+ */
Component getWidget();
+
+ /**
+ * Get a subcomponent by name.
+ * @return the component named gizmo.
+ */
Provider getGizmo();
}

private final ControllerParts m_parts;

+ /**
+ * Creation of the controller test component.
+ * @param parts the container provided part implementation
+ */
public ControllerComponent( ControllerParts parts )
{
m_parts = parts;
}

- public ControllerParts getParts() // for testcase
+ /**
+ * Get the parts implementation for the testcase.
+ * @return the parts implementation
+ */
+ public ControllerParts getParts()
{
return m_parts;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_parts.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/DefaultGizmo.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/DefaultGizmo.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/DefaultGizmo.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -29,19 +29,41 @@
{
private final Logger m_logger;

+ /**
+ * Creeation of a gizmo using a container supplied logging channel.
+ * @param logger the logging channel
+ */
public DefaultGizmo( Logger logger )
{
m_logger = logger;
m_logger.info( "instantiated" );
}

+ /**
+ * Returns a number.
+ * @return a number
+ */
public int getNumber()
{
return 42;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/DefaultWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/DefaultWidget.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/DefaultWidget.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -21,19 +21,38 @@
import net.dpml.annotation.Services;

/**
+ * Test componnet used to validate services annotation.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@Services( Widget.class )
public class DefaultWidget implements Widget
{
+ /**
+ * Return a message.
+ * @return some message
+ */
public String getMessage()
{
return "Hello";
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return getClass().hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/ForeignWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/ForeignWidget.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/ForeignWidget.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -18,16 +18,13 @@

package org.acme;

-import java.awt.Color;
-
import net.dpml.annotation.Component;
import net.dpml.annotation.Services;

import net.dpml.util.Logger;

-import static net.dpml.annotation.LifestylePolicy.TRANSIENT;
-
/**
+ * Sample component that contains a foreign type in the constructor.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -37,6 +34,14 @@
{
private final Gizmo m_gizmo;

+ /**
+ * Component constructor containing a standard logging argument and
+ * a foreign gizmo object. In this example the container will recognize
the
+ * logging channel type but will not recognize the Gizmo service. As
such the
+ * container has to go hunting for a solution.
+ * @param logger the assigned logging channel
+ * @param gizmo a gizmo
+ */
public ForeignWidget( final Logger logger, final Gizmo gizmo )
{
logger.info( "instantiated" );
@@ -44,13 +49,31 @@
logger.info( getMessage() );
}

+ /**
+ * Return a message.
+ * @return the m4essage
+ */
public String getMessage()
{
return "" + m_gizmo.getNumber();
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_gizmo.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/GenericComponent.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/GenericComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/GenericComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,32 +21,72 @@
import net.dpml.annotation.Parts;

/**
+ * Test componnet that leverages generics in the definition of
+ * parts method a return type.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class GenericComponent
{
+ /**
+ * Definition of a parts interface using generics.
+ */
@Parts
public interface GenericParts
{
+ /**
+ * Get a service instance of the component named 'widget'
+ * assigned to the type T.
+ * @param type the return type
+ * @return the service instance as an instance of T
+ */
<T>T getWidget( Class<T> type );
+
+ /**
+ * Get a service instance of the component named 'gizmo'
+ * assigned to the type T.
+ * @param type the return type
+ * @return the service instance as an instance of T
+ */
<T>T getGizmo( Class<T> type );
}

private final GenericParts m_parts;

+ /**
+ * Generic component constructor.
+ * @param parts the container supplied parts implementation
+ */
public GenericComponent( GenericParts parts )
{
m_parts = parts;
}

+ /**
+ * Get the part implementation for the testcase.
+ * @return the parts implementation
+ */
public GenericParts getParts()
{
return m_parts;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_parts.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/Gizmo.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/Gizmo.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/Gizmo.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -19,10 +19,15 @@
package org.acme;

/**
+ * A minimal service interface.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public interface Gizmo
{
+ /**
+ * Get a number.
+ * @return a number
+ */
int getNumber();
}

Modified: trunk/main/metro/part/src/test/org/acme/GizmoAdapter.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/GizmoAdapter.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/GizmoAdapter.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -21,7 +21,6 @@
import net.dpml.lang.Strategy;

import net.dpml.runtime.ComponentError;
-import net.dpml.runtime.ComponentStrategyHandler;

/**
* Example of a component that is declared as a service (via
META=INF/services)
@@ -34,6 +33,10 @@
{
private Gizmo m_delegate;

+ /**
+ * Get a number.
+ * @return a number
+ */
public int getNumber()
{
return getDelegate().getNumber();
@@ -63,8 +66,29 @@
}
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ if( null != m_delegate )
+ {
+ return m_delegate.hashCode();
+ }
+ else
+ {
+ return getClass().hashCode();
+ }
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/MapWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/MapWidget.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/MapWidget.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -25,38 +25,85 @@
import net.dpml.util.Logger;

/**
+ * A component containing variations on a theme related to the
+ * usage of Map return types in a context definition.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class MapWidget implements Widget
{
+ /**
+ * A context interface with examples of map dreturn type declarations.
+ */
public interface Context
{
+ /**
+ * Return a map with string keys and values using the 'primary' key.
+ * @return the map
+ */
Map<String,String> getPrimary();
+
+ /**
+ * Return a map with string keys and values using the 'secondary' key
+ * with an explicit map specialization as a return type.
+ * @return the map
+ */
SortedMap<String,String> getSecondary();
+
+ /**
+ * Return a map with string keys and complex object values using the
'colors' key.
+ * @return the map
+ */
Map<String,Color> getColors();
}

private Context m_context;

+ /**
+ * Creation of the test component.
+ * @param logger the assigned logging channel
+ * @param context the deployment context
+ */
public MapWidget( Logger logger, Context context )
{
m_context = context;
logger.info( "" + getMessage() );
}

+ /**
+ * Get a message.
+ * @return a message
+ */
public String getMessage()
{
return m_context.getPrimary().get( "message" );
}

+ /**
+ * Get the supplied context so that testcase can do its stuff.
+ * @return the constructor supplied context.
+ */
public Context getContext()
{
return m_context;
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_context.hashCode();
+ }
}

Deleted: trunk/main/metro/part/src/test/org/acme/Parameterizable.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/Parameterizable.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/Parameterizable.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2006 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 org.acme;
-
-import java.net.URI;
-import java.awt.Color;
-
-/**
- * Sample object used in test case. Contains a number of inner context
classes
- * used to evaluate strict and non-strict context evaluation strategies and
- * general part instantiation.
- */
-public class Parameterizable
-{
- private String m_name;
- private int m_id;
-
- public Parameterizable( String name, int id )
- {
- m_name = name;
- m_id = id;
- }
-
- public String getName()
- {
- return m_name;
- }
-
- public int getID()
- {
- return m_id;
- }
-}
\ No newline at end of file

Modified: trunk/main/metro/part/src/test/org/acme/Sample.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/Sample.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/Sample.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -23,8 +23,7 @@

/**
* Sample object used in test case. Contains a number of inner context
classes
- * used to evaluate strict and non-strict context evaluation strategies and
- * general part instantiation.
+ * used to evaluate strict and non-strict context evaluation strategies.
*/
public class Sample
{
@@ -83,7 +82,7 @@

/**
* Internal class used to validate that a inner context interface
- * marked as non-a-context using the <tt>ContextDef</tt> annotion is
+ * marked as not-a-context using the <tt>ContextDef</tt> annotion is
* correctly recognized as such.
*/
public static class Negation

Modified: trunk/main/metro/part/src/test/org/acme/SelectComponent.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/SelectComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/SelectComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,35 +18,70 @@

package org.acme;

-import java.util.List;
-
import net.dpml.util.Logger;

import net.dpml.runtime.Component;
import net.dpml.runtime.Provider;

/**
+ * Test ciomponent used to validate the sue of provider and component
+ * class references in a parts interface.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class SelectComponent
{
+ /**
+ * Parts definition.
+ */
public interface Parts
{
+ /**
+ * Get all components implemeting the Widget service.
+ * @return the widget array
+ */
Widget[] getWidgets();
+
+ /**
+ * Get an array of providers from sub-components that are
+ * candidate providers for the supplied service type.
+ * @param type the service type
+ * @return the provider array
+ */
Provider[] getProviders( Class type );
+
+ /**
+ * Get an array of components from sub-components that are
+ * candidate providers for the supplied service type.
+ * @param type the service type
+ * @return the component array
+ */
Component[] getComponents( Class type );
+
+ /**
+ * Get all of the sub-components.
+ * @return the component array
+ */
Component[] getAllComponents();
}

private final Parts m_parts;

+ /**
+ * Component consturctor.
+ * @param logger the assigned logging channel
+ * @param parts the container provider parts implementation
+ */
public SelectComponent( Logger logger, Parts parts )
{
logger.info( "instantiated" );
m_parts = parts;
}

+ /**
+ * Get the parts implementation (for the testcase).
+ * @return the parts
+ */
public Parts getParts()
{
return m_parts;

Modified: trunk/main/metro/part/src/test/org/acme/StandaloneWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/StandaloneWidget.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/StandaloneWidget.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,14 +20,14 @@

import java.awt.Color;

-import static net.dpml.annotation.LifestylePolicy.TRANSIENT;
-
import net.dpml.annotation.Component;
import net.dpml.annotation.Services;

import net.dpml.util.Logger;

/**
+ * An example of a component with bundled defaults (refer
StandaloneWidget.xprofile)
+ * including defaults for nested context definitions.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -35,15 +35,38 @@
@Services( Widget.class )
public class StandaloneWidget implements Widget
{
+ /**
+ * Deployment contrace.
+ */
public interface Context
{
+ /**
+ * Get the message value.
+ * @param value the defaul value supplied by the component
+ * @return the resolved value
+ */
String getMessage( String value );
+
+ /**
+ * Get a color manager (itself a context interface).
+ * @return the colour manager
+ */
ColorManager getColors();
+
+ /**
+ * Get an array of numbers
+ * @return the numbers array
+ */
int[] getNumbers();
}

private final Context m_context;

+ /**
+ * Creation of standalone widget.
+ * @param logger the assigned logging channel
+ * @param context the assigned deployment context
+ */
public StandaloneWidget( Logger logger, Context context )
{
logger.info( "instantiated" );
@@ -56,35 +79,77 @@
m_context = context;
}

+ /**
+ * Get the message.
+ * @return the message
+ */
public String getMessage()
{
return m_context.getMessage( "Hello" );
}

+ /**
+ * Get the primary color.
+ * @return the color
+ */
public Color getPrimary()
{
return m_context.getColors().getPrimary();
}

+ /**
+ * Get the seconary color.
+ * @return the color
+ */
public Color getSecondary()
{
return m_context.getColors().getSecondary();
}

+ /**
+ * Get the array of numbers
+ * @return the array
+ */
public int[] getNumbers()
{
return m_context.getNumbers();
}

+ /**
+ * A nested context definition.
+ */
@net.dpml.annotation.Context
public interface ColorManager
{
+ /**
+ * Get the color declared under the primary key.
+ * @return the color
+ */
Color getPrimary();
+
+ /**
+ * Get the color declared under the secondary key.
+ * @return the color
+ */
Color getSecondary();
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_context.hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/StandaloneWidgetAdapter.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/StandaloneWidgetAdapter.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/StandaloneWidgetAdapter.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -24,7 +24,6 @@
import net.dpml.util.Logger;

import net.dpml.runtime.ComponentError;
-import net.dpml.runtime.ComponentStrategyHandler;

/**
* Example of a component that is declared as a service (via
META=INF/services)
@@ -38,11 +37,19 @@
private Widget m_delegate;
private Logger m_logger = new DefaultLogger( "adapter" );

+ /**
+ * Create the component as a service implementation delegating to
+ * a real component behind the scenes.
+ */
public StandaloneWidgetAdapter()
{
m_logger.info( "instantiated" );
}

+ /**
+ * Get the message.
+ * @return a message
+ */
public String getMessage()
{
return getDelegate().getMessage();
@@ -73,8 +80,22 @@
}
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/StateWidget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/StateWidget.java 2007-04-24
17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/StateWidget.java 2007-04-25
06:38:01 UTC (rev 1990)
@@ -18,16 +18,13 @@

package org.acme;

-import java.awt.Color;
-
import net.dpml.annotation.Component;
import net.dpml.annotation.Services;

-import static net.dpml.annotation.LifestylePolicy.TRANSIENT;
-
import net.dpml.util.Logger;

/**
+ * Sample component that has an associated lifecycle graph.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -39,6 +36,10 @@

private int m_state = 0;

+ /**
+ * Component constructor.
+ * @param logger the assigned logging channel
+ */
public StateWidget( Logger logger )
{
m_logger = logger;
@@ -48,6 +49,12 @@
}
}

+ /**
+ * Start the component. This method is declared as an innitialization
+ * operation in the lifecycle graph and will be automatically invoked
+ * by the container as a part of the normal deployment process.
+ * @exception Exception if something goes wrong
+ */
public void start() throws Exception
{
m_state = 1;
@@ -57,6 +64,10 @@
}
}

+ /**
+ * Get a message.
+ * @return a message reflecting the runtime state.
+ */
public String getMessage()
{
if( m_state == 0 )
@@ -77,11 +88,21 @@
}
}

+ /**
+ * Get the runtime state.
+ * @return the status of the component
+ */
public int getState()
{
return m_state;
}

+ /**
+ * Stop the component. This method is declared as a termination
+ * operation in the lifecycle graph and will be automatically invoked
+ * by the container as a part of the normal decommissioning process.
+ * @exception Exception if something goes wrong
+ */
public void stop() throws Exception
{
m_state = 2;
@@ -91,8 +112,22 @@
}
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_state;
+ }
}

Modified: trunk/main/metro/part/src/test/org/acme/Widget.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/Widget.java 2007-04-24 17:52:45
UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/Widget.java 2007-04-25 06:38:01
UTC (rev 1990)
@@ -18,13 +18,16 @@

package org.acme;

-import net.dpml.lang.Strategy;
-
/**
+ * A service interface.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public interface Widget
{
+ /**
+ * Get a message.
+ * @return the message
+ */
String getMessage();
}

Modified: trunk/main/metro/part/src/test/org/acme/WidgetUsingGizmo.java
===================================================================
--- trunk/main/metro/part/src/test/org/acme/WidgetUsingGizmo.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/part/src/test/org/acme/WidgetUsingGizmo.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,17 +18,14 @@

package org.acme;

-import java.awt.Color;
-
import net.dpml.annotation.Context;
import net.dpml.annotation.Component;
import net.dpml.annotation.Services;

import net.dpml.util.Logger;

-import static net.dpml.annotation.LifestylePolicy.TRANSIENT;
-
/**
+ * Component playing around with a corner case.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -36,14 +33,26 @@
@Services( Widget.class )
public class WidgetUsingGizmo implements Widget
{
+ /**
+ * Deployment contract.
+ */
@Context
public interface WidgetContext
{
+ /**
+ * Return the 'gizmo' context value.
+ * @return a gizmo
+ */
Gizmo getGizmo();
}

private final Gizmo m_gizmo;

+ /**
+ * Component constructor.
+ * @param logger the logging channel
+ * @param context the deployment context
+ */
public WidgetUsingGizmo( final Logger logger, final WidgetContext
context )
{
logger.info( "instantiated" );
@@ -51,13 +60,31 @@
logger.info( getMessage() );
}

+ /**
+ * Get a message.
+ * @return a message
+ */
public String getMessage()
{
return "" + m_gizmo.getNumber();
}

+ /**
+ * Test the supplied object for equality with this object.
+ * @param other the supplied object
+ * @return the equality result
+ */
public boolean equals( Object other )
{
return ( hashCode() == other.hashCode() );
}
+
+ /**
+ * Get the component hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return m_gizmo.hashCode();
+ }
}

Modified: trunk/main/metro/station/src/main/dpml/station/console/Main.java
===================================================================
--- trunk/main/metro/station/src/main/dpml/station/console/Main.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/station/src/main/dpml/station/console/Main.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,13 +18,8 @@

package dpml.station.console;

-import dpml.appliance.ApplianceHelper;
-import dpml.station.connector.LocalConnector;
-import dpml.station.info.InfoDescriptor;
-import dpml.station.info.ProcessDescriptor;
-import dpml.station.info.ApplianceDescriptor;
+
import dpml.station.util.OutputStreamReader;
-import dpml.station.util.StreamReader;
import dpml.station.util.LoggingServer;

import dpml.cli.Option;
@@ -33,42 +28,29 @@
import dpml.cli.OptionException;
import dpml.cli.TooManyArgumentsException;
import dpml.cli.commandline.Parser;
-import dpml.cli.util.HelpFormatter;
-import dpml.cli.DisplaySetting;
import dpml.cli.builder.ArgumentBuilder;
import dpml.cli.builder.GroupBuilder;
import dpml.cli.builder.DefaultOptionBuilder;
import dpml.cli.builder.CommandBuilder;
-import dpml.cli.option.PropertyOption;
import dpml.cli.validation.URIValidator;
import dpml.cli.validation.NumberValidator;

-import dpml.util.PropertyResolver;
-import dpml.util.DefaultLogger;
-import dpml.util.PID;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.net.URI;
import java.net.URL;
-import java.net.URLConnection;
import java.net.MalformedURLException;
-import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import java.rmi.ConnectException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
-import java.util.Properties;
-import java.util.Iterator;
import java.util.Set;
import java.util.EnumSet;
import java.util.Collections;
-import java.util.concurrent.TimeUnit;
-import java.util.Map;
import java.util.List;
import java.util.ArrayList;

@@ -80,34 +62,17 @@
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;

-import net.dpml.annotation.Context;
import net.dpml.annotation.Component;

import net.dpml.appliance.Appliance;
-import net.dpml.appliance.ApplianceError;
import net.dpml.appliance.ApplianceException;
import net.dpml.appliance.ApplianceListener;
-import net.dpml.appliance.ApplianceEvent;
-import net.dpml.appliance.ApplianceConnector;

-import net.dpml.lang.Strategy;
-import net.dpml.lang.ServiceRegistry;
-import net.dpml.lang.SimpleServiceRegistry;
-import net.dpml.lang.DuplicateKeyException;
-
-import net.dpml.runtime.ComponentListener;
-import net.dpml.runtime.ComponentEvent;
-import net.dpml.runtime.ProviderEvent;
-import net.dpml.runtime.Status;
-
import net.dpml.station.Station;

import net.dpml.state.State;

import net.dpml.transit.Artifact;
-import net.dpml.transit.InvalidArtifactException;
-import net.dpml.transit.ContentHandler;
-import net.dpml.transit.Transit;

import net.dpml.util.Logger;

@@ -158,6 +123,10 @@
m_logger = logger;
}

+ /**
+ * Return the source version support by this tool.
+ * @return the source version set
+ */
public Set<SourceVersion> getSourceVersions()
{
return Collections.unmodifiableSet(
@@ -167,7 +136,12 @@
}

/**
- * Run the Metro tool.
+ * Run the Station tool.
+ * @param in the input stream
+ * @param out the output stream
+ * @param err the error stream
+ * @param arguments commandline arguments
+ * @return the execution result status
*/
public int run( InputStream in, OutputStream out, OutputStream err,
String... arguments )
{
@@ -241,6 +215,7 @@
/**
* Return the current state of the instance.
* @return the current state
+ * @exception RemoteException if a RMI error occurs
*/
public State getState() throws RemoteException
{
@@ -306,6 +281,7 @@
/**
* Returns the plan name.
* @return the name
+ * @exception RemoteException if a RMI error occurs
*/
public String getName() throws RemoteException
{
@@ -316,6 +292,11 @@
return m_plan.getName();
}

+ /**
+ * Returns the codebase uri.
+ * @return the uri
+ * @exception RemoteException if a RMI error occurs
+ */
public String getCodebaseURI() throws RemoteException
{
if( null == m_plan )
@@ -328,6 +309,11 @@
}
}

+ /**
+ * Returns the commissioned state of the plan.
+ * @return true if commissioned else false
+ * @exception RemoteException if a RMI error occurs
+ */
public boolean isCommissioned() throws RemoteException
{
if( null == m_plan )
@@ -352,71 +338,7 @@
int port = getPortValue( line, Registry.REGISTRY_PORT );
if( line.hasOption( SERVER_COMMAND ) )
{
- Registry registry = resolveRegistry( port );
-
- LoggingServer.init();
-
- //m_jmx = getJMXServiceURL( port );
- //m_server = getJMXConnectorServer( m_jmx );
- //m_server.start();
-
- URI uri = getURI( line );
- m_thread = Thread.currentThread();
-
- URL url = Artifact.toURL( uri );
- ClassLoader current =
Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "resolving plan [" + url + "]" );
- }
- try
- {
- m_plan = (Appliance) url.getContent( new Class[]{
Appliance.class } );
- }
- finally
- {
- Thread.currentThread().setContextClassLoader( current );
- }
- if( null == m_plan )
- {
- if( getLogger().isErrorEnabled() )
- {
- final String error =
- "Unable to resolve ["
- + url
- + "] to an appliance.";
- getLogger().error( error );
- }
- return -1;
- }
-
- registry.bind( name, this );
-
- try
- {
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "commissioning plan" );
- }
- m_plan.commission();
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "plan commissioning complete" );
- }
- return 1;
- }
- catch( Exception e )
- {
- final String error =
- "Plan deployment error.";
- if( getLogger().isErrorEnabled() )
- {
- getLogger().error( error, e );
- }
- m_plan.decommission();
- return -1;
- }
+ return executeInServerMode( name, port, line );
}
else if( line.hasOption( STARTUP_COMMAND ) )
{
@@ -522,62 +444,136 @@
}
else if( line.hasOption( INFO_COMMAND ) )
{
- try
+ return executeInfo( port );
+ }
+ else
+ {
+ final String error =
+ "Invalid command state.";
+ if( getLogger().isErrorEnabled() )
{
- Station station = getStation( port );
- System.out.println( "Station running on port [" + port + "]"
);
- System.out.println( "Codebase: " + station.getCodebaseURI()
);
-
- Appliance[] children = station.getChildren();
- int n = children.length;
-
- System.out.println( "Entries: " + children.length );
-
- if( n > 0 )
- {
- System.out.println( "" );
- int i=1;
- for( Appliance appliance : children )
- {
- System.out.println(
- "("
- + i
- + ") "
- + appliance.getName()
- + " ["
- + appliance.getState().getName()
- + "] "
- + appliance.getCodebaseURI()
- );
- }
- }
+ getLogger().error( error );
}
- catch( StationNotBoundException e )
+ return -1;
+ }
+ }
+
+ private int executeInfo( int port ) throws Exception
+ {
+ try
+ {
+ Station station = getStation( port );
+ System.out.println( "Station running on port [" + port + "]" );
+ System.out.println( "Codebase: " + station.getCodebaseURI() );
+
+ Appliance[] children = station.getChildren();
+ int n = children.length;
+
+ System.out.println( "Entries: " + children.length );
+
+ if( n > 0 )
{
- if( getLogger().isInfoEnabled() )
+ System.out.println( "" );
+ int i=1;
+ for( Appliance appliance : children )
{
- getLogger().info( "Station not bound on port [" + port +
"]" );
+ System.out.println(
+ "("
+ + i
+ + ") "
+ + appliance.getName()
+ + " ["
+ + appliance.getState().getName()
+ + "] "
+ + appliance.getCodebaseURI()
+ );
}
}
- catch( ConnectException e )
+ }
+ catch( StationNotBoundException e )
+ {
+ if( getLogger().isInfoEnabled() )
{
- if( getLogger().isInfoEnabled() )
- {
- getLogger().info( "Station not running" );
- }
+ getLogger().info( "Station not bound on port [" + port + "]"
);
}
- return 0;
}
- else
+ catch( ConnectException e )
{
- final String error =
- "Invalid command state.";
+ if( getLogger().isInfoEnabled() )
+ {
+ getLogger().info( "Station not running" );
+ }
+ }
+ return 0;
+ }
+
+ private int executeInServerMode( String name, int port, CommandLine line
) throws Exception
+ {
+ Registry registry = resolveRegistry( port );
+
+ LoggingServer.init();
+
+ //m_jmx = getJMXServiceURL( port );
+ //m_server = getJMXConnectorServer( m_jmx );
+ //m_server.start();
+
+ URI uri = getURI( line );
+ m_thread = Thread.currentThread();
+
+ URL url = Artifact.toURL( uri );
+ ClassLoader current = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(
getClass().getClassLoader() );
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "resolving plan [" + url + "]" );
+ }
+ try
+ {
+ m_plan = (Appliance) url.getContent( new
Class[]{Appliance.class} );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( current );
+ }
+ if( null == m_plan )
+ {
if( getLogger().isErrorEnabled() )
{
+ final String error =
+ "Unable to resolve ["
+ + url
+ + "] to an appliance.";
getLogger().error( error );
}
return -1;
}
+
+ registry.bind( name, this );
+
+ try
+ {
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "commissioning plan" );
+ }
+ m_plan.commission();
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "plan commissioning complete" );
+ }
+ return 1;
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Plan deployment error.";
+ if( getLogger().isErrorEnabled() )
+ {
+ getLogger().error( error, e );
+ }
+ m_plan.decommission();
+ return -1;
+ }
}

private JMXServiceURL getJMXServiceURL( int port ) throws
MalformedURLException
@@ -585,7 +581,7 @@
return new JMXServiceURL(
"service:jmx:rmi:///jndi/rmi://localhost:"
+ port
- + "/dpml-station-jmx");
+ + "/dpml-station-jmx" );
}

private JMXConnectorServer getJMXConnectorServer( JMXServiceURL url )
throws IOException
@@ -617,6 +613,10 @@
}
}

+ /**
+ * Station shutdown handler.
+ * @exception RemoteException if an RMI remoting exception occurs
+ */
public void shutdown() throws RemoteException
{
if( null != m_plan )
@@ -651,7 +651,10 @@
}
}
}
-
+
+ /**
+ * Terminator class.
+ */
private class Terminator extends Thread
{
private Thread m_thread;

Modified:
trunk/main/metro/station/src/main/dpml/station/console/StationNotBoundException.java
===================================================================
---
trunk/main/metro/station/src/main/dpml/station/console/StationNotBoundException.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/station/src/main/dpml/station/console/StationNotBoundException.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -20,9 +20,6 @@

import net.dpml.station.StationException;

-import org.w3c.dom.Element;
-
-
/**
* Exception thrown when an attempt is made to reference an unbound station.
*

Modified:
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
===================================================================
---
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -18,21 +18,18 @@

package org.acme.reference;

-import dpml.util.PID;
-
-import java.net.URI;
-
import net.dpml.annotation.Component;
-import net.dpml.annotation.Services;

import static net.dpml.annotation.LifestylePolicy.SINGLETON;

-import net.dpml.util.Logger;
-
import org.acme.Hello;

/**
- * Sample component used in testing aggregation by reference.
+ * Sample component used in testing aggregation by reference. Specifically,
the
+ * component direxctive contains a reference to a hello component using a
uri. The
+ * container has to reach out and build a part under this component
(involving the
+ * creation of a classloader sub-hierachy) and bind the result component to
the
+ * internal parts of this component.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -42,16 +39,31 @@
{
private Parts m_parts;

+ /**
+ * Internal parts contact.
+ */
public interface Parts
{
+ /**
+ * Get named component.
+ * @return a service
+ */
Hello getHello();
}

- public AggregatingComponent( Parts parts ) throws Exception
+ /**
+ * Component constructor.
+ * @param parts the parts solution
+ */
+ public AggregatingComponent( Parts parts )
{
m_parts = parts;
}

+ /**
+ * Get a message.
+ * @return a message
+ */
public String getMessage()
{
Hello hello = m_parts.getHello();

Modified:
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
===================================================================
---
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -39,11 +39,26 @@
"net.dpml.runtime.ComponentStrategyHandler" );
}

+ /**
+ * Utility operation to load a service.
+ * @param type the service type
+ * @param path the relative path to the part defintion
+ * @return an instance of the type
+ * @exception Exception if an error occurs
+ */
protected <T>T load( Class<T> type, String path ) throws Exception
{
return load( type, path, null );
}

+ /**
+ * Utility operation to load a service.
+ * @param type the service type
+ * @param path the relative path to the part defintion
+ * @param name the name to assign to the resolved supplier
+ * @return an instance of the type
+ * @exception Exception if an error occurs
+ */
protected <T>T load( Class<T> type, String path, String name ) throws
Exception
{
ClassLoader classloader = getClass().getClassLoader();

Modified:
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
===================================================================
---
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -21,12 +21,16 @@
import org.acme.reference.AggregatingComponent;

/**
- *
+ * Test part-by-reference semantics.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class ReferenceTestCase extends AbstractTestCase
{
+ /**
+ * Test deployment of a component configured using part-by-reference.
+ * @exception Exception if an error occurs
+ */
public void testComponent() throws Exception
{
AggregatingComponent component =

Modified:
trunk/main/metro/testing/sample/src/main/org/acme/AnotherContext.java
===================================================================
--- trunk/main/metro/testing/sample/src/main/org/acme/AnotherContext.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/sample/src/main/org/acme/AnotherContext.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -32,5 +32,10 @@
@Context
public interface AnotherContext
{
+ /**
+ * Return an optional uri value assigned to the 'uri' key.
+ * @param value the component supplied default value
+ * @return the resolved uri value
+ */
URI getUri( URI value );
}

Modified: trunk/main/metro/testing/sample/src/main/org/acme/Hello.java
===================================================================
--- trunk/main/metro/testing/sample/src/main/org/acme/Hello.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/sample/src/main/org/acme/Hello.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -26,5 +26,9 @@
*/
public interface Hello
{
+ /**
+ * Return a message.
+ * @return the message
+ */
String getMessage();
}

Modified:
trunk/main/metro/testing/sample/src/main/org/acme/HelloComponent.java
===================================================================
--- trunk/main/metro/testing/sample/src/main/org/acme/HelloComponent.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/sample/src/main/org/acme/HelloComponent.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -45,6 +45,12 @@
private final Logger m_logger;
private final HelloConfiguration m_context;

+ /**
+ * Component constructor.
+ * @param logger the assigned logging channel
+ * @param context the deployment context
+ * @exception Exception if an error occurs during deployment
+ */
public HelloComponent( Logger logger, HelloConfiguration context )
throws Exception
{
m_logger = logger;
@@ -59,17 +65,27 @@
m_logger.info( "target: " + context.getTarget().getUri( codebase ) );
}

+ /**
+ * Get the message.
+ * @return the message
+ */
public String getMessage()
{
return m_context.getMessage( "Hello" );
}

+ /**
+ * Start the component.
+ */
public void start()
{
m_logger.info( "starting" );
m_logger.info( "started" );
}

+ /**
+ * Stop the component.
+ */
public void stop()
{
m_logger.info( "stopping" );

Modified:
trunk/main/metro/testing/sample/src/main/org/acme/HelloConfiguration.java
===================================================================
--- trunk/main/metro/testing/sample/src/main/org/acme/HelloConfiguration.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/sample/src/main/org/acme/HelloConfiguration.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -29,7 +29,23 @@
@Context
public interface HelloConfiguration
{
+ /**
+ * Get the message.
+ * @param value the default value
+ * @return the message
+ */
String getMessage( String value );
+
+ /**
+ * Get the port.
+ * @param port the default port
+ * @return the resolved port
+ */
int getPort( int port );
+
+ /**
+ * Get the nested context solution.
+ * @return the nested context solution
+ */
AnotherContext getTarget();
}

Modified:
trunk/main/metro/testing/test/src/test/net/dpml/test/LocalTestCase.java
===================================================================
--- trunk/main/metro/testing/test/src/test/net/dpml/test/LocalTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/test/src/test/net/dpml/test/LocalTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,12 +19,10 @@
package net.dpml.test;

import dpml.util.DefaultLogger;
-import dpml.util.ExceptionHelper;

import java.net.URI;
import java.net.URL;
import java.rmi.RMISecurityManager;
-import java.util.concurrent.TimeUnit;

import junit.framework.TestCase;

@@ -43,11 +41,15 @@
{
private Logger m_logger = new DefaultLogger( "test" );

+ /**
+ * Test appliance deployment via appliance uri content resolution.
+ * @exception Exception if an error occurs
+ */
public void testClassicAppliance() throws Exception
{
URI uri = URI.create( "link:appliance:dpml/metro/demo" );
URL url = Artifact.toURL( uri );
- Appliance appliance = (Appliance) url.getContent( new Class[]{
Appliance.class } );
+ Appliance appliance = (Appliance) url.getContent( new
Class[]{Appliance.class} );
try
{
appliance.commission();

Modified:
trunk/main/metro/testing/test/src/test/net/dpml/test/PlanTestCase.java
===================================================================
--- trunk/main/metro/testing/test/src/test/net/dpml/test/PlanTestCase.java
2007-04-24 17:52:45 UTC (rev 1989)
+++ trunk/main/metro/testing/test/src/test/net/dpml/test/PlanTestCase.java
2007-04-25 06:38:01 UTC (rev 1990)
@@ -19,7 +19,6 @@
package net.dpml.test;

import dpml.util.DefaultLogger;
-import dpml.util.ExceptionHelper;

import java.net.URI;
import java.net.URL;
@@ -42,11 +41,15 @@
{
private Logger m_logger = new DefaultLogger( "test" );

+ /**
+ * Test plan deployment via plan uri content resolution.
+ * @exception Exception if an error occurs
+ */
public void testPlanDeployment() throws Exception
{
URI uri = URI.create( "link:plan:dpml/metro/demo" );
URL url = Artifact.toURL( uri );
- Appliance appliance = (Appliance) url.getContent( new Class[]{
Appliance.class } );
+ Appliance appliance = (Appliance) url.getContent( new
Class[]{Appliance.class} );
try
{
appliance.commission();




  • r1990 - in trunk/main/metro: appliance/src/main/dpml/station/info appliance/src/main/dpml/station/util appliance/src/main/net/dpml/station appliance/src/test/net/dpml/appliance connector/src/main/dpml/station/connector main/src/main/dpml/metro/console part/src/main/dpml/appliance part/src/main/dpml/lang part/src/main/dpml/state part/src/main/net/dpml/annotation part/src/main/net/dpml/appliance part/src/main/net/dpml/lang part/src/main/net/dpml/runtime part/src/test/dpml/lang part/src/test/net/dpml/runtime part/src/test/net/dpml/runtime/composition part/src/test/net/dpml/runtime/context part/src/test/net/dpml/runtime/isolation part/src/test/net/dpml/runtime/lifecycle part/src/test/net/dpml/runtime/lifestyle part/src/test/net/dpml/runtime/profile part/src/test/net/dpml/runtime/service part/src/test/org/acme station/src/main/dpml/station/console testing/plus/src/main/org/acme/reference testing/plus/src/test/net/dpml/part/composition testing/sample/src/main/org/acme tes! ting/test/src/test/net/dpml/test, mcconnell at BerliOS, 04/25/2007

Archive powered by MHonArc 2.6.24.

Top of Page