Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2239 - in development/main/metro: automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder/datatypes composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/model/impl composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2239 - in development/main/metro: automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder/datatypes composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/model/impl composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit
  • Date: Thu, 07 Apr 2005 14:42:28 -0400

Author: mcconnell AT dpml.net
Date: Thu Apr 7 14:42:23 2005
New Revision: 2239

Added:

development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardEntryModel.java
Removed:

development/main/metro/composition/control/src/main/net/dpml/composition/control/DependencyInvocationHandler.java
Modified:

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

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

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

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/EntryDataType.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
development/main/metro/composition/testing/acme/build.xml

development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetComponent.java
development/main/metro/composition/testing/unit/build.xml
Log:
Cleaning up including the removal of support for a Dependencies inner-class.
Improvments to the way context references are handled (but still a way to go
on this area). Improved model and instance naming convensions with the use
of URI values. Update testcases to reflect evolving codebase.

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
Thu Apr 7 14:42:23 2005
@@ -43,7 +43,7 @@
* @param part the part datastructure
* @return the model
*/
- Model getModel( String partition, ClassLoader parent, Part part )
+ Model getModel( URI partition, ClassLoader parent, Part part )
throws DelegationException, ModelException;

/**
@@ -55,7 +55,7 @@
* @param part the part datastructure
* @return the model
*/
- Model getModel( Model model, String partition, ClassLoader parent, Part
part )
+ Model getModel( Model model, URI partition, ClassLoader parent, Part
part )
throws DelegationException, ModelException;

/**
@@ -98,7 +98,7 @@
* @param path the nested part address
* @return the nested model or null if the model is not found
*/
- Model getProvider( Model model, String path );
+ //Model getProvider( Model model, String path );

/**
* Return a model identified by the supplied path within the supplied
model.

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
Thu Apr 7 14:42:23 2005
@@ -28,22 +28,51 @@
*/
public class PartNotFoundException extends Exception
{
- private URI m_uri;
+ private URI m_target;
+ private URI m_parent;

- public PartNotFoundException( URI uri )
+ public PartNotFoundException( URI target )
{
- this( uri, null );
+ this( target, null );
}

- public PartNotFoundException( URI uri, Exception cause )
+ public PartNotFoundException( URI parent, URI target )
{
- super( uri.toString(), cause );
- m_uri = uri;
+ super( buildMessage( parent, target ) );
+ m_target = target;
+ m_parent = parent;
}

- public URI getURI()
+ public URI getParentURI()
{
- return m_uri;
+ return m_parent;
+ }
+
+ public URI getTargetURI()
+ {
+ return m_target;
+ }
+
+ private static String buildMessage( URI parent, URI target )
+ {
+ if( null != parent )
+ {
+ final String error =
+ "Could not find the a part uri ["
+ + target
+ + "] relative to the enclosing part ["
+ + parent.toString()
+ + "].";
+ return error;
+ }
+ else
+ {
+ final String error =
+ "Could not find a part ["
+ + target
+ + "].";
+ return error;
+ }
}

}

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
Thu Apr 7 14:42:23 2005
@@ -19,6 +19,7 @@
package net.dpml.automation.model;

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

import net.dpml.automation.control.Controller;

@@ -33,9 +34,9 @@
{
String getName();

- String getPartition();
+ URI getPartition();

- String getQualifiedName();
+ URI getURI();

Controller getController();


Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/EntryDataType.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/EntryDataType.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/EntryDataType.java
Thu Apr 7 14:42:23 2005
@@ -37,6 +37,7 @@
import net.dpml.meta.info.Type;
import net.dpml.meta.info.EntryDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
+import net.dpml.meta.info.PartDescriptor;

import org.apache.tools.ant.BuildException;

@@ -122,24 +123,34 @@

public ValueDirective getValueDirective( ClassLoader classloader, Type
type )
{
- String classname = getClassname();
String key = getKey();
+ EntryDescriptor entry = type.getContext().getEntry( key );
+ DependencyDescriptor dep = type.getDependency( key );
+ PartDescriptor part = type.getPartDescriptor( key );
+ if( ( null == entry ) && ( null == dep ) && ( null == part ) )
+ {
+ final String error =
+ "The value ["
+ + key
+ + "] is unknown relative to the component type ["
+ + type.getInfo().getClassname()
+ + "].";
+ throw new ConstructionException( error );
+ }
+
+ String classname = getClassname();
if( null == classname )
{
- EntryDescriptor entry = type.getContext().getEntry( key );
if( null != entry )
{
classname = entry.getClassname();
}
else
{
- DependencyDescriptor dep = type.getDependency( key );
- if( null != dep )
- {
- classname = dep.getReference().getClassname();
- }
+ classname = dep.getReference().getClassname();
}
}
+
if( null == classname )
{
final String error =
@@ -150,6 +161,7 @@
+ "] as the primary classname was not resolvable.";
throw new ConstructionException( error );
}
+
String value = getValue();
if( null != value )
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,7 @@

package net.dpml.composition.control;

+import java.net.URI;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
@@ -101,6 +102,11 @@
// ApplianceInvocationHandler
//-------------------------------------------------------------------

+ public URI getURI()
+ {
+ return m_holder.getURI();
+ }
+
public void dispose()
{
if( !m_disposed )

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
Thu Apr 7 14:42:23 2005
@@ -36,19 +36,19 @@
// state
//--------------------------------------------------------------------

- private final String m_partition;
+ private final URI m_partition;
private final int m_index;

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

- public CompositionClassLoader( String partition, ClassLoader parent )
+ public CompositionClassLoader( URI partition, ClassLoader parent )
{
this( partition, 0, new URI[0], parent );
}

- public CompositionClassLoader( String partition, int index, URI[] uris,
ClassLoader parent )
+ public CompositionClassLoader( URI partition, int index, URI[] uris,
ClassLoader parent )
{
super( urisToURLs( uris ), parent );
m_partition = partition;
@@ -59,7 +59,7 @@
// CompositionClassLoader
//--------------------------------------------------------------------

- public String getPartition()
+ public URI getPartition()
{
return m_partition;
}
@@ -76,7 +76,7 @@
public String toString()
{
StringBuffer buffer = new StringBuffer( "classloader stack: " );
- buffer.append( getPartition() );
+ buffer.append( getPartition().toString() );
listClasspath( buffer );
return buffer.toString();
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
Thu Apr 7 14:42:23 2005
@@ -122,7 +122,7 @@
* @param part the part datastructure
* @return the model
*/
- public Model getModel( String partition, ClassLoader parent, Part part )
throws DelegationException, ModelException
+ public Model getModel( URI partition, ClassLoader parent, Part part )
throws DelegationException, ModelException
{
return getModel( null, partition, parent, part );
}
@@ -136,7 +136,7 @@
* @param part the part datastructure
* @return the model
*/
- public Model getModel( Model model, String partition, ClassLoader
parent, Part part ) throws DelegationException, ModelException
+ public Model getModel( Model model, URI partition, ClassLoader parent,
Part part ) throws DelegationException, ModelException
{
if( part instanceof ComponentProfile )
{
@@ -277,44 +277,6 @@
* the models controller.
*
* @param model the model to use for path resolution
- * @param path the path identifying a internal part or context entry
- */
- public Model getProvider( Model model, String path )
- {
- if( model instanceof StandardComponentModel )
- {
- StandardComponentModel m = (StandardComponentModel) model;
- Model provider = m.getPart( path );
- if( null == provider )
- {
- return m.getProvider( path );
- }
- else
- {
- return provider;
- }
- }
- else if( model instanceof ValueModel )
- {
- return null;
- }
- else
- {
- return model.getController().getProvider( model, path );
- }
- }
-
- /**
- * Return a component model using a supplied path using the supplied
- * model as the source for path resolution. If the model is a standard
- * composition model the implementation will attempt to resolve the path
- * using internal parts. If that is not successfull, the implementation
- * will attempt to resolve the path relative to the registered context
- * entries. If this fails, a null value will be returned. If the supplied
- * model is not a composition model then the request will be delegated to
- * the models controller.
- *
- * @param model the model to use for path resolution
* @param uri the path identifying a internal part or context entry
*/
public Model getProvider( Model model, URI uri )
@@ -411,7 +373,8 @@

public Object getLoggingChannel( StandardComponentModel model )
{
- String path = model.getQualifiedName();
+ URI uri = model.getURI();
+ String path = model.getURI().getSchemeSpecificPart();
return m_system.getLoggingManager().getLoggerForCategory( path );
}

@@ -435,7 +398,7 @@
* @return the model
*/
public StandardComponentModel getComponentModel(
- Model model, String partition, ClassLoader parent, ComponentProfile
profile )
+ Model model, URI partition, ClassLoader parent, ComponentProfile
profile )
throws DelegationException, ModelException
{
getMonitor().debug( "creating nested model using " + profile );
@@ -460,7 +423,7 @@
* @return the model
*/
public ValueModel getValueModel(
- Model model, String partition, ClassLoader parent, ValueDirective
value )
+ Model model, URI partition, ClassLoader parent, ValueDirective value )
throws DelegationException, ModelException
{
return new ValueModel( this, parent, value, new Hashtable() );
@@ -492,7 +455,7 @@
* @param uri the part controller uri
* @return the part model
*/
- private Model getForeignModel( Model parent, String partition,
ClassLoader classloader, Part part, URI uri ) throws DelegationException
+ private Model getForeignModel( Model parent, URI partition, ClassLoader
classloader, Part part, URI uri ) throws DelegationException
{
try
{
@@ -523,10 +486,10 @@
}
}

- private ClassLoader getClassLoader( String partition, ClassLoader
parent, ComponentProfile profile )
+ private ClassLoader getClassLoader( URI partition, ClassLoader parent,
ComponentProfile profile )
{
final String name = profile.getName();
- final String local = getLocalPartition( partition, name );
+ final URI local = getLocalPartition( partition, name );
final ClassLoaderDirective cld = profile.getClassLoaderDirective();
final ClasspathDirective[] cpds = cld.getClasspathDirectives();
for( int i=0; i<cpds.length; i++ )
@@ -538,15 +501,38 @@
return parent;
}

- private String getLocalPartition( String base, String name )
+ private URI getLocalPartition( URI base, String name )
{
- if( base.endsWith( "/" ) )
+ String scheme = base.getScheme();
+ String spec = base.getSchemeSpecificPart();
+ String path = getPathWithTrailingSlash( spec );
+ String cleanName = getNameWithoutLeadingSlash( name );
+ return createURI( scheme, path, cleanName );
+ }
+
+ private String getNameWithoutLeadingSlash( String path )
+ {
+ String spec = path.trim();
+ if( spec.startsWith( "/" ) )
+ {
+ return spec.substring( 1 );
+ }
+ else
+ {
+ return spec;
+ }
+ }
+
+ private String getPathWithTrailingSlash( String path )
+ {
+ String spec = path.trim();
+ if( spec.endsWith( "/" ) )
{
- return base + name;
+ return spec;
}
else
{
- return base + "/" + name;
+ return spec + "/";
}
}

@@ -554,6 +540,52 @@
// static utilities
//--------------------------------------------------------------------

+ public static URI createURI( URI base, String name )
+ {
+ String scheme = base.getScheme();
+ String partition = base.getSchemeSpecificPart();
+ if( partition.endsWith( "/" ) )
+ {
+ final String path = partition + name;
+ return createURI( scheme, path );
+ }
+ else
+ {
+ final String path = partition + "/" + name;
+ return createURI( scheme, path );
+ }
+ }
+
+ public static URI createInstanceURI( URI base, String id )
+ {
+ String scheme = base.getScheme();
+ String partition = base.getSchemeSpecificPart();
+ return createURI( scheme, partition, id );
+ }
+
+ private static URI createURI( String scheme, String path )
+ {
+ return createURI( scheme, path, null );
+ }
+
+ private static URI createURI( String scheme, String path, String
fragment )
+ {
+ try
+ {
+ return new URI( scheme, path, fragment );
+ }
+ catch( URISyntaxException e )
+ {
+ final String error =
+ "Internal exception while attempting to construct a part uri
using the schme ["
+ + scheme
+ + "] and path ["
+ + path
+ + "].";
+ throw new ControlRuntimeException( error, e );
+ }
+ }
+
private static final URI CONTROLLER_URI = setupURI(
"@PART-CONTROLLER-URI@" );

protected static URI setupURI( String spec )

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
Thu Apr 7 14:42:23 2005
@@ -32,6 +32,7 @@
import net.dpml.automation.control.SystemManager;
import net.dpml.automation.control.PartHandler;
import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.ControlRuntimeException;
import net.dpml.automation.control.Monitor;
import net.dpml.automation.control.DuplicateNameException;
import net.dpml.automation.control.UnsupportedPartTypeException;
@@ -59,16 +60,25 @@
//--------------------------------------------------------------------

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

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

- public CompositionManager( SystemContext context )
+ public CompositionManager( SystemContext system )
{
- super( new DefaultMonitor( context.getLogger() ), context );
- m_context = context;
+ super( new DefaultMonitor( system.getLogger() ), system );
+
+ URI partition = createPartition( system );
+ ClassLoader anchor = Logger.class.getClassLoader();
+
+ m_classloader = new CompositionClassLoader( partition, anchor );
+ m_context = system;
+ m_partition = partition;
+
setShutdownHook( this );
}

@@ -77,15 +87,6 @@
//--------------------------------------------------------------------

/**
- * Return the name of this controller.
- * @return the controller name
- */
- public String getName()
- {
- return "manager";
- }
-
- /**
* Add a part to the collection of parts managed by this controller.
*
* @param uri a uri identifying the part to add
@@ -121,6 +122,16 @@
// extras
//--------------------------------------------------------------------

+ private URI getPartition()
+ {
+ return m_partition;
+ }
+
+ private ClassLoader getClassLoader()
+ {
+ return m_classloader;
+ }
+
/**
* Install a part to the collection of parts managed by this manager.
*
@@ -130,7 +141,9 @@
private Model installPart( Part part )
throws DelegationException, ModelException
{
- Model model = getModel( "/", CLASSLOADER, part );
+ URI partition = getPartition();
+ ClassLoader classloader = getClassLoader();
+ Model model = getModel( partition, classloader, part );
m_models.add( model );
return model;
}
@@ -198,11 +211,29 @@
// static utilities
//--------------------------------------------------------------------

- private final ClassLoader CLASSLOADER = setupRootClassLoader();

- private static ClassLoader setupRootClassLoader()
+ private static URI createPartition( SystemContext system )
{
- ClassLoader root = Logger.class.getClassLoader();
- return new CompositionClassLoader( "/", root );
+ URI uri = system.getDomain();
+ String path = uri.getSchemeSpecificPart();
+ try
+ {
+ if( path.endsWith( "/" ) )
+ {
+ return new URI( "part", path, null );
+ }
+ else
+ {
+ return new URI( "part", path + "/", null );
+ }
+ }
+ catch( URISyntaxException e )
+ {
+ final String error =
+ "Internal exception while attempting to construct a part uri
relative to the system context uri ["
+ + uri.toString()
+ + "].";
+ throw new ControlRuntimeException( error, e );
+ }
}
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,7 @@

package net.dpml.composition.control;

+import java.net.URI;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
@@ -33,6 +34,7 @@

import net.dpml.composition.models.StandardComponentModel;
import net.dpml.composition.models.ValueModel;
+import net.dpml.composition.models.StandardEntryModel;
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.ImportDirective;
import net.dpml.composition.data.ValueDirective;
@@ -71,6 +73,11 @@
*/
private final Type m_type;

+ /**
+ * The instance uri (possibly null)
+ */
+ private final URI m_uri;
+
//-------------------------------------------------------------------
// constructor
//-------------------------------------------------------------------
@@ -81,11 +88,12 @@
* @param system the system context
* @param model the component model
*/
- public ContextInvocationHandler( SystemContext system,
StandardComponentModel model )
+ public ContextInvocationHandler( SystemContext system,
StandardComponentModel model, URI uri )
throws LifecycleException, ModelException
{
m_system = system;
m_model = model;
+ m_uri = uri;
m_type = model.getType();
}

@@ -122,32 +130,43 @@
String name = method.getName();
String key = getKeyFromMethod( method );
final Model provider = m_model.getProvider( key );
- Object instance = getInstance( key, provider, args );
-
- if( instance instanceof String )
+ if( provider instanceof StandardEntryModel )
{
- String v = (String) instance;
- if( v.startsWith( "urn:metro:" ) )
+ StandardEntryModel sem = (StandardEntryModel) provider;
+ URI uri = sem.getEntryURI();
+ String urn = uri.getSchemeSpecificPart();
+ if( "composition:name".equals( urn ) )
{
- if( "urn:metro:name".equals( v ) )
- {
- return m_model.getName();
- }
- else if( "urn:metro:partition".equals( v ) )
+ return m_model.getName();
+ }
+ else if( "composition:partition".equals( urn ) )
+ {
+ return m_model.getPartition();
+ }
+ else if( "composition:uri".equals( urn ) )
+ {
+ if( null == m_uri )
{
- return m_model.getPartition();
+ return m_model.getURI();
}
else
{
- final String error =
- "Context entry urn ["
- + v
- + "] not recognized.";
- throw new IllegalArgumentException( error );
+ return m_uri;
}
}
+ else
+ {
+ final String error =
+ "Context entry urn ["
+ + urn
+ + "] not recognized.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ else
+ {
+ return getInstance( key, provider, args );
}
- return instance;
}

private Object getInstance( String key, Model provider, final Object[]
args )

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,7 @@

package net.dpml.composition.control;

+import java.net.URI;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.WeakHashMap;
@@ -44,6 +45,7 @@
private final Object m_key;
private final Monitor m_monitor;
private final StandardComponentModel m_model;
+ private final URI m_uri;
private final LifecycleHandler m_factory;

private boolean m_disposed = false;
@@ -54,6 +56,7 @@
m_monitor = monitor;
m_factory = factory;
m_model = model;
+
if( null == key )
{
m_key = new Integer( System.identityHashCode( this ) );
@@ -62,6 +65,39 @@
{
m_key = key;
}
+
+ //
+ // Create a uri identifying the instance. If the instance key is
LifestyleHandler.SELF then
+ // we use the model's uri, otherwise the key bacomes a fragment part
of the uri using the model
+ // uri as the base.
+ //
+
+ URI base = model.getURI();
+ if( LifestyleHandler.SELF.equals( key ) )
+ {
+ m_uri = base;
+ }
+ else
+ {
+ String fragment = getFragment( getKey() );
+ m_uri = CompositionController.createInstanceURI( base, fragment
);
+ }
+ }
+
+ private String getFragment( Object key )
+ {
+ if( key instanceof String )
+ {
+ return (String) key;
+ }
+ else if( key instanceof Integer )
+ {
+ return key.toString();
+ }
+ else
+ {
+ return "" + System.identityHashCode( key );
+ }
}

public Object getKey()
@@ -74,9 +110,9 @@
return m_model;
}

- public Object getQualifiedName()
+ public URI getURI()
{
- return getModel().getQualifiedName() + "#" + getKey().toString();
+ return m_uri;
}

public Object newProxy() throws Exception
@@ -154,7 +190,7 @@

public String toString()
{
- return m_model.getQualifiedName() + "#" + m_key;
+ return getURI().toString();
}

protected void finalize()

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,7 @@

package net.dpml.composition.control;

+import java.net.URI;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
@@ -66,12 +67,13 @@
{
final String message =
"Incarnating ["
- + holder.getQualifiedName()
+ + holder.getURI()
+ "].";
getMonitor().debug( message );
}
StandardComponentModel model = holder.getModel();
- return execute( model );
+ URI uri = holder.getURI();
+ return execute( model, uri );
}

/**
@@ -86,11 +88,11 @@
{
final String message =
"Incarnating ["
- + model.getQualifiedName()
+ + model.getURI()
+ "].";
getMonitor().debug( message );
}
- return execute( model );
+ return execute( model, null );
}

/**
@@ -99,14 +101,13 @@
*
* @return a new component instance
*/
- private Object execute( StandardComponentModel model ) throws
LifecycleException
+ private Object execute( StandardComponentModel model, URI id ) throws
LifecycleException
{
Class subject = model.getDeploymentClass();
ClassLoader classloader = subject.getClassLoader();
Constructor constructor = getConstructor( subject );
Class parts = getInnerClass( subject, "$Parts" );
Class context = getInnerClass( subject, "$Context" );
- Class dependencies = getInnerClass( subject, "$Dependencies" );
Class[] classes = constructor.getParameterTypes();
Object[] args = new Object[ classes.length ];

@@ -121,13 +122,9 @@
{
args[i] = newPartsInvocationHandler( model, parts );
}
- else if( ( null != dependencies ) &&
dependencies.isAssignableFrom( c ) )
- {
- args[i] = newDependencyInvocationHandler( model,
dependencies );
- }
else if( ( null != context ) && context.isAssignableFrom( c ) )
{
- args[i] = newContextInvocationHandler( model, context );
+ args[i] = newContextInvocationHandler( model, context, id );
}
else
{
@@ -239,11 +236,11 @@
return null;
}

- private Object newContextInvocationHandler( StandardComponentModel
model, Class clazz ) throws LifecycleException
+ private Object newContextInvocationHandler( StandardComponentModel
model, Class clazz, URI uri ) throws LifecycleException
{
try
{
- InvocationHandler handler = new ContextInvocationHandler(
m_system, model );
+ InvocationHandler handler = new ContextInvocationHandler(
m_system, model, uri );
ClassLoader classloader =
model.getDeploymentClass().getClassLoader();
return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
}
@@ -271,22 +268,6 @@
}
}

- private Object newDependencyInvocationHandler( StandardComponentModel
model, Class clazz ) throws LifecycleException
- {
- try
- {
- InvocationHandler handler = new DependencyInvocationHandler(
model );
- ClassLoader classloader =
model.getDeploymentClass().getClassLoader();
- return Proxy.newProxyInstance( classloader, new Class[]{ clazz
}, handler );
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected error while attempting to construct the
dependencies invocation handler.";
- throw new LifecycleException( error, e );
- }
- }
-
private Monitor getMonitor()
{
return m_monitor;

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
Thu Apr 7 14:42:23 2005
@@ -34,6 +34,8 @@
*/
public class LifestyleHandler
{
+ public static final String SELF = "self";
+
private final LifecycleHandler m_handler;
private Monitor m_monitor;

@@ -56,7 +58,7 @@
{
final String message =
"Aquiring an object key for the model ["
- + model.getQualifiedName()
+ + model.getURI()
+ "] using the lifestyle ["
+ lifestyle
+ "].";
@@ -72,9 +74,7 @@
{
final String message =
"Established key ["
- + model.getQualifiedName()
- + "#"
- + key
+ + holder.getURI()
+ "].";
getMonitor().debug( message );
}
@@ -90,7 +90,7 @@
{
synchronized( model )
{
- String key = "model";
+ String key = SELF;
return aquire( model, key );
}
}
@@ -122,9 +122,7 @@
{
final String message =
"Initiating creation of identifiable instance ["
- + model.getQualifiedName()
- + "#"
- + key
+ + holder.getURI()
+ "].";
getMonitor().debug( message );
}
@@ -133,9 +131,7 @@
{
final String message =
"Adding holder ["
- + model.getQualifiedName()
- + "#"
- + key
+ + holder.getURI()
+ "].";
getMonitor().debug( message );
}
@@ -147,9 +143,7 @@
{
final String message =
"Using existing holder ["
- + model.getQualifiedName()
- + "#"
- + key
+ + holder.getURI()
+ "].";
getMonitor().debug( message );
}
@@ -164,7 +158,7 @@
{
final String message =
"Releasing ["
- + model.getQualifiedName()
+ + model.getURI()
+ "#"
+ key
+ "].";

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
Thu Apr 7 14:42:23 2005
@@ -116,7 +116,7 @@
"Unable to locate a part using the key ["
+ key
+ "] withing the component ["
- + m_model.getQualifiedName()
+ + m_model.getURI()
+ "].";
throw new IllegalStateException( error );
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryModel.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,8 @@

package net.dpml.composition.models;

+import java.net.URI;
+
import net.dpml.automation.model.Model;
import net.dpml.automation.model.ModelException;
import net.dpml.automation.control.Controller;
@@ -36,7 +38,6 @@
// state
//--------------------------------------------------------------

- //private EntryDescriptor m_descriptor;
private Controller m_controller;

//--------------------------------------------------------------
@@ -52,11 +53,10 @@
public EntryModel( Controller controller )
throws NullPointerException
{
- //if( descriptor == null )
- //{
- // throw new NullPointerException( "descriptor" );
- //}
- //m_descriptor = descriptor;
+ if( controller == null )
+ {
+ throw new NullPointerException( "controller" );
+ }
m_controller = controller;
}

@@ -93,7 +93,7 @@
throw new UnsupportedOperationException( "getName/0" );
}

- public String getPartition()
+ public URI getPartition()
{
throw new UnsupportedOperationException( "getPartition/0" );
}
@@ -103,22 +103,16 @@
throw new UnsupportedOperationException( "getQualifiedName/0" );
}

+ public URI getURI()
+ {
+ throw new UnsupportedOperationException( "getURI/0" );
+ }

//--------------------------------------------------------------
// EntryModel
//--------------------------------------------------------------

/**
- * Return the context entry key.
- *
- * @return the key
- */
- //public String getKey()
- //{
- // return m_descriptor.getKey();
- //}
-
- /**
* Return the context entry value.
*
* @return the context entry value

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/InvalidModelException.java
Thu Apr 7 14:42:23 2005
@@ -43,10 +43,9 @@

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

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingDependencyDirectiveException.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingDependencyDirectiveException.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingDependencyDirectiveException.java
Thu Apr 7 14:42:23 2005
@@ -50,10 +50,9 @@

private static String buildMessage( StandardComponentModel model, String
key )
{
- final String name = model.getQualifiedName();
final String error =
"The component model ["
- + name
+ + model.getURI()
+ "] does not delcare a dependency directive for the required
dependency ["
+ key
+ "].";

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingPartException.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingPartException.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/MissingPartException.java
Thu Apr 7 14:42:23 2005
@@ -50,10 +50,9 @@

private static String buildMessage( StandardComponentModel model, String
key )
{
- final String name = model.getQualifiedName();
final String error =
"The component model ["
- + name
+ + model.getURI()
+ "] does not contain a part for the key ["
+ key
+ "].";

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/PartsModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/PartsModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/PartsModel.java
Thu Apr 7 14:42:23 2005
@@ -24,6 +24,7 @@
import java.util.WeakHashMap;
import java.util.List;
import java.util.LinkedList;
+import java.net.URI;

import net.dpml.automation.model.Model;
import net.dpml.automation.model.ModelException;
@@ -56,7 +57,7 @@
public class PartsModel implements Serializable
{
private final ClassLoader m_classloader;
- private final String m_partition;
+ private final URI m_partition;
private final CompositionController m_controller;
private final StandardComponentModel m_parent;

@@ -68,12 +69,12 @@
*
* @param controller the model controller
* @param parent the enclosing parent model
- * @param partition a name defining the partition within which the parts
are enclosed
+ * @param partition the enclosing component uri
* @param classloader the classloader established as the parent for the
parts
* @param profile the component profile from which initial default values
are established
*/
public PartsModel(
- CompositionController controller, StandardComponentModel parent,
String partition, ClassLoader classloader )
+ CompositionController controller, StandardComponentModel parent, URI
partition, ClassLoader classloader )
throws DelegationException, ModelException
{
m_controller = controller;
@@ -133,34 +134,21 @@
void addPartToCollection( String key, Part part, boolean validate )
throws DelegationException, ModelException
{
Model model = loadModelFromPart( part );
- String k = getKey( key, model );
- if( m_parts.containsKey( k ) )
+ if( m_parts.containsKey( key ) )
{
- throw new DuplicateKeyException( k );
+ throw new DuplicateKeyException( key );
}
- m_parts.put( k, model );
+ m_parts.put( key, model );
if( validate )
{
build();
}
}

- private String getKey( String key, Model model )
- {
- if( null == key )
- {
- return model.getName();
- }
- else
- {
- return key;
- }
- }
-
private Model loadModelFromPart( Part part ) throws DelegationException,
ModelException, DuplicateKeyException
{
StandardComponentModel parent = getParentModel();
- String partition = getPartition();
+ URI partition = getPartition();
ClassLoader classloader = getClassLoader();
return getController().getModel( parent, partition, classloader,
part );
}
@@ -210,7 +198,7 @@
return m_parent;
}

- private String getPartition()
+ private URI getPartition()
{
return m_partition;
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
Thu Apr 7 14:42:23 2005
@@ -33,6 +33,7 @@
import net.dpml.automation.model.TypeClassNotFoundException;
import net.dpml.automation.control.Controller;
import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.control.PartNotFoundException;
import net.dpml.automation.part.Part;
import net.dpml.automation.part.PartReference;

@@ -61,7 +62,7 @@
{
private final ComponentProfile m_profile;
private final ClassLoader m_classloader;
- private final String m_partition;
+ private final URI m_partition;
private final CompositionController m_controller;
private final PartsModel m_parts;

@@ -75,17 +76,18 @@

private String m_name;
private String m_lifestyle;
+ private URI m_uri;

/**
* Creation of a new root component model.
*
* @param controller the model controller
- * @param partition a name defineing the partition that this model exists
within
+ * @param partition a name defining the partition that this model exists
within
* @param classloader the classloader established for this model
* @param profile the component profile from which initial default values
are established
*/
public StandardComponentModel(
- CompositionController controller, String partition, ClassLoader
classloader, ComponentProfile profile )
+ CompositionController controller, URI partition, ClassLoader
classloader, ComponentProfile profile )
throws DelegationException, ModelException
{
this( controller, null, partition, classloader, profile );
@@ -108,7 +110,7 @@
* @param profile the component profile from which initial default values
are established
*/
public StandardComponentModel(
- CompositionController controller, Model parent, String partition,
ClassLoader classloader, ComponentProfile profile )
+ CompositionController controller, Model parent, URI partition,
ClassLoader classloader, ComponentProfile profile )
throws DelegationException, ModelException
{
m_controller = controller;
@@ -118,7 +120,10 @@

m_class = loadComponentClass( classloader, profile );
m_type = controller.loadType( m_class );
- m_name = profile.getName();
+
+ String name = profile.getName();
+ m_name = name;
+ m_uri = CompositionController.createURI( partition, name );

//
// Construct an array of the interface classes that the component
@@ -151,8 +156,7 @@
// (or alternatively - we pass the classloader chain into the
constructor)
//

- String newPartition = getQualifiedName() + "/";
- m_parts = new PartsModel( controller, this, newPartition,
classloader );
+ m_parts = new PartsModel( controller, this, getURI(), classloader );
PartReference[] parts = profile.getParts();
for( int i=0; i<parts.length; i++ )
{
@@ -179,7 +183,7 @@
{
final String error =
"The component model ["
- + getQualifiedName()
+ + this
+ "] does not declare a context entry for the key "
+ key
+ "].";
@@ -188,6 +192,7 @@
}
else
{
+
Model m = loadPartReference( reference, controller,
classloader, parent );
m_providers.put( key, m );
}
@@ -206,63 +211,26 @@
for( int i=0; i<dependencies.length; i++ )
{
DependencyDescriptor dependency = dependencies[i];
+ String key = dependency.getKey();
boolean required = dependency.isRequired();
-
- if( null == parent )
+ PartReference reference = context.getPartReference( key );
+ if( null == reference )
{
- if( required )
- {
- final String error =
- "The top-level component ["
- + getQualifiedName()
- + "] is declaring a required service dependency which
logically cannot be resolved.";
- throw new ModelRuntimeException( error );
- }
- else
+ if( dependency.isRequired() )
{
- // ignore it as its optional and unresolvable
+ final String error =
+ "The component model ["
+ + this
+ + "] does not declare a context entry for the
dependency key "
+ + key
+ + "].";
+ throw new ModelException( error );
}
}
else
{
- String key = dependency.getKey();
-
- PartReference reference = context.getPartReference( key );
-
- if( reference != null )
- {
- Model m = loadPartReference( reference, controller,
classloader, parent );
- m_providers.put( key, m );
- }
- else
- {
- // THE FOLLOWING WILL BE REMOVED ONCE DEPS/CONTEXT ARE
SORTED
- // AT THE TYPE LEVEL
-
- DependencyDirective directive =
profile.getDependencyDirective( key );
- if( null == directive )
- {
- if( required )
- {
- Exception e = new
MissingDependencyDirectiveException( this, key );
- m_errors.add( e );
- }
- }
- else
- {
- String path = directive.getSource();
- Model model = controller.getProvider( parent, path );
- if( null == model )
- {
- final Exception e = new
UnresolvableDependencyException( this, directive );
- m_errors.add( e );
- }
- else
- {
- m_providers.put( key, model );
- }
- }
- }
+ Model m = loadPartReference( reference, controller,
classloader, parent );
+ m_providers.put( key, m );
}
}
}
@@ -280,6 +248,24 @@
{
ReferenceDirective ref = (ReferenceDirective) part;
URI uri = ref.getURI();
+
+ if( "entry".equals( uri.getScheme() ) )
+ {
+ String path = uri.getSchemeSpecificPart();
+ return new StandardEntryModel( controller, uri );
+ }
+
+ if( null == parent )
+ {
+ final String error =
+ "The component ["
+ + this
+ + "] is requesting the resolution of a dependency ["
+ + uri.toString()
+ + "] which cannot be resolved as this component has no
enclosing parent.";
+ throw new ModelException( error );
+ }
+
Model m = controller.getProvider( parent, uri );
if( null != m )
{
@@ -287,18 +273,15 @@
}
else
{
- final String error =
- "Unresolvable reference ["
- + uri
- + "] in the component ["
- + this
- + "].";
- throw new ModelException( error );
+ URI enclosing = parent.getURI();
+ Exception cause = new PartNotFoundException( enclosing, uri
);
+ throw new ModelException( cause.getMessage(), cause );
}
}
else
{
- return controller.getModel( this, getQualifiedName() + "/",
classloader, part );
+ URI partition = getURI();
+ return controller.getModel( this, partition, classloader, part
);
}
}

@@ -371,33 +354,31 @@
return m_name;
}

- public void setName( String name )
- {
- if( null == name )
- {
- throw new NullPointerException( "name" );
- }
- if( false == name.equals( getName() ) )
- {
- m_name = name;
- }
- }
+ //public void setName( String name ) //??
+ //{
+ // if( null == name )
+ // {
+ // throw new NullPointerException( "name" );
+ // }
+ // if( false == name.equals( getName() ) )
+ // {
+ // m_name = name;
+ // }
+ //}

- public String getPartition()
+ public URI getPartition()
{
return m_partition;
}

- public String getQualifiedName()
+ //public String getQualifiedName()
+ //{
+ // return getURI().toString();
+ //}
+
+ public URI getURI()
{
- if( getPartition().endsWith( "/" ) )
- {
- return getPartition() + getName();
- }
- else
- {
- return getPartition() + "/" + getName();
- }
+ return m_uri;
}

public Class getDeploymentClass()
@@ -497,6 +478,6 @@

public String toString()
{
- return getQualifiedName();
+ return getURI().toString();
}
}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardEntryModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardEntryModel.java
Thu Apr 7 14:42:23 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.models;
+
+import java.net.URI;
+import java.lang.reflect.Constructor;
+import java.util.Map;
+
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.model.ModelException;
+
+import net.dpml.composition.data.ValueDirective;
+import net.dpml.composition.data.ValueDirective.Value;
+
+import net.dpml.meta.info.EntryDescriptor;
+
+/**
+ * Default implementation of a the context entry constructor model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: DefaultConstructorModel.java 1518 2005-01-17 17:13:05Z
niclas $
+ */
+public class StandardEntryModel extends EntryModel
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private URI m_uri;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new context entry import model.
+ *
+ * @param controller the controller
+ * @param uri the standard entry uri
+ */
+ public StandardEntryModel( Controller controller, URI uri )
+ {
+ super( controller );
+ m_uri = uri;
+ }
+
+ //--------------------------------------------------------------
+ // EntryModel
+ //--------------------------------------------------------------
+
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public Object getValue()
+ {
+ return m_uri;
+ }
+
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public URI getEntryURI()
+ {
+ return m_uri;
+ }
+}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/UnresolvableDependencyException.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/UnresolvableDependencyException.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/UnresolvableDependencyException.java
Thu Apr 7 14:42:23 2005
@@ -52,14 +52,13 @@

private static String buildMessage( StandardComponentModel model,
DependencyDirective directive )
{
- final String name = model.getQualifiedName();
final String key = directive.getKey();
final String source = directive.getSource();
final String error =
"The source provider address ["
+ source
+ "] declared by the component model ["
- + name
+ + model.getURI()
+ "] under the dependency key ["
+ key
+ "] was not found.";

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,7 @@

package net.dpml.composition.models;

+import java.net.URI;
import java.lang.reflect.Constructor;
import java.util.Map;


Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
Thu Apr 7 14:42:23 2005
@@ -18,6 +18,8 @@

package net.dpml.composition.model.impl;

+import java.net.URI;
+
import net.dpml.automation.control.Controller;

import net.dpml.composition.model.EntryModel;
@@ -94,11 +96,16 @@
throw new UnsupportedOperationException( "getQualifiedName/0" );
}

- public String getPartition()
+ public URI getPartition()
{
throw new UnsupportedOperationException( "getQualifiedName/0" );
}

+ public URI getURI()
+ {
+ throw new UnsupportedOperationException( "getURI/0" );
+ }
+
public String getName()
{
throw new UnsupportedOperationException( "getName/0" );

Modified: development/main/metro/composition/testing/acme/build.xml
==============================================================================
--- development/main/metro/composition/testing/acme/build.xml (original)
+++ development/main/metro/composition/testing/acme/build.xml Thu Apr 7
14:42:23 2005
@@ -21,8 +21,9 @@
<value key="foo" value="bar"/>
<value key="width" value="12"/>
<value key="height" value="100"/>
- <value key="name" value="urn:metro:name"/>
- <value key="partition" value="urn:metro:partition"/>
+ <reference key="name" uri="entry:composition:name"/>
+ <reference key="uRI" uri="entry:composition:uri"/>
+ <reference key="partition" uri="entry:composition:partition"/>
<value key="workingDirectory" value="acme/workspace"/>
<value key="dimension"
class="net.dpml.composition.testing.Dimension">
<value class="int" value="35"/>

Modified:
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetComponent.java
==============================================================================
---
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetComponent.java
(original)
+++
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/WidgetComponent.java
Thu Apr 7 14:42:23 2005
@@ -19,6 +19,7 @@
package net.dpml.composition.testing;

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

import net.dpml.logging.Logger;

@@ -77,10 +78,18 @@
m_logger = logger;

m_name = m_context.getName();
- String partition = m_context.getPartition();
+ URI uri = m_context.getURI();
File work = m_context.getWorkingDirectory();

- m_logger.debug( "widget created" );
+ final String message =
+ "Widget created with a uri ["
+ + uri
+ + "] and name ["
+ + m_name
+ + "] with a working dir ["
+ + work
+ + "].";
+ m_logger.debug( message );
}

//------------------------------------------------------------------
@@ -158,9 +167,10 @@

public interface Context
{
- String getFoo();
+ URI getPartition();
+ URI getURI();
String getName();
- String getPartition();
+ String getFoo();
int getWidth();
int getHeight( int defaultHeight );
File getWorkingDirectory();

Modified: development/main/metro/composition/testing/unit/build.xml
==============================================================================
--- development/main/metro/composition/testing/unit/build.xml (original)
+++ development/main/metro/composition/testing/unit/build.xml Thu Apr 7
14:42:23 2005
@@ -29,8 +29,9 @@
<value class="int" value="35"/>
<value class="int" value="21"/>
</value>
- <value key="name" value="urn:metro:name"/>
- <value key="partition" value="urn:metro:partition"/>
+ <reference key="name" uri="entry:composition:name"/>
+ <reference key="uRI" uri="entry:composition:uri"/>
+ <reference key="partition" uri="entry:composition:partition"/>
<value key="workingDirectory" value="acme/workspace"/>
</context>
</component>
@@ -57,9 +58,10 @@
<value key="foo" value="bar"/>
<value key="width" value="12"/>
<value key="height" value="100"/>
- <value key="name" value="urn:metro:name"/>
- <value key="partition" value="urn:metro:partition"/>
<value key="workingDirectory" value="acme/workspace"/>
+ <reference key="name" uri="entry:composition:name"/>
+ <reference key="uRI" uri="entry:composition:uri"/>
+ <reference key="partition" uri="entry:composition:partition"/>
</context>
</component>
<component name="gizmo"
class="net.dpml.composition.testing.GizmoComponent">



  • svn commit: r2239 - in development/main/metro: automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder/datatypes composition/control/src/main/net/dpml/composition/control composition/control/src/main/net/dpml/composition/models composition/impl/src/main/net/dpml/composition/model/impl composition/testing/acme composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit, mcconnell, 04/07/2005

Archive powered by MHonArc 2.6.24.

Top of Page