Skip to Content.
Sympa Menu

notify-dpml - r1542 - in trunk/main: central/src/docs/metro/directives/component depot/core/src/main/net/dpml/depot depot/library/src/main/net/dpml/library depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/tools/builder/src/main/net/dpml/tools/tasks lang/component/etc metro/component/src/main/net/dpml/component metro/model/etc/data metro/model/src/main/net/dpml/metro metro/model/src/main/net/dpml/metro/builder metro/model/src/main/net/dpml/metro/data metro/model/src/main/net/dpml/metro/info metro/model/src/test/net/dpml/metro/builder metro/model/src/test/net/dpml/metro/data/test metro/runtime/src/main/net/dpml/metro/runtime metro/state/src/main/net/dpml/state metro/test/src/test/net/dpml/test/runtime metro/tools/src/main/net/dpml/metro/tools planet/http/impl/src/main/net/dpml/http planet/http/test planet/http/test/etc planet/http/test/etc/data station/builder/src/main/net/dpml/station/builder station/console/src/main/net/dpml/station/! console station/server/etc/bin/scm/conf station/server/etc/prefs/propertiess station/server/src/main/net/dpml/station/server transit/core/etc/prefs/propertiess transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/util

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: r1542 - in trunk/main: central/src/docs/metro/directives/component depot/core/src/main/net/dpml/depot depot/library/src/main/net/dpml/library depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/tools/builder/src/main/net/dpml/tools/tasks lang/component/etc metro/component/src/main/net/dpml/component metro/model/etc/data metro/model/src/main/net/dpml/metro metro/model/src/main/net/dpml/metro/builder metro/model/src/main/net/dpml/metro/data metro/model/src/main/net/dpml/metro/info metro/model/src/test/net/dpml/metro/builder metro/model/src/test/net/dpml/metro/data/test metro/runtime/src/main/net/dpml/metro/runtime metro/state/src/main/net/dpml/state metro/test/src/test/net/dpml/test/runtime metro/tools/src/main/net/dpml/metro/tools planet/http/impl/src/main/net/dpml/http planet/http/test planet/http/test/etc planet/http/test/etc/data station/builder/src/main/net/dpml/station/builder station/console/src/main/net/dpml/station/! console station/server/etc/bin/scm/conf station/server/etc/prefs/propertiess station/server/src/main/net/dpml/station/server transit/core/etc/prefs/propertiess transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/util
  • Date: Tue, 11 Jul 2006 18:12:15 +0200

Author: mcconnell
Date: 2006-07-11 18:12:04 +0200 (Tue, 11 Jul 2006)
New Revision: 1542

Added:
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
trunk/main/planet/http/test/etc/
trunk/main/planet/http/test/etc/data/
trunk/main/planet/http/test/etc/data/logging.properties
trunk/main/transit/core/etc/prefs/propertiess/trace.properties
trunk/main/transit/core/src/main/net/dpml/util/Resolver.java
trunk/main/transit/core/src/main/net/dpml/util/SimpleResolver.java
Removed:
trunk/main/metro/model/etc/data/parts/
trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
trunk/main/metro/model/src/main/net/dpml/metro/data/ImportDirective.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
trunk/main/metro/state/src/main/net/dpml/state/Enum.java
trunk/main/station/server/etc/prefs/propertiess/logging.properties
Modified:
trunk/main/central/src/docs/metro/directives/component/index.xml
trunk/main/depot/core/src/main/net/dpml/depot/Main.java
trunk/main/depot/library/src/main/net/dpml/library/Feature.java
trunk/main/depot/library/src/main/net/dpml/library/Resource.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java

trunk/main/depot/library/src/main/net/dpml/library/info/FeatureFilterDirective.java

trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
trunk/main/lang/component/etc/component.xsd
trunk/main/metro/component/src/main/net/dpml/component/Component.java
trunk/main/metro/component/src/main/net/dpml/component/Composition.java
trunk/main/metro/component/src/main/net/dpml/component/Provider.java

trunk/main/metro/component/src/main/net/dpml/component/ProviderListener.java
trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java

trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java

trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentEncoder.java

trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java

trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeEncoder.java
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
trunk/main/metro/model/src/main/net/dpml/metro/info/Composite.java
trunk/main/metro/model/src/main/net/dpml/metro/info/PartReference.java
trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java

trunk/main/metro/model/src/test/net/dpml/metro/data/test/ComponentDirectiveTestCase.java

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

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

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

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

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

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

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

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

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
trunk/main/metro/state/src/main/net/dpml/state/ApplyAction.java
trunk/main/metro/state/src/main/net/dpml/state/DefaultInterface.java
trunk/main/metro/state/src/main/net/dpml/state/DefaultOperation.java
trunk/main/metro/state/src/main/net/dpml/state/DefaultState.java
trunk/main/metro/state/src/main/net/dpml/state/DefaultTransition.java
trunk/main/metro/state/src/main/net/dpml/state/DefaultTrigger.java
trunk/main/metro/state/src/main/net/dpml/state/ExecAction.java
trunk/main/metro/state/src/main/net/dpml/state/StateDecoder.java
trunk/main/metro/state/src/main/net/dpml/state/StateEncoder.java
trunk/main/metro/state/src/main/net/dpml/state/StateMachine.java
trunk/main/metro/state/src/main/net/dpml/state/Trigger.java
trunk/main/metro/test/src/test/net/dpml/test/runtime/ProviderTestCase.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/CatalogTask.java

trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypeBuilderTask.java

trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java

trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java

trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
trunk/main/station/server/etc/bin/scm/conf/wrapper.conf
trunk/main/station/server/etc/prefs/propertiess/application.properties
trunk/main/station/server/etc/prefs/propertiess/server.properties

trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
trunk/main/transit/core/src/main/net/dpml/lang/Builder.java
trunk/main/transit/core/src/main/net/dpml/lang/Info.java
trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
trunk/main/transit/core/src/main/net/dpml/transit/Artifact.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
trunk/main/transit/core/src/main/net/dpml/util/ConfigurationHandler.java
trunk/main/transit/core/src/main/net/dpml/util/Decoder.java
trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
trunk/main/transit/core/src/main/net/dpml/util/EventHandler.java
trunk/main/transit/core/src/main/net/dpml/util/EventQueue.java
trunk/main/transit/core/src/main/net/dpml/util/UnicastEventSource.java
Log:
1. add component directive customization from an existing component definition
2. checkstyle cleanup

Modified: trunk/main/central/src/docs/metro/directives/component/index.xml
===================================================================
--- trunk/main/central/src/docs/metro/directives/component/index.xml
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/central/src/docs/metro/directives/component/index.xml
2006-07-11 16:12:04 UTC (rev 1542)
@@ -14,6 +14,10 @@
<pre>link:xsd:dpml/lang/dpml-component#1.0</pre>

<subsection name="Description">
+
+ <p>
+ Definition of a part deployment strategy using the Metro component
model.
+ </p>

</subsection>

@@ -21,7 +25,9 @@
<table>
<tr>
<td><tt>type</tt></td>
- <td>Set the component type classname (required).</td>
+ <td>Set the component type classname (required unless a
super-directive
+ is declared via the uri attribute). May not be used in
conjunction with
+ the special <tt>uri</tt> attribute.</td>
</tr>
<tr>
<td><tt>name</tt></td>
@@ -63,18 +69,6 @@
memory for the lifetime of the JVM unless explicitly removed
via a management system or controlling application.</td>
</tr>
- <tr>
- <td><tt>collection</tt></td>
- <td>Overrides the component garbage collection policy
(optional). Allowable
- values include <tt>WEAK</tt>, <tt>SOFT</tt> and <tt>HARD</tt>.
- A component declaring a <tt>WEAK</tt> collection policy will
- be garbage collected at the discretion of the JVM. A component
- declaring a <tt>SOFT</tt> collection policy will be garbage
- collected in the event of memory contention. A component
- declaring the <tt>HARD</tt> collection policy will remain in
- memory for the lifetime of the JVM unless explicitly removed
- via a management system or controlling application.</td>
- </tr>
</table>

</subsection>
@@ -84,11 +78,16 @@
<table>
<tr>
<td><tt>key</tt></td>
- <td>Required only when declaring a nested component within a
type.
- The key corresponds to the internal key that uniquely
identifies the
- child component within the scope of the enclosing component
type.
+ <td>Required only when declaring a nested component within a
type or
+ parent component. The key corresponds to the internal key that
uniquely
+ identifies the child component within the scope of the
enclosing entity.
</td>
</tr>
+ <tr>
+ <td><tt>uri</tt></td>
+ <td>Optionally set the super-profile that the definition
extends. May not
+ be used in conjunction with the <tt>type</tt> attribute.</td>
+ </tr>
</table>

</subsection>
@@ -123,7 +122,7 @@
</tr>
<tr>
<td><tt><a href="parts.html">parts</a></tt></td>
- <td>Declaration of the nested componets.</td>
+ <td>Declaration of the nested components.</td>
</tr>
</table>


Modified: trunk/main/depot/core/src/main/net/dpml/depot/Main.java
===================================================================
--- trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -56,6 +56,7 @@

private Object m_plugin;
private boolean m_debug = false;
+ private boolean m_trace = false;

/**
* Processes command line options to establish the command handler plugin
to deploy.
@@ -90,69 +91,82 @@
// check for debug mode
//

- if( CLIHelper.isOptionPresent( args, "-debug" ) )
+ if( CLIHelper.isOptionPresent( args, "-trace" ) )
{
+ args = CLIHelper.consolidate( args, "-trace" );
+ System.setProperty( "dpml.trace", "true" );
+ m_trace = true;
+ }
+ else if( CLIHelper.isOptionPresent( args, "-debug" ) )
+ {
args = CLIHelper.consolidate( args, "-debug" );
System.setProperty( "dpml.debug", "true" );
- }
-
- if( "true".equals( System.getProperty( "dpml.debug" ) ) )
- {
m_debug = true;
}

- if( null == System.getProperty( "dpml.logging.config" ) )
- {
- if( m_debug )
- {
- System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/debug" );
- }
- else
- {
- System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/default" );
- }
- }
-
- if( m_debug )
- {
- for( int i=0; i<arguments.length; i++ )
- {
- getLogger().debug( "arg[" + i + "]: " + arguments[i] );
- }
- }
-
//
// handle cli sub-system establishment
//

Command command = getCommand( args );
- if( Command.BUILD.equals( command ) )
+ if( Command.STATION.equals( command ) )
{
- handleBuild( args );
- }
- else if( Command.TRANSIT.equals( command ) )
- {
- handleTransit( args );
- }
- else if( Command.METRO.equals( command ) )
- {
- handleMetro( args );
- }
- else if( Command.STATION.equals( command ) )
- {
handleStation( args );
}
else
{
- final String error =
- "Missing application key '" + APPLICATION_KEY + "'.";
- System.err.println( error );
- System.exit( 1 );
+ if( null == System.getProperty( "dpml.logging.config" ) )
+ {
+ if( m_trace )
+ {
+ System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/trace" );
+ }
+ else if( m_debug )
+ {
+ System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/debug" );
+ }
+ else
+ {
+ System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/default" );
+ }
+ }
+
+ if( m_debug || m_trace )
+ {
+ for( int i=0; i<arguments.length; i++ )
+ {
+ getLogger().debug( "arg[" + i + "]: " + arguments[i] );
+ }
+ }
+
+ if( Command.BUILD.equals( command ) )
+ {
+ handleBuild( args );
+ }
+ else if( Command.TRANSIT.equals( command ) )
+ {
+ handleTransit( args );
+ }
+ else if( Command.METRO.equals( command ) )
+ {
+ handleMetro( args );
+ }
+ else
+ {
+ final String error =
+ "Missing application key '" + APPLICATION_KEY + "'.";
+ System.err.println( error );
+ System.exit( 1 );
+ }
}
}

private void handleBuild( String[] args )
{
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "launching builder" );
+ }
String name = "build";
String spec = "@DEPOT-BUILDER-URI@";
handlePlugin( name, spec, args, false );
@@ -160,6 +174,10 @@

private void handleMetro( String[] args )
{
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "launching metro" );
+ }
String name = "exec";
String spec = "@DEPOT-EXEC-URI@";
handlePlugin( name, spec, args, true );
@@ -177,6 +195,18 @@
new File( Transit.DPML_DATA, "logs/station" ).mkdirs();
if( CLIHelper.isOptionPresent( args, "-server" ) )
{
+ if( m_trace )
+ {
+ System.setProperty( "dpml.logging.level", "FINEST" );
+ }
+ else if( m_debug )
+ {
+ System.setProperty( "dpml.logging.level", "FINE" );
+ }
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "launching station in server mode" );
+ }
String name = "station";
args = CLIHelper.consolidate( args, "-server" );
String spec = "@DEPOT-STATION-SERVER-URI@";
@@ -184,6 +214,10 @@
}
else
{
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "launching station in client mode" );
+ }
String name = "station";
String spec = "@DEPOT-STATION-URI@";
handlePlugin( name, spec, args, false );

Modified: trunk/main/depot/library/src/main/net/dpml/library/Feature.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/Feature.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/depot/library/src/main/net/dpml/library/Feature.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -151,6 +151,7 @@
/**
* Return the value of a feature.
* @param resource the target resource
+ * @param feature the feature
* @return the resolved value
*/
public static String resolve( Resource resource, Feature feature )
@@ -161,6 +162,7 @@
/**
* Return the value of a feature.
* @param resource the target resource
+ * @param feature the feature
* @param type the selected type
* @return the resolved value
*/
@@ -172,6 +174,7 @@
/**
* Return the value of a feature.
* @param resource the target resource
+ * @param feature the feature
* @param type the selected type
* @param alias flag indicated that alias based uri resolution is
requested
* @return the resolved value

Modified: trunk/main/depot/library/src/main/net/dpml/library/Resource.java
===================================================================
--- trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/depot/library/src/main/net/dpml/library/Resource.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -24,15 +24,18 @@
import net.dpml.library.info.ResourceDirective.Classifier;

import net.dpml.transit.Artifact;
+
import net.dpml.lang.Category;

+import net.dpml.util.Resolver;
+
/**
* The Resource interface describes infomation about a published resource.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public interface Resource extends Dictionary
+public interface Resource extends Dictionary, Resolver
{
/**
* Return the singleton library.

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,6 +20,7 @@

import java.io.File;
import java.io.IOException;
+import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
@@ -41,6 +42,7 @@
import net.dpml.library.Resource;
import net.dpml.library.Type;
import net.dpml.library.Data;
+import net.dpml.library.ResourceNotFoundException;
import net.dpml.library.info.InfoDirective;
import net.dpml.library.info.TypeDirective;
import net.dpml.library.info.ResourceDirective;
@@ -55,13 +57,16 @@
import net.dpml.transit.Artifact;
import net.dpml.transit.Transit;

+import net.dpml.util.Resolver;
+
+
/**
* Implementation of a resource.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public class DefaultResource extends DefaultDictionary implements Resource,
Comparable
+public class DefaultResource extends DefaultDictionary implements Resource,
Resolver, Comparable
{
/**
* Timestamp.
@@ -514,6 +519,70 @@
}
}

+
//----------------------------------------------------------------------------
+ // Resolver
+
//----------------------------------------------------------------------------
+
+ /**
+ * Utility function supporting resolution of uris containing 'resource'
or
+ * 'alias' schemes. If the supplied uri schem is 'resource' or 'alias'
the
+ * reference is resolved to a artifact type, group and name from which a
+ * resource is resolved and the uri returned. If the scheme is resource
+ * the usri of the resource is returned. If the scheme is 'alias' a
+ * linkn alias is returned. If the scheme is not 'resource' or 'alias'
+ * the argument will be evaluated as a normal transit artifact uri
+ * specification.
+ *
+ * @param ref the uri argument
+ * @return the uri value
+ */
+ public URI toURI( String ref ) throws URISyntaxException
+ {
+ Artifact spec = Artifact.createArtifact( ref );
+ if( spec.isRecognized() )
+ {
+ return spec.toURI();
+ }
+ else if( ref.startsWith( "resource:" ) || ref.startsWith( "alias:" )
)
+ {
+ String type = spec.getType();
+ String group = spec.getGroup();
+ String name = spec.getName();
+ String path = group + "/" + name;
+ Library library = getLibrary();
+ try
+ {
+ Resource resource = library.getResource( path );
+ if( ref.startsWith( "resource:" ) )
+ {
+ Artifact artifact = resource.getArtifact( type );
+ return artifact.toURI();
+ }
+ else
+ {
+ Artifact artifact = resource.getLinkArtifact( type );
+ return artifact.toURI();
+ }
+ }
+ catch( ResourceNotFoundException e )
+ {
+ final String error =
+ "Unresolvable resource reference: " + path;
+ IllegalArgumentException iae = new IllegalArgumentException(
error );
+ iae.initCause( e );
+ throw iae;
+ }
+ }
+ else
+ {
+ return spec.toURI();
+ }
+ }
+
+
//----------------------------------------------------------------------------
+ // implementation
+
//----------------------------------------------------------------------------
+
Map getFilterMap()
{
return m_filters;

Modified:
trunk/main/depot/library/src/main/net/dpml/library/info/FeatureFilterDirective.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/FeatureFilterDirective.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/FeatureFilterDirective.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,18 +18,11 @@

package net.dpml.library.info;

-import java.io.File;
-
-import net.dpml.lang.Version;
-
import net.dpml.library.Feature;
-import net.dpml.library.FeatureRuntimeException;
import net.dpml.library.Resource;
import net.dpml.library.ResourceNotFoundException;
import net.dpml.library.Type;

-import net.dpml.transit.Artifact;
-
/**
* Simple value filter.
*

Modified:
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -62,6 +62,7 @@

/**
* Creation of a new anonymous resource directive.
+ * @param scheme the schema name
* @param name the resource name
* @param version the resource version
* @param type the resource type

Modified:
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
===================================================================
---
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/depot/tools/builder/src/main/net/dpml/tools/tasks/PartTask.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -194,15 +194,14 @@
Info info = getInfo( resource );
Classpath classpath = getClasspath( resource );
Type type = resource.getType( TYPE );
-
Element element = type.getElement();
PartDecoder decoder = PartDecoder.getInstance();
- return decoder.build( info, classpath, element );
+ return decoder.build( info, classpath, element, resource );
}
catch( Throwable e )
{
final String error =
- "Internal error while attempting to build an external part
defintion."
+ "Internal error while attempting to build an external part
definition."
+ "\nResource: " + resource;
throw new BuildException( error, e, getLocation() );
}

Modified: trunk/main/lang/component/etc/component.xsd
===================================================================
--- trunk/main/lang/component/etc/component.xsd 2006-07-11 06:24:53 UTC (rev
1541)
+++ trunk/main/lang/component/etc/component.xsd 2006-07-11 16:12:04 UTC (rev
1542)
@@ -28,7 +28,7 @@
<attribute name="collection" type="this:collection"/>
<attribute name="activation" type="this:activation"/>
<attribute name="handler" type="part:URI"
default="link:part:dpml/metro/dpml-metro-runtime"/>
- <attribute name="extends" type="anyURI"/>
+ <attribute name="uri" type="anyURI"/>
</extension>
</complexContent>
</complexType>
@@ -67,7 +67,6 @@
<complexType name="PartsType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="component" type="this:TaggedComponent" minOccurs="0"
maxOccurs="unbounded"/>
- <element name="import" type="this:TaggedComponentImport"
minOccurs="0" maxOccurs="unbounded"/>
</choice>
</complexType>

@@ -75,6 +74,7 @@
<complexContent>
<extension base="this:component">
<attribute name="key" type="string" use="required"/>
+ <attribute name="priority" type="integer" default="0"/>
</extension>
</complexContent>
</complexType>

Modified:
trunk/main/metro/component/src/main/net/dpml/component/Component.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Component.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/component/src/main/net/dpml/component/Component.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -35,8 +35,8 @@
* Return a provider of an instance of the component.
* @return the instance provider
* @exception InvocationTargetException if a target invocation error
occurs
- * @exception ControlException if a controller related error occurs
- * @exception RemoteException if a remote exception occurs
+ * @exception IOException if a IO error occurs
+ * @exception InvocationTargetException if a component invocation error
occurs
*/
Provider getProvider() throws IOException, InvocationTargetException;


Modified:
trunk/main/metro/component/src/main/net/dpml/component/Composition.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Composition.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/component/src/main/net/dpml/component/Composition.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -34,7 +34,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public abstract class Composition extends Part
+public abstract class Composition extends Part implements Directive
{
private final Directive m_directive;
private final Controller m_controller;
@@ -50,8 +50,9 @@
* @param directive the part deployment strategy directive
* @exception IOException if an I/O error occurs
*/
- public Composition( Logger logger, Info info, Classpath classpath,
Controller controller, Directive directive )
- throws IOException
+ public Composition(
+ Logger logger, Info info, Classpath classpath, Controller controller,
+ Directive directive ) throws IOException
{
super( logger, info, classpath );

@@ -62,6 +63,15 @@
m_directive = directive;
m_controller = controller;
}
+
+ /**
+ * Return the assigned controller.
+ * @return the controller
+ */
+ public Controller getController()
+ {
+ return m_controller;
+ }

/**
* Return the part content or null if the result type is unresolvable

Modified: trunk/main/metro/component/src/main/net/dpml/component/Provider.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Provider.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/component/src/main/net/dpml/component/Provider.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -45,6 +45,7 @@
/**
* Return the current status of the provider.
* @return the provider status
+ * @exception RemoteException if a remote I/O occurs
*/
Status getStatus() throws RemoteException;


Modified:
trunk/main/metro/component/src/main/net/dpml/component/ProviderListener.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/ProviderListener.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/component/src/main/net/dpml/component/ProviderListener.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,8 +18,6 @@

package net.dpml.component;

-import java.util.EventListener;
-
import net.dpml.state.StateListener;

/**

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/ComponentModelManager.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,10 +20,6 @@

import java.rmi.RemoteException;

-import net.dpml.metro.info.CollectionPolicy;
-
-import net.dpml.lang.UnknownKeyException;
-
/**
* The ComponentManager interface provides support for manipulatation of
* a local component model.
@@ -40,29 +36,5 @@
*/
ContextModelManager getContextManager() throws RemoteException;

- /**
- * Return the set of subsidiary component model keys.
- * @return the part keys
- * @exception RemoteException if a remote I/O error occurs
- */
- //String[] getPartKeys() throws RemoteException;
-
- /**
- * Return a subsidiary component manager.
- * @param key the component part key
- * @return the component manager
- * @exception UnknownKeyException if the key is not recognized
- * @exception RemoteException if a remote I/O error occurs
- * @see #getPartKeys()
- */
- //ComponentModelManager getComponentManager( String key )
- // throws UnknownKeyException, RemoteException;
-
- /**
- * Override the assigned collection policy.
- * @param policy the collection policy value
- * @exception RemoteException if a remote I/O error occurs
- */
- //void setCollectionPolicy( CollectionPolicy policy ) throws
RemoteException;
}


Modified:
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -29,7 +29,6 @@
import net.dpml.metro.data.ComponentDirective;
import net.dpml.metro.data.ValueDirective;
import net.dpml.metro.data.LookupDirective;
-import net.dpml.metro.data.ImportDirective;

import net.dpml.metro.info.LifestylePolicy;
import net.dpml.metro.info.CollectionPolicy;
@@ -39,9 +38,11 @@
import net.dpml.lang.ValueDecoder;
import net.dpml.lang.Value;

+import net.dpml.util.Resolver;
import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.util.ElementHelper;
import net.dpml.util.DecodingException;
+import net.dpml.util.SimpleResolver;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -62,7 +63,10 @@
private static final ValueDecoder VALUE_DECODER = new ValueDecoder();

/**
- * Construct a component directive using the supplied uri.
+ * Construct a component directive using the supplied uri. The uri
+ * must refer to an XML document containing a root component element
+ * (typically used in component data testcases).
+ *
* @param uri the part uri
* @return the component directive
* @exception IOException if an error occurs during directive creation
@@ -77,7 +81,8 @@
{
final Document document = DOCUMENT_BUILDER.parse( uri );
final Element root = document.getDocumentElement();
- return buildComponent( root );
+ Resolver resolver = new SimpleResolver();
+ return buildComponent( root, resolver );
}
catch( Throwable e )
{
@@ -96,7 +101,7 @@
* @return the component directive
* @exception DecodingException if an error occurs during directive
creation
*/
- public ComponentDirective buildComponent( Element root ) throws
DecodingException
+ public ComponentDirective buildComponent( Element root, Resolver
resolver ) throws DecodingException
{
if( null == root )
{
@@ -105,7 +110,7 @@
String tag = root.getTagName();
if( "component".equals( tag ) )
{
- return createComponentDirective( root );
+ return createComponentDirective( root, resolver );
}
else
{
@@ -117,26 +122,55 @@
}
}

- private ComponentDirective createComponentDirective( Element element )
throws DecodingException
+ private ComponentDirective createComponentDirective(
+ Element element, Resolver resolver ) throws DecodingException
{
String classname = buildComponentClassname( element );
- String name = buildComponentName( element, classname );
+ String name = buildComponentName( element );
ActivationPolicy activation = buildActivationPolicy( element );
CollectionPolicy collection = buildCollectionPolicy( element );
LifestylePolicy lifestyle = buildLifestylePolicy( element );
CategoriesDirective categories = getNestedCategoriesDirective(
element );
ContextDirective context = getNestedContextDirective( element );
- PartReference[] parts = getNestedParts( element );
- URI base = getBaseURI( element );
+ PartReference[] parts = getNestedParts( element, resolver );
+ URI base = getBaseURI( element, resolver );

- return new ComponentDirective(
- name, activation, collection, lifestyle, classname,
- categories, context, parts, base );
+ if( null == base )
+ {
+ if( null == classname )
+ {
+ final String error =
+ "Missing component type attribute.";
+ throw new DecodingException( element, error );
+ }
+ }
+ else
+ {
+ if( null != classname )
+ {
+ final String error =
+ "llegal attempt to override a base type in a supertype.";
+ throw new DecodingException( element, error );
+ }
+ }
+
+ try
+ {
+ return new ComponentDirective(
+ name, activation, collection, lifestyle, classname,
+ categories, context, parts, base );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Component directive creation error.";
+ throw new DecodingException( element, error, e );
+ }
}

- private URI getBaseURI( Element element ) throws DecodingException
+ private URI getBaseURI( Element element, Resolver resolver ) throws
DecodingException
{
- String base = ElementHelper.getAttribute( element, "extends" );
+ String base = ElementHelper.getAttribute( element, "uri" );
if( null == base )
{
return null;
@@ -145,12 +179,12 @@
{
try
{
- return new URI( base );
+ return resolver.toURI( base );
}
catch( Exception e )
{
final String error =
- "Unable to resolve the URI declared as under the 'extends'
attribute."
+ "Unable to resolve the URI declared as under the base
'uri' attribute."
+ "\n URI: " + base;
throw new DecodingException( element, error );
}
@@ -159,26 +193,22 @@

private String buildComponentClassname( Element element ) throws
DecodingException
{
- String classname = ElementHelper.getAttribute( element, "type" );
- if( null == classname )
+ return ElementHelper.getAttribute( element, "type" );
+ }
+
+ private ActivationPolicy buildActivationPolicy( Element element ) throws
DecodingException
+ {
+ String policy = ElementHelper.getAttribute( element, "activation" );
+ if( null == policy )
{
- final String error =
- "Missing component 'class' attribute.";
- throw new DecodingException( element, error );
+ return null;
}
else
{
- return classname;
+ return ActivationPolicy.parse( policy );
}
}

- private ActivationPolicy buildActivationPolicy( Element element ) throws
DecodingException
- {
- String defaultValue = ActivationPolicy.SYSTEM.getName();
- String policy = ElementHelper.getAttribute( element, "activation",
defaultValue );
- return ActivationPolicy.parse( policy );
- }
-
private LifestylePolicy buildLifestylePolicy( Element element ) throws
DecodingException
{
String policy = ElementHelper.getAttribute( element, "lifestyle",
null );
@@ -194,32 +224,22 @@

private CollectionPolicy buildCollectionPolicy( Element element ) throws
DecodingException
{
- String defaultValue = CollectionPolicy.SYSTEM.getName();
- String policy = ElementHelper.getAttribute( element, "collection",
defaultValue );
- return CollectionPolicy.parse( policy );
- }
-
- private String buildComponentName( Element element, String classname )
- {
- String name = ElementHelper.getAttribute( element, "name" );
- if( null != name )
- {
- return name;
+ String policy = ElementHelper.getAttribute( element, "collection" );
+ if( null != policy )
+ {
+ return CollectionPolicy.parse( policy );
}
else
{
- name = ElementHelper.getAttribute( element, "key" );
- if( null != name )
- {
- return name;
- }
- else
- {
- return toName( classname );
- }
+ return null;
}
}

+ private String buildComponentName( Element element )
+ {
+ return ElementHelper.getAttribute( element, "name" );
+ }
+
private CategoriesDirective getNestedCategoriesDirective( Element root )
{
Element element = ElementHelper.getChild( root, "categories" );
@@ -368,7 +388,7 @@
}
}

- private PartReference[] getNestedParts( Element root ) throws
DecodingException
+ private PartReference[] getNestedParts( Element root, Resolver resolver
) throws DecodingException
{
Element parts = ElementHelper.getChild( root, "parts" );
if( null == parts )
@@ -377,49 +397,32 @@
}
else
{
- return createParts( parts );
+ return createParts( parts, resolver );
}
}

- private PartReference[] createParts( Element element ) throws
DecodingException
+ private PartReference[] createParts( Element element, Resolver resolver
) throws DecodingException
{
Element[] children = ElementHelper.getChildren( element );
PartReference[] parts = new PartReference[ children.length ];
for( int i=0; i<children.length; i++ )
{
Element elem = children[i];
- parts[i] = createPartReference( elem );
+ parts[i] = createPartReference( elem, resolver );
}
return parts;
}

- private PartReference createPartReference( Element element ) throws
DecodingException
+ private PartReference createPartReference( Element element, Resolver
resolver ) throws DecodingException
{
String tag = element.getTagName();
String key = ElementHelper.getAttribute( element, "key" );
+ int priority = getPriority( element );
if( "component".equals( tag ) )
{
- ComponentDirective directive = buildComponent( element );
- return new PartReference( key, directive );
+ ComponentDirective directive = buildComponent( element, resolver
);
+ return new PartReference( key, directive, priority );
}
- else if( "import".equals( tag ) )
- {
- String spec = ElementHelper.getAttribute( element, "uri" );
- try
- {
- URI uri = new URI( spec );
- ImportDirective directive = new ImportDirective( uri );
- return new PartReference( key, directive );
- }
- catch( Exception e )
- {
- final String error =
- "Internal error while attempting to construct import
directive."
- + "\nImport URI: " + spec
- + "\nPart key: " + key;
- throw new DecodingException( element, error );
- }
- }
else
{
final String error =
@@ -429,7 +432,22 @@
throw new DecodingException( element, error );
}
}
-
+
+ private int getPriority( Element element ) throws DecodingException
+ {
+ String priority = ElementHelper.getAttribute( element, "priority",
"0" );
+ try
+ {
+ return Integer.parseInt( priority );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unable to parse priority value.";
+ throw new DecodingException( element, error, e );
+ }
+ }
+
/**
* Internal utility to get the name of the class without the package
name. Used
* when constructing a default component name.

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentEncoder.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -38,7 +38,6 @@
import net.dpml.metro.data.ComponentDirective;
import net.dpml.metro.data.LookupDirective;
import net.dpml.metro.data.ValueDirective;
-import net.dpml.metro.data.ImportDirective;

import net.dpml.metro.info.LifestylePolicy;
import net.dpml.metro.info.CollectionPolicy;
@@ -109,7 +108,7 @@
{
if( object instanceof ComponentDirective )
{
- writeTaggedComponent( writer, (ComponentDirective) object, null,
pad );
+ writeTaggedComponent( writer, (ComponentDirective) object, null,
pad, true );
}
else
{
@@ -144,40 +143,49 @@
public void writeTaggedComponent(
Writer writer, ComponentDirective directive, String key, String pad )
throws IOException
{
- writer.write( "\n" + pad + "<component xmlns=\"" +
COMPONENT_SCHEMA_URN + "\"" );
- if( null != key )
- {
- writer.write( " key=\"" + key + "\"" );
- }
- writer.write( "\n" + pad + " " );
- writeAttributes( writer, directive, pad + " " );
- writeBody( writer, directive, pad + " " );
- writer.write( "\n" + pad + "</component>" );
+ writeTaggedComponent( writer, directive, key, pad, true );
}

/**
- * Export a tagged import directive to an output stream as XML.
+ * Export a tagged component directive to an output stream as XML.
* @param writer the print writer
- * @param directive the import directive
+ * @param directive the component directive
* @param key the key identifying the component
* @param pad character offset
+ * @param flag true if the xml namespace should be included
* @exception IOException if an IO error occurs
*/
- public void writeTaggedImport(
- Writer writer, ImportDirective directive, String key, String pad )
throws IOException
+ public void writeTaggedComponent(
+ Writer writer, ComponentDirective directive, String key, String pad,
boolean flag ) throws IOException
{
- URI uri = directive.getURI();
- String spec = uri.toASCIIString();
- writer.write( "\n" + pad + "<import xmlns=\"" + COMPONENT_SCHEMA_URN
+ "\"" );
- writer.write( " key=\"" + key + "\"" );
- writer.write( " uri=\"" + spec + "\"/>" );
+ writer.write( "\n" + pad + "<component" );
+ if( flag )
+ {
+ writer.write( " xmlns=\"" + COMPONENT_SCHEMA_URN + "\"" );
+ }
+ if( null != key )
+ {
+ writer.write( " key=\"" + key + "\"" );
+ }
+ writer.write( "\n" + pad + " " );
+ writeAttributes( writer, directive, pad + " " );
+ writeBody( writer, directive, pad + " " );
+ writer.write( "\n" + pad + "</component>" );
}

void writeAttributes(
Writer writer, ComponentDirective directive, String pad ) throws
IOException
{
String classname = directive.getClassname();
- writer.write( " type=\"" + classname + "\"" );
+ if( null != classname )
+ {
+ writer.write( " type=\"" + classname + "\"" );
+ }
+ URI uri = directive.getBaseURI();
+ if( null != uri )
+ {
+ writer.write( " uri=\"" + uri.toASCIIString() + "\"" );
+ }
String name = directive.getName();
if( null != name )
{
@@ -198,11 +206,6 @@
{
writer.write( "\n" + pad + " activation=\"" +
activation.getName() + "\"" );
}
- URI base = directive.getBaseDirective();
- if( null != base )
- {
- writer.write( "\n" + pad + " extends=\"" + base.toASCIIString()
+ "\"" );
- }
writer.write( ">" );
}

@@ -214,12 +217,17 @@
PartReference[] parts = directive.getPartReferences();
writeCategoriesDirective( writer, categories, pad );
writeContextDirective( writer, context, pad );
- writeParts( writer, parts, pad );
+ writeParts( writer, parts, pad, false );
}

private void writeCategoriesDirective(
Writer writer, CategoriesDirective categories, String pad ) throws
IOException
{
+ if( null == categories )
+ {
+ return;
+ }
+
String name = categories.getName();
Priority priority = categories.getPriority();
String target = categories.getTarget();
@@ -318,6 +326,11 @@
private void writeContextDirective(
Writer writer, ContextDirective context, String pad ) throws
IOException
{
+ if( null == context )
+ {
+ return;
+ }
+
String classname = context.getClassname();
PartReference[] parts = context.getDirectives();

@@ -348,11 +361,17 @@
* @param writer the writer
* @param parts the part refernece array
* @param pad the offset
+ * @param flag true if the xml namespace should be included
* @exception IOException if an IO error occurs
*/
protected void writeParts(
- Writer writer, PartReference[] parts, String pad ) throws IOException
+ Writer writer, PartReference[] parts, String pad, boolean flag )
throws IOException
{
+ if( null == parts )
+ {
+ return;
+ }
+
if( parts.length == 0 )
{
return;
@@ -360,18 +379,18 @@
else
{
writer.write( "\n" + pad + "<parts>" );
- writePartReferences( writer, parts, pad + " " );
+ writePartReferences( writer, parts, pad + " ", flag );
writer.write( "\n" + pad + "</parts>" );
}
}

private void writePartReferences(
- Writer writer, PartReference[] parts, String pad ) throws IOException
+ Writer writer, PartReference[] parts, String pad, boolean flag )
throws IOException
{
for( int i=0; i<parts.length; i++ )
{
PartReference ref = parts[i];
- writePartReference( writer, ref, pad );
+ writePartReference( writer, ref, pad, flag );
}
}

@@ -408,11 +427,6 @@
LookupDirective value = (LookupDirective) directive;
writeLookupEntry( writer, key, value, pad );
}
- else if( directive instanceof ComponentDirective )
- {
- ComponentDirective value = (ComponentDirective) directive;
- writeTaggedComponent( writer, value, key, pad );
- }
else
{
String classname = directive.getClass().getName();
@@ -436,7 +450,7 @@
}

private void writePartReference(
- Writer writer, PartReference part, String pad ) throws IOException
+ Writer writer, PartReference part, String pad, boolean flag ) throws
IOException
{
String key = part.getKey();
if( null == key )
@@ -452,18 +466,13 @@
if( directive instanceof ComponentDirective )
{
ComponentDirective component = (ComponentDirective) directive;
- writeTaggedComponent( writer, component, key, pad );
+ writeTaggedComponent( writer, component, key, pad, flag );
}
- else if( directive instanceof ImportDirective )
- {
- ImportDirective importDirective = (ImportDirective) directive;
- writeTaggedImport( writer, importDirective, key, pad );
- }
else
{
String classname = directive.getClass().getName();
final String error =
- "Part reference class not recognized."
+ "Part reference directive class not recognized."
+ "\nClass: " + classname;
throw new IllegalArgumentException( error );
}

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeDecoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -47,6 +47,7 @@
import net.dpml.util.DOM3DocumentBuilder;
import net.dpml.util.DecodingException;
import net.dpml.util.ElementHelper;
+import net.dpml.util.Resolver;

import org.w3c.dom.Element;
import org.w3c.dom.Document;
@@ -69,10 +70,12 @@
/**
* Load a type.
* @param subject the component implementation class
+ * @param resolver build-time value resolver
* @return the component type descriptor
* @exception IOException if an error occurs reading the type definition
+ * @exception IntrospectionException if an introspection error occurs
*/
- public Type loadType( Class subject ) throws IOException,
IntrospectionException
+ public Type loadType( Class subject, Resolver resolver ) throws
IOException, IntrospectionException
{
String classname = subject.getName();
String path = classname.replace( '.', '/' );
@@ -88,7 +91,7 @@
try
{
URI uri = new URI( url.toString() );
- return loadType( uri );
+ return loadType( uri, resolver );
}
catch( URISyntaxException e )
{
@@ -108,13 +111,13 @@
* @return the component type descriptor
* @exception IOException if an error occurs reading the type definition
*/
- public Type loadType( URI uri ) throws IOException
+ public Type loadType( URI uri, Resolver resolver ) throws IOException
{
try
{
final Document document = DOCUMENT_BUILDER.parse( uri );
final Element root = document.getDocumentElement();
- return buildType( root );
+ return buildType( root, resolver );
}
catch( Throwable e )
{
@@ -127,14 +130,14 @@
}
}

- private Type buildType( Element root ) throws Exception
+ private Type buildType( Element root, Resolver resolver ) throws
Exception
{
InfoDescriptor info = buildNestedInfoDescriptor( root );
ServiceDescriptor[] services = buildNestedServices( root );
ContextDescriptor context = buildNestedContext( root );
CategoryDescriptor[] categories = buildNestedCategories( root );
State state = buildNestedState( root );
- PartReference[] parts = buildNestedParts( root );
+ PartReference[] parts = buildNestedParts( root, resolver );
return new Type( info, categories, context, services, parts, state );
}

@@ -263,7 +266,7 @@
}
}

- private PartReference[] buildNestedParts( Element root ) throws Exception
+ private PartReference[] buildNestedParts( Element root, Resolver
resolver ) throws Exception
{
Element element = ElementHelper.getChild( root, "parts" );
if( null == element )
@@ -283,17 +286,17 @@
for( int i=0; i<children.length; i++ )
{
Element child = children[i];
- refs[i] = buildPartReference( child );
+ refs[i] = buildPartReference( child, resolver );
}
return refs;
}
}
}

- private PartReference buildPartReference( Element element ) throws
Exception
+ private PartReference buildPartReference( Element element, Resolver
resolver ) throws Exception
{
String key = ElementHelper.getAttribute( element, "key" );
- ComponentDirective definition = COMPONENT_DECODER.buildComponent(
element );
+ ComponentDirective definition = COMPONENT_DECODER.buildComponent(
element, resolver );
return new PartReference( key, definition );
}


Modified:
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeEncoder.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeEncoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentTypeEncoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -223,7 +223,7 @@

private void writeTypeParts( Writer writer, PartReference[] parts,
String pad ) throws IOException
{
- COMPONENT_ENCODER.writeParts( writer, parts, pad );
+ COMPONENT_ENCODER.writeParts( writer, parts, pad, true );
}

private void writeAttributes( Writer writer, Descriptor descriptor,
String pad ) throws IOException

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/data/ComponentDirective.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,6 +18,7 @@

package net.dpml.metro.data;

+import java.io.IOException;
import java.net.URI;

import net.dpml.component.ActivationPolicy;
@@ -28,6 +29,10 @@
import net.dpml.metro.info.LifestylePolicy;
import net.dpml.metro.info.CollectionPolicy;

+//import net.dpml.metro.builder.ComponentDecoder;
+
+import net.dpml.lang.Part;
+
/**
* Definition of the criteria for an explicit component profile. A profile,
when
* included within the scope of a container declaration will be instantiated
in
@@ -97,7 +102,44 @@

private static final CategoriesDirective EMPTY_CATEGORIES =
new CategoriesDirective();
-
+
+ //private static final ComponentDecoder DECODER = new ComponentDecoder();
+
+ /*
+ private static PartReference[] mergePartReferences(
+ PartReference[] parts, ComponentDirective directive )
+ {
+ if( null == directive )
+ {
+ return parts;
+ }
+ else if( null == parts )
+ {
+ return directive.getPartReferences();
+ }
+ else
+ {
+ Hashtable table = new Hashtable();
+ PartReference[] references = directive.getPartReferences();
+ for( int i=0; i<references.length; i++ )
+ {
+ PartReference ref = references[i];
+ String key = ref.getKey();
+ table.put( key, ref );
+ }
+ for( int i=0; i<parts.length; i++ )
+ {
+ PartReference ref = parts[i];
+ String key = ref.getKey();
+ table.put( key, ref );
+ }
+ PartReference[] refs = (PartReference[]) table.values().toArray(
new PartReference[0] );
+ Arrays.sort( refs );
+ return refs;
+ }
+ }
+ */
+

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

//--------------------------------------------------------------------------
@@ -106,7 +148,7 @@
* The collection policy override.
*/
private final CollectionPolicy m_collection;
-
+
/**
* The component lifestyle policy.
*/
@@ -139,9 +181,14 @@
private final CategoriesDirective m_categories;

/**
+ * Base directive uri.
+ */
+ private final URI m_uri;
+
+ /**
* Base directive.
*/
- private final URI m_base;
+ private final DefaultComposition m_base;


//--------------------------------------------------------------------------
// constructors
@@ -152,8 +199,9 @@
*
* @param name the name to assign to the component deployment scenario
* @param classname the classname of the component type
+ * @exception IOException if an IO exception occurs
*/
- public ComponentDirective( final String name, final String classname )
+ public ComponentDirective( final String name, final String classname )
throws IOException
{
this(
name,
@@ -174,8 +222,8 @@
* @param categories logging categories
* @param context context directive
* @param parts the component internal parts
- * @param base URI of the component super-definition
- * @exception NullPointerException if the supplied name if null
+ * @param uri URI of the component super-definition
+ * @exception IOException if an IO exception occurs
*/
public ComponentDirective(
final String name,
@@ -186,13 +234,20 @@
final CategoriesDirective categories,
final ContextDirective context,
final PartReference[] parts,
- final URI base )
+ final URI uri ) throws IOException
{
super( parts );

if( null == activation )
{
- m_activation = ActivationPolicy.SYSTEM;
+ if( null != uri )
+ {
+ m_activation = null;
+ }
+ else
+ {
+ m_activation = ActivationPolicy.SYSTEM;
+ }
}
else
{
@@ -201,7 +256,14 @@

if( null == categories )
{
- m_categories = EMPTY_CATEGORIES;
+ if( null != uri )
+ {
+ m_categories = null;
+ }
+ else
+ {
+ m_categories = EMPTY_CATEGORIES;
+ }
}
else
{
@@ -210,54 +272,108 @@

if( null == classname )
{
- m_classname = Object.class.getName();
+ if( null != uri )
+ {
+ m_classname = null;
+ }
+ else
+ {
+ m_classname = Object.class.getName();
+ }
}
else
{
m_classname = classname;
}
-
+
if( null == context )
{
- m_context = new ContextDirective( new PartReference[0] );
+ if( null != uri )
+ {
+ m_context = null;
+ }
+ else
+ {
+ m_context = new ContextDirective( new PartReference[0] );
+ }
}
else
{
m_context = context;
}

- m_lifestyle = lifestyle;
- m_collection = collection;
- m_base = base;
+ if( null == lifestyle )
+ {
+ if( null != uri )
+ {
+ m_lifestyle = null;
+ }
+ else
+ {
+ m_lifestyle = LifestylePolicy.SYSTEM;
+ }
+ }
+ else
+ {
+ m_lifestyle = lifestyle;
+ }
+
+ if( null == collection )
+ {
+ if( null != uri )
+ {
+ m_collection = null;
+ }
+ else
+ {
+ m_collection = CollectionPolicy.SYSTEM;
+ }
+ }
+ else
+ {
+ m_collection = collection;
+ }

- if( null != name )
+ m_uri = uri;
+
+ if( null != uri )
{
- if( name.indexOf( " " ) > 0 || name.indexOf( "." ) > 0 ||
name.indexOf( "," ) > 0
- || name.indexOf( "/" ) > 0 )
+ Part part = Part.load( uri );
+ if( part instanceof DefaultComposition )
{
- final String error =
- "Directive name ["
- + name
- + "] contains an illegal character (' ', ',', '/', or
'.')";
- throw new IllegalArgumentException( error );
+ m_base = (DefaultComposition) part;
}
- else if( name.length() == 0 )
+ else
{
final String error =
- "Directive name [] is insufficient.";
- throw new IllegalArgumentException( error );
+ "Base part class is not recognized."
+ + "\nClass: " + part.getClass().getName();
+ throw new IllegalStateException( error );
}
+ }
+ else
+ {
+ m_base = null;
+ }
+
+ if( null == name )
+ {
+ if( null != uri )
+ {
+ m_name = null;
+ }
else
{
- m_name = name;
+ m_name = toName( m_classname );
}
}
else
{
- throw new NullPointerException( "name" );
+ validateName( name );
+ m_name = name;
}
}
-
+

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

//--------------------------------------------------------------------------
@@ -341,8 +457,35 @@
*
* @return the uri of the base directive
*/
- public URI getBaseDirective()
+ public URI getBaseURI()
{
+ return m_uri;
+ }
+
+ /**
+ * Return the base directive.
+ *
+ * @return the base directive
+ */
+ public ComponentDirective getBaseDirective()
+ {
+ if( null == m_base )
+ {
+ return null;
+ }
+ else
+ {
+ return m_base.getComponentDirective();
+ }
+ }
+
+ /**
+ * Return the base part.
+ *
+ * @return the base part
+ */
+ public DefaultComposition getBasePart()
+ {
return m_base;
}

@@ -352,12 +495,19 @@
*/
public String toString()
{
- return "[" + getName() + "]";
+ if( null != m_name )
+ {
+ return "[" + getName() + "]";
+ }
+ else
+ {
+ return "[unknown]";
+ }
}

/**
* Compare this object with the supplied object.
- * @param object the obvject to compare with
+ * @param object the object to compare with
* @return the result
*/
public int compareTo( Object object )
@@ -374,10 +524,6 @@
*/
public boolean equals( Object other )
{
- if( null == other )
- {
- return false;
- }
if( !super.equals( other ) )
{
return false;
@@ -387,23 +533,23 @@
return false;
}
ComponentDirective profile = (ComponentDirective) other;
- if( !m_name.equals( profile.getName() ) )
+ if( !equals( m_name, profile.getName() ) )
{
return false;
}
- else if( !m_activation.equals( profile.getActivationPolicy() ) )
+ else if( !equals( m_activation, profile.getActivationPolicy() ) )
{
return false;
}
- else if( !m_categories.equals( profile.getCategoriesDirective() ) )
+ else if( !equals( m_categories, profile.getCategoriesDirective() ) )
{
return false;
}
- else if( !m_classname.equals( profile.getClassname() ) )
+ else if( !equals( m_classname, profile.getClassname() ) )
{
return false;
}
- else if( !m_context.equals( profile.getContextDirective() ) )
+ else if( !equals( m_context, profile.getContextDirective() ) )
{
return false;
}
@@ -417,7 +563,7 @@
}
else
{
- return equals( m_base, profile.getBaseDirective() );
+ return equals( m_uri, profile.getBaseURI() );
}
}

@@ -428,23 +574,52 @@
public int hashCode()
{
int hash = super.hashCode();
- hash ^= m_name.hashCode();
- hash ^= m_activation.hashCode();
- hash ^= m_categories.hashCode();
- hash ^= m_classname.hashCode();
- hash ^= m_context.hashCode();
- if( null != m_collection )
+ hash ^= hashValue( m_name );
+ hash ^= hashValue( m_activation );
+ hash ^= hashValue( m_categories );
+ hash ^= hashValue( m_classname );
+ hash ^= hashValue( m_context );
+ hash ^= hashValue( m_collection );
+ hash ^= hashValue( m_lifestyle );
+ hash ^= hashValue( m_uri );
+ return hash;
+ }
+
+ /**
+ * Internal utility to get the name of the class without the package
name. Used
+ * when constructing a default component name.
+ * @param classname the fully qualified classname
+ * @return the short class name without the package name
+ */
+ private String toName( String classname )
+ {
+ int i = classname.lastIndexOf( "." );
+ if( i == -1 )
{
- hash ^= m_collection.hashCode();
+ return classname.toLowerCase();
}
- if( null != m_lifestyle )
+ else
{
- hash ^= m_lifestyle.hashCode();
+ return classname.substring( i + 1, classname.length()
).toLowerCase();
}
- if( null != m_base )
+ }
+
+ private void validateName( final String name )
+ {
+ if( name.indexOf( " " ) > 0 || name.indexOf( "." ) > 0 ||
name.indexOf( "," ) > 0
+ || name.indexOf( "/" ) > 0 )
{
- hash ^= m_base.hashCode();
+ final String error =
+ "Directive name ["
+ + name
+ + "] contains an illegal character (' ', ',', '/', or '.')";
+ throw new IllegalArgumentException( error );
}
- return hash;
+ else if( name.length() == 0 )
+ {
+ final String error =
+ "Directive name [] is insufficient.";
+ throw new IllegalArgumentException( error );
+ }
}
}

Deleted: trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/data/Composite.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2005 Stephen J. McConnell
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.metro.data;
-
-import java.io.IOException;
-
-import net.dpml.lang.Classpath;
-import net.dpml.lang.Value;
-import net.dpml.lang.Info;
-import net.dpml.lang.Plugin;
-
-import net.dpml.util.Logger;
-
-/**
- * A component based plugin.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class Composite extends Plugin
-{
- private final ComponentDirective m_directive;
-
- /**
- * Creation of a new composite instance.
- * @param logger the assigned logging channel
- * @param info the info descriptor
- * @param classpath the classpath descriptor
- * @param directive the deployment directive
- * @exception IOException if an I/O error occurs
- */
- public Composite(
- Logger logger, Info info, Classpath classpath, ComponentDirective
directive )
- throws IOException
- {
- super( logger, info, classpath, directive.getClassname(), new
Value[0] );
-
- m_directive = directive;
- }
-
- /**
- * Get the deplyment directive.
- * @return the deployment directive
- */
- public ComponentDirective getComponentDirective()
- {
- return m_directive;
- }
-
- /**
- * Return true if this object is equal to the supplied object.
- * @param other the object to evaluate
- * @return the equality status
- */
- public boolean equals( Object other )
- {
- if( super.equals( other ) && ( other instanceof Composite ) )
- {
- Composite composite = (Composite) other;
- return m_directive.equals( composite.m_directive );
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Return the hashcode for the instance.
- * @return the instance hashcode
- */
- public int hashCode()
- {
- int hash = super.hashCode();
- hash ^= m_directive.hashCode();
- return hash;
- }
-}
-

Added:
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/main/net/dpml/metro/data/DefaultComposition.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -0,0 +1,112 @@
+/*
+ * 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 net.dpml.metro.data;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import net.dpml.component.Controller;
+import net.dpml.component.Composition;
+
+import net.dpml.lang.Classpath;
+import net.dpml.lang.Info;
+
+import net.dpml.metro.builder.ComponentEncoder;
+
+import net.dpml.util.Logger;
+
+
+/**
+ * Component composition.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public final class DefaultComposition extends Composition
+{
+ private ComponentDirective m_directive;
+
+ /**
+ * Creation of a new composition diefinition.
+ * @param logger the assigned logging channel
+ * @param info the part info definition
+ * @param classpath the part classpath definition
+ * @param controller the deployment controller
+ * @param directive the deployment directive
+ * @exception IOException if an I/O exception occurs
+ */
+ public DefaultComposition(
+ Logger logger, Info info, Classpath classpath, Controller controller,
ComponentDirective directive )
+ throws IOException
+ {
+ super( logger, info, classpath, controller, directive );
+
+ m_directive = directive;
+ }
+
+ /**
+ * Get the deployment directive.
+ * @return the deployment directive
+ */
+ public ComponentDirective getComponentDirective()
+ {
+ return m_directive;
+ }
+
+ /**
+ * Encode the deployment directive to XML.
+ * @param writer the output stream writer
+ * @param pad the outoput offset
+ * @exception IOException if an I/O exception occurs
+ */
+ protected void encodeStrategy( Writer writer, String pad ) throws
IOException
+ {
+ ComponentEncoder encoder = new ComponentEncoder();
+ encoder.writeComponent( writer, m_directive, pad );
+ }
+
+ /**
+ * Return true if this object is equal to the supplied object.
+ * @param other the object to evaluate
+ * @return the equality status
+ */
+ public boolean equals( Object other )
+ {
+ if( super.equals( other ) && ( other instanceof DefaultComposition )
)
+ {
+ DefaultComposition composite = (DefaultComposition) other;
+ return m_directive.equals( composite.m_directive );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Return the hashcode for the instance.
+ * @return the instance hashcode
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_directive.hashCode();
+ return hash;
+ }
+}

Deleted:
trunk/main/metro/model/src/main/net/dpml/metro/data/ImportDirective.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/data/ImportDirective.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/data/ImportDirective.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -1,102 +0,0 @@
-/*
- * Copyright 2004 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.metro.data;
-
-import java.net.URI;
-
-import net.dpml.component.Directive;
-
-/**
- * A reference directive is a reference to a part within the enclosing part's
- * context or parts.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class ImportDirective extends AbstractDirective implements
Directive
-{
- /**
- * Serial version identifier.
- */
- static final long serialVersionUID = 1L;
-
- /**
- * The part import uri.
- */
- private final URI m_uri;
-
- /**
- * Creation of a new import directive.
- * @param uri the part uri to import
- * @exception NullPointerException if the key or uri arguments are null.
- */
- public ImportDirective( final URI uri )
- throws NullPointerException
- {
- if( null == uri )
- {
- throw new NullPointerException( "uri" );
- }
- m_uri = uri;
- }
-
- /**
- * Return the uri of the component part to import.
- *
- * @return the uri
- */
- public URI getURI()
- {
- return m_uri;
- }
-
- /**
- * Test if the supplied object is equal to this object.
- * @param other the object to compare with this instance
- * @return TRUE if the supplied object is equal to this object
- */
- public boolean equals( Object other )
- {
- if( null == other )
- {
- return false;
- }
- else
- {
- if( other instanceof ImportDirective )
- {
- ImportDirective directive = (ImportDirective) other;
- return m_uri.equals( directive.m_uri );
- }
- else
- {
- return false;
- }
- }
- }
-
- /**
- * Return the hashcode for the instance.
- * @return the instance hashcode
- */
- public int hashCode()
- {
- return m_uri.hashCode();
- }
-}

Modified: trunk/main/metro/model/src/main/net/dpml/metro/info/Composite.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/info/Composite.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/info/Composite.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -19,15 +19,18 @@
package net.dpml.metro.info;

import java.io.Serializable;
+import java.util.Arrays;

import net.dpml.component.Directive;

+import net.dpml.lang.AbstractDirective;
+
/**
* Abstract base class for composite entities.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public abstract class Composite implements Serializable
+public abstract class Composite extends AbstractDirective implements
Serializable
{
static final long serialVersionUID = 1L;

@@ -86,7 +89,7 @@
*/
public boolean equals( Object other )
{
- if( null == other )
+ if( !super.equals( other ) )
{
return false;
}
@@ -95,21 +98,7 @@
return false;
}
Composite t = (Composite) other;
- if( m_parts.length != t.m_parts.length )
- {
- return false;
- }
- else
- {
- for( int i=0; i<m_parts.length; i++ )
- {
- if( !m_parts[i].equals( t.m_parts[i] ) )
- {
- return false;
- }
- }
- }
- return true;
+ return Arrays.equals( m_parts, t.m_parts );
}

/**
@@ -119,29 +108,7 @@
public int hashCode()
{
int hash = getClass().hashCode();
- for( int i = 0; i < m_parts.length; i++ )
- {
- hash ^= m_parts[i].hashCode();
- hash = hash - 163611323;
- }
+ hash ^= hashArray( m_parts );
return hash;
}
-
- /**
- * Utility to compare two object for equality.
- * @param a the first object
- * @param b the second object
- * @return true if the objects are equal
- */
- protected boolean equals( Object a, Object b )
- {
- if( null == a )
- {
- return ( null == b );
- }
- else
- {
- return a.equals( b );
- }
- }
}

Modified:
trunk/main/metro/model/src/main/net/dpml/metro/info/PartReference.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/info/PartReference.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/info/PartReference.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -29,7 +29,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public class PartReference implements Serializable
+public class PartReference implements Serializable, Comparable
{
/**
* Serial version identifier.
@@ -47,6 +47,11 @@
private final Directive m_directive;

/**
+ * The reference priority.
+ */
+ private final int m_priority;
+
+ /**
* Creation of a new part reference.
*
* @param key the key identifying this part within the scope of its
container
@@ -54,6 +59,18 @@
*/
public PartReference( final String key, Directive directive )
{
+ this( key, directive, 0 );
+ }
+
+ /**
+ * Creation of a new part reference.
+ *
+ * @param key the key identifying this part within the scope of its
container
+ * @param directive the directive
+ * @param priority the relative priority
+ */
+ public PartReference( final String key, Directive directive, int
priority )
+ {
if( null == key )
{
throw new NullPointerException( "key" );
@@ -64,6 +81,7 @@
}
m_key = key;
m_directive = directive;
+ m_priority = priority;
}

/**
@@ -84,7 +102,41 @@
return m_directive;
}

+ /**
+ * Return the priority value.
+ * @return the priority ranking of this reference
+ */
+ public int getPriority()
+ {
+ return m_priority;
+ }
+
/**
+ * Compare this object with the supplied object.
+ * @param other the object to compare with
+ * @return the result
+ */
+ public int compareTo( Object other )
+ {
+ if( null == other )
+ {
+ throw new NullPointerException( "other" );
+ }
+ else if( other instanceof PartReference )
+ {
+ PartReference ref = (PartReference) other;
+ Integer p1 = new Integer( m_priority );
+ Integer p2 = new Integer( ref.m_priority );
+ return p1.compareTo( p2 );
+ }
+ else
+ {
+ String suspect = other.getClass().getName();
+ throw new IllegalArgumentException( suspect );
+ }
+ }
+
+ /**
* Test if the supplied object is equal to this object.
* @param other the object to compare with this instance
* @return TRUE if the supplied object is equal to this object
@@ -108,9 +160,13 @@
{
return false;
}
+ else if( !m_directive.equals( reference.m_directive ) )
+ {
+ return false;
+ }
else
{
- return m_directive.equals( reference.m_directive );
+ return m_priority == reference.m_priority;
}
}
}
@@ -124,6 +180,7 @@
{
int hash = m_key.hashCode();
hash ^= m_directive.hashCode();
+ hash ^= m_priority;
return hash;
}


Modified: trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/main/net/dpml/metro/info/Type.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -302,7 +302,8 @@
/**
* Utility operation to construct a default type given a supplied class.
* @param subject the component implementation class
- * @return the defalt type descriptor for the class
+ * @return the type descriptor for the class
+ * @exception IntrospectionException if an introspection error occurs
*/
public static Type createType( Class subject )
throws IntrospectionException

Deleted:
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -1,61 +0,0 @@
-/*
- * Copyright 2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.metro.builder;
-
-import java.io.File;
-import java.net.URI;
-
-import net.dpml.metro.data.ComponentDirective;
-
-import junit.framework.TestCase;
-
-/**
- * Test component import.
- *
- * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
- */
-public class ImportTestCase extends TestCase
-{
- private ComponentDecoder m_builder;
-
- /**
- * Testcase setup.
- * @exception Exception if a setup error occurs
- */
- public void setUp() throws Exception
- {
- m_builder = new ComponentDecoder();
- }
-
- /**
- * List the state graph.
- * @exception Exception if an error occurs
- */
- public void testComponentLoading() throws Exception
- {
- String testPath = System.getProperty( "project.test.dir" );
- File test = new File( testPath );
- File example = new File( test, "parts/test.xml" );
- URI uri = example.toURI();
- ComponentDirective directive = m_builder.loadComponentDirective( uri
);
- }
-}
-
-
-

Modified:
trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
===================================================================
--- trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -25,6 +25,9 @@
import net.dpml.metro.info.ContextDescriptor;
import net.dpml.metro.info.EntryDescriptor;

+import net.dpml.util.Resolver;
+import net.dpml.util.SimpleResolver;
+
import junit.framework.TestCase;

/**
@@ -55,7 +58,8 @@
File test = new File( testPath );
File example = new File( test, "types/example-1.xml" );
URI uri = example.toURI();
- Type type = m_builder.loadType( uri );
+ Resolver resolver = new SimpleResolver();
+ Type type = m_builder.loadType( uri, resolver );
ContextDescriptor context = type.getContextDescriptor();
EntryDescriptor[] entries = context.getEntryDescriptors();
if( entries.length != 1 )

Modified:
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ComponentDirectiveTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ComponentDirectiveTestCase.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ComponentDirectiveTestCase.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -71,7 +71,7 @@
}
);
m_parts = new PartReference[0];
- m_base = new URI( "local:part:org/acme/widget" );
+ m_base = null;
m_directive =
new ComponentDirective(
m_name, m_activation, m_collection, m_lifestyle, m_classname,
@@ -99,8 +99,9 @@

/**
* Test "" name.
+ * @exception Exception if an error occurs.
*/
- public void testInsufficientName()
+ public void testInsufficientName() throws Exception
{
try
{
@@ -117,8 +118,9 @@

/**
* Test "." in name.
+ * @exception Exception if an error occurs.
*/
- public void testIllegalPeriodInName()
+ public void testIllegalPeriodInName() throws Exception
{
try
{
@@ -135,8 +137,9 @@

/**
* Test "," in name.
+ * @exception Exception if an error occurs.
*/
- public void testIllegalCommaInName()
+ public void testIllegalCommaInName() throws Exception
{
try
{
@@ -153,8 +156,9 @@

/**
* Test "/" in name.
+ * @exception Exception if an error occurs.
*/
- public void testIllegalFowardSlashInName()
+ public void testIllegalFowardSlashInName() throws Exception
{
try
{
@@ -194,15 +198,16 @@
}

/**
- * Test null lifestyle policy returns null.
+ * Test null lifestyle policy returns SYSTEM.
+ * @exception Exception if an error occurs.
*/
- public void testNullLifestylePolicy()
+ public void testNullLifestylePolicy() throws Exception
{
ComponentDirective directive = new ComponentDirective(
m_name, m_activation, m_collection, null, m_classname,
m_categories, m_context, m_parts, null );
LifestylePolicy lifestyle = directive.getLifestylePolicy();
- assertEquals( "null-lifestyle", null, lifestyle );
+ assertEquals( "null-lifestyle", LifestylePolicy.SYSTEM, lifestyle );
}

/**
@@ -218,7 +223,7 @@
*/
public void testBase()
{
- assertEquals( "base", m_base, m_directive.getBaseDirective() );
+ assertEquals( "base", m_base, m_directive.getBaseURI() );
}

/**
@@ -239,8 +244,9 @@

/**
* Test equality.
+ * @exception Exception if an error occurs.
*/
- public void testEquality()
+ public void testEquality() throws Exception
{
ContextDirective context =
new ContextDirective(

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -29,7 +29,6 @@

import net.dpml.component.Directive;
import net.dpml.component.ControlException;
-import net.dpml.component.Component;
import net.dpml.component.Model;
import net.dpml.component.ServiceNotFoundException;
import net.dpml.component.Provider;
@@ -45,6 +44,7 @@
import net.dpml.metro.info.ServiceDescriptor;
import net.dpml.metro.data.LookupDirective;
import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.DefaultComposition;
import net.dpml.metro.ComponentModel;
import net.dpml.metro.ContextModel;
import net.dpml.metro.PartsManager;
@@ -53,6 +53,8 @@
import net.dpml.util.Logger;
import net.dpml.util.DefaultLogger;
import net.dpml.util.EventQueue;
+import net.dpml.util.Resolver;
+import net.dpml.util.SimpleResolver;

/**
* The ComponentController class is a controller of a component instance.
@@ -123,7 +125,8 @@
String path = partition + name;
Logger logger = new DefaultLogger( path );
EventQueue queue = m_controller.getEventQueue();
- return new DefaultComponentModel( queue, logger, classloader,
classpath, this, directive, partition, name );
+ return new DefaultComponentModel(
+ queue, logger, classloader, classpath, this, directive,
partition, name );
}
catch( RemoteException e )
{
@@ -149,15 +152,18 @@
* @param classpath the classpath definition
* @param partition the enclosing partition
* @param directive the component definition
+ * @param key the component key
* @return the managable component model
*/
+ /*
ComponentModel createComponentModel(
- ClassLoader anchor, Classpath classpath, String partition,
ComponentDirective directive )
+ ClassLoader anchor, Classpath classpath, String partition,
+ ComponentDirective directive, String key )
throws ControlException
{
return createComponentModel( anchor, classpath, partition,
directive, null );
}
-
+ */
/**
* Create a new remotely manageable component model.
* @param key the component key
@@ -176,7 +182,8 @@
Logger logger = new DefaultLogger( partition );
ClassLoader classloader = getClassLoader( anchor, classpath );
EventQueue queue = m_controller.getEventQueue();
- return new DefaultComponentModel( queue, logger, classloader,
classpath, this, directive, partition, key );
+ return new DefaultComponentModel(
+ queue, logger, classloader, classpath, this, directive,
partition, key );
}
catch( RemoteException e )
{
@@ -355,7 +362,8 @@
{
try
{
- return BUILDER.loadType( subject );
+ Resolver resolver = new SimpleResolver();
+ return BUILDER.loadType( subject, resolver );
}
catch( Throwable e )
{
@@ -643,32 +651,6 @@
throw new ControllerException( error, ee );
}
}
- else if( directive instanceof ComponentDirective )
- {
- ClassLoader classloader = handler.getClassLoader();
- ComponentDirective componentDirective =
(ComponentDirective) directive;
- Classpath classpath = new Classpath();
- String partition = handler.getPath();
- ComponentModel componentModel =
- createComponentModel( classloader, classpath,
partition, componentDirective );
- try
- {
- Component component = m_controller.createComponent(
componentModel );
- return component.getProvider().getValue( false );
- }
- catch( Exception ee )
- {
- final String error =
- "Unable to resolve context entry component
directive ["
- + componentDirective
- + "] requested in component ["
- + handler.getPath()
- + "] under the context key ["
- + key
- + "].";
- throw new ControllerException( error, ee );
- }
- }
else
{
final String error =

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -22,10 +22,6 @@
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.HashMap;
-import java.util.EventObject;
-import java.util.LinkedList;
-import java.util.List;

import net.dpml.component.Controller;
import net.dpml.component.ControlException;
@@ -45,11 +41,13 @@

import net.dpml.metro.ComponentModel;
import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.DefaultComposition;
import net.dpml.metro.builder.ComponentDecoder;

import net.dpml.util.Logger;
import net.dpml.util.DefaultLogger;
import net.dpml.util.EventQueue;
+import net.dpml.util.Resolver;

import org.w3c.dom.Element;

@@ -159,7 +157,8 @@
* @return the part definition
* @exception IOException if an I/O error occurs
*/
- public Part build( Info info, Classpath classpath, Element strategy )
throws IOException
+ public Part build(
+ Info info, Classpath classpath, Element strategy, Resolver resolver )
throws IOException
{
if( getLogger().isTraceEnabled() )
{
@@ -173,7 +172,7 @@
ClassLoader anchor = Component.class.getClassLoader();
Thread.currentThread().setContextClassLoader( anchor );
ComponentDecoder decoder = new ComponentDecoder();
- ComponentDirective directive = decoder.buildComponent( strategy
);
+ ComponentDirective directive = decoder.buildComponent( strategy,
resolver );
Logger logger = getLogger();
return new DefaultComposition( logger, info, classpath, this,
directive );
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ContextInvocationHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ContextInvocationHandler.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ContextInvocationHandler.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,7 +18,6 @@

package net.dpml.metro.runtime;

-import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;


Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -38,7 +38,6 @@
import net.dpml.component.ActivationPolicy;
import net.dpml.component.Disposable;
import net.dpml.component.ControlException;
-import net.dpml.component.ServiceNotFoundException;
import net.dpml.component.Component;
import net.dpml.component.Provider;
import net.dpml.component.Service;
@@ -46,11 +45,9 @@
import net.dpml.component.ModelEvent;

import net.dpml.lang.Version;
-import net.dpml.lang.UnknownKeyException;

import net.dpml.metro.ComponentModel;
import net.dpml.metro.ComponentHandler;
-import net.dpml.metro.PartsManager;
import net.dpml.metro.ComponentModelManager;
import net.dpml.metro.data.CategoryDirective;
import net.dpml.metro.info.Type;
@@ -483,7 +480,7 @@
if( m_model.getActivationPolicy().equals(
ActivationPolicy.STARTUP ) )
{
getLogger().debug( "activating" );
- m_holder.getProvider();
+ m_holder.getProvider().getValue( false );
}
m_active = true;
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -24,28 +24,25 @@
import java.util.EventObject;
import java.util.EventListener;
import java.util.Map;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.Arrays;

-import net.dpml.component.Directive;
import net.dpml.component.ActivationPolicy;
import net.dpml.component.ControlException;
import net.dpml.component.ModelListener;
import net.dpml.component.ModelEvent;

import net.dpml.lang.Classpath;
-import net.dpml.lang.UnknownKeyException;

import net.dpml.metro.data.ComponentDirective;
import net.dpml.metro.data.ContextDirective;
import net.dpml.metro.data.CategoriesDirective;
import net.dpml.metro.data.CategoryDirective;
+
import net.dpml.metro.info.CollectionPolicy;
import net.dpml.metro.info.LifestylePolicy;
import net.dpml.metro.info.Type;
import net.dpml.metro.info.PartReference;
-import net.dpml.metro.info.Composite;
-import net.dpml.metro.ComponentModel;
+
import net.dpml.metro.ContextModel;
import net.dpml.metro.ComponentModelManager;
import net.dpml.metro.ContextModelManager;
@@ -87,8 +84,8 @@
//
------------------------------------------------------------------------

public DefaultComponentModel(
- EventQueue queue, Logger logger, ClassLoader classloader, Classpath
classpath, ComponentController controller,
- ComponentDirective directive, String partition, String name )
+ EventQueue queue, Logger logger, ClassLoader classloader, Classpath
classpath,
+ ComponentController controller, ComponentDirective directive, String
partition, String name )
throws ControlException, IOException, RemoteException
{
super( queue, logger );
@@ -97,21 +94,162 @@
m_controller = controller;
m_directive = directive;
m_classloader = classloader;
- m_classname = directive.getClassname();
+ m_classname = getClassname( directive );
m_class = m_controller.loadComponentClass( m_classloader,
m_classname );
m_type = m_controller.loadType( m_class );
m_path = setupPath( partition, name );
- m_activation = directive.getActivationPolicy();
- m_lifestyle = setupLifestyle();
- m_collection = directive.getCollectionPolicy();
- ContextDirective context = directive.getContextDirective();
+ m_activation = getActivationPolicy( directive );
+ m_lifestyle = getLifestylePolicy( directive );
+ m_collection = getCollectionPolicy( directive );
+ ContextDirective context = getContextDirective( directive );
m_context =
new DefaultContextModel(
queue,
this, logger, m_classloader, m_type, context );
- m_references = buildPartReferences();
+ m_references = getPartReferences( directive );
}
+
+ private String getClassname( ComponentDirective directive )
+ {
+ if( null == directive )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ else
+ {
+ ComponentDirective base = directive.getBaseDirective();
+ if( null == base )
+ {
+ return directive.getClassname();
+ }
+ else
+ {
+ return getClassname( base );
+ }
+ }
+ }

+ private ActivationPolicy getActivationPolicy( ComponentDirective
directive )
+ {
+ if( null == directive )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ if( null != directive.getActivationPolicy() )
+ {
+ return directive.getActivationPolicy();
+ }
+ else
+ {
+ ComponentDirective base = directive.getBaseDirective();
+ return getActivationPolicy( base );
+ }
+ }
+
+ private CollectionPolicy getCollectionPolicy( ComponentDirective
directive )
+ {
+ if( null == directive )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ if( null != directive.getCollectionPolicy() )
+ {
+ return directive.getCollectionPolicy();
+ }
+ else
+ {
+ ComponentDirective base = directive.getBaseDirective();
+ return getCollectionPolicy( base );
+ }
+ }
+
+ private ContextDirective getContextDirective( ComponentDirective
directive )
+ {
+ if( null == directive )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ if( null != directive.getContextDirective() )
+ {
+ return directive.getContextDirective();
+ }
+ else
+ {
+ ComponentDirective base = directive.getBaseDirective();
+ return getContextDirective( base );
+ }
+ }
+
+ private LifestylePolicy getLifestylePolicy( ComponentDirective directive
)
+ {
+ if( null == directive )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ if( null != directive.getLifestylePolicy() )
+ {
+ return directive.getLifestylePolicy();
+ }
+ else
+ {
+ ComponentDirective base = directive.getBaseDirective();
+ if( null != base )
+ {
+ return getLifestylePolicy( base );
+ }
+ else
+ {
+ return m_type.getInfo().getLifestylePolicy();
+ }
+ }
+ }
+
+ private PartReference[] getPartReferences( ComponentDirective directive )
+ {
+ Map map = new Hashtable();
+ populatePartReferences( map, directive );
+ PartReference[] refs = (PartReference[]) map.values().toArray( new
PartReference[0] );
+ Arrays.sort( refs );
+ return refs;
+ }
+
+ private void populatePartReferences( Map map, ComponentDirective
directive )
+ {
+ PartReference[] references = directive.getPartReferences();
+ for( int i=0; i < references.length; i++ )
+ {
+ PartReference ref = references[i];
+ String key = ref.getKey();
+ if( !map.containsKey( key ) )
+ {
+ map.put( key, ref );
+ }
+ }
+ ComponentDirective parent = directive.getBaseDirective();
+ if( null != parent )
+ {
+ populatePartReferences( map, parent );
+ }
+ else
+ {
+ populateTypeReferences( map );
+ }
+ }
+
+ private void populateTypeReferences( Map map )
+ {
+ PartReference[] typeRefs = m_type.getPartReferences();
+ for( int i=0; i < typeRefs.length; i++ )
+ {
+ PartReference ref = typeRefs[i];
+ String key = ref.getKey();
+ if( !map.containsKey( key ) )
+ {
+ map.put( key, ref );
+ }
+ }
+ }
+
/**
* Return the component thread-safe status.
*
@@ -373,49 +511,5 @@
}
}

- private LifestylePolicy setupLifestyle()
- {
- LifestylePolicy lifestyle = m_directive.getLifestylePolicy();
- if( null == lifestyle )
- {
- return m_type.getInfo().getLifestylePolicy();
- }
- else
- {
- return lifestyle;
- }
- }
-
- private PartReference[] buildPartReferences()
- {
- List list = new LinkedList();
- Map map = new Hashtable();
- populatePartReferences( list, map, m_type );
- populatePartReferences( list, map, m_directive );
- PartReference[] refs = new PartReference[ list.size() ];
- String[] names = (String[]) list.toArray( new String[0] );
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- PartReference ref = (PartReference) map.get( name );
- refs[ i ] = ref;
- }
- return refs;
- }
-
- private void populatePartReferences( List names, Map map, Composite
composite )
- {
- PartReference[] references = composite.getPartReferences();
- for( int i=0; i < references.length; i++ )
- {
- PartReference ref = references[i];
- String key = ref.getKey();
- if( !names.contains( key ) )
- {
- names.add( key );
- }
- map.put( key, ref );
- }
- }
}


Deleted:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComposition.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -1,113 +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 net.dpml.metro.runtime;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import net.dpml.component.Controller;
-import net.dpml.component.Composition;
-
-import net.dpml.lang.Classpath;
-import net.dpml.lang.Info;
-
-import net.dpml.metro.data.ComponentDirective;
-import net.dpml.metro.builder.ComponentEncoder;
-
-import net.dpml.util.Logger;
-
-
-/**
- * Component composition.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public final class DefaultComposition extends Composition
-{
- private ComponentDirective m_directive;
-
- /**
- * Creation of a new composition diefinition.
- * @param logger the assigned logging channel
- * @param info the part info definition
- * @param classpath the part classpath definition
- * @param controller the deployment controller
- * @param directive the deployment directive
- * @exception IOException if an I/O exception occurs
- */
- public DefaultComposition(
- Logger logger, Info info, Classpath classpath, Controller controller,
ComponentDirective directive )
- throws IOException
- {
- super( logger, info, classpath, controller, directive );
-
- m_directive = directive;
- }
-
- /**
- * Get the deployment directive.
- * @return the deployment directive
- */
- public ComponentDirective getComponentDirective()
- {
- return m_directive;
- }
-
- /**
- * Encode the deployment directive to XML.
- * @param writer the output stream writer
- * @param pad the outoput offset
- * @exception IOException if an I/O exception occurs
- */
- protected void encodeStrategy( Writer writer, String pad ) throws
IOException
- {
- ComponentEncoder encoder = new ComponentEncoder();
- encoder.writeComponent( writer, m_directive, pad );
- }
-
- /**
- * Return true if this object is equal to the supplied object.
- * @param other the object to evaluate
- * @return the equality status
- */
- public boolean equals( Object other )
- {
- if( super.equals( other ) && ( other instanceof DefaultComposition )
)
- {
- DefaultComposition composite = (DefaultComposition) other;
- return m_directive.equals( composite.m_directive );
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Return the hashcode for the instance.
- * @return the instance hashcode
- */
- public int hashCode()
- {
- int hash = super.hashCode();
- hash ^= m_directive.hashCode();
- return hash;
- }
-}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,11 +20,7 @@

import java.io.IOException;
import java.rmi.RemoteException;
-import java.util.Map;
import java.util.ArrayList;
-import java.util.Hashtable;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URI;

import net.dpml.component.ActivationPolicy;
import net.dpml.component.ControlException;
@@ -33,25 +29,19 @@
import net.dpml.component.Service;
import net.dpml.component.Directive;
import net.dpml.component.Disposable;
-import net.dpml.component.Composition;

import net.dpml.lang.Classpath;
import net.dpml.lang.UnknownKeyException;
-import net.dpml.lang.Part;
import net.dpml.lang.Version;

import net.dpml.metro.PartsManager;
import net.dpml.metro.ComponentHandler;
-import net.dpml.metro.ComponentModelManager;
import net.dpml.metro.ComponentModel;
import net.dpml.metro.info.PartReference;
import net.dpml.metro.data.ComponentDirective;
-import net.dpml.metro.data.ImportDirective;

-import net.dpml.util.Logger;
-
/**
- * Null implementation of the local Parts interface.
+ * Internal parts manager.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -95,11 +85,11 @@
{
try
{
- Classpath classpath = new Classpath();
ComponentDirective directive = (ComponentDirective) part;
+ Classpath classpath = resolveClasspath( directive );
ComponentController controller =
handler.getComponentController();
ComponentModel manager =
- controller.createComponentModel( classloader,
classpath, base, directive );
+ controller.createComponentModel( classloader,
classpath, base, directive, key );
ComponentHandler component =
controller.createDefaultComponentHandler( m_provider,
classloader, manager, true );
m_components[i] = component;
@@ -115,32 +105,6 @@
throw new ControllerRuntimeException( error, e );
}
}
- else if( part instanceof ImportDirective )
- {
- ImportDirective importDirective = (ImportDirective) part;
- URI uri = importDirective.getURI();
- Part p = Part.load( uri, false );
- if( p instanceof Composition )
- {
- Composition composition = (Composition) p;
- ComponentDirective directive = (ComponentDirective)
composition.getDirective();
- Classpath classpath = composition.getClasspath();
- ComponentController controller =
handler.getComponentController();
- ComponentModel manager =
- controller.createComponentModel( classloader,
classpath, base, directive, key );
- ComponentHandler component =
- controller.createDefaultComponentHandler( m_provider,
classloader, manager, true );
- m_components[i] = component;
- }
- else
- {
- final String error =
- "Part class ["
- + part.getClass().getName()
- + "] not recognized.";
- throw new ControllerException( error );
- }
- }
else
{
final String error =
@@ -348,4 +312,17 @@
}
m_commissioned = false;
}
+
+
+ private Classpath resolveClasspath( ComponentDirective directive )
+ {
+ if( null != directive.getBasePart() )
+ {
+ return directive.getBasePart().getClasspath();
+ }
+ else
+ {
+ return new Classpath();
+ }
+ }
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -19,8 +19,6 @@
package net.dpml.metro.runtime;

import java.io.IOException;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -46,8 +44,6 @@
import net.dpml.state.UnknownTransitionException;
import net.dpml.state.UnknownOperationException;

-import net.dpml.lang.UnknownKeyException;
-
import net.dpml.util.Logger;
import net.dpml.util.EventQueue;


Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultStateMachine.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,9 +20,6 @@

import java.beans.Expression;
import java.beans.Statement;
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.ArrayList;
@@ -50,7 +47,6 @@
import net.dpml.state.ApplyAction;

import net.dpml.util.Logger;
-import net.dpml.util.UnicastEventSource;
import net.dpml.util.EventQueue;
import net.dpml.util.EventHandler;

@@ -98,7 +94,10 @@

/**
* Creation of a new state machine using a state graph.
+ * @param queue the event queue
+ * @param logger the logging channel
* @param state the state graph
+ * @exception RemoteException if RMI exception occurs
*/
public DefaultStateMachine( EventQueue queue, Logger logger, State state
) throws RemoteException
{
@@ -111,11 +110,6 @@
// StateMachine

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

- private Logger getLogger()
- {
- return m_logger;
- }
-
/**
* Add a state change listener to the state machine.
* @param listener the state listener
@@ -150,6 +144,10 @@
}
}

+ /**
+ * Return the assigned state event listeners.
+ * @return the event listeners
+ */
public EventListener[] getEventListeners()
{
return getStateListeners();
@@ -163,6 +161,10 @@
}
}

+ /**
+ * Process the supplied event.
+ * @param event the event to process
+ */
public void processEvent( EventObject event )
{
StateListener[] listeners = getStateListeners();
@@ -1037,4 +1039,9 @@
}
}

+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -19,14 +19,6 @@
package net.dpml.metro.runtime;

import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.rmi.NoSuchObjectException;
-import java.lang.ref.WeakReference;
-import java.util.EventObject;
-import java.util.EventListener;
-import java.util.WeakHashMap;
-import java.util.List;
-import java.util.LinkedList;

import net.dpml.component.Disposable;


Modified: trunk/main/metro/state/src/main/net/dpml/state/ApplyAction.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/ApplyAction.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/ApplyAction.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,8 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.Action;
-
/**
* Default implementation of delegating action.
*

Modified: trunk/main/metro/state/src/main/net/dpml/state/DefaultInterface.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/DefaultInterface.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/DefaultInterface.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,8 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.Interface;
-
/**
* Default implementation of an operation.
*

Modified: trunk/main/metro/state/src/main/net/dpml/state/DefaultOperation.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/DefaultOperation.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/DefaultOperation.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,8 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.Operation;
-
/**
* Default implementation of an operation.
*

Modified: trunk/main/metro/state/src/main/net/dpml/state/DefaultState.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/DefaultState.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/DefaultState.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -21,13 +21,6 @@
import java.io.Serializable;
import java.util.Arrays;

-import net.dpml.state.State;
-import net.dpml.state.Transition;
-import net.dpml.state.Interface;
-import net.dpml.state.Operation;
-import net.dpml.state.Trigger;
-import net.dpml.state.Action;
-
/**
* Default implementation of an application state descriptor.
*

Modified:
trunk/main/metro/state/src/main/net/dpml/state/DefaultTransition.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/DefaultTransition.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/DefaultTransition.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,9 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.State;
-import net.dpml.state.Transition;
-import net.dpml.state.Operation;

/**
* Default implemention of a state transition descriptor.

Modified: trunk/main/metro/state/src/main/net/dpml/state/DefaultTrigger.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/DefaultTrigger.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/DefaultTrigger.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,10 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.Trigger;
-import net.dpml.state.Trigger.TriggerEvent;
-import net.dpml.state.Action;
-
/**
* Default implementation of trigger.
*

Deleted: trunk/main/metro/state/src/main/net/dpml/state/Enum.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/Enum.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/Enum.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -1,173 +0,0 @@
-/*
- * Copyright 1997-2004 The Apache Software Foundation
- * Copyright 2005 Stephen J. McConnell, OSM
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.state;
-
-import java.util.Map;
-import java.io.Serializable;
-
-/**
- * Basic enum class for type-safe enums. Should be used as an abstract base.
For example:
- *
- * <pre>
- * import net.dpml.lang.Enum;
- *
- * public final class Color extends Enum {
- * public static final Color RED = new Color( "Red" );
- * public static final Color GREEN = new Color( "Green" );
- * public static final Color BLUE = new Color( "Blue" );
- *
- * private Color( final String color )
- * {
- * super( color );
- * }
- * }
- * </pre>
- *
- * If further operations, such as iterating over all items, are required, the
- * {@link #Enum(String, Map)} constructor can be used to populate a
<code>Map</code>, from which
- * further functionality can be derived:
- * <pre>
- * public final class Color extends Enum {
- * static final Map map = new HashMap();
- *
- * public static final Color RED = new Color( "Red", map );
- * public static final Color GREEN = new Color( "Green", map );
- * public static final Color BLUE = new Color( "Blue", map );
- *
- * private Color( final String color, final Map map )
- * {
- * super( color, map );
- * }
- *
- * public static Iterator iterator()
- * {
- * return map.values().iterator();
- * }
- * }
- * </pre>
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public abstract class Enum implements Serializable
-{
- /**
- * The string representation of the Enum.
- */
- private final String m_name;
-
- /**
- * Constructor to add a new named item.
- *
- * @param name Name of the item.
- */
- protected Enum( final String name )
- {
- this( name, null );
- }
-
- /**
- * Constructor to add a new named item.
- *
- * @param name Name of the item.
- * @param map A <code>Map</code> to which newly constructed instances
will be added.
- */
- protected Enum( final String name, final Map map )
- {
- m_name = name;
- if( null != map )
- {
- map.put( name, this );
- }
- }
-
- /**
- * Tests for equality. Two Enum:s are considered equal
- * if they are of the same class and have the same names.
- *
- * @param o the other object
- * @return the equality status
- */
- public boolean equals( Object o )
- {
- if( this == o )
- {
- return true;
- }
- if( !( o instanceof Enum ) )
- {
- return false;
- }
- final Enum enumerated = (Enum) o;
- if( !getClass().equals( enumerated.getClass() ) )
- {
- return false;
- }
- if( m_name != null )
- {
- if( !m_name.equals( enumerated.m_name ) )
- {
- return false;
- }
- }
- else
- {
- if( enumerated.m_name != null )
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Compute the hashcode.
- * @return the hashcode value
- */
- public int hashCode()
- {
- int result = 0;
- if( m_name != null )
- {
- result = m_name.hashCode();
- }
- result = 29 * result + getClass().hashCode();
- return result;
- }
-
- /**
- * Retrieve the name of this Enum item, set in the constructor.
- * @return the name <code>String</code> of this Enum item
- */
- public final String getName()
- {
- return m_name;
- }
-
- /**
- * Human readable description of this Enum item in the form
<code>type:name</code>, eg.:
- * <code>Color:Red</code>.
- * @return the string representation
- */
- public String toString()
- {
- return getClass().getName() + ":" + m_name;
- }
-}

Modified: trunk/main/metro/state/src/main/net/dpml/state/ExecAction.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/ExecAction.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/ExecAction.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,8 +20,6 @@

import java.io.Serializable;

-import net.dpml.state.Action;
-
/**
* Default implementation of delegating action.
*

Modified: trunk/main/metro/state/src/main/net/dpml/state/StateDecoder.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/StateDecoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/StateDecoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -23,13 +23,9 @@

import javax.xml.XMLConstants;

-import net.dpml.state.State;
-import net.dpml.state.Action;
import net.dpml.state.Trigger.TriggerEvent;
-import net.dpml.state.StateBuilderRuntimeException;

import net.dpml.util.DOM3DocumentBuilder;
-
import net.dpml.util.ElementHelper;

import org.w3c.dom.Document;

Modified: trunk/main/metro/state/src/main/net/dpml/state/StateEncoder.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/StateEncoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/StateEncoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -25,13 +25,7 @@

import javax.xml.XMLConstants;

-import net.dpml.state.State;
-import net.dpml.state.Action;
import net.dpml.state.Trigger.TriggerEvent;
-import net.dpml.state.Trigger;
-import net.dpml.state.Transition;
-import net.dpml.state.Operation;
-import net.dpml.state.Interface;

/**
* Construct a state graph.

Modified: trunk/main/metro/state/src/main/net/dpml/state/StateMachine.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/StateMachine.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/StateMachine.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,7 +18,6 @@

package net.dpml.state;

-import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;

/**

Modified: trunk/main/metro/state/src/main/net/dpml/state/Trigger.java
===================================================================
--- trunk/main/metro/state/src/main/net/dpml/state/Trigger.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/metro/state/src/main/net/dpml/state/Trigger.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -18,6 +18,8 @@

package net.dpml.state;

+import net.dpml.lang.Enum;
+
/**
* Interface describing a condition within which an action may be invoked.
*

Modified:
trunk/main/metro/test/src/test/net/dpml/test/runtime/ProviderTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/test/runtime/ProviderTestCase.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/test/src/test/net/dpml/test/runtime/ProviderTestCase.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,8 +18,6 @@

package net.dpml.test.runtime;

-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.io.File;
import java.net.URI;
import java.lang.reflect.Proxy;
@@ -29,7 +27,7 @@
import net.dpml.component.Controller;
import net.dpml.component.Component;
import net.dpml.component.Provider;
-import net.dpml.state.State;
+
import net.dpml.state.StateListener;
import net.dpml.state.StateEvent;

@@ -185,9 +183,17 @@
}
}

+ /**
+ * State event listener.
+ */
private class DefaultStateListener implements StateListener
{
private Logger m_logger = new DefaultLogger( "test" );
+
+ /**
+ * Handle a state change notification.
+ * @param event the state change event
+ */
public void stateChanged( StateEvent event )
{
m_logger.info( "event: " + event );

Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/CatalogTask.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/CatalogTask.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/CatalogTask.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -42,6 +42,9 @@

import net.dpml.transit.Transit;

+import net.dpml.util.Resolver;
+import net.dpml.util.SimpleResolver;
+
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -742,7 +745,8 @@
try
{
URI uri = source.toURI();
- Type type = COMPONENT_TYPE_DECODER.loadType( uri );
+ Resolver resolver = new SimpleResolver();
+ Type type = COMPONENT_TYPE_DECODER.loadType( uri, resolver );
createTypePage( htmls, type );
}
catch( Exception e )

Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
===================================================================
---
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -42,7 +42,7 @@
import net.dpml.metro.info.Type;
import net.dpml.metro.info.EntryDescriptor;
import net.dpml.metro.builder.ComponentTypeDecoder;
-import net.dpml.metro.runtime.DefaultComposition;
+import net.dpml.metro.data.DefaultComposition;

import net.dpml.lang.Classpath;
import net.dpml.lang.Part;
@@ -400,8 +400,9 @@
}
try
{
+ Resource resource = getResource();
Class c = classloader.loadClass( classname );
- return COMPONENT_TYPE_DECODER.loadType( c );
+ return COMPONENT_TYPE_DECODER.loadType( c, resource );
}
catch( Throwable e )
{

Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypeBuilderTask.java
===================================================================
--- trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypeBuilderTask.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/metro/tools/src/main/net/dpml/metro/tools/TypeBuilderTask.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -34,6 +34,7 @@
import java.util.Properties;

import net.dpml.metro.builder.ComponentTypeEncoder;
+
import net.dpml.metro.info.CategoryDescriptor;
import net.dpml.metro.info.ContextDescriptor;
import net.dpml.metro.info.InfoDescriptor;

Modified:
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
===================================================================
---
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/planet/http/impl/src/main/net/dpml/http/NCSARequestLogHandler.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -21,8 +21,6 @@

import org.mortbay.jetty.handler.RequestLogHandler;
import org.mortbay.jetty.NCSARequestLog;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.RequestLog;

/**
* Wrapper for the Jetty NCSA request logger.

Modified: trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -27,7 +27,6 @@

import org.mortbay.thread.ThreadPool;
import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.RequestLog;
import org.mortbay.jetty.security.UserRealm;
import org.mortbay.xml.XmlConfiguration;


Added: trunk/main/planet/http/test/etc/data/logging.properties
===================================================================
--- trunk/main/planet/http/test/etc/data/logging.properties 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/planet/http/test/etc/data/logging.properties 2006-07-11
16:12:04 UTC (rev 1542)
@@ -0,0 +1,6 @@
+.level=INFO
+sun.rmi.level=INFO
+#dpml.metro.level=INFO
+dpml.transit.level=INFO
+dpml.lang.level=INFO
+

Modified:
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
===================================================================
---
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/station/builder/src/main/net/dpml/station/builder/RegistryBuilder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -31,6 +31,8 @@

import net.dpml.util.DecodingException;
import net.dpml.util.Decoder;
+import net.dpml.util.Resolver;
+import net.dpml.util.SimpleResolver;

import net.dpml.lang.ValueDirective;
import net.dpml.util.ElementHelper;
@@ -60,7 +62,8 @@
{
Document document = DOCUMENT_BUILDER.parse( uri );
Element root = document.getDocumentElement();
- return decode( root );
+ Resolver resolver = new SimpleResolver();
+ return decode( root , resolver );
}

/**
@@ -69,16 +72,16 @@
* @return the registry descriptor
* @exception DecodingException if a decoding error occurs
*/
- public Object decode( Element element ) throws DecodingException
+ public Object decode( Element element, Resolver resolver ) throws
DecodingException
{
String tag = element.getTagName();
if( "application".equals( tag ) )
{
- return buildApplicationDescriptor( element );
+ return buildApplicationDescriptor( element, resolver );
}
else if( "registry".equals( tag ) )
{
- return buildRegistryDescriptor( element );
+ return buildRegistryDescriptor( element, resolver );
}
else
{
@@ -88,7 +91,8 @@
}
}

- private RegistryDescriptor buildRegistryDescriptor( Element element )
throws DecodingException
+ private RegistryDescriptor buildRegistryDescriptor(
+ Element element, Resolver resolver ) throws DecodingException
{
Element[] elements = ElementHelper.getChildren( element );
Entry[] entries = new Entry[ elements.length ];
@@ -102,13 +106,14 @@
"Missing 'key' attribute in application element.";
throw new DecodingException( elem, error );
}
- ApplicationDescriptor descriptor = buildApplicationDescriptor(
elem );
+ ApplicationDescriptor descriptor = buildApplicationDescriptor(
elem, resolver );
entries[i] = new Entry( key, descriptor );
}
return new RegistryDescriptor( entries );
}

- private ApplicationDescriptor buildApplicationDescriptor( Element
element ) throws DecodingException
+ private ApplicationDescriptor buildApplicationDescriptor(
+ Element element, Resolver resolver ) throws DecodingException
{
String title = ElementHelper.getAttribute( element, "title" );
StartupPolicy policy = buildStartupPolicy( element );

Modified:
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
===================================================================
---
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -462,12 +462,16 @@
list.add( "-server" );
list.add( "" + port );

- list.add(
"-Ddpml.logging.config=local:properties:dpml/station/logging" );
+ list.add(
"-Ddpml.logging.config=local:properties:dpml/station/server" );
list.add( "-Ddpml.subprocess=true" );
- if( "true".equals( System.getProperty( "dpml.debug" ) ) )
+ if( "true".equals( System.getProperty( "dpml.trace" ) ) )
{
- list.add( "-Ddpml.debug=true" );
+ list.add( "-trace" );
}
+ else if( "true".equals( System.getProperty( "dpml.debug" ) ) )
+ {
+ list.add( "-debug" );
+ }
Set propertyValue = line.getProperties();
Iterator iterator = propertyValue.iterator();
while( iterator.hasNext() )

Modified: trunk/main/station/server/etc/bin/scm/conf/wrapper.conf
===================================================================
--- trunk/main/station/server/etc/bin/scm/conf/wrapper.conf 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/station/server/etc/bin/scm/conf/wrapper.conf 2006-07-11
16:12:04 UTC (rev 1542)
@@ -106,7 +106,7 @@
wrapper.ntservice.dependency.1=

# Mode in which the service is installed. AUTO_START or DEMAND_START
-wrapper.ntservice.starttype=AUTO_START
+wrapper.ntservice.starttype=DEMAND_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

Modified:
trunk/main/station/server/etc/prefs/propertiess/application.properties
===================================================================
--- trunk/main/station/server/etc/prefs/propertiess/application.properties
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/station/server/etc/prefs/propertiess/application.properties
2006-07-11 16:12:04 UTC (rev 1542)
@@ -9,6 +9,5 @@
java.util.logging.FileHandler.limit=100000

java.util.logging.FileHandler.pattern=${dpml.station.logging.dir}/${dpml.station.key}/${dpml.station.key}-%g.log
java.util.logging.FileHandler.formatter=net.dpml.util.StandardFormatter
-sun.rmi.transport.tcp.level=INFO
-sun.rmi.loader.level=INFO
+sun.rmi.level=INFO


Deleted: trunk/main/station/server/etc/prefs/propertiess/logging.properties
===================================================================
--- trunk/main/station/server/etc/prefs/propertiess/logging.properties
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/station/server/etc/prefs/propertiess/logging.properties
2006-07-11 16:12:04 UTC (rev 1542)
@@ -1,8 +0,0 @@
-handlers=java.util.logging.FileHandler
-java.util.logging.FileHandler.pattern=${dpml.data}/logs/station/server-%u.log
-java.util.logging.FileHandler.limit=50000
-java.util.logging.FileHandler.count=1
-java.util.logging.FileHandler.formatter=net.dpml.util.StandardFormatter
-sun.rmi.transport.tcp.level=INFO
-sun.rmi.loader.level=INFO
-

Modified: trunk/main/station/server/etc/prefs/propertiess/server.properties
===================================================================
--- trunk/main/station/server/etc/prefs/propertiess/server.properties
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/station/server/etc/prefs/propertiess/server.properties
2006-07-11 16:12:04 UTC (rev 1542)
@@ -3,10 +3,9 @@
#

handlers=java.util.logging.FileHandler
-java.util.logging.FileHandler.pattern=${dpml.data}/logs/station/server-%u.log
+java.util.logging.FileHandler.pattern=${dpml.data}/logs/station/dpml-station-server-%u.log
java.util.logging.FileHandler.limit=50000
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=net.dpml.util.StandardFormatter
-sun.rmi.transport.tcp.level=INFO
-sun.rmi.loader.level=INFO
+sun.rmi.level=INFO


Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -316,22 +316,6 @@
}

/**
- * Process a log record. The implementation
- * prepends the log record message with the process id. Subsequent
processing
- * of log records is subject to the logging configuration applied to the
- * JVM process in which the server is established.
- *
- * @param process the process id of the jvm initiating the log record
- * @param record the log record
- * @exception RemoteException is a remote exception occurs
- */
- //public void log( PID process, LogRecord record ) throws RemoteException
- //{
- // m_loggingServer.log( process, record );
- //}
-
-
- /**
* Return an application reference for the supplied key.
* @param key the application key
* @return the application

Added: trunk/main/transit/core/etc/prefs/propertiess/trace.properties
===================================================================
--- trunk/main/transit/core/etc/prefs/propertiess/trace.properties
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/etc/prefs/propertiess/trace.properties
2006-07-11 16:12:04 UTC (rev 1542)
@@ -0,0 +1,3 @@
+.level=FINEST
+sun.rmi.level=INFO
+sun.rmi.transport.tcp.level=INFO

Modified: trunk/main/transit/core/src/main/net/dpml/lang/Builder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Builder.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Builder.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -20,6 +20,8 @@

import java.io.IOException;

+import net.dpml.util.Resolver;
+
import org.w3c.dom.Element;

/**
@@ -38,5 +40,16 @@
* @return the part definition
* @exception IOException if an I/O error occurs
*/
- Part build( Info info, Classpath classpath, Element strategy ) throws
IOException;
+ //Part build( Info info, Classpath classpath, Element strategy ) throws
IOException;
+
+ /**
+ * Construct a new part using a supplied value resolver.
+ * @param info the part information descriptor
+ * @param classpath the part classpath descriptor
+ * @param strategy the DOM element definining the deployment strategy
+ * @param resolver build time value resolver
+ * @return the part definition
+ * @exception IOException if an I/O error occurs
+ */
+ Part build( Info info, Classpath classpath, Element strategy, Resolver
resolver ) throws IOException;
}

Modified: trunk/main/transit/core/src/main/net/dpml/lang/Info.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Info.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Info.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -19,7 +19,6 @@
package net.dpml.lang;

import java.net.URI;
-import java.io.Serializable;

/**
* Part info description.

Modified: trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -20,6 +20,7 @@

import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Map;
import java.util.Hashtable;
import java.lang.ref.WeakReference;
@@ -33,6 +34,9 @@
import net.dpml.util.Decoder;
import net.dpml.util.DecoderFactory;
import net.dpml.util.DecodingException;
+import net.dpml.util.Resolver;
+import net.dpml.util.SimpleResolver;
+import net.dpml.util.PropertyResolver;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -113,13 +117,14 @@
}
}

- // cache based retrival was either not requested or no cache value
present
+ // cache based retrival was disabled or no cache value present

try
{
final Document document = DOCUMENT_BUILDER.parse( uri );
final Element root = document.getDocumentElement();
- Part value = decodePart( uri, root );
+ Resolver resolver = new SimpleResolver();
+ Part value = decodePart( uri, root, resolver );
if( cache )
{
WeakReference reference = new WeakReference( value );
@@ -167,22 +172,24 @@
/**
* Resolve a object from a DOM element.
* @param element the dom element
+ * @param resolver build-time value resolver
* @return the resolved object
* @exception IOException if an error occurs during element evaluation
*/
- public Object decode( Element element ) throws IOException
+ public Object decode( Element element, Resolver resolver ) throws
IOException
{
- return decodePart( null, element );
+ return decodePart( null, element, resolver );
}

/**
* Resolve a part from a DOM element.
* @param uri the part uri
* @param element element part definition
- * @return the resoplved part datastructure
+ * @param resolver build-time value resolver
+ * @return the resolved part datastructure
* @exception IOException if an error occurs during element evaluation
*/
- public Part decodePart( URI uri, Element element ) throws IOException
+ public Part decodePart( URI uri, Element element, Resolver resolver )
throws IOException
{
TypeInfo info = element.getSchemaTypeInfo();
String namespace = info.getTypeNamespace();
@@ -192,7 +199,7 @@
Info information = getInfo( uri, element );
Classpath classpath = getClasspath( element );
Element strategy = getStrategyElement( element );
- return build( information, classpath, strategy );
+ return build( information, classpath, strategy, resolver );
}
else
{
@@ -209,10 +216,13 @@
* @param information the part info definition
* @param classpath the part classpath definition
* @param strategy part deployment strategy definition
+ * @param resolver build-time value resolver
* @return the resolved part
* @exception IOException if an error occurs during element evaluation
*/
- public Part build( Info information, Classpath classpath, Element
strategy ) throws IOException
+ public Part build(
+ Info information, Classpath classpath, Element strategy, Resolver
resolver )
+ throws IOException
{
TypeInfo info = strategy.getSchemaTypeInfo();
String namespace = info.getTypeNamespace();
@@ -260,7 +270,7 @@

if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "reading foreign part definition" );
+ getLogger().trace( "loading foreign part definition" );
}
try
{
@@ -269,21 +279,21 @@
if( getLogger().isTraceEnabled() )
{
getLogger().trace(
- "loaded forign builder ["
+ "loaded foreign builder ["
+ builder.getClass().getName()
+ "]" );
}
- return builder.build( information, classpath, strategy );
+ return builder.build( information, classpath, strategy,
resolver );
}
catch( Exception ioe )
{
final String error =
- "Internal error while attempting to load foreign part
builder.";
+ "Internal error while attempting to load foreign part.";
throw new DecodingException( strategy, error, ioe );
}
}
}
-
+
/**
* Resolve the element decoder uri.
*

Modified: trunk/main/transit/core/src/main/net/dpml/transit/Artifact.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/Artifact.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/transit/Artifact.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -36,10 +36,19 @@
*/
public final class Artifact implements Serializable, Comparable
{
+ /**
+ * Constant scheme name for the artifact protocol.
+ */
public static final String ARTIFACT = "artifact";

+ /**
+ * Constant scheme name for the link protocol.
+ */
public static final String LINK = "link";

+ /**
+ * Constant scheme name for the local protocol.
+ */
public static final String LOCAL = "local";

static final long serialVersionUID = 1L;
@@ -136,12 +145,12 @@
"URI does not declare a scheme: " + uri;
throw new UnsupportedSchemeException( error );
}
- if( !scheme.equals( ARTIFACT ) && !scheme.equals( LINK ) &&
!scheme.equals( LOCAL ) )
- {
- final String error =
- "URI contains a scheme that is not recognized: " + uri;
- throw new UnsupportedSchemeException( error );
- }
+ //if( !scheme.equals( ARTIFACT ) && !scheme.equals( LINK ) &&
!scheme.equals( LOCAL ) )
+ //{
+ // final String error =
+ // "URI contains a scheme that is not recognized: " + uri;
+ // throw new UnsupportedSchemeException( error );
+ //}
return new Artifact( uri );
}

@@ -253,6 +262,10 @@
{
return uri.toURL();
}
+ catch( IllegalArgumentException e )
+ {
+ return uri.toURL();
+ }
}

/**
@@ -456,6 +469,17 @@
}
}

+ /**
+ * Test if the artifact scheme is recognized. Specificially
+ * the test validates that the artifact scheme corresponding to
+ * 'artifact', link', or 'local'.
+ * @return true if the uri scheme is recognized
+ */
+ public boolean isRecognized()
+ {
+ return isRecognized( m_uri );
+ }
+
/**
* Create an artifact url backed by the repository.
*

Modified: trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -19,11 +19,8 @@
package net.dpml.transit;

import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
import java.util.EventObject;
import java.util.EventListener;
-import java.util.List;
-import java.util.LinkedList;
import java.util.Map;
import java.util.WeakHashMap;

@@ -54,6 +51,7 @@

/**
* Creation of a new model.
+ * @param queue the event queue
* @param name the name used to construct a logging channel
* @exception RemoteException if a remote exception occurs
*/
@@ -65,6 +63,7 @@

/**
* Creation of a new model.
+ * @param queue the event queue
* @param logger the assigned logging channel
* @exception NullPointerException if the supplied logging channel is null
* @exception RemoteException if a remote exception occurs
@@ -79,6 +78,10 @@
// DefaultModel
//
------------------------------------------------------------------------

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

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-07-11 06:24:53 UTC (rev 1541)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -190,7 +190,8 @@
* model, layout registry model, cache model, and repository codebase
* model using the supplied configuration.
*
- * @param logger the assigned loging channel
+ * @param queue the event queue
+ * @param logger the assigned logging channel
* @param directive the transit configuration
* @exception NullPointerException if the logger or directive arguments
are null
* @exception RemoteException if a remote exception occurs

Modified:
trunk/main/transit/core/src/main/net/dpml/util/ConfigurationHandler.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/ConfigurationHandler.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/ConfigurationHandler.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -125,13 +125,13 @@

private String getDefaultLevel()
{
- if( "true".equals( System.getProperty( "dpml.debug" ) ) )
- {
- return "FINE";
- }
- else
- {
+ //if( "true".equals( System.getProperty( "dpml.debug" ) ) )
+ //{
+ // return "FINE";
+ //}
+ //else
+ //{
return System.getProperty( "dpml.logging.level", "INFO"
).toUpperCase();
- }
+ //}
}
}

Modified: trunk/main/transit/core/src/main/net/dpml/util/Decoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/Decoder.java 2006-07-11
06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/Decoder.java 2006-07-11
16:12:04 UTC (rev 1542)
@@ -30,9 +30,10 @@
/**
* Create an object using a supplied classloader and DOM element.
* @param element the DOM element
+ * @param resolver build-time value resolver
* @return the decoded object
* @exception IOException if an error occurs in the evaluation
* of the supplied element
*/
- Object decode( Element element ) throws IOException;
+ Object decode( Element element, Resolver resolver ) throws IOException;
}

Modified: trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/DecoderFactory.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -177,10 +177,10 @@
* @return the resulting object
* @exception IOException if an IO error occurs
*/
- public Object decode( Element element ) throws IOException
+ public Object decode( Element element, Resolver resolver ) throws
IOException
{
Decoder decoder = getDelegateDecoder();
- return decoder.decode( element );
+ return decoder.decode( element, resolver );
}

private Decoder getDelegateDecoder()

Modified: trunk/main/transit/core/src/main/net/dpml/util/EventHandler.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/EventHandler.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/EventHandler.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -30,7 +30,15 @@
*/
public interface EventHandler
{
+ /**
+ * Return the associated event listeners.
+ * @return the event listeners
+ */
EventListener[] getEventListeners();

+ /**
+ * Process the supplied event.
+ * @param event the event to be processed
+ */
void processEvent( EventObject event );
}

Modified: trunk/main/transit/core/src/main/net/dpml/util/EventQueue.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/EventQueue.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/EventQueue.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -18,19 +18,12 @@

package net.dpml.util;

-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
import java.util.EventObject;
-import java.util.EventListener;
import java.util.List;
import java.util.LinkedList;
-import java.util.Map;
-import java.util.WeakHashMap;

import net.dpml.transit.monitor.LoggingAdapter;

-import net.dpml.util.Logger;
-
/**
* A abstract base class that established an event queue and handles event
dispatch
* operations for listeners declared in classes extending this base class.

Added: trunk/main/transit/core/src/main/net/dpml/util/Resolver.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/Resolver.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/Resolver.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -0,0 +1,39 @@
+/*
+ * 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 net.dpml.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Interace implemented by a value (key, ref, and property) resolver.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface Resolver
+{
+ URI toURI( String ref ) throws URISyntaxException;
+
+ String getProperty( String key );
+
+ String getProperty( String key, String value );
+
+ String resolve( String value );
+}

Added: trunk/main/transit/core/src/main/net/dpml/util/SimpleResolver.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/SimpleResolver.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/SimpleResolver.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -0,0 +1,49 @@
+/*
+ * 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 net.dpml.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Build-time value resolver.
+ */
+public class SimpleResolver implements Resolver
+{
+ public URI toURI( String ref ) throws URISyntaxException
+ {
+ String value = resolve( ref );
+ return new URI( value );
+ }
+
+ public String getProperty( String key )
+ {
+ return System.getProperty( key );
+ }
+
+ public String getProperty( String key, String value )
+ {
+ return System.getProperty( key, value );
+ }
+
+ public String resolve( String value )
+ {
+ return PropertyResolver.resolve( value );
+ }
+}

Modified:
trunk/main/transit/core/src/main/net/dpml/util/UnicastEventSource.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/UnicastEventSource.java
2006-07-11 06:24:53 UTC (rev 1541)
+++ trunk/main/transit/core/src/main/net/dpml/util/UnicastEventSource.java
2006-07-11 16:12:04 UTC (rev 1542)
@@ -24,11 +24,7 @@
import java.util.EventObject;
import java.util.EventListener;
import java.util.WeakHashMap;
-import java.util.List;
-import java.util.LinkedList;

-import net.dpml.util.Logger;
-
/**
* A abstract base class that established an event queue and handles event
dispatch
* operations for listeners declared in a class extending this base class.




  • r1542 - in trunk/main: central/src/docs/metro/directives/component depot/core/src/main/net/dpml/depot depot/library/src/main/net/dpml/library depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/tools/builder/src/main/net/dpml/tools/tasks lang/component/etc metro/component/src/main/net/dpml/component metro/model/etc/data metro/model/src/main/net/dpml/metro metro/model/src/main/net/dpml/metro/builder metro/model/src/main/net/dpml/metro/data metro/model/src/main/net/dpml/metro/info metro/model/src/test/net/dpml/metro/builder metro/model/src/test/net/dpml/metro/data/test metro/runtime/src/main/net/dpml/metro/runtime metro/state/src/main/net/dpml/state metro/test/src/test/net/dpml/test/runtime metro/tools/src/main/net/dpml/metro/tools planet/http/impl/src/main/net/dpml/http planet/http/test planet/http/test/etc planet/http/test/etc/data station/builder/src/main/net/dpml/station/builder station/console/src/main/net/dpml/station/! console station/server/etc/bin/scm/conf station/server/etc/prefs/propertiess station/server/src/main/net/dpml/station/server transit/core/etc/prefs/propertiess transit/core/src/main/net/dpml/lang transit/core/src/main/net/dpml/transit transit/core/src/main/net/dpml/util, mcconnell at BerliOS, 07/11/2006

Archive powered by MHonArc 2.6.24.

Top of Page