Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2287 - in development/main/metro: automation/builder/src/main/net/dpml/automation/builder automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder 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/testing/unit/src/test/net/dpml/composition/testing main meta/api/src/main/net/dpml/meta/info system/impl/etc/main

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: r2287 - in development/main/metro: automation/builder/src/main/net/dpml/automation/builder automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder 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/testing/unit/src/test/net/dpml/composition/testing main meta/api/src/main/net/dpml/meta/info system/impl/etc/main
  • Date: Fri, 15 Apr 2005 01:15:04 -0400

Author: mcconnell AT dpml.net
Date: Fri Apr 15 01:15:02 2005
New Revision: 2287

Added:

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

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

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

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

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/ControlBuilder.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/BadStrategyException.java
Modified:

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java

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

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

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

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

development/main/metro/automation/control/src/main/net/dpml/automation/control/InvalidQueryException.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/PartReferenceBuilder.java

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilder.java

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.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/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/CompositionPartHandler.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/AbstractModel.java

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

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

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

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

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
development/main/metro/main/build.xml

development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
development/main/metro/system/impl/etc/main/dpml.system.properties
Log:
cleaning up

Modified:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
Fri Apr 15 01:15:02 2005
@@ -21,7 +21,7 @@
import java.net.URI;

/**
- * The contract for builders that create component part.
+ * The abstract contract for builders that create a objects that are builder
identified.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $

Modified:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
Fri Apr 15 01:15:02 2005
@@ -19,7 +19,7 @@
package net.dpml.automation.builder;

/**
- * An exception throws if an error occurs while introspecting a method.
+ * An exception throws if an error occurs while introspecting a method or
class.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $

Modified:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
Fri Apr 15 01:15:02 2005
@@ -23,16 +23,16 @@

import net.dpml.automation.part.Part;
import net.dpml.automation.part.PartReference;
-import net.dpml.automation.control.BadStrategyException;

/**
- * The contract for builders that create component part.
+ * The contract for builders that create component parts.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
public interface PartBuilder extends Builder
{
+
/**
* Return a urn identitifying the part handler for this builder.
*

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
Fri Apr 15 01:15:02 2005
@@ -28,15 +28,9 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public interface Control
+public interface Control extends Identifiable
{
/**
- * Return the uri identifying this controller.
- * @return the controller uri
- */
- URI getURI();
-
- /**
* Return a human readable short name of the controller.
* @return the controller name
*/

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlException.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlException.java
Fri Apr 15 01:15:02 2005
@@ -18,23 +18,60 @@

package net.dpml.automation.control;

+import java.net.URI;
+
/**
- * Unexpected runtime exception indicating an internal home error.
+ * Exception indicating an controller related error. A controller exception
+ * delcares the URI of the controller form which the exception was initiated.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
public class ControlException extends Exception
{
- public ControlException( String message )
+ private final URI m_uri;
+
+ /**
+ * Creation of a new ControlException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ */
+ public ControlException( URI controller )
{
- this( message, null );
+ this( controller, null );
}

- public ControlException( String message, Throwable cause )
+ /**
+ * Creation of a new ControlException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ * @param message the description of the exception
+ */
+ public ControlException( URI controller, String message )
+ {
+ this( controller, message, null );
+ }
+
+ /**
+ * Creation of a new ControlException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ * @param message the description of the exception
+ * @param cause the causal exception
+ */
+ public ControlException( URI controller, String message, Throwable cause
)
{
super( message, cause );
+ m_uri = controller;
}

+ /**
+ * Return the uri of the controller initiating this exception.
+ * @return the controller uri
+ */
+ public URI getControlURI()
+ {
+ return m_uri;
+ }
}


Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlRuntimeException.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlRuntimeException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlRuntimeException.java
Fri Apr 15 01:15:02 2005
@@ -18,23 +18,61 @@

package net.dpml.automation.control;

+import java.net.URI;
+
/**
- * Unexpected runtime exception indicating an internal home error.
+ * Exception indicating an unexpected controller related error. A
controller
+ * runtime exception delcares the URI of the controller form which the
exception
+ * was initiated.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
public class ControlRuntimeException extends RuntimeException
{
- public ControlRuntimeException( String message )
+ private final URI m_uri;
+
+ /**
+ * Creation of a new ControlRuntimeException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ */
+ public ControlRuntimeException( URI controller )
{
- super( message );
+ this( controller, null );
}

- public ControlRuntimeException( String message, Throwable cause )
+ /**
+ * Creation of a new ControlRuntimeException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ * @param message the description of the exception
+ */
+ public ControlRuntimeException( URI controller, String message )
+ {
+ this( controller, message, null );
+ }
+
+ /**
+ * Creation of a new ControlRuntimeException.
+ *
+ * @param controller the uri identifying the controller iniating the
exception
+ * @param message the description of the exception
+ * @param cause the causal exception
+ */
+ public ControlRuntimeException( URI controller, String message,
Throwable cause )
{
super( message, cause );
+ m_uri = controller;
}

+ /**
+ * Return the uri of the controller initiating this exception.
+ * @return the controller uri
+ */
+ public URI getControlURI()
+ {
+ return m_uri;
+ }
}


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
Fri Apr 15 01:15:02 2005
@@ -49,24 +49,17 @@
* <li>model:partition</li>
* </ol>
*
- * @param model the model
- * @param urn the uniform resource identifier
- * @return the resource
+ * An implementation may choose to provide support for additional urns
beyond those
+ * listed in the above table.
+ *
+ * @param model the model from which any model relative urn values are to
be resolved
+ * @param urn the uniform resource identifier identifying the requested
resource
+ * @return the resource matching the supplied urn
* @exception IllegalStateException if the supplied urn is not valid
*/
Object getResource( Model model, URI urn );

/**
- * Return a model identified by the supplied uri from the supplied model.
- * Recognized urn schemes include 'parts' and 'context'.
- *
- * @param model the enclosing model
- * @param urn the resource identifier
- * @return the nested model or null if the model is not found
- */
- Entry getEntry( Model model, URI urn ) throws EntryNotFoundException;
-
- /**
* Create a return a new model for a supplied part.
*
* @param partition the enclosing partition
@@ -76,37 +69,24 @@
* @return the model
*/
Model getModel( ClassLoader parent, Part part, String name )
- throws DelegationException, ModelException;
+ throws ModelException;

/**
- * Create a return a new nested model for a supplied part within the
supplied
- * enclosing model.
- *
- * @param model the enclosing model
- * @param parent the parent classloader
- * @param part the part datastructure
- * @param name the name to assign to the model
- * @return the model
- */
- Model getModel( Model model, ClassLoader parent, Part part, String name
)
- throws DelegationException, ModelException;
-
- /**
- * Create and return a new non-proxied instance of the component
represented
- * by the supplied model.
+ * Create and return an entry containing the default instance of the part
managed
+ * by the supplied model.
*
* @param model the component model
- * @return the resolved instance
+ * @return an entry containing instance value
*/
Entry create( Model model ) throws Exception;

/**
- * Create and return a new non-proxied instance of the component
represented
- * by the supplied model.
- *
+ * Create and return an entry containing an identifiable instance of the
part managed
+ * by the supplied model.
+ *
* @param model the component model
* @param key the instance key
- * @return the resolved instance
+ * @return an entry containing the key and instance value
*/
Entry create( Model model, Object key ) throws Exception;


Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Identifiable.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Identifiable.java
Fri Apr 15 01:15:02 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.automation.control;
+
+import java.net.URI;
+
+/**
+ * Interface implemented by objects that expose an identity.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public interface Identifiable
+{
+ /**
+ * Returns the identity of the object implementing this interface.
+ * @return a uri identifying the object
+ */
+ URI getURI();
+}

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/control/InvalidQueryException.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/control/InvalidQueryException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/InvalidQueryException.java
Fri Apr 15 01:15:02 2005
@@ -32,9 +32,9 @@
private URI m_model;
private URI m_query;

- public InvalidQueryException( URI model, URI query )
+ public InvalidQueryException( URI control, URI model, URI query )
{
- super( buildMessage( model, query ) );
+ super( control );
m_model = model;
m_query = query;
}
@@ -44,19 +44,21 @@
return m_model;
}

- public URI getQuery()
+ public URI getQueryURI()
{
return m_query;
}

- private static String buildMessage( URI model, URI query )
+ public String getMessage()
{
final String error =
- "The following query ["
- + query
- + "] was rejected as invalid when applied to the model ["
- + model
- + "].";
+ "Invalid query."
+ + "\nController: "
+ + getControlURI()
+ + "\nModel: "
+ + getModelURI()
+ + "\nQuery: "
+ + getQueryURI();
return error;
}
}

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/UnknownSchemaException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/UnknownSchemaException.java
Fri Apr 15 01:15:02 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.automation.control;
+
+import java.net.URI;
+
+/**
+ * Exception thrown when an attempt is made to reference an unknown handler.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class UnknownSchemaException extends ControlException
+{
+ private URI m_query;
+ private URI m_model;
+
+ public UnknownSchemaException( URI controller, URI model, URI query )
+ {
+ super( controller );
+ m_query = query;
+ m_model = model;
+ }
+
+ public URI getQueryURI()
+ {
+ return m_query;
+ }
+
+ public URI getModelURI()
+ {
+ return m_model;
+ }
+
+ public String getMessage()
+ {
+ final String error =
+ "Schema not recognized."
+ + "\nController: "
+ + getControlURI()
+ + "\nModel: "
+ + getModelURI()
+ + "\nQuery: "
+ + getQueryURI();
+ 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
Fri Apr 15 01:15:02 2005
@@ -24,6 +24,7 @@
import java.util.Map.Entry;

import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.Identifiable;

/**
* The Model interface defines a common view of a component part. Operations
@@ -32,7 +33,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public interface Model extends Entry
+public interface Model extends Entry, Identifiable
{
/**
* Return the primary controller assigned to the model.
@@ -41,18 +42,8 @@
Controller getController();

/**
- * Return a resource relative to the supplied urn.
- *
- * @param urn the uniform resource identifier
- * @return the resource
- * @exception IllegalStateException if the supplied urn is not valid
+ * Return the uri identifying the partition that this model is enclosed
within.
+ * @return the partition uri
*/
- Object getResource( URI urn );
-
URI getPartition();
-
- URI getURI();
-
- //Entry create() throws Exception;
-
}

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/PartReferenceBuilder.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/PartReferenceBuilder.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/PartReferenceBuilder.java
Fri Apr 15 01:15:02 2005
@@ -23,7 +23,6 @@

import net.dpml.automation.part.Part;
import net.dpml.automation.part.PartReference;
-import net.dpml.automation.control.BadStrategyException;
import net.dpml.automation.builder.PartBuilder;
import net.dpml.automation.builder.IntrospectionException;


Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilder.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilder.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilder.java
Fri Apr 15 01:15:02 2005
@@ -23,7 +23,6 @@

import net.dpml.automation.builder.Builder;
import net.dpml.automation.builder.IntrospectionException;
-import net.dpml.automation.control.BadStrategyException;

import net.dpml.meta.info.Type;


Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypeBuilderTask.java
Fri Apr 15 01:15:02 2005
@@ -50,7 +50,6 @@
import net.dpml.meta.info.PartDescriptor.Operation;

import net.dpml.automation.builder.IntrospectionException;
-import net.dpml.automation.control.BadStrategyException;

import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
@@ -142,7 +141,7 @@
log( "creating: " + subject.getName() );
InfoDescriptor info = createInfoDescriptor( subject );
ServiceDescriptor[] services = createServiceDescriptors( subject );
- DependencyDescriptor[] dependencies = createDependencyDescriptors(
subject );
+ DependencyDescriptor[] dependencies = new DependencyDescriptor[0];
// legacy
CategoryDescriptor[] categories = new CategoryDescriptor[0];
ContextDescriptor context = createContextDescriptor( subject );
PartDescriptor[] parts = createPartDescriptors( subject );
@@ -458,52 +457,6 @@
}
}

-
- /**
- * If the class contains an inner class named "Dependencies" then
- * resolve the key/inteterface clasname pairs based on the inner class
- * method names.
- * @param subject the component implmentation class
- * @return an array of dependency descriptors
- */
- private DependencyDescriptor[] createDependencyDescriptors( Class
subject ) throws IntrospectionException
- {
- String classname = subject.getName();
- Class[] classes = subject.getClasses();
- Class dependencies = locateClass( "$Dependencies", classes );
- if( null == dependencies )
- {
- return new DependencyDescriptor[0];
- }
- else
- {
- ArrayList list = new ArrayList();
- Method[] methods = dependencies.getMethods();
- for( int i=0; i<methods.length; i++ )
- {
- Method method = methods[i];
- DependencyDescriptor dep = createDependencyDescriptor(
method );
- list.add( dep );
- }
- return (DependencyDescriptor[]) list.toArray( new
DependencyDescriptor[0] );
- }
- }
-
- private DependencyDescriptor createDependencyDescriptor( Method method )
throws IntrospectionException
- {
- validateMethodName( method );
- Class returnType = method.getReturnType();
- validateNonNullReturnType( method, returnType );
- validateNonArrayReturnType( method, returnType );
- validateInterfaceReturnType( method, returnType );
- validateNoExceptions( method );
- validateAtMostOneParameter( method );
-
- String key = PartDescriptor.getPartKey( method, PartDescriptor.GET );
- String type = returnType.getName();
- return new DependencyDescriptor( key, type );
- }
-
private ServiceDescriptor[] createServiceDescriptors( Class subject )
{
ArrayList list = new ArrayList();

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
Fri Apr 15 01:15:02 2005
@@ -116,12 +116,11 @@
{
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 ) )
+ if( ( null == entry ) && ( null == part ) )
{
final String error =
- "The value ["
+ "The value key ["
+ key
+ "] is unknown relative to the component type ["
+ type.getInfo().getClassname()
@@ -138,7 +137,7 @@
}
else
{
- classname = dep.getReference().getClassname();
+ classname = part.getReturnType();
}
}


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
Fri Apr 15 01:15:02 2005
@@ -167,7 +167,7 @@
"Internal error occured while attempting to transform the uri
["
+ uri
+ "] to a url.";
- throw new ControlRuntimeException( error, e );
+ throw new ControlRuntimeException(
CompositionController.CONTROLLER_URI, error, e );
}
}
}

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
Fri Apr 15 01:15:02 2005
@@ -50,6 +50,7 @@
import net.dpml.automation.control.EntryNotFoundException;
import net.dpml.automation.control.ControlException;
import net.dpml.automation.control.Disposable;
+import net.dpml.automation.control.UnknownSchemaException;

import net.dpml.automation.model.ModelException;
import net.dpml.automation.model.Model;
@@ -59,9 +60,11 @@
import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ValueDirective;

+import net.dpml.composition.models.AbstractModel;
import net.dpml.composition.models.CompositionModel;
import net.dpml.composition.models.ValueModel;
import net.dpml.composition.models.Holder;
+import net.dpml.composition.models.EntryTable;

import net.dpml.system.SystemContext;

@@ -204,25 +207,41 @@
return m_partition.toString();
}

- public Entry getEntry( Model model, URI uri ) throws
EntryNotFoundException
+ public Entry getEntry( CompositionModel model, URI uri ) throws
EntryNotFoundException, UnknownSchemaException
{
- if( model instanceof CompositionModel )
+ if( null == uri )
{
- CompositionModel standard = (CompositionModel) model;
- return standard.getEntry( uri );
+ throw new NullPointerException( "uri" );
+ }
+ URI ref = model.getURI();
+ EntryTable table = getEntryTable( model, uri );
+ String path = uri.getSchemeSpecificPart();
+ Entry entry = table.getEntry( path );
+ if( null == entry )
+ {
+ throw new EntryNotFoundException( ref, uri );
}
else
{
- Controller controller = model.getController();
- if( this.equals( controller ) )
- {
- URI ref = getURI();
- throw new EntryNotFoundException( ref, uri );
- }
- else
- {
- return controller.getEntry( model, uri );
- }
+ return entry;
+ }
+ }
+
+ private EntryTable getEntryTable( CompositionModel model, URI uri )
throws UnknownSchemaException
+ {
+ final String scheme = uri.getScheme();
+ if( "context".equals( scheme ) )
+ {
+ return model.getContextTable();
+ }
+ else if( "parts".equals( scheme ) )
+ {
+ return model.getPartsTable();
+ }
+ else
+ {
+ URI ref = model.getURI();
+ throw new UnknownSchemaException( CONTROLLER_URI, ref, uri );
}
}

@@ -234,13 +253,13 @@
* @param key the key to assign to the model
* @return the model
*/
- public Model getModel( ClassLoader parent, Part part, String key )
throws DelegationException, ModelException
+ public Model getModel( ClassLoader parent, Part part, String key )
throws ModelException
{
return getModel( null, parent, part, key );
}

/**
- * Return the model for a supplied part.
+ * Return a nested model for a supplied part using enclosing model.
*
* @param model the enclosing model
* @param classloader the parent classloader
@@ -248,8 +267,8 @@
* @param key the key to assign to the model
* @return the model
*/
- public Model getModel( Model model, ClassLoader classloader, Part part,
String key )
- throws DelegationException, ModelException
+ public Model getModel( CompositionModel model, ClassLoader classloader,
Part part, String key )
+ throws ModelException
{
if( part instanceof ComponentProfile )
{
@@ -273,86 +292,16 @@
}
else
{
- final URI uri = part.getPartHandlerURI();
- if( getURI().equals( uri ) )
- {
- throw new UnsupportedPartTypeException(
part.getClass().getName() );
- }
- else
- {
- try
- {
- PartHandler handler = loadPartHandler( uri );
- Controller controller = handler.getController();
- if( null == model )
- {
- return controller.getModel( classloader, part, key );
- }
- else
- {
- return controller.getModel( model, classloader,
part, key );
- }
- }
- catch( HandlerNotFoundException e )
- {
- if( null == model )
- {
- final String error =
- "Cannot create model ["
- + key
- + "] because the part handler ["
- + uri
- + "] was not found.";
- throw new DelegationException( uri, error, e );
- }
- else
- {
- final String error =
- "Cannot create model ["
- + key
- + "] in the model ["
- + model.getURI()
- + "] because the part handler ["
- + uri
- + "] was not found.";
- throw new DelegationException( uri, error, e );
- }
- }
- catch( ModelException e )
- {
- if( null == model )
- {
- final String error =
- "Cannot create model ["
- + key
- + "] due to an external model related error raised
by ["
- + uri
- + "].";
- throw new DelegationException( uri, error, e );
- }
- else
- {
- final String error =
- "Cannot create model ["
- + key
- + "] in the model ["
- + model.getURI()
- + "] due to an external model related error raised
by ["
- + uri
- + "].";
- throw new DelegationException( uri, error, e );
- }
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected error raised by delegate while requesting
part model.";
- throw new DelegationException( uri, error, e );
- }
- }
+ final String error =
+ "The request to construct a model for the part type ["
+ + part.getClass().getName()
+ + "] is not supported.";
+ throw new UnsupportedOperationException( error );
}
}

+
+
/**
* Create and return an instance entry.
*
@@ -361,30 +310,7 @@
*/
public Entry create( Model model ) throws Exception
{
- if( model instanceof ValueModel )
- {
- return model;
- }
- else if( model instanceof CompositionModel )
- {
- return create( model, null );
- }
- else
- {
- Controller controller = model.getController();
- if( false == controller.equals( this ) )
- {
- return controller.create( model );
- }
- else
- {
- final String error =
- "Unsupported model implementation class ["
- + model.getClass().getName()
- + "] passed to 'create/1'.";
- throw new UnsupportedOperationException( error );
- }
- }
+ return create( model, null, "create/1" );
}

/**
@@ -396,6 +322,18 @@
*/
public Entry create( Model model, Object key ) throws Exception
{
+ return create( model, key, "create/2" );
+ }
+
+ /**
+ * Create and return an instance entry using a supplied instance
identifier.
+ *
+ * @param model the component model
+ * @param key the instance identifier
+ * @return the resolved instance
+ */
+ private Entry create( Model model, Object key, String method ) throws
Exception
+ {
if( model instanceof CompositionModel )
{
CompositionModel standard = (CompositionModel) model;
@@ -403,19 +341,13 @@
}
else
{
- Controller controller = model.getController();
- if( false == controller.equals( this ) )
- {
- return controller.create( model, key );
- }
- else
- {
- final String error =
- "Unsupported model implementation class ["
- + model.getClass().getName()
- + "] passed to 'create/2'.";
- throw new UnsupportedOperationException( error );
- }
+ final String error =
+ "Unsupported model implementation class ["
+ + model.getClass().getName()
+ + "] passed to "
+ + method
+ + ".";
+ throw new UnsupportedOperationException( error );
}
}

@@ -475,19 +407,11 @@
}
else
{
- Controller controller = model.getController();
- if( false == controller.equals( this ) )
- {
- return controller.resolve( model, key );
- }
- else
- {
- final String error =
- "Unsupported model implementation class ["
- + model.getClass().getName()
- + "] passed to 'resolve/3'.";
- throw new UnsupportedOperationException( error );
- }
+ final String error =
+ "Unsupported model implementation class ["
+ + model.getClass().getName()
+ + "] passed to resolve/n.";
+ throw new UnsupportedOperationException( error );
}
}

@@ -702,11 +626,11 @@
+ "] and path ["
+ path
+ "].";
- throw new ControlRuntimeException( error, e );
+ throw new ControlRuntimeException( CONTROLLER_URI, error, e );
}
}

- private static final URI CONTROLLER_URI = setupURI(
"@PART-CONTROLLER-URI@" );
+ 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
Fri Apr 15 01:15:02 2005
@@ -244,11 +244,11 @@
{
if( path.endsWith( "/" ) )
{
- return new URI( "part", path, null );
+ return new URI( "metro", path, null );
}
else
{
- return new URI( "part", path + "/", null );
+ return new URI( "metro", path + "/", null );
}
}
catch( URISyntaxException e )
@@ -257,7 +257,7 @@
"Internal exception while attempting to construct a part uri
relative to the system context uri ["
+ uri.toString()
+ "].";
- throw new ControlRuntimeException( error, e );
+ throw new RuntimeException( error, e );
}
}
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionPartHandler.java
Fri Apr 15 01:15:02 2005
@@ -28,7 +28,6 @@

import net.dpml.automation.part.Part;
import net.dpml.automation.part.PartHolder;
-import net.dpml.automation.control.BadStrategyException;
import net.dpml.automation.control.PartNotFoundException;
import net.dpml.automation.control.Controller;
import net.dpml.automation.control.PartHandler;

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
Fri Apr 15 01:15:02 2005
@@ -33,9 +33,12 @@

import net.dpml.automation.control.Controller;
import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.control.EntryNotFoundException;
+import net.dpml.automation.control.UnknownSchemaException;
import net.dpml.automation.model.Model;

import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.EntryTable;
import net.dpml.composition.models.Holder;

import net.dpml.system.SystemContext;
@@ -151,8 +154,7 @@
int semantic = PartDescriptor.getPartSemantic( method );
String postfix = PartDescriptor.getPartPostfix( method );
String key = PartDescriptor.getPartKey( method, semantic );
- URI uri = CompositionController.createURI( "parts", key );
- final Entry provider = getComponentModel().getEntry( uri );
+ Entry provider = getComponentModel().getPartsTable().getEntry( key );

if( PartDescriptor.SELECT == semantic )
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/AbstractModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/AbstractModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/AbstractModel.java
Fri Apr 15 01:15:02 2005
@@ -41,20 +41,21 @@
// state
//--------------------------------------------------------------

- private CompositionController m_controller;
- private String m_key;
+ private final CompositionController m_controller;
+ private final String m_key;

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

/**
- * Creation of a new context entry model.
+ * Abstract basee class for models within the composition package.
*
- * @param descriptor the context entry descriptor
- * @exception NullPointerException is the descriptor argument is null.
+ * @param controller the controller assigned to the model
+ * @param key the model key
+ * @exception NullPointerException if a null controller or key arument is
supplied
*/
- public AbstractModel( CompositionController controller, String key )
+ public AbstractModel( final CompositionController controller, final
String key )
throws NullPointerException
{
if( controller == null )
@@ -82,28 +83,6 @@
return getCompositionController();
}

- public CompositionController getCompositionController()
- {
- return m_controller;
- }
-
- /**
- * Return a resource relative to the supplied urn.
- *
- * @param urn the uniform resource identifier
- * @return the resource
- * @exception IllegalStateException if the supplied urn is not valid
- */
- public Object getResource( URI urn )
- {
- return getController().getResource( this, urn );
- }
-
- public Object getKey()
- {
- return m_key;
- }
-
public abstract URI getPartition();

public abstract URI getURI();
@@ -113,7 +92,19 @@
//--------------------------------------------------------------

/**
- * Return the entry value.
+ * Return the key identifying this model within the context is used.
+ * For example - a key may identify a a model relative to a collection of
+ * of parts or within a the set of context entries.
+ *
+ * @return the model key
+ */
+ public Object getKey()
+ {
+ return m_key;
+ }
+
+ /**
+ * Return the value of the model.
*
* @return the entry value
*/
@@ -124,9 +115,23 @@
*
* @param value the new value
* @return the old value
+ * @exception UnsupportedOperationException is thrown unless overriden
*/
public Object setValue( Object value )
{
throw new UnsupportedOperationException( "setValue/1" );
}
+
+ //--------------------------------------------------------------
+ // AbstractModel
+ //--------------------------------------------------------------
+
+ /**
+ * Return the primary controller assigned to the model.
+ * @return the primary controller
+ */
+ public CompositionController getCompositionController()
+ {
+ return m_controller;
+ }
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
Fri Apr 15 01:15:02 2005
@@ -67,7 +67,7 @@
private final ComponentProfile m_profile;
private final ClassLoader m_classloader;
private final URI m_partition;
- private final EntryTable m_parts;
+ private final PartsTable m_parts;
private final EntryTable m_context;
private final InstanceTable m_instances;
private final Class m_class;
@@ -87,7 +87,7 @@
*/
public CompositionModel(
CompositionController controller, URI partition, ClassLoader
classloader, ComponentProfile profile, String name )
- throws DelegationException, ModelException
+ throws ModelException
{
this( controller, null, partition, classloader, profile, name );
}
@@ -95,13 +95,6 @@
/**
* Creation of a new nested component model.
*
- * TODO: Update so that the constructor simply established the initial
state
- * (including validity) in such a way that we can progromatically update
the
- * state. As such only a small subset of operations in the constructor
will
- * result in a runtime exception (e.g. component class not found, etc.).
this
- * will require the creation of som sub-models such as DependenciesModel,
- * ContextModel, PartsModel, etc. - each representing a management
concern.
- *
* @param controller the model controller
* @param parent the enclosing parent model
* @param partition a name defineing the partition that this model exists
within
@@ -110,9 +103,9 @@
* @param name the name of the model
*/
public CompositionModel(
- CompositionController controller, Model parent, URI partition,
ClassLoader classloader,
+ CompositionController controller, CompositionModel parent, URI
partition, ClassLoader classloader,
ComponentProfile profile, String name )
- throws DelegationException, ModelException
+ throws ModelException
{
super( controller, name );

@@ -121,9 +114,10 @@
m_profile = profile;

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

@@ -303,44 +297,6 @@
return m_interfaces;
}

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

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/ContextTable.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/ContextTable.java
Fri Apr 15 01:15:02 2005
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.models;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Hashtable;
+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;
+import net.dpml.automation.model.ModelRuntimeException;
+import net.dpml.automation.model.ServiceClassNotFoundException;
+import net.dpml.automation.model.TypeClassNotFoundException;
+import net.dpml.automation.model.PartClassNotFoundException;
+
+import net.dpml.automation.control.EntryNotFoundException;
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.DelegationException;
+
+import net.dpml.automation.part.Part;
+
+import net.dpml.composition.data.ReferenceDirective;
+import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.data.ContextDirective;
+import net.dpml.composition.data.DependencyDirective;
+
+import net.dpml.composition.control.CompositionController;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.ServiceDescriptor;
+import net.dpml.meta.info.DependencyDescriptor;
+import net.dpml.meta.info.PartDescriptor;
+
+/**
+ * The parts model is a model of the set of parts maintained by a parent
model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class ContextTable extends EntryTable
+{
+ private final CompositionModel m_parent;
+
+ /**
+ * Creation of a new context entry table.
+ *
+ * @param model the composition model
+ * @param parent the enclosing parent composition model
+ */
+ public ContextTable(
+ CompositionModel model, CompositionModel parent )
+ {
+ super( model );
+ m_parent = parent;
+ }
+
+ public void addEntry( String key, Part part ) throws ModelException
+ {
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == part )
+ {
+ throw new NullPointerException( "part" );
+ }
+ if( containsKey( key ) )
+ {
+ throw new DuplicateKeyException( key );
+ }
+
+ CompositionModel parent = getParentModel();
+ if( part instanceof ReferenceDirective )
+ {
+ ReferenceDirective reference = (ReferenceDirective) part;
+ URI uri = reference.getURI();
+ if( null == parent )
+ {
+ final String error =
+ "The context entry ["
+ + key
+ + "] in the component ["
+ + getModel().getURI()
+ + "] is requesting a reference to a part ["
+ + uri
+ + "] which cannot be resolved as the component has no
enclosing composition model.";
+ throw new ModelException( error );
+ }
+ else
+ {
+ String ref = uri.getSchemeSpecificPart();
+ Entry entry = parent.getPartsTable().getEntry( ref );
+ if( null == entry )
+ {
+ final String error =
+ "Could not add part under the key ["
+ + key
+ + "] in the model ["
+ + getModel().getURI()
+ + "] because the reference ["
+ + uri
+ + "] was not found.";
+ throw new ModelException( error );
+ }
+ else
+ {
+ addEntry( key, entry );
+ }
+ }
+ }
+ else
+ {
+ super.addEntry( key, part );
+ }
+ }
+
+ protected CompositionModel getParentModel()
+ {
+ return m_parent;
+ }
+
+}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryTable.java
Fri Apr 15 01:15:02 2005
@@ -45,6 +45,8 @@
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.DependencyDirective;

+import net.dpml.composition.control.CompositionController;
+
import net.dpml.meta.info.Type;
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
@@ -58,25 +60,18 @@
*/
public class EntryTable
{
- private final Map m_entries = new Hashtable();
private final CompositionModel m_model;
- private final Model m_parent;
+
+ private final Map m_entries = new Hashtable();

/**
* Creation of a new entry table.
*
- * @param model the model
- * @param parent the enclosing parent model
- * @param partition the enclosing component uri
- * @param classloader the classloader established as the parent for the
parts
- * @param profile the component profile from which initial default values
are established
+ * @param model the composition model
*/
- public EntryTable(
- CompositionModel model, Model parent )
- throws DelegationException, ModelException
+ public EntryTable( CompositionModel model )
{
m_model = model;
- m_parent = parent;
}

public Entry getEntry( String key )
@@ -88,7 +83,16 @@
return (Entry) m_entries.get( key );
}

- public void addEntry( String key, Part part ) throws
DelegationException, ModelException
+ public boolean containsKey( String key )
+ {
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ return m_entries.containsKey( key );
+ }
+
+ public void addEntry( String key, Part part ) throws ModelException
{
if( null == key )
{
@@ -102,66 +106,14 @@
{
throw new DuplicateKeyException( key );
}
-
- Model parent = getParentModel();
- if( part instanceof ReferenceDirective )
- {
- ReferenceDirective ref = (ReferenceDirective) part;
- URI uri = ref.getURI();
- if( null == parent )
- {
- final String error =
- "The entry ["
- + key
- + "] in the component ["
- + getModel().getURI()
- + "] is requesting a reference to a part ["
- + uri
- + "] which cannot be resolved as the component has no
enclosing parent.";
- throw new ModelException( error );
- }
- else
- {
- try
- {
- Entry model = getModel().getController().getEntry(
parent, uri );
- addEntry( key, model );
- }
- catch( EntryNotFoundException e )
- {
- final String error =
- "Could not add part under the key ["
- + key
- + "] because ["
- + uri
- + "] was not found.";
- throw new ModelException( error, e );
- }
- catch( Throwable e )
- {
- final String error =
- "Could not add part under the key ["
- + key
- + "] in the model ["
- + getModel().getURI()
- + "] due to an unexpected error when invoking the
query ["
- + uri
- + "].";
- throw new ModelException( error, e );
- }
- }
- }
- else
- {
- ClassLoader classloader = getModel().getClassLoader();
- Model model = getModel();
- Controller controller = model.getController();
- Entry entry = controller.getModel( model, classloader, part, key
);
- addEntry( key, entry );
- }
+ ClassLoader classloader = getModel().getClassLoader();
+ CompositionModel model = getModel();
+ CompositionController controller = model.getCompositionController();
+ Entry entry = controller.getModel( model, classloader, part, key );
+ addEntry( key, entry );
}

- public void addEntry( String key, Entry entry ) throws
DelegationException, ModelException
+ public void addEntry( String key, Entry entry ) throws ModelException
{
if( null == key )
{
@@ -227,13 +179,8 @@
}
}

- private CompositionModel getModel()
+ protected CompositionModel getModel()
{
return m_model;
}
-
- private Model getParentModel()
- {
- return m_parent;
- }
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
Fri Apr 15 01:15:02 2005
@@ -30,7 +30,7 @@
import net.dpml.automation.control.Monitor;
import net.dpml.automation.control.LifecycleException;
import net.dpml.automation.control.ControlRuntimeException;
-import net.dpml.automation.control.Monitor;
+import net.dpml.automation.control.Identifiable;

import net.dpml.composition.control.CompositionController;

@@ -43,7 +43,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: LifestyleManager.java 259 2004-10-30 07:24:40Z mcconnell $
*/
-public class Holder implements Entry
+public class Holder implements Entry, Identifiable
{
private final Map m_proxies = new WeakHashMap();

@@ -85,7 +85,7 @@
}
else
{
- String fragment = getFragment( getKey() );
+ String fragment = getFragment( m_key );
m_uri = CompositionController.createInstanceURI( base, fragment
);
}


Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/PartsTable.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/PartsTable.java
Fri Apr 15 01:15:02 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2005 Stephen J. McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.composition.models;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Hashtable;
+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;
+import net.dpml.automation.model.ModelRuntimeException;
+import net.dpml.automation.model.ServiceClassNotFoundException;
+import net.dpml.automation.model.TypeClassNotFoundException;
+import net.dpml.automation.model.PartClassNotFoundException;
+
+import net.dpml.automation.control.EntryNotFoundException;
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.DelegationException;
+
+import net.dpml.automation.part.Part;
+
+import net.dpml.composition.data.ReferenceDirective;
+import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.data.ContextDirective;
+import net.dpml.composition.data.DependencyDirective;
+
+import net.dpml.composition.control.CompositionController;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.ServiceDescriptor;
+import net.dpml.meta.info.DependencyDescriptor;
+import net.dpml.meta.info.PartDescriptor;
+
+/**
+ * The parts model is a model of the set of parts maintained by a parent
model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class PartsTable extends EntryTable
+{
+ /**
+ * Creation of a new parts table.
+ *
+ * @param model the composition model
+ */
+ public PartsTable( CompositionModel model )
+ {
+ super( model );
+ }
+
+ public void addEntry( String key, Part part ) throws ModelException
+ {
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == part )
+ {
+ throw new NullPointerException( "part" );
+ }
+ if( part instanceof ReferenceDirective )
+ {
+ final String error =
+ "Illegal attempt to add a parts reference parts within ["
+ + getModel().getURI()
+ + "] under the key ["
+ + key
+ + "].";
+ }
+ else
+ {
+ super.addEntry( key, part );
+ }
+ }
+}

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
Fri Apr 15 01:15:02 2005
@@ -60,8 +60,12 @@
/**
* Creation of a new context entry import model.
*
- * @param descriptor the context entry descriptor
- * @param directive the context entry directive
+ * @param name the name of this value model
+ * @param controller the value model's controller
+ * @param classloader the assigned classloader
+ * @param directive the value directive from which we construct the value
model
+ * @param model the enclosing model
+
* @exception NullArgumentException if either the directive argument or
the
* context argument is null.
*/
@@ -665,17 +669,23 @@
{
String arg = argument.substring( 11 );
URI urn = CompositionController.createURI( "system", arg );
- return m_model.getResource( urn );
+ return getParentResource( urn );
}
else if ( argument.startsWith( "urn:model:" ) )
{
String arg = argument.substring( 10 );
URI urn = CompositionController.createURI( "model", arg );
- return m_model.getResource( urn );
+ return getParentResource( urn );
}
else
{
return null;
}
}
+
+ private Object getParentResource( URI urn )
+ {
+ Controller modelController = m_model.getController();
+ return modelController.getResource( m_model, urn );
+ }
}

Modified:
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
==============================================================================
---
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
(original)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
Fri Apr 15 01:15:02 2005
@@ -112,6 +112,23 @@
}

/**
+ * Test the construction of the widget implementation and invocation
+ * of a non-service public method on the implementation class.
+ */
+ public void testIdentifiableEntryCreation() throws Exception
+ {
+ String id = "niclas";
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( PATH );
+ Model model = helper.getCompositionManager().addPart( uri, "widget"
);
+ Controller controller = model.getController();
+ Entry entry = controller.create( model, id );
+ Object key = entry.getKey();
+ assertEquals( "key", id, key );
+ controller.release( entry );
+ }
+
+ /**
* Test the construction of an identifiable widget instance. We create
* widgets w1 and w2 under unique ids and check that they are in fact
* unique. Then we create w3 using the same key as we used for w1 and

Modified: development/main/metro/main/build.xml
==============================================================================
--- development/main/metro/main/build.xml (original)
+++ development/main/metro/main/build.xml Fri Apr 15 01:15:02 2005
@@ -8,6 +8,7 @@
<target name="init" depends="standard.init">
<x:filter feature="plugin" token="METRO-PLUGIN-URI"/>
<x:filter feature="plugin" key="dpml-system-impl"
token="SYSTEM-PLUGIN-URI"/>
+ <x:filter feature="plugin" key="dpml-composition-control"
token="FREIGHT-TRAIN-CONTROLLER-URI"/>
<x:filter feature="plugin" key="dpml-composition-impl"
token="COMPOSITION-IMPL-ARTIFACT-URI"/>
<x:filter feature="plugin" key="dpml-activation-impl"
token="RUNTIME-IMPL-ARTIFACT-URI"/>
<x:filter feature="version" key="dpml-transit-main"
token="TRANSIT_VERSION"/>

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java
Fri Apr 15 01:15:02 2005
@@ -306,6 +306,25 @@
return null;
}

+ public String getReturnType()
+ {
+ Operation[] operations = getOperations();
+ for( int i=0; i<operations.length; i++ )
+ {
+ Operation operation = operations[i];
+ if( SELECT == operation.getSemantic() )
+ {
+ if( null == operation.getPostfix() )
+ {
+ return operation.getType();
+ }
+ }
+ }
+ return null;
+ }
+
+
+
/**
* Compare this object with another for equality.
* @param other the object to compare this object with
@@ -448,6 +467,7 @@
}
}

+
private static String formatKey( String method, int offset )
{
String string = method.substring( offset );

Modified: development/main/metro/system/impl/etc/main/dpml.system.properties
==============================================================================
--- development/main/metro/system/impl/etc/main/dpml.system.properties
(original)
+++ development/main/metro/system/impl/etc/main/dpml.system.properties Fri
Apr 15 01:15:02 2005
@@ -6,7 +6,7 @@
# the system context criteria creation phase.
#

-dpml.system.domain = system:dpml/local
+dpml.system.domain = system:local
dpml.system.logging.artifact = @DEFAULT-LOGGING-PLUGIN-SPEC@
dpml.system.anchor = ${dpml.home}/lib




  • svn commit: r2287 - in development/main/metro: automation/builder/src/main/net/dpml/automation/builder automation/control/src/main/net/dpml/automation/control automation/control/src/main/net/dpml/automation/model composition/builder/src/main/net/dpml/composition/builder 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/testing/unit/src/test/net/dpml/composition/testing main meta/api/src/main/net/dpml/meta/info system/impl/etc/main, mcconnell, 04/14/2005

Archive powered by MHonArc 2.6.24.

Top of Page