Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2196 - in development/main: metro metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/automation/builder/src/main/net/dpml/automation/builder metro/automation/builder/src/main/net/dpml/builder metro/automation/control/src/main/net/dpml/automation/control metro/automation/control/src/main/net/dpml/automation/model metro/automation/control/src/main/net/dpml/automation/part metro/automation/control/src/main/net/dpml/control metro/automation/part metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/builder/src/main/net/dpml/composition/builder metro/composition/builder/src/main/net/dpml/composition/builder/datatypes metro/composition/control/src/main/net/dpml/composition/control metro/composition/control/src/main/net/dpml/composition/models metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/testing/classic metro/composition/testing/classic/src metro/composition/testing/system metro/composition/testing/system/src/test/net/dpml/composition/testing metro/composition/testing/unit metro/meta/api/src/main/net/dpml/meta/info metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/spi/src/main/net/dpml/meta/info/builder transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/monitors

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: r2196 - in development/main: metro metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/automation/builder/src/main/net/dpml/automation/builder metro/automation/builder/src/main/net/dpml/builder metro/automation/control/src/main/net/dpml/automation/control metro/automation/control/src/main/net/dpml/automation/model metro/automation/control/src/main/net/dpml/automation/part metro/automation/control/src/main/net/dpml/control metro/automation/part metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/builder/src/main/net/dpml/composition/builder metro/composition/builder/src/main/net/dpml/composition/builder/datatypes metro/composition/control/src/main/net/dpml/composition/control metro/composition/control/src/main/net/dpml/composition/models metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/testing/classic metro/composition/testing/classic/src metro/composition/testing/system metro/composition/testing/system/src/test/net/dpml/composition/testing metro/composition/testing/unit metro/meta/api/src/main/net/dpml/meta/info metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/spi/src/main/net/dpml/meta/info/builder transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/monitors
  • Date: Sun, 03 Apr 2005 12:29:18 -0400

Author: mcconnell AT dpml.net
Date: Sun Apr 3 12:29:16 2005
New Revision: 2196

Added:

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/
- copied from r2178,
development/main/metro/automation/builder/src/main/net/dpml/builder/

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
- copied, changed from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/Builder.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/BuilderRuntimeException.java
- copied, changed from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/BuilderRuntimeException.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/ControlBuilder.java
- copied, changed from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/ControlBuilder.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
- copied, changed from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/IntrospectionException.java

development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
- copied, changed from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/PartBuilder.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/
- copied from r2178,
development/main/metro/automation/control/src/main/net/dpml/control/

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

development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/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
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/ControlRuntimeException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/DelegationException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/DelegationException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/DuplicateNameException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/DuplicateNameException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/HandlerNotFoundException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/HandlerNotFoundException.java

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

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

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

development/main/metro/automation/control/src/main/net/dpml/automation/control/Monitor.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/Monitor.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/NoSuchControlException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/NoSuchControlException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandler.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartHandler.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandlerRuntimeException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartHandlerRuntimeException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartNotFoundException.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/SystemManager.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java

development/main/metro/automation/control/src/main/net/dpml/automation/control/UnsupportedPartTypeException.java
- copied, changed from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/UnsupportedPartTypeException.java

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

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

development/main/metro/automation/control/src/main/net/dpml/automation/part/

development/main/metro/automation/control/src/main/net/dpml/automation/part/Part.java

development/main/metro/automation/control/src/main/net/dpml/automation/part/PartHolder.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceException.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/ContextInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/DependencyInvocationHandler.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/DependencyModel.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/ValueModel.java
development/main/metro/composition/testing/classic/
- copied from r2178, development/main/metro/composition/testing/unit/
development/main/metro/composition/testing/classic/build.properties
- copied unchanged from r2195,
development/main/metro/composition/testing/unit/build.properties
development/main/metro/composition/testing/classic/build.xml
- copied, changed from r2195,
development/main/metro/composition/testing/unit/build.xml
development/main/metro/composition/testing/classic/src/
- copied from r2195,
development/main/metro/composition/testing/unit/src/
development/main/metro/meta/api/src/main/net/dpml/meta/info/TypeHolder.java
Removed:
development/main/metro/automation/builder/src/main/net/dpml/builder/

development/main/metro/automation/control/src/main/net/dpml/automation/control/Model.java
development/main/metro/automation/control/src/main/net/dpml/control/
development/main/metro/automation/part/
development/main/metro/composition/testing/unit/

development/main/metro/meta/spi/src/main/net/dpml/meta/info/builder/TypeHolder.java
Modified:

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ValueDirective.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java

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

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

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

development/main/metro/composition/builder/src/main/net/dpml/composition/builder/SerializableObjectHelper.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/TypesTask.java

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

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/PartsDataType.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/ConsoleMonitor.java

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

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

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
development/main/metro/composition/testing/system/build.xml

development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
development/main/metro/index.xml

development/main/metro/meta/api/src/main/net/dpml/meta/info/PartDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/SerializedTypeCreator.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java

development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java

development/main/transit/core/handler/src/main/net/dpml/transit/cache/RemoteCacheHandler.java

development/main/transit/core/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
Log:
Initial freight-train implementation.

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ContextInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -73,8 +73,7 @@
/**
* Create a context invocation handler.
*
- * @param type the component type
- * @param map a map of context values keyed by entry key
+ * @param model the component model
*/
public ContextInvocationHandler( ComponentModel model )
throws NullPointerException

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DependencyInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -74,8 +74,7 @@
/**
* Create a dependency invocation handler.
*
- * @param type the component type
- * @param map a map of context values keyed by entry key
+ * @param model the component model
*/
public DependencyInvocationHandler( ComponentModel model )
throws NullPointerException

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/PartsInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -73,7 +73,6 @@
* Create a dependency invocation handler.
*
* @param type the component type
- * @param map a map of context values keyed by entry key
*/
public PartsInvocationHandler( Type type )
throws NullPointerException

Copied:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
(from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/Builder.java)
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/builder/Builder.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/Builder.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.builder;
+package net.dpml.automation.builder;

import java.net.URI;


Copied:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/BuilderRuntimeException.java
(from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/BuilderRuntimeException.java)
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/builder/BuilderRuntimeException.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/BuilderRuntimeException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.builder;
+package net.dpml.automation.builder;

/**
* An exception throws if an internal error occurs during builder execution.

Copied:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/ControlBuilder.java
(from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/ControlBuilder.java)
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/builder/ControlBuilder.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/ControlBuilder.java
Sun Apr 3 12:29:16 2005
@@ -16,11 +16,11 @@
* limitations under the License.
*/

-package net.dpml.builder;
+package net.dpml.automation.builder;

import java.net.URI;

-import net.dpml.control.Control;
+import net.dpml.automation.control.Control;

/**
* The contract for builders that creates a control descriptor.

Copied:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
(from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/IntrospectionException.java)
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/builder/IntrospectionException.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/IntrospectionException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.builder;
+package net.dpml.automation.builder;

/**
* An exception throws if an error occurs while introspecting a method.

Copied:
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
(from r2195,
development/main/metro/automation/builder/src/main/net/dpml/builder/PartBuilder.java)
==============================================================================
---
development/main/metro/automation/builder/src/main/net/dpml/builder/PartBuilder.java
(original)
+++
development/main/metro/automation/builder/src/main/net/dpml/automation/builder/PartBuilder.java
Sun Apr 3 12:29:16 2005
@@ -16,13 +16,13 @@
* limitations under the License.
*/

-package net.dpml.builder;
+package net.dpml.automation.builder;

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

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

/**
* The contract for builders that create component part.

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/BadStrategyException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/BadStrategyException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,52 @@
+/*
+ * 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 strategy handler attempts to handle an
+ * incompatible type.
+ *
+ * @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 BadStrategyException extends Exception
+{
+ private URI m_handler;
+ private URI m_requested;
+
+ public BadStrategyException( URI handler, URI requested )
+ {
+ super( requested.toString() );
+ m_handler = handler;
+ m_requested = requested ;
+ }
+
+ public URI getHandlerURI()
+ {
+ return m_handler;
+ }
+
+ public URI getRequestedURI()
+ {
+ return m_requested;
+ }
+}
+

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/Control.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/Control.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Control.java
Sun Apr 3 12:29:16 2005
@@ -16,11 +16,11 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

import java.net.URI;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

/**
* Common interface implemented by controls.

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+/**
+ * Unexpected runtime exception indicating an internal home error.
+ *
+ * @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 )
+ {
+ this( message, null );
+ }
+
+ public ControlException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
+

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlRuntimeException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/ControlRuntimeException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/ControlRuntimeException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/ControlRuntimeException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

/**
* Unexpected runtime exception indicating an internal home error.
@@ -26,6 +26,11 @@
*/
public class ControlRuntimeException extends RuntimeException
{
+ public ControlRuntimeException( String message )
+ {
+ super( message );
+ }
+
public ControlRuntimeException( String message, Throwable cause )
{
super( message, cause );

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/Controller.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Controller.java
Sun Apr 3 12:29:16 2005
@@ -16,12 +16,14 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

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

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.model.Model;
+import net.dpml.automation.model.ModelException;

/**
* The Controller interface defines the a contract for a object that is
capable of
@@ -34,12 +36,49 @@
public interface Controller extends Control
{
/**
- * Create and return a serializable model using a supplied classloader
and part
- * datatype.
+ * Return the model for a supplied part.
*
- * @param part the immutable part datatype
- * @return the mutable model
+ * @param partition the enclosing partition
+ * @param parent the parent classloader
+ * @param part the part datastructure
+ * @return the model
*/
- Model getModel( ClassLoader classloader, Part part ) throws
DelegationException;
+ Model getModel( String partition, ClassLoader parent, Part part )
+ throws DelegationException, ModelException;

+ /**
+ * Return the model for a supplied part.
+ *
+ * @param model the enclosing model
+ * @param partition the enclosing partition
+ * @param parent the parent classloader
+ * @param part the part datastructure
+ * @return the model
+ */
+ Model getModel( Model model, String partition, ClassLoader parent, Part
part )
+ throws DelegationException, ModelException;
+
+ /**
+ * Create and return a new instance of the component represented
+ * by the supplied model.
+ *
+ * @param model the component model
+ * @return the resolved instance
+ */
+ Object resolve( Model model ) throws Exception;
+
+ /**
+ * Return a component instance
+ *
+ * @param instance the instance to release
+ */
+ void release( Object instance );
+
+ /**
+ * Return a model identified by the supplied path within the supplied
model.
+ * @param model the enclosing model
+ * @param path the nested part address
+ * @return the nested model or null if the model is not found
+ */
+ Model getProvider( Model model, String path );
}

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/DelegationException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/DelegationException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/DelegationException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/DelegationException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

import java.net.URI;


Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/DuplicateNameException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/DuplicateNameException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/DuplicateNameException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/DuplicateNameException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

/**
* Exception thrown when an attempt is made to reference an unknown handler.

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/HandlerNotFoundException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/HandlerNotFoundException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/HandlerNotFoundException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/HandlerNotFoundException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

import java.net.URI;


Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifecycleException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifecycleException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.automation.control;
+
+/**
+ * Exception to indicate that there was a lifecycle related error.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: LifecycleException.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class LifecycleException
+ extends Exception
+{
+ /**
+ * Construct a new <code>LifecycleException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public LifecycleException( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>LifecycleException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param throwable the root cause of the exception
+ */
+ public LifecycleException( final String message, final Throwable
throwable )
+ {
+ super( message, throwable );
+ }
+}
+

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifecycleRuntimeException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifecycleRuntimeException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.automation.control;
+
+/**
+ * Exception to indicate that there was a lifecycle runtime related error.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: LifecycleRuntimeException.java 259 2004-10-30 07:24:40Z
mcconnell $
+ */
+public class LifecycleRuntimeException
+ extends RuntimeException
+{
+ /**
+ * Construct a new <code>LifecycleRuntimeException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public LifecycleRuntimeException( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>LifecycleRuntimeException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param throwable the root cause of the exception
+ */
+ public LifecycleRuntimeException( final String message, final Throwable
throwable )
+ {
+ super( message, throwable );
+ }
+}
+

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifestyleException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/LifestyleException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.automation.control;
+
+/**
+ * Exception to indicate that there was a lifecycle related error.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: LifecycleException.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class LifestyleException
+ extends Exception
+{
+ /**
+ * Construct a new <code>LifecycleException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public LifestyleException( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>LifestyleException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param throwable the root cause of the exception
+ */
+ public LifestyleException( final String message, final Throwable
throwable )
+ {
+ super( message, throwable );
+ }
+}
+

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/Monitor.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/Monitor.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/Monitor.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/Monitor.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

/**
* Monitor supplied to a startable controller.
@@ -28,25 +28,25 @@
{
/**
* Log the supplied debug level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
void debug( String message );

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
void info( String message );

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
void warn( String message );

/**
* Log the supplied error level message.
- * @param mesage the message to log
+ * @param message the message to log
* @param throwable the exception
*/
void error( String message, Throwable throwable );

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/NoSuchControlException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/NoSuchControlException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/NoSuchControlException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/NoSuchControlException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

/**
* An exception thrown in responde to a request for an unknown control.

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandler.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartHandler.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/PartHandler.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandler.java
Sun Apr 3 12:29:16 2005
@@ -16,12 +16,12 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

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

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

/**
* Definition of a part handler.

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandlerRuntimeException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartHandlerRuntimeException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/PartHandlerRuntimeException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartHandlerRuntimeException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

/**
* Unexpected runtime exception indicating an internal part handler error.

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/PartNotFoundException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/PartNotFoundException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/PartNotFoundException.java
Sun Apr 3 12:29:16 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

import java.net.URI;


Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/SystemManager.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/SystemManager.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/SystemManager.java
Sun Apr 3 12:29:16 2005
@@ -16,12 +16,14 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

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

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.model.Model;
+import net.dpml.automation.model.ModelException;

/**
* The SystemManager interface defines the a contract for a object that is
capable of
@@ -31,14 +33,14 @@
* @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 SystemManager
+public interface SystemManager extends Controller
{
/**
* Add a part designated by a supplied uri to the system scope.
* @param uri a part uri
* @return the management view of the loaded part
*/
- Model addPart( URI uri ) throws IOException, DelegationException,
PartNotFoundException;
+ Model addPart( URI uri ) throws IOException, DelegationException,
ModelException, PartNotFoundException;

/**
* Add a model to the system scope.
@@ -47,13 +49,6 @@
void addModel( Model model );

/**
- * Return a new model for tyhe supplied part.
- * @param part the part datastructure
- * @return the model
- */
- Model getModel( ClassLoader classloader, Part part ) throws
DelegationException;
-
- /**
* Start the system.
* @exception if a startup failure occurs
*/

Copied:
development/main/metro/automation/control/src/main/net/dpml/automation/control/UnsupportedPartTypeException.java
(from r2195,
development/main/metro/automation/control/src/main/net/dpml/control/UnsupportedPartTypeException.java)
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/control/UnsupportedPartTypeException.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/control/UnsupportedPartTypeException.java
Sun Apr 3 12:29:16 2005
@@ -16,11 +16,11 @@
* limitations under the License.
*/

-package net.dpml.control;
+package net.dpml.automation.control;

import java.net.URI;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

/**
* Exception thrown when an strategy handler attempts to handle an
@@ -51,3 +51,4 @@

}

+

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,42 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+import net.dpml.automation.control.Controller;
+
+/**
+ * The Model interface defines a common view of a component part. Operations
+ * delcared on this interface concern the managment of the model state.
+ *
+ * @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
+{
+ String getName();
+
+ String getPartition();
+
+ String getQualifiedName();
+
+ Controller getController();
+
+}

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/model/ModelRuntimeException.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/model/ModelRuntimeException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,35 @@
+/*
+ * 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.model;
+
+/**
+ * Unexpected runtime exception indicating an internal model error.
+ *
+ * @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 ModelRuntimeException extends RuntimeException
+{
+ public ModelRuntimeException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
+

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/part/Part.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/part/Part.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,40 @@
+/*
+ * 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.part;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * The common interface implemented by all 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 Part extends Serializable
+{
+ static final String ARTIFACT_TYPE = "part";
+
+ /**
+ * Return the part handler uri.
+ * @return the uri of the part handler
+ */
+ URI getPartHandlerURI();
+
+}

Added:
development/main/metro/automation/control/src/main/net/dpml/automation/part/PartHolder.java
==============================================================================
--- (empty file)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/part/PartHolder.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,98 @@
+/*
+ * 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.part;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Properties;
+import java.io.Serializable;
+
+/**
+ *
+ *
+ * @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 PartHolder implements Serializable
+{
+ private final URI m_handler;
+ private final byte[] m_part;
+
+ public PartHolder( URI handler, byte[] part )
+ {
+ m_handler = handler;
+ m_part = part;
+ }
+
+ public URI getPartHandlerURI()
+ {
+ return m_handler;
+ }
+
+ public byte[] getByteArray()
+ {
+ return m_part;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_handler.hashCode();
+ for( int i=0; i<m_part.length; i++ )
+ {
+ hash ^= new Byte( m_part[i] ).hashCode();
+ }
+ return hash;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof PartHolder )
+ {
+ PartHolder holder = (PartHolder) other;
+ if( getPartHandlerURI().equals( holder.getPartHandlerURI() ) ==
false )
+ {
+ return false;
+ }
+ else if( Arrays.equals( getByteArray(), holder.getByteArray() )
== false )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public String toString()
+ {
+ return "[part-holder handler:" + m_handler + " size:" +
m_part.length + "]";
+ }
+
+}
+

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
Sun Apr 3 12:29:16 2005
@@ -53,7 +53,6 @@
/**
* Create a ClasspathDirective instance.
*
- * @param filesets the filesets to be included in a classloader
* @param uris the set of artifact uris
*/
public ClasspathDirective( final URI[] uris )

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
Sun Apr 3 12:29:16 2005
@@ -18,17 +18,14 @@

package net.dpml.composition.data;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

import net.dpml.configuration.Configuration;
import net.dpml.parameters.Parameters;
import net.dpml.meta.info.InfoDescriptor;
-
import net.dpml.lang.NullArgumentException;
-
import net.dpml.logging.data.CategoriesDirective;

-
/**
* Definition of the criteria for an explicit component profile. A profile,
when
* included within the scope of a container declaration will be instantiated
in
@@ -112,6 +109,11 @@
private int m_collection;

/**
+ * The component lifestyle policy.
+ */
+ private final String m_lifestyle;
+
+ /**
* The component classname.
*/
private final String m_classname;
@@ -156,7 +158,7 @@
throws NullArgumentException
{
this(
- name, DeploymentProfile.DEFAULT,
InfoDescriptor.UNDEFINED_COLLECTION, classname, null, null, null,
+ name, DeploymentProfile.DEFAULT,
InfoDescriptor.UNDEFINED_COLLECTION, "request", classname, null, null, null,
null, null, null, null, Mode.IMPLICIT );
}

@@ -172,6 +174,7 @@
name,
template.getActivationPolicy(),
template.getCollectionPolicy(),
+ template.getLifestylePolicy(),
template.getClassname(),
template.getCategoriesDirective(),
template.getContextDirective(),
@@ -187,6 +190,7 @@
final String name,
final int activation,
final int collection,
+ final String lifestyle,
final String classname,
final CategoriesDirective categories,
final ContextDirective context,
@@ -214,6 +218,15 @@
m_context = context;
}

+ if( null == lifestyle )
+ {
+ m_lifestyle = "request";
+ }
+ else
+ {
+ m_lifestyle = lifestyle;
+ }
+
m_collection = collection;
m_classname = classname;
m_parameters = parameters;
@@ -252,6 +265,16 @@
}

/**
+ * Return the component lifestyle policy.
+ *
+ * @return the lifestyle policy value
+ */
+ public String getLifestylePolicy()
+ {
+ return m_lifestyle;
+ }
+
+ /**
* Return the component collection policy. If null, the component
* type collection policy will apply.
*

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
Sun Apr 3 12:29:16 2005
@@ -20,11 +20,9 @@

import java.util.ArrayList;

-import net.dpml.part.Part;
-
-import net.dpml.meta.info.ServiceDescriptor;
-
+import net.dpml.automation.part.Part;
import net.dpml.logging.data.CategoriesDirective;
+import net.dpml.meta.info.ServiceDescriptor;

/**
* A containment profile describes a containment context including
@@ -81,9 +79,10 @@
* Creation of a new containment profile.
*
* @param name the profile name
- * @param classpath the description of the classpath
+ * @param classloader the description of the classloader
* @param exports the set of servides that this component is
* dependent on for normal execution
+ * @param categories the categories directive
* @param profiles the set of profiles contained within this
* containment profile
*/

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
Sun Apr 3 12:29:16 2005
@@ -23,7 +23,7 @@
import java.net.URI;
import java.net.URISyntaxException;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

import net.dpml.logging.data.CategoriesDirective;


Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ValueDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ValueDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ValueDirective.java
Sun Apr 3 12:29:16 2005
@@ -24,7 +24,7 @@

import net.dpml.lang.NullArgumentException;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

/**
* A <code>Value</code> represents a single constructor typed argument
value. The directive

Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
Sun Apr 3 12:29:16 2005
@@ -19,7 +19,7 @@

import junit.framework.TestCase;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContextDirective;
@@ -61,6 +61,7 @@
private String m_name;
private String m_classname;
private int m_collection;
+ private String m_lifestyle;
private ClassLoaderDirective m_classpath;

public ComponentProfileTestCase( String name )
@@ -83,12 +84,13 @@
m_collection = InfoDescriptor.SOFT_COLLECTION;
m_classpath = null;
m_parts = new Part[0];
+ m_lifestyle = "request";
}

public void testProfile() throws Exception
{
ComponentProfile profile = new ComponentProfile(
- m_name, m_activation, m_collection, m_classname, m_categories,
+ m_name, m_activation, m_collection, m_lifestyle, m_classname,
m_categories,
m_context, m_dependencies, m_parts, m_parameters,
m_configuration, m_classpath, m_mode );

@@ -101,12 +103,13 @@
assertEquals( "parameters", m_parameters, profile.getParameters() );
assertEquals( "configuration", m_configuration,
profile.getConfiguration() );
assertEquals( "context", m_context, profile.getContextDirective() );
+ assertEquals( "lifestyle", m_lifestyle, profile.getLifestylePolicy()
);
}

public void testSerialization() throws Exception
{
ComponentProfile profile = new ComponentProfile(
- m_name, m_activation, m_collection, m_classname, m_categories,
+ m_name, m_activation, m_collection, m_lifestyle, m_classname,
m_categories,
m_context, m_dependencies, m_parts, m_parameters,
m_configuration, m_classpath, m_mode );
testSerialization( profile );

Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ContainmentProfileTestCase.java
Sun Apr 3 12:29:16 2005
@@ -19,7 +19,7 @@

import junit.framework.TestCase;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

import net.dpml.composition.data.ServiceDirective;
import net.dpml.composition.data.ClassLoaderDirective;
@@ -64,6 +64,7 @@
private String m_classname;
private int m_collection;
private ClassLoaderDirective m_classpath;
+ private String m_lifestyle;

private ComponentProfile m_componentOne;
private ComponentProfile m_componentTwo;
@@ -103,9 +104,10 @@
m_categories = new CategoriesDirective( new CategoryDirective[0] );
m_collection = InfoDescriptor.SOFT_COLLECTION;
m_classpath = new ClassLoaderDirective();
+ m_lifestyle = "model";
m_parts = new Part[0];
return new ComponentProfile(
- name, m_activation, m_collection, m_classname, m_categories,
+ name, m_activation, m_collection, m_lifestyle, m_classname,
m_categories,
m_context, m_dependencies, m_parts, m_parameters,
m_configuration, m_classpath, m_mode );
}

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ComponentBuilderTask.java
Sun Apr 3 12:29:16 2005
@@ -57,7 +57,7 @@
import net.dpml.composition.data.Parameter;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.Mode;
-import net.dpml.composition.control.CompositionController;
+import net.dpml.composition.control.CompositionPartHandler;

import net.dpml.composition.builder.datatypes.CategoriesDataType;
import net.dpml.composition.builder.datatypes.ContextDataType;
@@ -68,21 +68,19 @@

import net.dpml.meta.info.EntryDescriptor;

-import net.dpml.control.PartNotFoundException;
-import net.dpml.control.DelegationException;
-
-import net.dpml.part.Part;
-import net.dpml.part.PartHolder;
-
-import net.dpml.builder.PartBuilder;
-import net.dpml.builder.IntrospectionException;
+import net.dpml.automation.control.PartNotFoundException;
+import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.part.PartHolder;
+import net.dpml.automation.builder.PartBuilder;
+import net.dpml.automation.builder.IntrospectionException;

import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfiguration;

import net.dpml.meta.info.Type;
import net.dpml.meta.info.InfoDescriptor;
-import net.dpml.meta.info.builder.TypeHolder;
+import net.dpml.meta.info.TypeHolder;

import net.dpml.parameters.Parameters;
import net.dpml.parameters.impl.DefaultParameters;
@@ -113,7 +111,6 @@
{
private URI m_uri;

- private String m_key;
private String m_name;
private String m_classname;
private String m_lifestyle;
@@ -139,11 +136,6 @@
m_output = file;
}

- public void setKey( String key )
- {
- m_key = key;
- }
-
public void setUri( URI uri )
{
m_uri = uri;
@@ -433,21 +425,23 @@
}

/**
- * Return the key identifying the part that this builder is building.
+ * Return a urn identitifying the part handler for this builder.
+ *
+ * @return a strategy uri
*/
- public String getKey()
+ public URI getPartHandlerURI()
{
- return m_key;
+ return PART_HANDLER_URI;
}

/**
- * Return a urn identitifying the part handler for this builder.
+ * Return the part key.
*
- * @return a strategy uri
+ * @return the key
*/
- public URI getPartHandlerURI()
+ public String getKey()
{
- return PART_HANDLER_URI;
+ return getName();
}

//---------------------------------------------------------------------
@@ -463,18 +457,18 @@
private ComponentProfile buildComponentProfile( ClassLoader classloader,
ClassLoaderDirective cld )
throws IntrospectionException, IOException, ClassNotFoundException
{
- String name = getName();
+ String id = getName();
if( null != m_uri )
{
log( "including component: " + m_uri, Project.MSG_VERBOSE );
- CompositionController controller = new CompositionController();
+ CompositionPartHandler handler = new CompositionPartHandler();
try
{
- Part part = controller.loadPart( m_uri );
+ Part part = handler.loadPart( m_uri );
if( part instanceof ComponentProfile )
{
ComponentProfile profile = (ComponentProfile) part;
- return new ComponentProfile( name, profile );
+ return new ComponentProfile( id, profile );
}
else
{
@@ -508,7 +502,7 @@
}
}

- log( "building component: " + getName(), Project.MSG_VERBOSE );
+ log( "building component: " + id, Project.MSG_VERBOSE );

//
// setup classname and type
@@ -516,7 +510,7 @@

String classname = getClassname();
Type type = loadType( classloader, classname );
- String lifestyle = getLifestylePolicy( type ); // need to update
ComponentProfile to handle this
+ String lifestyle = getLifestylePolicy( type );
int collection = getCollectionPolicy( type );
int activation = getActivationPolicy();
Mode mode = Mode.EXPLICIT;
@@ -533,7 +527,7 @@
//

return new ComponentProfile(
- name, activation, collection, classname, categories, context,
+ id, activation, collection, lifestyle, classname, categories,
context,
dependencies, parts, parameters, configuration, cld, mode );
}

@@ -586,16 +580,9 @@
{
if( null == m_name )
{
- if( null == m_key )
- {
- final String error =
- "Missing component 'name' attribute.";
- throw new BuildException( error, getLocation() );
- }
- else
- {
- return m_key;
- }
+ final String error =
+ "The component profile name attribute is not defined.";
+ throw new BuildException( error, getLocation() );
}
return m_name;
}

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ConstructionException.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ConstructionException.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ConstructionException.java
Sun Apr 3 12:29:16 2005
@@ -54,7 +54,7 @@
/**
* Creation of a new construction exception.
* @param message the exception message
- * @param cause the causal exception
+ * @param location the location of the error
*/
public ConstructionException( String message, Location location )
{

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/ContainerBuilderTask.java
Sun Apr 3 12:29:16 2005
@@ -37,11 +37,10 @@
import net.dpml.meta.info.Type;
import net.dpml.meta.info.InfoDescriptor;

-import net.dpml.part.Part;
-import net.dpml.part.PartHolder;
-
-import net.dpml.builder.PartBuilder;
-import net.dpml.builder.IntrospectionException;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.part.PartHolder;
+import net.dpml.automation.builder.PartBuilder;
+import net.dpml.automation.builder.IntrospectionException;

import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ContainmentProfile;
@@ -225,7 +224,7 @@
private ContainmentProfile buildContainer( ClassLoader classloader )
{
String name = getName();
- log( "building container: " + name );
+ log( "building container: " + name, Project.MSG_VERBOSE );
ClassLoaderDirective cld = getClassLoaderDirective();
ServiceDirective[] services = getServiceDirectives();
CategoriesDirective categories = new CategoriesDirective(); // TODO

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/SerializableObjectHelper.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/SerializableObjectHelper.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/SerializableObjectHelper.java
Sun Apr 3 12:29:16 2005
@@ -30,7 +30,7 @@
import java.net.URI;
import java.rmi.MarshalledObject;

-import net.dpml.builder.BuilderRuntimeException;
+import net.dpml.automation.builder.BuilderRuntimeException;

/**
* A datatype that enables custom part builders.

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
Sun Apr 3 12:29:16 2005
@@ -21,10 +21,9 @@
import java.io.IOException;
import java.net.URI;

-import net.dpml.builder.Builder;
-import net.dpml.builder.IntrospectionException;
-
-import net.dpml.part.BadStrategyException;
+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
Sun Apr 3 12:29:16 2005
@@ -46,9 +46,8 @@
import net.dpml.meta.info.CategoryDescriptor;
import net.dpml.meta.info.PartDescriptor;

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

import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypesTask.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypesTask.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/TypesTask.java
Sun Apr 3 12:29:16 2005
@@ -35,9 +35,9 @@
import java.util.ArrayList;

import net.dpml.meta.info.Type;
-import net.dpml.meta.info.builder.TypeHolder;
+import net.dpml.meta.info.TypeHolder;

-import net.dpml.builder.IntrospectionException;
+import net.dpml.automation.builder.IntrospectionException;

import net.dpml.magic.tasks.ProjectTask;
import net.dpml.magic.model.Policy;

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/ContextDataType.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/ContextDataType.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/ContextDataType.java
Sun Apr 3 12:29:16 2005
@@ -23,9 +23,9 @@
import java.util.ArrayList;
import java.io.IOException;

-import net.dpml.part.Part;
-import net.dpml.builder.PartBuilder;
-import net.dpml.builder.IntrospectionException;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.builder.PartBuilder;
+import net.dpml.automation.builder.IntrospectionException;

import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.ConstructorDirective;

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
Sun Apr 3 12:29:16 2005
@@ -24,9 +24,8 @@
import java.net.URI;
import java.net.URISyntaxException;

-import net.dpml.part.Part;
-
-import net.dpml.builder.PartBuilder;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.builder.PartBuilder;

import net.dpml.composition.data.ValueDirective;
import net.dpml.composition.data.ValueDirective.Value;

Modified:
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/PartsDataType.java
==============================================================================
---
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/PartsDataType.java
(original)
+++
development/main/metro/composition/builder/src/main/net/dpml/composition/builder/datatypes/PartsDataType.java
Sun Apr 3 12:29:16 2005
@@ -23,9 +23,9 @@
import java.util.LinkedList;
import java.net.URI;

-import net.dpml.part.Part;
-import net.dpml.builder.PartBuilder;
-import net.dpml.builder.IntrospectionException;
+import net.dpml.automation.part.Part;
+import net.dpml.automation.builder.PartBuilder;
+import net.dpml.automation.builder.IntrospectionException;

import net.dpml.composition.builder.ComponentBuilderTask;


Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceException.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceException.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.control;
+
+/**
+ * Exception to indicate that there was a appliance related error.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ApplianceException.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class ApplianceException
+ extends Exception
+{
+ private final Throwable m_cause;
+
+ /**
+ * Construct a new <code>ApplianceException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ */
+ public ApplianceException( final String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>ApplianceException</code> instance.
+ *
+ * @param message The detail message for this exception.
+ * @param throwable the root cause of the exception
+ */
+ public ApplianceException( final String message, final Throwable
throwable )
+ {
+ super( message );
+ m_cause = throwable;
+ }
+
+ /**
+ * Return the exception that was the cause of this exception.
+ * @return the causal exception
+ */
+ public Throwable getCause()
+ {
+ return m_cause;
+ }
+}
+

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,185 @@
+/*
+ * 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.control;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.lang.reflect.Method;
+
+import net.dpml.automation.control.LifecycleException;
+
+import net.dpml.composition.models.StandardComponentModel;
+
+import net.dpml.logging.Logger;
+
+/**
+ * The ApplianceInvocationHandler class represents an instance of a
component.
+ * It is responsible for the incarnation, runtime management, execution, and
+ * etherialization of the instance it controls.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
+ */
+public final class ApplianceInvocationHandler
+ implements InvocationHandler
+{
+ //-------------------------------------------------------------------
+ // state
+ //-------------------------------------------------------------------
+
+ private final StandardComponentModel m_model;
+ private final LifestyleHandler m_handler;
+ private final Object m_key;
+ private final Object m_instance;
+
+ private boolean m_disposed = false;
+
+ //-------------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------------
+
+ /**
+ * Create a proxy invocation handler.
+ *
+ * @param appliance the runtime appliance
+ * @param logger the assigned logging channel
+ */
+ ApplianceInvocationHandler( LifestyleHandler handler,
StandardComponentModel model )
+ throws NullPointerException, LifecycleException
+ {
+ assertNotNull( handler, "handler" );
+ assertNotNull( model, "model" );
+
+ m_handler = handler;
+ m_model = model;
+
+ m_key = handler.aquire( model ); // <-- here and now or later on
invocation ?
+ m_instance = model.get( m_key );
+ }
+
+ //-------------------------------------------------------------------
+ // InvocationHandler
+ //-------------------------------------------------------------------
+
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ * @throws Throwable if an error occurs
+ */
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable
+ {
+ if( m_disposed )
+ {
+ throw new IllegalStateException( "destroyed" );
+ }
+
+ try
+ {
+ return method.invoke( m_instance, args );
+ }
+ catch( Throwable e )
+ {
+ throw handleInvocationThrowable( e );
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // ApplianceInvocationHandler
+ //-------------------------------------------------------------------
+
+ public void dispose()
+ {
+ if( !m_disposed )
+ {
+ m_disposed = true;
+ m_handler.release( m_model, m_key );
+ }
+ }
+
+ protected void finalize() throws Throwable
+ {
+ if( !m_disposed && ( null != m_instance ) )
+ {
+ dispose();
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // utilities
+ //-------------------------------------------------------------------
+
+ private Throwable handleInvocationThrowable( Throwable e )
+ {
+ final String error =
+ "Delegation error raised by component ["
+ + m_model
+ + "].";
+
+ while( true )
+ {
+ if( e instanceof UndeclaredThrowableException )
+ {
+ Throwable cause =
+ ((UndeclaredThrowableException)e).getUndeclaredThrowable();
+ if( cause == null )
+ {
+ return new ApplianceException( error, e );
+ }
+ else
+ {
+ e = cause;
+ }
+ }
+ else if( e instanceof InvocationTargetException )
+ {
+ Throwable cause =
+ ((InvocationTargetException)e).getTargetException();
+ if( cause == null )
+ {
+ return new ApplianceException( error, e );
+ }
+ else
+ {
+ e = cause;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ return e;
+ }
+
+ private void assertNotNull( Object object, String key )
+ throws NullPointerException
+ {
+ if( null == object )
+ {
+ throw new NullPointerException( key );
+ }
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionClassLoader.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,173 @@
+/*
+ * 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.control;
+
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import net.dpml.automation.control.ControlRuntimeException;
+
+/**
+ * A named classloader.
+ *
+ * @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 CompositionClassLoader extends URLClassLoader
+{
+ //--------------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------------
+
+ private final String m_partition;
+ private final int m_index;
+
+ //--------------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------------
+
+ public CompositionClassLoader( String partition, ClassLoader parent )
+ {
+ this( partition, 0, new URI[0], parent );
+ }
+
+ public CompositionClassLoader( String partition, int index, URI[] uris,
ClassLoader parent )
+ {
+ super( urisToURLs( uris ), parent );
+ m_partition = partition;
+ m_index = index;
+ }
+
+ //--------------------------------------------------------------------
+ // CompositionClassLoader
+ //--------------------------------------------------------------------
+
+ public String getPartition()
+ {
+ return m_partition;
+ }
+
+ public int getIndex()
+ {
+ return m_index;
+ }
+
+ //--------------------------------------------------------------------
+ // Object
+ //--------------------------------------------------------------------
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer( "classloader stack: " );
+ buffer.append( getPartition() );
+ listClasspath( buffer );
+ return buffer.toString();
+ }
+
+ protected void listClasspath( StringBuffer buffer )
+ {
+ ClassLoader parent = getParent();
+ if( null != parent )
+ {
+ listClasspath( buffer, parent );
+ }
+ listClasspath( buffer, this );
+ buffer.append( "\n" );
+ }
+
+ protected void listClasspath( StringBuffer buffer, ClassLoader
classloader )
+ {
+ if( classloader instanceof CompositionClassLoader )
+ {
+ CompositionClassLoader cl = (CompositionClassLoader) classloader;
+ int index = cl.getIndex();
+ buffer.append( "\n classpath (" + index + ")" );
+ appendEntries( buffer, cl );
+ }
+ else if( classloader instanceof URLClassLoader )
+ {
+ URLClassLoader cl = (URLClassLoader) classloader;
+ buffer.append( "\n url classloader" );
+ appendEntries( buffer, cl );
+ }
+ else
+ {
+ buffer.append( "\n classloader (no details)" );
+ buffer.append( "\n" );
+ }
+ }
+
+ private void appendEntries( StringBuffer buffer, URLClassLoader
classloader )
+ {
+ URL[] urls = classloader.getURLs();
+ for( int i=0; i<urls.length; i++ )
+ {
+ buffer.append( "\n " );
+ URL url = urls[i];
+ String spec = url.toString();
+ buffer.append( spec );
+ }
+ buffer.append( "\n" );
+ }
+
+ //--------------------------------------------------------------------
+ // static utilities
+ //--------------------------------------------------------------------
+
+ private static URL[] urisToURLs( final URI[] uris )
+ {
+ URL[] urls = new URL[ uris.length ];
+ for( int i=0; i<uris.length; i++ )
+ {
+ URI uri = uris[i];
+ urls[i] = uriToURL( uri );
+ }
+ return urls;
+ }
+
+ private static URL uriToURL( URI uri )
+ {
+ try
+ {
+ if( "artifact".equals( uri.getScheme() ) )
+ {
+ String spec = uri.toString();
+ return new URL( null, spec, new
net.dpml.transit.artifact.Handler() );
+ }
+ else if( "link".equals( uri.getScheme() ) )
+ {
+ String spec = uri.toString();
+ return new URL( null, spec, new
net.dpml.transit.link.Handler() );
+ }
+ else
+ {
+ return uri.toURL();
+ }
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error occured while attempting to transform the uri
["
+ + uri
+ + "] to a url.";
+ throw new ControlRuntimeException( 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
Sun Apr 3 12:29:16 2005
@@ -19,30 +19,43 @@
package net.dpml.composition.control;

import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.net.URISyntaxException;
import java.io.IOException;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.WeakHashMap;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.InvocationHandler;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

-import net.dpml.control.PartHandler;
-import net.dpml.control.Controller;
-import net.dpml.control.Monitor;
-import net.dpml.control.Model;
-import net.dpml.control.DuplicateNameException;
-import net.dpml.control.UnsupportedPartTypeException;
-import net.dpml.control.DelegationException;
-import net.dpml.control.HandlerNotFoundException;
-import net.dpml.control.PartNotFoundException;
+import net.dpml.automation.control.PartHandler;
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.Monitor;
+import net.dpml.automation.control.DuplicateNameException;
+import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.control.HandlerNotFoundException;
+import net.dpml.automation.control.LifecycleException;
+import net.dpml.automation.control.UnsupportedPartTypeException;
+import net.dpml.automation.control.PartNotFoundException;
+import net.dpml.automation.control.ControlException;
+import net.dpml.automation.model.ModelException;
+import net.dpml.automation.model.Model;

import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.data.ClasspathDirective;
+import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.models.StandardComponentModel;

import net.dpml.logging.Logger;

+import net.dpml.system.SystemContext;
+
+import net.dpml.transit.artifact.Handler;
+
/**
* A initial test controller.
*
@@ -56,26 +69,21 @@
//--------------------------------------------------------------------

private final Monitor m_monitor;
+ private final SystemContext m_system;
+ private final LifestyleHandler m_handler;

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

- public CompositionController()
- {
- this( new ConsoleMonitor() );
- }
-
- public CompositionController( Logger logger )
- {
- super();
- m_monitor = new DefaultMonitor( logger );
- }
-
- public CompositionController( Monitor monitor )
+ public CompositionController( Monitor monitor, SystemContext system )
{
super();
m_monitor = monitor;
+ m_system = system;
+
+ LifecycleHandler lifecycle = new LifecycleHandler( system );
+ m_handler = new LifestyleHandler( lifecycle );
}

//--------------------------------------------------------------------
@@ -88,7 +96,7 @@
*/
public Controller getController()
{
- return this;
+ return getCompositionController();
}

//--------------------------------------------------------------------
@@ -102,16 +110,32 @@

/**
* Return the model for a supplied part.
+ *
+ * @param partition the enclosing partition
+ * @param parent the parent classloader
+ * @param part the part datastructure
+ * @return the model
+ */
+ public Model getModel( String partition, ClassLoader parent, Part part )
throws DelegationException, ModelException
+ {
+ return getModel( null, partition, parent, part );
+ }
+
+ /**
+ * Return the model for a supplied part.
+ *
+ * @param model the enclosing model
+ * @param partition the enclosing partition
+ * @param parent the parent classloader
* @param part the part datastructure
* @return the model
*/
- public Model getModel( ClassLoader classloader, Part part ) throws
DelegationException
+ public Model getModel( Model model, String partition, ClassLoader
parent, Part part ) throws DelegationException, ModelException
{
if( part instanceof ComponentProfile )
{
- getMonitor().info( "creating model for " + part );
ComponentProfile profile = (ComponentProfile) part;
- return createStandardComponentModel( classloader, profile );
+ return getComponentModel( model, partition, parent, profile );
}
else
{
@@ -122,42 +146,174 @@
}
else
{
- return getForeignModel( classloader, part, uri );
+ return getForeignModel( model, partition, parent, part, uri
);
+ }
+ }
+ }
+
+ /**
+ * Create and return a new instance of the component represented
+ * by the supplied model.
+ *
+ * @param model the component model
+ * @return the resolved instance
+ */
+ public Object resolve( Model model ) throws Exception
+ {
+ if( model instanceof StandardComponentModel )
+ {
+ StandardComponentModel componentModel = (StandardComponentModel)
model;
+ return resolveInstance( componentModel );
+ }
+ else
+ {
+ return model.getController().resolve( model );
+ }
+ }
+
+ /**
+ * Release an instance.
+ *
+ * @param instance the object to release
+ */
+ public void release( Object instance )
+ {
+ if( Proxy.isProxyClass( instance.getClass() ) )
+ {
+ Object handler = Proxy.getInvocationHandler( instance );
+ if( handler instanceof ApplianceInvocationHandler )
+ {
+ ApplianceInvocationHandler aic =
+ (ApplianceInvocationHandler) handler;
+ aic.dispose();
}
}
}

+ public Model getProvider( Model model, String path )
+ {
+ if( model instanceof StandardComponentModel )
+ {
+ StandardComponentModel componentModel = (StandardComponentModel)
model;
+ return getProviderComponentModel( componentModel, path );
+ }
+ else
+ {
+ return model.getController().getProvider( model, path );
+ }
+ }
+
//--------------------------------------------------------------------
- // internal
+ // CompositionController
//--------------------------------------------------------------------

/**
- * Create a new serializable component model using a supplied classloader
- * as the parent classloader for the classloader stack constructed for
- * component instances.
+ * Load the model controller.
+ * @return the controller
*/
- private StandardComponentModel createStandardComponentModel( ClassLoader
classloader, ComponentProfile profile )
+ public CompositionController getCompositionController()
{
- return new StandardComponentModel( classloader, profile );
+ return this;
}

+ public Object getLoggingChannel( StandardComponentModel model )
+ {
+ String path = model.getQualifiedName();
+ return m_system.getLoggingManager().getLoggerForCategory( path );
+ }
+
+ /**
+ * Return the monitor assigned to this controller.
+ *
+ * @return the assigned monitor
+ */
protected Monitor getMonitor()
{
return m_monitor;
- }
+ }
+
+ /**
+ * Return the model for a supplied part.
+ *
+ * @param model the enclosing model
+ * @param partition the enclosing partition
+ * @param parent the parent classloader
+ * @param profile the part profile
+ * @return the model
+ */
+ public StandardComponentModel getComponentModel(
+ Model model, String partition, ClassLoader parent, ComponentProfile
profile )
+ throws DelegationException, ModelException
+ {
+ getMonitor().info( "creating nested model using " + profile );
+ ClassLoader classloader = getClassLoader( partition, parent, profile
);
+ if( null == model )
+ {
+ return new StandardComponentModel( this, partition, classloader,
profile );
+ }
+ else
+ {
+ return new StandardComponentModel( this, model, partition,
classloader, profile );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ // private
+ //--------------------------------------------------------------------
+
+ /**
+ * Locate and return a component model nested within the supplied model
using
+ * the address expressed by the path argument.
+ *
+ * @param model the enclosing model
+ * @param the path to the requested model
+ * @return the nested model (possibly null)
+ */
+ private Model getProviderComponentModel( StandardComponentModel model,
String path )
+ {
+ return model.getPart( path );
+ }
+
+ /**
+ * Create and return a new instance of the component represented
+ * by the supplied model.
+ *
+ * @param model the component model
+ * @return the resolved instance
+ */
+ private Object resolveInstance( StandardComponentModel model ) throws
Exception
+ {
+ InvocationHandler handler = new ApplianceInvocationHandler(
m_handler, model );
+ Class subject = model.getDeploymentClass();
+ ClassLoader classloader = subject.getClassLoader();
+ Class[] interfaces = model.getServiceClasses();
+ return Proxy.newProxyInstance( classloader, interfaces, handler );
+ }

/**
* Return a management view of a part.
- * @param part the part to present
- * @return the management view
+ *
+ * @param model the enclosing model
+ * @param partition the assigned partition
+ * @param classloader the parent classloader
+ * @param part the part backing the moel to be created
+ * @param uri the part controller uri
+ * @return the part model
*/
- public Model getForeignModel( ClassLoader classloader, Part part, URI
uri ) throws DelegationException
+ private Model getForeignModel( Model parent, String partition,
ClassLoader classloader, Part part, URI uri ) throws DelegationException
{
try
{
PartHandler handler = loadPartHandler( uri );
Controller controller = handler.getController();
- return controller.getModel( classloader, part );
+ if( null == parent )
+ {
+ return controller.getModel( partition, classloader, part );
+ }
+ else
+ {
+ return controller.getModel( parent, partition, classloader,
part );
+ }
}
catch( HandlerNotFoundException e )
{
@@ -175,6 +331,33 @@
}
}

+ private ClassLoader getClassLoader( String partition, ClassLoader
parent, ComponentProfile profile )
+ {
+ final String name = profile.getName();
+ final String local = getLocalPartition( partition, name );
+ final ClassLoaderDirective cld = profile.getClassLoaderDirective();
+ final ClasspathDirective[] cpds = cld.getClasspathDirectives();
+ for( int i=0; i<cpds.length; i++ )
+ {
+ ClasspathDirective cpd = cpds[i];
+ URI[] uris = cpd.getURIs();
+ parent = new CompositionClassLoader( local, i, uris, parent );
+ }
+ return parent;
+ }
+
+ private String getLocalPartition( String base, String name )
+ {
+ if( base.endsWith( "/" ) )
+ {
+ return base + name;
+ }
+ else
+ {
+ return base + "/" + name;
+ }
+ }
+
//--------------------------------------------------------------------
// static utilities
//--------------------------------------------------------------------

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
Sun Apr 3 12:29:16 2005
@@ -26,18 +26,19 @@
import java.util.Collections;
import java.util.WeakHashMap;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

-import net.dpml.control.SystemManager;
-import net.dpml.control.PartHandler;
-import net.dpml.control.Controller;
-import net.dpml.control.Monitor;
-import net.dpml.control.Model;
-import net.dpml.control.DuplicateNameException;
-import net.dpml.control.UnsupportedPartTypeException;
-import net.dpml.control.DelegationException;
-import net.dpml.control.HandlerNotFoundException;
-import net.dpml.control.PartNotFoundException;
+import net.dpml.automation.control.SystemManager;
+import net.dpml.automation.control.PartHandler;
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.Monitor;
+import net.dpml.automation.control.DuplicateNameException;
+import net.dpml.automation.control.UnsupportedPartTypeException;
+import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.control.HandlerNotFoundException;
+import net.dpml.automation.control.PartNotFoundException;
+import net.dpml.automation.model.Model;
+import net.dpml.automation.model.ModelException;

import net.dpml.system.SystemContext;

@@ -53,12 +54,6 @@
public class CompositionManager extends CompositionController implements
SystemManager
{
//--------------------------------------------------------------------
- // static
- //--------------------------------------------------------------------
-
- private final ClassLoader CLASSLOADER = Logger.class.getClassLoader();
-
- //--------------------------------------------------------------------
// state
//--------------------------------------------------------------------

@@ -71,7 +66,7 @@

public CompositionManager( SystemContext context )
{
- super( new DefaultMonitor( context.getLogger() ) );
+ super( new DefaultMonitor( context.getLogger() ), context );
m_context = context;
}

@@ -87,11 +82,11 @@
/**
* Add a part to the collection of parts managed by this controller.
*
- * @param name the name identifying the part within the collection
- * @param part the part to add
+ * @param uri a uri identifying the part to add
+ * @return the model of the part
*/
public Model addPart( URI uri )
- throws IOException, DelegationException, PartNotFoundException
+ throws IOException, DelegationException, ModelException,
PartNotFoundException
{
Part part = loadPart( uri );
return installPart( part );
@@ -136,9 +131,9 @@
* @param part the part to add
*/
private Model installPart( Part part )
- throws DelegationException
+ throws DelegationException, ModelException
{
- Model model = getModel( CLASSLOADER, part );
+ Model model = getModel( "/", CLASSLOADER, part );
m_models.add( model );
return model;
}
@@ -153,4 +148,16 @@
getMonitor().info( "model: " + model );
}
}
+
+ //--------------------------------------------------------------------
+ // static utilities
+ //--------------------------------------------------------------------
+
+ private final ClassLoader CLASSLOADER = setupRootClassLoader();
+
+ private static ClassLoader setupRootClassLoader()
+ {
+ ClassLoader root = Logger.class.getClassLoader();
+ return new CompositionClassLoader( "/", root );
+ }
}

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
Sun Apr 3 12:29:16 2005
@@ -26,16 +26,18 @@
import java.net.URI;
import java.net.URL;

-import net.dpml.part.Part;
-import net.dpml.part.PartHolder;
-import net.dpml.part.BadStrategyException;
-
-import net.dpml.control.Controller;
-import net.dpml.control.PartNotFoundException;
-import net.dpml.control.PartHandler;
-import net.dpml.control.PartHandlerRuntimeException;
-import net.dpml.control.HandlerNotFoundException;
-import net.dpml.control.DelegationException;
+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;
+import net.dpml.automation.control.PartHandlerRuntimeException;
+import net.dpml.automation.control.HandlerNotFoundException;
+import net.dpml.automation.control.DelegationException;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.TypeHolder;

import net.dpml.transit.TransitException;
import net.dpml.transit.artifact.Handler;
@@ -47,7 +49,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 abstract class CompositionPartHandler implements PartHandler
+public class CompositionPartHandler implements PartHandler
{
/**
* Map containing the foreign part handlers. The map keys
@@ -85,10 +87,14 @@
}

/**
- * Load the part controller.
+ * Return the model controller.
* @return the controller
+ * @exception UnsupportedOperationException allways thrown
*/
- public abstract Controller getController();
+ public Controller getController()
+ {
+ throw new UnsupportedOperationException( "getController" );
+ }

/**
* Load a part from serialized form. The uri is assumed to be a uri that
@@ -142,6 +148,34 @@
}
}

+ public Type loadType( Class clazz )
+ {
+ String path = clazz.getName().replace( '.', '/' ) + ".type";
+ URL url = clazz.getClassLoader().getResource( path );
+ if( null == url )
+ {
+ return null;
+ }
+ try
+ {
+ InputStream input = url.openStream();
+ ObjectInputStream stream = new ObjectInputStream( input );
+ TypeHolder holder = (TypeHolder) stream.readObject();
+ byte[] bytes = holder.getByteArray();
+ ByteArrayInputStream byteinput = new ByteArrayInputStream( bytes
);
+ ObjectInputStream bytestream = new ObjectInputStream( byteinput
);
+ return (Type) bytestream.readObject();
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error occured while attempting to load a type from
the path ["
+ + path
+ + "]";
+ throw new PartHandlerRuntimeException( error, e );
+ }
+ }
+
private Part loadSerializedPart( URI uri )
throws IOException, DelegationException, PartNotFoundException
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ConsoleMonitor.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ConsoleMonitor.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ConsoleMonitor.java
Sun Apr 3 12:29:16 2005
@@ -18,7 +18,7 @@

package net.dpml.composition.control;

-import net.dpml.control.Monitor;
+import net.dpml.automation.control.Monitor;


/**
@@ -46,7 +46,7 @@

/**
* Log the supplied debug level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void debug( String message )
{
@@ -58,7 +58,7 @@

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void info( String message )
{
@@ -67,7 +67,7 @@

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void warn( String message )
{
@@ -76,7 +76,7 @@

/**
* Log the supplied error level message.
- * @param mesage the message to log
+ * @param message the message to log
* @param throwable the exception
*/
public void error( String message, Throwable throwable )
@@ -107,7 +107,7 @@

/**
* Log the supplied debug level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
private void write( String level, String message )
{

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,292 @@
+/*
+ * 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.control;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import net.dpml.automation.control.LifecycleException;
+import net.dpml.automation.model.ModelException;
+
+import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.EntryModel;
+import net.dpml.composition.models.ValueModel;
+import net.dpml.composition.data.ContextDirective;
+import net.dpml.composition.data.EntryDirective;
+import net.dpml.composition.data.ValueDirective;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.EntryDescriptor;
+
+import net.dpml.system.SystemContext;
+
+/**
+ * This makes a dynamic proxy for an object. The object can be represented
+ * by one, some or all of it's interfaces.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
+ */
+public final class ContextInvocationHandler
+ implements InvocationHandler
+{
+ //-------------------------------------------------------------------
+ // state
+ //-------------------------------------------------------------------
+
+ /**
+ * A map of context entry key name and context entry values.
+ */
+ private final SystemContext m_system;
+
+ /**
+ * A map of context entry key name and context entry values.
+ */
+ private final Map m_map = new Hashtable();
+
+ /**
+ * A map of the entry descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_entries = new Hashtable();
+
+ /**
+ * The component model.
+ */
+ private final StandardComponentModel m_model;
+
+ /**
+ * The component type.
+ */
+ private final Type m_type;
+
+ //-------------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------------
+
+ /**
+ * Create a context invocation handler.
+ *
+ * @param system the system context
+ * @param model the component model
+ */
+ public ContextInvocationHandler( SystemContext system,
StandardComponentModel model )
+ throws LifecycleException, ModelException
+ {
+ m_system = system;
+ m_model = model;
+ m_type = model.getType();
+
+ //
+ // get the set of context entries declared by the component type
+ // and for for each entry determine the context entry model to
+ // use for context entry value resolution
+ //
+
+ EntryDescriptor[] entries = m_type.getContext().getEntries();
+ ContextDirective context = model.getContextDirective();
+ ClassLoader classloader = model.getClassLoader();
+
+ for( int i=0; i<entries.length; i++ )
+ {
+ EntryDescriptor entry = entries[i];
+ final String key = entry.getKey();
+ EntryDirective directive = context.getEntryDirective( key );
+
+ if( null == directive )
+ {
+ if( entry.isRequired() )
+ {
+ final String error =
+ "The component model ["
+ + model.getQualifiedName()
+ + "] does not delcare a context directive for the key "
+ + key
+ + "].";
+ throw new LifecycleException( error );
+ }
+ }
+ else
+ {
+ m_entries.put( key, entry );
+ if( directive instanceof ValueDirective )
+ {
+ ValueDirective value = (ValueDirective) directive;
+ ValueModel m = new ValueModel( classloader, entry,
value, m_map );
+ m_map.put( key, m );
+ }
+ else
+ {
+ final String error =
+ "Unrecognized entry directive class ["
+ + directive.getClass().getName()
+ + "] withing the component model ["
+ + model.getQualifiedName()
+ + "].";
+ throw new LifecycleException( error );
+ }
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ * @throws Throwable if an error occurs
+ * @exception NullPointerException if any one of the proxy or method
arguments
+ * is null, or if the object instance has been destroyed
earlier.
+ */
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable, NullPointerException
+ {
+ if( proxy == null )
+ throw new NullPointerException( "proxy" );
+ if( method == null )
+ throw new NullPointerException( "method" );
+
+ Class source = method.getDeclaringClass();
+ if( Object.class == method.getDeclaringClass() )
+ {
+ return method.invoke( this, args );
+ }
+
+ String name = method.getName();
+ String key = getKeyFromMethod( method );
+ EntryDescriptor entry = (EntryDescriptor) m_entries.get( key );
+
+ if( null == entry )
+ {
+ final String error =
+ "Illegal request for an undeclared context entry ["
+ + key
+ + "] withing the component type ["
+ + m_type.getInfo().getClassname()
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+
+ //
+ // we have a valid key
+ //
+
+ EntryModel model = (EntryModel) m_map.get( key );
+ if( null == model )
+ {
+ return returnClientSuppliedDefaultArgument( entry, args );
+ }
+ else
+ {
+ Object value = model.getValue();
+ if( value instanceof String )
+ {
+ String v = (String) value;
+ if( v.startsWith( "urn:metro:" ) )
+ {
+ if( "urn:metro:name".equals( v ) )
+ {
+ return m_model.getName();
+ }
+ else if( "urn:metro:partition".equals( v ) )
+ {
+ return m_model.getPartition();
+ }
+ else
+ {
+ final String error =
+ "Context entry urn ["
+ + v
+ + "] not recognized.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+ }
+ return value;
+ }
+ }
+
+ private String getKeyFromMethod( Method method )
+ {
+ String name = method.getName();
+ if( name.startsWith( "get" ) )
+ {
+ return formatKey( name.substring( 3 ) );
+ }
+ else
+ {
+ final String error =
+ "Invalid method accessor ["
+ + name
+ + "]";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ private String formatKey( String key )
+ {
+ if( key.length() < 1 )
+ {
+ throw new IllegalArgumentException( "key" );
+ }
+ String first = key.substring( 0, 1 ).toLowerCase();
+ String remainder = key.substring( 1 );
+ return first + remainder;
+ }
+
+ private Object returnClientSuppliedDefaultArgument( EntryDescriptor
entry, Object[] args )
+ {
+ if( args.length < 1 )
+ {
+ final String error =
+ "Insuffient arguments to resolve a default value for the key ["
+ + entry.getKey()
+ + "] within the component type ["
+ + m_type.getInfo().getName()
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+ Object arg = args[0];
+ return arg;
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ private void assertNotNull( Object object, String key )
+ throws NullPointerException
+ {
+ if( null == object )
+ {
+ throw new NullPointerException( key );
+ }
+ }
+}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/DefaultMonitor.java
Sun Apr 3 12:29:16 2005
@@ -19,7 +19,7 @@
package net.dpml.composition.control;

import net.dpml.logging.Logger;
-import net.dpml.control.Monitor;
+import net.dpml.automation.control.Monitor;


/**
@@ -39,7 +39,7 @@

/**
* Log the supplied debug level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void debug( String message )
{
@@ -48,7 +48,7 @@

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void info( String message )
{
@@ -57,7 +57,7 @@

/**
* Log the supplied info level message.
- * @param mesage the message to log
+ * @param message the message to log
*/
public void warn( String message )
{
@@ -66,7 +66,7 @@

/**
* Log the supplied error level message.
- * @param mesage the message to log
+ * @param message the message to log
* @param throwable the exception
*/
public void error( String message, Throwable throwable )

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/DependencyInvocationHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/DependencyInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,192 @@
+/*
+ * 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.control;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.ControlRuntimeException;
+import net.dpml.automation.model.Model;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.DependencyDescriptor;
+
+import net.dpml.composition.models.StandardComponentModel;
+import net.dpml.composition.models.DependencyModel;
+
+/**
+ * This makes a dynamic proxy for an object. The object can be represented
+ * by one, some or all of it's interfaces.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
+ */
+public final class DependencyInvocationHandler
+ implements InvocationHandler
+{
+ //-------------------------------------------------------------------
+ // state
+ //-------------------------------------------------------------------
+
+ private final Type m_type;
+ private final StandardComponentModel m_model;
+
+ //-------------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------------
+
+ /**
+ * Create a dependency invocation handler.
+ *
+ * @param model the component model
+ */
+ public DependencyInvocationHandler( StandardComponentModel model )
+ throws NullPointerException
+ {
+ m_model = model;
+ m_type = model.getType();
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ * @throws Throwable if an error occurs
+ * @exception NullPointerException if any one of the proxy or method
arguments
+ * is null, or if the object instance has been destroyed
earlier.
+ */
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable, NullPointerException
+ {
+ Class source = method.getDeclaringClass();
+ if( Object.class == method.getDeclaringClass() )
+ {
+ return method.invoke( this, args );
+ }
+
+ String name = method.getName();
+ String key = getKeyFromMethod( method );
+ final Model provider = m_model.getProvider( key );
+ if( null == provider )
+ {
+ return returnClientSuppliedDefaultArgument( key, args );
+ }
+ else
+ {
+ return getServiceInstance( key, provider );
+ }
+ }
+
+ private Object getServiceInstance( String key, Model provider )
+ {
+ if( null == provider )
+ {
+ throw new NullPointerException( "provider" );
+ }
+
+ try
+ {
+ Controller controller = provider.getController();
+ return controller.resolve( provider );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected runtime error while attempting to resolve the
service for the dependency key ["
+ + key
+ + "] using the provider ["
+ + provider
+ + "] for the component type ["
+ + m_type.getInfo().getClassname()
+ + "].";
+ throw new ControlRuntimeException( error, e );
+ }
+ }
+
+ private String getKeyFromMethod( Method method )
+ {
+ String name = method.getName();
+ if( name.startsWith( "get" ) )
+ {
+ return formatKey( name.substring( 3 ) );
+ }
+ else
+ {
+ final String error =
+ "Invalid method accessor ["
+ + name
+ + "]";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ private String formatKey( String key )
+ {
+ if( key.length() < 1 )
+ {
+ throw new IllegalArgumentException( "key" );
+ }
+ String first = key.substring( 0, 1 ).toLowerCase();
+ String remainder = key.substring( 1 );
+ return first + remainder;
+ }
+
+ private Object returnClientSuppliedDefaultArgument( String key, Object[]
args )
+ {
+ if( args.length < 1 )
+ {
+ final String error =
+ "Insuffient arguments to resolve a default value for the key ["
+ + key
+ + "] within the component type ["
+ + m_type.getInfo().getName()
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+ Object arg = args[0];
+ return arg;
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ private void assertNotNull( Object object, String key )
+ throws NullPointerException
+ {
+ if( null == object )
+ {
+ throw new NullPointerException( key );
+ }
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,236 @@
+/*
+ * 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.control;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import net.dpml.automation.control.LifecycleException;
+
+import net.dpml.composition.models.StandardComponentModel;
+
+import net.dpml.meta.info.Type;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.system.SystemContext;
+
+/**
+ * A lifestyle handler provides support for the aquisition and release
+ * of component instances. An implementation is responsible for the
+ * handling of new instance creation based on lifestyle policy declared
+ * in a component model.
+ *
+ * @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 LifecycleHandler
+{
+ private final SystemContext m_system;
+
+ public LifecycleHandler( SystemContext system )
+ {
+ m_system = system;
+ }
+
+ /**
+ * Execute the incarnation sequence and return a new annonomous
+ * component instance.
+ *
+ * @return a new component instance
+ */
+ public Object incarnate( StandardComponentModel model ) 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 ];
+
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class c = classes[i];
+ if( Logger.class.isAssignableFrom( c ) )
+ {
+ args[i] =
model.getCompositionController().getLoggingChannel( model );
+ }
+ else if( ( null != parts ) && parts.isAssignableFrom( c ) )
+ {
+ 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 );
+ }
+ else
+ {
+ final String error =
+ "The componet class ["
+ + subject.getName()
+ + "] decares an unsupported constructor parameter type ["
+ + c.getName()
+ + "].";
+ throw new LifecycleException( error );
+ }
+ }
+
+ try
+ {
+ return constructor.newInstance( args );
+ }
+ catch( Throwable e )
+ {
+ Class clazz = constructor.getDeclaringClass();
+ final String error =
+ "Internal error while attempting to instantiate the component
class ["
+ + clazz.getName()
+ + "].";
+ throw new LifecycleException( error, e );
+ }
+ }
+
+ /**
+ * Apply the etherialization process to the supplied instance.
+ *
+ * @param object the object to etherialize
+ */
+ public void etherialize( Object object )
+ {
+ if( null == object )
+ {
+ return;
+ }
+ Class subject = object.getClass();
+ try
+ {
+ Method method = subject.getDeclaredMethod( "dispose", new
Class[0] );
+ method.invoke( object, new Object[0] );
+ }
+ catch( NoSuchMethodException e )
+ {
+ // ignore
+ }
+ catch( Exception e )
+ {
+ // ignore
+ }
+ }
+
+ private Constructor getConstructor( Class subject ) throws
LifecycleException
+ {
+ Constructor[] constructors = subject.getConstructors();
+ if( constructors.length < 1 )
+ {
+ final String error =
+ "The component class ["
+ + subject.getName()
+ + "] does not declare a public constructor.";
+ throw new LifecycleException( error );
+ }
+ else if( constructors.length > 1 )
+ {
+ final String error =
+ "The component class ["
+ + subject.getName()
+ + "] declares more than one public constructor.";
+ throw new LifecycleException( error );
+ }
+ else
+ {
+ return constructors[0];
+ }
+ }
+
+ private Class getInnerClass( Class subject, String postfix )
+ {
+ Class[] classes = subject.getClasses();
+ return locateClass( postfix, classes );
+ }
+
+ private Class locateClass( String postfix, Class[] classes )
+ {
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class inner = classes[i];
+ String name = inner.getName();
+ if( name.endsWith( postfix ) )
+ {
+ return inner;
+ }
+ }
+ return null;
+ }
+
+ private Object newContextInvocationHandler( StandardComponentModel
model, Class clazz ) throws LifecycleException
+ {
+ try
+ {
+ InvocationHandler handler = new ContextInvocationHandler(
m_system, 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 context
invocation handler.";
+ throw new LifecycleException( error, e );
+ }
+ }
+
+ private Object newPartsInvocationHandler( StandardComponentModel model,
Class clazz ) throws LifecycleException
+ {
+ try
+ {
+ InvocationHandler handler = new PartsInvocationHandler( 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 parts
invocation handler.";
+ throw new LifecycleException( error, e );
+ }
+ }
+
+ 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 );
+ }
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,111 @@
+/*
+ * 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.control;
+
+import net.dpml.automation.control.LifecycleException;
+
+import net.dpml.composition.models.StandardComponentModel;
+
+/**
+ * A lifestyle handler provides support for the aquisition and release
+ * of component instances. An implementation is responsible for the
+ * handling of new instance creation based on lifestyle policy declared
+ * in a component model.
+ *
+ * @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 LifestyleHandler
+{
+ private final LifecycleHandler m_handler;
+
+ public LifestyleHandler( LifecycleHandler handler )
+ {
+ m_handler = handler;
+ }
+
+ /**
+ * Aquire a key to an instance.
+ *
+ * @param model the model from which new or existing instances will be
resolved
+ * @return the key to the resolved instance
+ */
+ public Object aquire( StandardComponentModel model ) throws
LifecycleException
+ {
+ final String lifestyle = model.getLifestylePolicy();
+ if( "request".equals( lifestyle ) || "transient".equals( lifestyle )
)
+ {
+ synchronized( model )
+ {
+ Object object = m_handler.incarnate( model );
+ Object key = new Integer( System.identityHashCode( object )
);
+ model.put( key, object );
+ return key;
+ }
+ }
+ else if( "thread".equals( lifestyle ) )
+ {
+ throw new UnsupportedOperationException( "thread" );
+ }
+ else if( "model".equals( lifestyle ) || "singleton".equals(
lifestyle ) )
+ {
+ synchronized( model )
+ {
+ String key = "self";
+ Object object = model.get( key );
+ if( null == object )
+ {
+ object = m_handler.incarnate( model );
+ model.put( key, object );
+ }
+ return key;
+ }
+ }
+ else
+ {
+ final String error =
+ "Lifestyle policy ["
+ + lifestyle
+ + "] is not recognized.";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ public void release( StandardComponentModel model, Object key )
+ {
+ final String lifestyle = model.getLifestylePolicy();
+ if( "request".equals( lifestyle ) )
+ {
+ synchronized( model )
+ {
+ Object object = model.get( key );
+ m_handler.etherialize( object );
+ model.remove( key );
+ }
+ }
+ else if( "thread".equals( lifestyle ) )
+ {
+ throw new UnsupportedOperationException( "thread" );
+ }
+ else if( "model".equals( lifestyle ) )
+ {
+ return;
+ }
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,259 @@
+/*
+ * 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.control;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.PartDescriptor;
+
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.model.Model;
+
+import net.dpml.composition.models.StandardComponentModel;
+
+/**
+ * This makes a dynamic proxy for a Parts object.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: ApplianceInvocationHandler.java 2106 2005-03-21 18:46:10Z
mcconnell AT dpml.net $
+ */
+public final class PartsInvocationHandler
+ implements InvocationHandler
+{
+ //-------------------------------------------------------------------
+ // state
+ //-------------------------------------------------------------------
+
+ /**
+ * A map of the 'get' part descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_getters = new Hashtable();
+
+ /**
+ * A map of the 'create' part descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_creators = new Hashtable();
+
+ /**
+ * A map of the 'release' part descriptors published by the component type
+ * and keyed by entry key.
+ */
+ private final Map m_releasors = new Hashtable();
+
+ /**
+ * The component type.
+ */
+ private final Type m_type;
+
+ /**
+ * The component type.
+ */
+ private final StandardComponentModel m_model;
+
+ //-------------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------------
+
+ /**
+ * Create a dependency invocation handler.
+ *
+ * @param model the component model
+ */
+ public PartsInvocationHandler( StandardComponentModel model )
+ throws NullPointerException
+ {
+ m_model = model;
+ m_type = model.getType();
+
+ PartDescriptor[] entries = m_type.getPartDescriptors();
+ for( int i=0; i<entries.length; i++ )
+ {
+ PartDescriptor p = entries[i];
+ String key = p.getKey();
+ int semantic = p.getSemantic();
+ if( PartDescriptor.GET == semantic )
+ {
+ m_getters.put( key, p );
+ }
+ else if( PartDescriptor.CREATE == semantic )
+ {
+ m_creators.put( key, p );
+ }
+ else if( PartDescriptor.RELEASE == semantic )
+ {
+ m_releasors.put( key, p );
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ * @throws Throwable if an error occurs
+ * @exception NullPointerException if any one of the proxy or method
arguments
+ * is null, or if the object instance has been destroyed
earlier.
+ */
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable, NullPointerException
+ {
+ Class source = method.getDeclaringClass();
+ if( Object.class == method.getDeclaringClass() )
+ {
+ return method.invoke( this, args );
+ }
+
+ PartDescriptor descriptor = getPartDescriptor( method );
+ if( null == descriptor )
+ {
+ final String error =
+ "Illegal request for an undeclared part ["
+ + descriptor.getKey()
+ + "] withing the component type ["
+ + m_type.getInfo().getClassname()
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+
+ //
+ // we have a valid key
+ //
+
+ String key = descriptor.getKey();
+ Model m = m_model.getPart( key );
+ if( null == m )
+ {
+ final String error =
+ "Unable to locate a part using the key ["
+ + key
+ + "] withing the component ["
+ + m_model.getQualifiedName()
+ + "].";
+ throw new IllegalStateException( error );
+ }
+ else
+ {
+ Controller controller = m.getController();
+ Object instance = controller.resolve( m );
+ return method.invoke( instance, args );
+ }
+ }
+
+ private PartDescriptor getPartDescriptor( Method method )
+ {
+ String name = method.getName();
+ String key = getKeyFromMethod( method );
+ if( name.startsWith( "get" ) )
+ {
+ return (PartDescriptor) m_getters.get( key );
+ }
+ else if( name.startsWith( "create" ) )
+ {
+ return (PartDescriptor) m_creators.get( key );
+ }
+ else if( name.startsWith( "release" ) )
+ {
+ return (PartDescriptor) m_releasors.get( key );
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private String getKeyFromMethod( Method method )
+ {
+ String name = method.getName();
+ if( name.startsWith( "get" ) )
+ {
+ return formatKey( name.substring( 3 ) );
+ }
+ else if( name.startsWith( "create" ) )
+ {
+ return formatKey( name.substring( 6 ) );
+ }
+ else if( name.startsWith( "release" ) )
+ {
+ return formatKey( name.substring( 7 ) );
+ }
+ else
+ {
+ final String error =
+ "Invalid method accessor ["
+ + name
+ + "]";
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ private String formatKey( String key )
+ {
+ if( key.length() < 1 )
+ {
+ throw new IllegalArgumentException( "key" );
+ }
+ String first = key.substring( 0, 1 ).toLowerCase();
+ String remainder = key.substring( 1 );
+ return first + remainder;
+ }
+
+ //-------------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------------
+
+ private void assertNotNull( Object object, String key )
+ throws NullPointerException
+ {
+ if( null == object )
+ {
+ throw new NullPointerException( key );
+ }
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "[parts {" );
+ PartDescriptor[] entries = m_type.getPartDescriptors();
+ for( int i=0; i<entries.length; i++ )
+ {
+ PartDescriptor p = entries[i];
+ buffer.append( p.toString() );
+ }
+ buffer.append( "}]" );
+ return buffer.toString();
+ }
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/DependencyModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/DependencyModel.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,131 @@
+/*
+ * 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.util.ArrayList;
+
+import net.dpml.automation.model.ModelException;
+
+import net.dpml.composition.data.DependencyDirective;
+
+import net.dpml.meta.info.DependencyDescriptor;
+
+/**
+ * Default implementation of the deplendency model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: DefaultDependencyModel.java 2153 2005-03-26 23:14:35Z
mcconnell AT dpml.net $
+ */
+public class DependencyModel
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private final DependencyDescriptor m_descriptor;
+ private final DependencyDirective m_directive;
+
+ private StandardComponentModel m_provider;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new dependency model.
+ *
+ * @param descriptor the dependency descriptor
+ */
+ public DependencyModel( final DependencyDescriptor descriptor )
+ throws ModelException, NullPointerException
+ {
+ this( descriptor, null );
+ }
+
+ /**
+ * Creation of a new dependency model.
+ *
+ * @param descriptor the dependency descriptor
+ * @param directive the dependency directive (possibly null)
+ */
+ public DependencyModel( final DependencyDescriptor descriptor,
DependencyDirective directive )
+ throws ModelException, NullPointerException
+ {
+ if( descriptor == null )
+ {
+ throw new NullPointerException( "descriptor" );
+ }
+
+ m_descriptor = descriptor;
+ m_directive = directive;
+ }
+
+ //--------------------------------------------------------------
+ // DependencyModel
+ //--------------------------------------------------------------
+
+ /**
+ * Return the dependency descriptor.
+ *
+ * @return the descriptor
+ */
+ public DependencyDescriptor getDependencyDescriptor()
+ {
+ return m_descriptor;
+ }
+
+ /**
+ * Return the dependency directive.
+ *
+ * @return the directive (possibly null)
+ */
+ public DependencyDirective getDependencyDirective()
+ {
+ return m_directive;
+ }
+
+ /**
+ * Set the provider model.
+ *
+ * @param model the provider model
+ */
+ public void setProvider( StandardComponentModel model )
+ {
+ m_provider = model;
+ }
+
+ /**
+ * Return the assigned provider model.
+ *
+ * @return the stage provider model
+ */
+ public StandardComponentModel getProvider()
+ {
+ return m_provider;
+ }
+
+ /**
+ * Clear the assigned provider.
+ */
+ public void clearProvider()
+ {
+ m_provider = null;
+ }
+
+}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/EntryModel.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,80 @@
+/*
+ * 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 net.dpml.automation.model.ModelException;
+
+import net.dpml.meta.info.EntryDescriptor;
+
+/**
+ * A context entry model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: DefaultEntryModel.java 1518 2005-01-17 17:13:05Z niclas $
+ */
+public abstract class EntryModel
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private EntryDescriptor m_descriptor;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new context entry model.
+ *
+ * @param descriptor the context entry descriptor
+ * @exception NullPointerException is the descriptor argument is null.
+ */
+ public EntryModel( EntryDescriptor descriptor )
+ throws NullPointerException
+ {
+ if( descriptor == null )
+ {
+ throw new NullPointerException( "descriptor" );
+ }
+ m_descriptor = descriptor;
+ }
+
+ //--------------------------------------------------------------
+ // 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
+ */
+ public abstract Object getValue() throws ModelException;
+
+}

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
Sun Apr 3 12:29:16 2005
@@ -19,13 +19,29 @@
package net.dpml.composition.models;

import java.io.Serializable;
+import java.util.Map;
+import java.util.Hashtable;
+import java.util.WeakHashMap;
+
+import net.dpml.automation.model.Model;
+import net.dpml.automation.model.ModelException;
+import net.dpml.automation.model.ModelRuntimeException;
+import net.dpml.automation.control.Controller;
+import net.dpml.automation.control.DelegationException;
+import net.dpml.automation.part.Part;

-import net.dpml.part.Part;
-import net.dpml.control.Model;
import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.data.ContextDirective;
+import net.dpml.composition.data.DependencyDirective;
+import net.dpml.composition.control.CompositionClassLoader;
+import net.dpml.composition.control.CompositionController;
+
+import net.dpml.meta.info.Type;
+import net.dpml.meta.info.ServiceDescriptor;
+import net.dpml.meta.info.DependencyDescriptor;

/**
- * The implementation of the model of a composition.
+ * The implementation of a component 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 $
@@ -34,21 +50,263 @@
{
private final ComponentProfile m_profile;
private final ClassLoader m_classloader;
+ private final String m_partition;
+ private final CompositionController m_controller;
+
+ private final Class m_class;
+ private final Type m_type;
+ private final Class[] m_interfaces;
+ private final String m_name;
+ private final String m_lifestyle;
+
+ private transient Map m_instances = new WeakHashMap();
+ private final Hashtable m_providers = new Hashtable();
+ private final Hashtable m_parts = new Hashtable();

- public StandardComponentModel( ClassLoader classloader, ComponentProfile
profile )
+ public StandardComponentModel(
+ CompositionController controller, String partition, ClassLoader
classloader, ComponentProfile profile )
+ throws DelegationException, ModelException
{
+ this( controller, null, partition, classloader, profile );
+ }
+
+ public StandardComponentModel(
+ CompositionController controller, Model parent, String partition,
ClassLoader classloader, ComponentProfile profile )
+ throws DelegationException, ModelException
+ {
+ m_controller = controller;
+ m_partition = partition;
m_classloader = classloader;
m_profile = profile;
+
+ m_class = loadComponentClass( classloader, profile );
+ m_type = controller.loadType( m_class );
+ m_name = profile.getName();
+ m_lifestyle = profile.getLifestylePolicy();
+
+ //
+ // construct an array of the interface classes that the component
+ // exposes as public services - these will be used when constructing
+ // a proxy to component instances created from this model
+ //
+
+ ServiceDescriptor[] services = m_type.getServices();
+ Class[] interfaces = new Class[ services.length ];
+ for( int i=0; i<interfaces.length; i++ )
+ {
+ ServiceDescriptor service = services[i];
+ interfaces[i] = loadServiceClass( classloader, service );
+ }
+ m_interfaces = interfaces;
+
+ //
+ // Get the set of parts within this part and add them as nested
models
+ // within this model. There is an issue here concerning selection of
+ // our classloader as the parent for the parts - in effect we need a
+ // classname that identifies a class in the component's api loader.
+ //
+
+ String newPartition = getQualifiedName() + "/";
+ Part[] parts = profile.getParts();
+ for( int i=0; i<parts.length; i++ )
+ {
+ Part part = parts[i];
+ Model model = getController().getModel( this, newPartition,
m_classloader, part );
+ m_parts.put( model.getName(), model );
+ }
+
+ //
+ // Any dependencies declared by the component part must be resolvable
+ // by the enclosing model's controller (if available). We use the
supplied
+ // parent model
+ //
+
+ DependencyDescriptor[] dependencies = m_type.getDependencies();
+ for( int i=0; i<dependencies.length; i++ )
+ {
+ DependencyDescriptor dependency = dependencies[i];
+ boolean required = dependency.isRequired();
+ String key = dependency.getKey();
+ DependencyDirective directive = profile.getDependencyDirective(
key );
+
+ if( ( null == directive ) && required )
+ {
+ final String error =
+ "Missing required dependency directive for the key ["
+ + key
+ + "].";
+ throw new ModelException( error );
+ }
+
+ if( null == parent )
+ {
+ if( required )
+ {
+ final String error =
+ "The top-level component ["
+ + getQualifiedName()
+ + "] is declaring a required service dependency which
logically cannot be resolved.";
+ throw new ModelException( error );
+ }
+ }
+ else
+ {
+ Controller manager = parent.getController();
+ String path = directive.getSource();
+ Model model = manager.getProvider( parent, path );
+ if( null == model )
+ {
+ final String error =
+ "Unable to locate a service provider for the key ["
+ + key
+ + "] in the component model ["
+ + getQualifiedName()
+ + "] using the source path ["
+ + path
+ + "].";
+ throw new ModelException( error );
+ }
+ else
+ {
+ m_providers.put( key, model );
+ }
+ }
+ }
}

- public ClassLoader getParentClassLoader()
+ public String getLifestylePolicy()
+ {
+ return m_lifestyle;
+ }
+
+ public Model getPart( String spec )
+ {
+ //
+ // the following is rather limited - in particular we are
+ // not handling paths in the form aaa/bbb/ccc
+ //
+
+ return (Model) m_parts.get( spec );
+ }
+
+ public ClassLoader getClassLoader()
{
return m_classloader;
}

+ public Controller getController()
+ {
+ return getCompositionController();
+ }
+
+ public CompositionController getCompositionController()
+ {
+ return m_controller;
+ }
+
public String getName()
{
- return m_profile.getName();
+ return m_name;
+ }
+
+ public String getPartition()
+ {
+ return m_partition;
+ }
+
+ public String getQualifiedName()
+ {
+ if( getPartition().endsWith( "/" ) )
+ {
+ return getPartition() + getName();
+ }
+ else
+ {
+ return getPartition() + "/" + getName();
+ }
+ }
+
+ public Class getDeploymentClass()
+ {
+ return m_class;
+ }
+
+ public Type getType()
+ {
+ return m_type;
+ }
+
+ public Class[] getServiceClasses()
+ {
+ return m_interfaces;
+ }
+
+ public ContextDirective getContextDirective()
+ {
+ return m_profile.getContextDirective();
+ }
+
+ public Model getProvider( String key )
+ {
+ return (Model) m_providers.get( key );
+ }
+
+ public void put( Object key, Object instance )
+ {
+ synchronized( m_instances )
+ {
+ m_instances.put( key, instance );
+ }
+ }
+
+ public Object get( Object key )
+ {
+ synchronized( m_instances )
+ {
+ return m_instances.get( key );
+ }
+ }
+
+ public void remove( Object key )
+ {
+ synchronized( m_instances )
+ {
+ m_instances.remove( key );
+ }
+ }
+
+ private Class loadComponentClass( ClassLoader classloader,
ComponentProfile profile )
+ {
+ final String classname = profile.getClassname();
+ try
+ {
+ return classloader.loadClass( classname );
+ }
+ catch( ClassNotFoundException cnfe )
+ {
+ final String error =
+ "Component implementation class ["
+ + classname
+ + "] not found.";
+ throw new ModelRuntimeException( error, cnfe );
+ }
+ }
+
+ private Class loadServiceClass( ClassLoader classloader,
ServiceDescriptor service )
+ {
+ final String classname = service.getReference().getClassname();
+ try
+ {
+ return classloader.loadClass( classname );
+ }
+ catch( ClassNotFoundException cnfe )
+ {
+ final String error =
+ "Service interface class ["
+ + classname
+ + "] not found.";
+ throw new ModelRuntimeException( error, cnfe );
+ }
}

}

Added:
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/ValueModel.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,581 @@
+/*
+ * 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.lang.reflect.Constructor;
+import java.util.Map;
+
+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 ValueModel extends EntryModel
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private final ValueDirective m_directive;
+ private final EntryDescriptor m_descriptor;
+ private final ClassLoader m_classloader;
+ private final Map m_map;
+
+ private Object m_value;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new context entry import model.
+ *
+ * @param descriptor the context entry descriptor
+ * @param directive the context entry directive
+ * @exception NullArgumentException if either the directive argument or
the
+ * context argument is null.
+ */
+ public ValueModel( ClassLoader classloader, EntryDescriptor descriptor,
ValueDirective directive, Map entries )
+ throws ModelException, NullPointerException
+ {
+ super( descriptor );
+ if( directive == null )
+ {
+ throw new NullPointerException( "directive" );
+ }
+ m_descriptor = descriptor;
+ m_directive = directive;
+ m_classloader = classloader;
+ m_map = entries;
+
+ validate();
+ }
+
+ private void validate()
+ throws ModelException
+ {
+ final String descriptorClassName = m_descriptor.getClassname();
+ final String directiveClassName = m_directive.getClassname();
+ validatePair( descriptorClassName, directiveClassName );
+ }
+
+ private void validatePair( String descriptorClassName, String
directiveClassName )
+ throws ModelException
+ {
+ if( "int".equals( descriptorClassName ) )
+ {
+ if( ( null == directiveClassName ) || "int".equals(
directiveClassName ) )
+ {
+ return;
+ }
+ else
+ {
+ final String error =
+ "Descriptor class ["
+ + descriptorClassName
+ + "] does not match the supplied directive class ["
+ + directiveClassName
+ + "].";
+ throw new ModelException( error );
+ }
+ }
+
+ if( null == directiveClassName )
+ {
+ return;
+ }
+
+ final String key = m_descriptor.getKey();
+ Class target = null;
+ try
+ {
+ target = m_classloader.loadClass( descriptorClassName );
+ }
+ catch( ClassNotFoundException e )
+ {
+ final String error =
+ "Context entry return class ["
+ + descriptorClassName
+ + "] declared under the key ["
+ + key
+ + "] not found.";
+ throw new ModelException( error );
+ }
+
+ Class source = null;
+ try
+ {
+ source = m_classloader.loadClass( directiveClassName );
+ }
+ catch( ClassNotFoundException e )
+ {
+ final String error =
+ "Context entry implementation class ["
+ + directiveClassName
+ + "] declared under the key ["
+ + key
+ + "] not found.";
+ throw new ModelException( error );
+ }
+
+ if( !target.isAssignableFrom( source ) )
+ {
+ final String error =
+ "Context entry implementation class ["
+ + directiveClassName
+ + "] declared under the key ["
+ + key
+ + "] is not assignable to the context entry return type ["
+ + descriptorClassName
+ + "].";
+ throw new ModelException( error );
+ }
+ }
+
+ //--------------------------------------------------------------
+ // EntryModel
+ //--------------------------------------------------------------
+
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public Object getValue()
+ throws ModelException
+ {
+ if( m_value != null )
+ {
+ return m_value;
+ }
+
+ String target = m_descriptor.getKey();
+ Object object = null;
+ try
+ {
+ String classname = getReturnTypeClassname();
+ String argument = m_directive.getLocalValue();
+ Value[] params = m_directive.getValues();
+ Class clazz = getValueClass( classname );
+ object = getValue( clazz, argument, params );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cannot establish a constructed context entry for the key " +
target
+ + " due to a runtime failure.";
+ throw new ModelException( error, e );
+ }
+
+ if( !m_descriptor.isVolatile() )
+ {
+ m_value = object;
+ }
+
+ return object;
+ }
+
+ private String getReturnTypeClassname()
+ {
+ String classname = m_directive.getClassname();
+ if( null == classname )
+ {
+ return m_descriptor.getClassname();
+ }
+ else
+ {
+ return classname;
+ }
+ }
+
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public Object getValue( Value p )
+ throws ModelException
+ {
+ String classname = p.getClassname();
+ String argument = p.getArgument();
+ Value[] params = p.getValueDirectives();
+ Class clazz = getValueClass( classname );
+ return getValue( clazz, argument, params );
+ }
+
+ /**
+ * Return the derived parameter value.
+ * @param clazz the constructor class
+ * @param argument a single string constructor argument
+ * @param parameters an alternative sequence of arguments
+ * @return the value
+ * @exception ModelException if the parameter value cannot be resolved
+ */
+ public Object getValue( Class clazz, String argument, Value[] parameters
)
+ throws ModelException
+ {
+ //
+ // if the parameter contains a text argument then check if its a
reference
+ // to a map entry (in the form"${<key>}" ), otherwise its a simple
constructor
+ // case with a single string paremeter
+ //
+
+ if( parameters.length == 0 )
+ {
+ if( argument == null )
+ {
+ return getNullArgumentConstructorValue( clazz );
+ }
+ else
+ {
+ return getSingleArgumentConstructorValue( clazz, argument );
+ }
+ }
+ else
+ {
+ return getMultiArgumentConstructorValue( clazz, parameters );
+ }
+ }
+
+ private Object getMultiArgumentConstructorValue( Class clazz, Value[]
parameters )
+ throws ModelException
+ {
+ //
+ // getting here means we are dealing with 0..n types parameter
constructor where the
+ // parameters are defined by the nested parameter definitions
+ //
+
+ if ( parameters.length == 0 )
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch ( InstantiationException e )
+ {
+ final String error =
+ "Unable to instantiate instance of class: " +
clazz.getName();
+ throw new ModelException( error, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ final String error =
+ "Cannot access null constructor for the class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ }
+ else
+ {
+ Class[] params = new Class[ parameters.length ];
+ for ( int i = 0; i < parameters.length; i++ )
+ {
+ String classname = parameters[i].getClassname();
+ try
+ {
+ params[i] = m_classloader.loadClass( classname );
+ }
+ catch ( Throwable e )
+ {
+ final String error =
+ "Unable to resolve sub-parameter class: "
+ + classname
+ + " for the parameter " + clazz.getName();
+ throw new ModelException( error, e );
+ }
+ }
+
+ Object[] values = new Object[ parameters.length ];
+ for ( int i = 0; i < parameters.length; i++ )
+ {
+ Value p = parameters[i];
+ String classname = p.getClassname();
+ try
+ {
+ values[i] = getValue( p );
+ }
+ catch ( Throwable e )
+ {
+ final String error =
+ "Unable to instantiate sub-parameter for value: "
+ + classname
+ + " inside the parameter " + clazz.getName();
+ throw new ModelException( error, e );
+ }
+ }
+ Constructor constructor = null;
+ try
+ {
+ constructor = clazz.getConstructor( params );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ final String error =
+ "Supplied parameters for "
+ + clazz.getName()
+ + " do not match the available class constructors.";
+ throw new ModelException( error, e );
+ }
+
+ try
+ {
+ return constructor.newInstance( values );
+ }
+ catch ( InstantiationException e )
+ {
+ final String error =
+ "Unable to instantiate an instance of a multi-parameter
constructor for class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ final String error =
+ "Cannot access multi-parameter constructor for the class:
'"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ catch ( Throwable e )
+ {
+ final String error =
+ "Unexpected error while attmpting to instantiate a
multi-parameter constructor "
+ + "for the class: '" + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ }
+ }
+
+ private Object getNullArgumentConstructorValue( Class clazz )
+ throws ModelException
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch ( InstantiationException e )
+ {
+ final String error =
+ "Unable to instantiate instance of class: " + clazz.getName();
+ throw new ModelException( error, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ final String error =
+ "Cannot access null parameter constructor for the class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ catch ( Throwable e )
+ {
+ final String error =
+ "Unexpected exception while creating the class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ }
+
+ private Object getSingleArgumentConstructorValue( Class clazz, String
argument )
+ throws ModelException
+ {
+ if ( argument.startsWith( "${" ) )
+ {
+ if ( argument.endsWith( "}" ) )
+ {
+ final String key = argument.substring( 2, argument.length()
- 1 );
+ Object value = m_map.get( key );
+ if ( value != null )
+ {
+ if( value instanceof EntryModel )
+ {
+ return ((EntryModel)value).getValue();
+ }
+ else
+ {
+ return value;
+ }
+ }
+ else
+ {
+ final String error =
+ "Unresolvable context value: '" + key + "'.";
+ throw new ModelException( error );
+ }
+ }
+ else
+ {
+ final String error =
+ "Illegal format for context reference: '" + argument +
"'.";
+ throw new ModelException( error );
+ }
+ }
+ else
+ {
+ //
+ // the argument is a simple type that takes a single String value
+ // as a constructor argument
+ //
+
+ if( clazz.isPrimitive() )
+ {
+ if( Integer.TYPE == clazz )
+ {
+ return Integer.valueOf( argument );
+ }
+ else if( Boolean.TYPE == clazz )
+ {
+ return Boolean.valueOf( argument );
+ }
+ else if( Byte.TYPE == clazz )
+ {
+ return Byte.valueOf( argument );
+ }
+ else if( Short.TYPE == clazz )
+ {
+ return Short.valueOf( argument );
+ }
+ else if( Long.TYPE == clazz )
+ {
+ return Long.valueOf( argument );
+ }
+ else if( Float.TYPE == clazz )
+ {
+ return Float.valueOf( argument );
+ }
+ else if( Double.TYPE == clazz )
+ {
+ return Double.valueOf( argument );
+ }
+ else
+ {
+ final String error =
+ "The primitive return type ["
+ + clazz.getName()
+ + "] is not supported.";
+ throw new ModelException( error );
+ }
+ }
+
+ try
+ {
+ final Class[] params = new Class[]{ String.class };
+ Constructor constructor = clazz.getConstructor( params );
+ final Object[] values = new Object[]{ argument };
+ return constructor.newInstance( values );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ final String error =
+ "Class: '" + clazz.getName()
+ + "' does not implement a single string argument
constructor.";
+ throw new ModelException( error );
+ }
+ catch ( InstantiationException e )
+ {
+ final String error =
+ "Unable to instantiate instance of class: " +
clazz.getName()
+ + " with the single argument: '" + argument + "'";
+ throw new ModelException( error, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ final String error =
+ "Cannot access single string parameter constructor for the
class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ catch ( Throwable e )
+ {
+ final String error =
+ "Unexpected exception while creating a single string
parameter value for the class: '"
+ + clazz.getName() + "'.";
+ throw new ModelException( error, e );
+ }
+ }
+ }
+
+ /**
+ * Return the classname of the parameter implementation to use.
+ * @return the parameter class
+ * @exception ModelException if the parameter class cannot be resolved
+ */
+ Class getValueClass( String classname ) throws ModelException
+ {
+ try
+ {
+ return m_classloader.loadClass( classname );
+ }
+ catch ( final ClassNotFoundException e )
+ {
+ if ( classname.equals( "int" ) )
+ {
+ return int.class;
+ }
+ else if ( classname.equals( "short" ) )
+ {
+ return short.class;
+ }
+ else if ( classname.equals( "long" ) )
+ {
+ return long.class;
+ }
+ else if ( classname.equals( "byte" ) )
+ {
+ return byte.class;
+ }
+ else if ( classname.equals( "double" ) )
+ {
+ return double.class;
+ }
+ else if ( classname.equals( "byte" ) )
+ {
+ return byte.class;
+ }
+ else if ( classname.equals( "float" ) )
+ {
+ return float.class;
+ }
+ else if ( classname.equals( "char" ) )
+ {
+ return char.class;
+ }
+ else if ( classname.equals( "char" ) )
+ {
+ return char.class;
+ }
+ else if ( classname.equals( "boolean" ) )
+ {
+ return boolean.class;
+ }
+ else
+ {
+ throw new ModelException(
+ "Could not locate the parameter implementation for class:
'"
+ + classname + "'.", e );
+ }
+ }
+ }
+}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
Sun Apr 3 12:29:16 2005
@@ -19,7 +19,7 @@

import java.util.ArrayList;

-import net.dpml.part.Part;
+import net.dpml.automation.part.Part;

import net.dpml.logging.data.CategoriesDirective;

@@ -131,7 +131,7 @@
//

return new ComponentProfile(
- name, activation, collection, classname, categories, context,
dependencies, parts,
+ name, activation, collection, null, classname, categories,
context, dependencies, parts,
params, configuration, cld, Mode.EXPLICIT );
}


Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
Sun Apr 3 12:29:16 2005
@@ -122,10 +122,6 @@
public CompositionCriteria createCompositionCriteria()
{
CompositionCriteria criteria = new DefaultCompositionCriteria(
m_system );
- if( m_line.hasOption( "secure" ) )
- {
- criteria.put( CompositionCriteria.SECURITY_ENABLED_KEY, new
Boolean( true ) );
- }
if( m_line.hasOption( "audit" ) )
{
criteria.put( CompositionCriteria.AUDIT_ENABLED_KEY, new
Boolean( true ) );
@@ -468,24 +464,12 @@
Options options = new Options();

//
- // secure switches
- //
-
- OptionGroup security = new OptionGroup();
- security.addOption(
- new Option( "secure", REZ.getString( "cli-secure-description" ) )
);
- security.addOption(
- new Option( "unsecure", REZ.getString( "cli-unsecure-description"
) ) );
- options.addOptionGroup( security );
-
- //
// audit
//

options.addOption(
new Option( "audit", REZ.getString( "cli-audit-description" ) ) );

-
//
// runtime artifact
//

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
Sun Apr 3 12:29:16 2005
@@ -32,6 +32,8 @@
import java.util.LinkedList;
import java.util.List;

+import net.dpml.automation.part.Part;
+
import net.dpml.composition.data.CompositionDirective;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContainmentProfile;
@@ -63,9 +65,7 @@
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.composition.provider.ModelFactory;

-import net.dpml.composition.control.CompositionController;
-
-import net.dpml.part.Part;
+import net.dpml.composition.control.CompositionPartHandler;

import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
@@ -590,8 +590,8 @@
try
{
Logger logger = getLogger();
- CompositionController controller = new CompositionController(
logger );
- Part part = controller.loadPart( uri );
+ CompositionPartHandler handler = new CompositionPartHandler();
+ Part part = handler.loadPart( uri );
if( part instanceof DeploymentProfile )
{
DeploymentProfile profile = (DeploymentProfile) part;

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
Sun Apr 3 12:29:16 2005
@@ -50,7 +50,7 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Type;
-import net.dpml.meta.info.builder.TypeHolder;
+import net.dpml.meta.info.TypeHolder;


/**

Copied: development/main/metro/composition/testing/classic/build.xml (from
r2195, development/main/metro/composition/testing/unit/build.xml)
==============================================================================
--- development/main/metro/composition/testing/unit/build.xml (original)
+++ development/main/metro/composition/testing/classic/build.xml Sun
Apr 3 12:29:16 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-composition-testing-unit" default="install" basedir="."
+<project name="dpml-composition-testing-classic" default="install"
basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core">

<transit:import uri="artifact:template:dpml/magic/standard"/>
@@ -72,7 +72,7 @@
class="net.dpml.composition.testing.CompositeGizmo"
dest="target/test/acme-gizmo.part">
<parts>
- <component key="widget" uri="${acme.part}"/>
+ <component name="widget" uri="${acme.part}"/>
</parts>
</component>


Modified: development/main/metro/composition/testing/system/build.xml
==============================================================================
--- development/main/metro/composition/testing/system/build.xml (original)
+++ development/main/metro/composition/testing/system/build.xml Sun Apr 3
12:29:16 2005
@@ -11,4 +11,20 @@
<filter token="ACME-PART-URI" value="${acme.part}"/>
</target>

+ <target name="build" depends="standard.build">
+
+ <!--
+ Setup a component dealing with experimental part handling.
+ -->
+ <component xmlns="plugin:dpml/composition/dpml-composition-builder"
+ name="gizmo"
+ class="net.dpml.composition.testing.CompositeGizmo"
+ dest="target/test/acme-gizmo.part">
+ <parts>
+ <component name="widget" uri="${acme.part}"/>
+ </parts>
+ </component>
+
+ </target>
+
</project>

Modified:
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
==============================================================================
---
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
(original)
+++
development/main/metro/composition/testing/system/src/test/net/dpml/composition/testing/CompositionManagerTestCase.java
Sun Apr 3 12:29:16 2005
@@ -38,7 +38,8 @@
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;

-import net.dpml.control.Model;
+import net.dpml.automation.model.Model;
+import net.dpml.automation.control.Controller;

import net.dpml.composition.control.CompositionManager;

@@ -72,10 +73,14 @@
// test
//------------------------------------------------------------------

- public void testSomething() throws Exception
+ public void testAcmePart() throws Exception
{
CompositionManager manager = getCompositionManager();
Model model = manager.addPart( ACME_PART_URI );
+ Controller controller = model.getController();
+ Widget widget = (Widget) controller.resolve( model );
+ widget.doWidgetTypeStuff();
+ controller.release( widget );
manager.list();
}


Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Sun Apr 3 12:29:16 2005
@@ -25,18 +25,6 @@

<!-- Automation -->

- <project basedir="automation/part">
- <info>
- <group>dpml/metro/protected</group>
- <name>dpml-automation-part</name>
- <version>1.0.0</version>
- <status>SNAPSHOT</status>
- <types>
- <type>jar</type>
- </types>
- </info>
- </project>
-
<project basedir="automation/control">
<info>
<group>dpml/metro/protected</group>
@@ -47,9 +35,6 @@
<type>jar</type>
</types>
</info>
- <dependencies>
- <include key="dpml-automation-part"/>
- </dependencies>
</project>

<project basedir="automation/builder">
@@ -63,7 +48,6 @@
</types>
</info>
<dependencies>
- <include key="dpml-automation-part"/>
<include key="dpml-automation-control"/>
</dependencies>
</project>
@@ -318,7 +302,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-automation-part" tag="api"/>
+ <include key="dpml-automation-control" tag="api"/>
<include key="dpml-composition-spi"/>
<include key="dpml-composition-impl" build="false"/>
<include key="dpml-configuration-api"/>
@@ -349,7 +333,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-automation-part"/>
+ <include key="dpml-automation-control"/>
<include key="dpml-transit-main"/>
<include key="dpml-meta-api"/>
<include key="dpml-util-i18n"/>
@@ -447,6 +431,25 @@
</dependencies>
</project>

+ <project basedir="composition/control">
+ <info>
+ <group>dpml/metro/private</group>
+ <name>dpml-composition-control</name>
+ <version>1.0.0</version>
+ <status>SNAPSHOT</status>
+ <types>
+ <type>jar</type>
+ <type>plugin</type>
+ </types>
+ </info>
+ <dependencies>
+ <include key="dpml-transit-main" tag="api"/>
+ <include key="dpml-automation-control" tag="spi"/>
+ <include key="dpml-composition-api" tag="spi"/>
+ <include key="dpml-system-api" tag="spi"/>
+ </dependencies>
+ </project>
+
<project basedir="composition/builder">
<info>
<group>dpml/metro/tools</group>
@@ -469,32 +472,14 @@
<include key="dpml-parameters-api"/>
<include key="dpml-parameters-impl"/>
<include key="dpml-composition-api"/>
+ <include key="dpml-composition-control"/>
</dependencies>
</project>

- <project basedir="composition/control">
- <info>
- <group>dpml/metro/private</group>
- <name>dpml-composition-control</name>
- <version>1.0.0</version>
- <status>SNAPSHOT</status>
- <types>
- <type>jar</type>
- <type>plugin</type>
- </types>
- </info>
- <dependencies>
- <include key="dpml-transit-main" tag="api"/>
- <include key="dpml-automation-control" tag="spi"/>
- <include key="dpml-composition-api" tag="spi"/>
- <include key="dpml-system-api" tag="spi"/>
- </dependencies>
- </project>
-
- <project basedir="composition/testing/system">
+ <project basedir="composition/testing/acme">
<info>
<group>dpml/test</group>
- <name>dpml-composition-testing-system</name>
+ <name>dpml-composition-testing-acme</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>
<types>
@@ -504,19 +489,16 @@
</info>
<dependencies>
<include key="dpml-logging-api"/>
- <include key="dpml-composition-control"/>
- <include key="dpml-composition-testing-acme"/>
- <include key="dpml-system-impl" runtime="false"/>
</dependencies>
<plugins>
<include key="dpml-composition-builder"/>
</plugins>
</project>

- <project basedir="composition/testing/acme">
+ <project basedir="composition/testing/system">
<info>
<group>dpml/test</group>
- <name>dpml-composition-testing-acme</name>
+ <name>dpml-composition-testing-system</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>
<types>
@@ -526,16 +508,19 @@
</info>
<dependencies>
<include key="dpml-logging-api"/>
+ <include key="dpml-composition-control"/>
+ <include key="dpml-composition-testing-acme"/>
+ <include key="dpml-system-impl" runtime="false"/>
</dependencies>
<plugins>
<include key="dpml-composition-builder"/>
</plugins>
</project>

- <project basedir="composition/testing/unit">
+ <project basedir="composition/testing/classic">
<info>
<group>dpml/test</group>
- <name>dpml-composition-testing-unit</name>
+ <name>dpml-composition-testing-classic</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>
<types>
@@ -903,7 +888,7 @@
<include key="dpml-transit-main" tag="api"/>
<include key="dpml-activation-api" tag="api"/>
<include key="dpml-composition-api" tag="api"/>
- <include key="dpml-automation-part" tag="api"/>
+ <include key="dpml-automation-control" tag="api"/>
<include key="dpml-activation-metro-provider" build="false"/>
<include key="dpml-activation-avalon-provider" build="false"/>
<include key="dpml-system-impl" build="false"/>

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
Sun Apr 3 12:29:16 2005
@@ -98,7 +98,6 @@
* @param key the key resolved from the method name
* @param type the argument type corresponding to the method return type
* for get and create methods, and the single parameter for the
release method
- * @param semantic the operation semantics ( GET, CREATE or RELEASE )
* @exception NullPointerException if key or type is null
*/
public PartDescriptor( final String key, final String type ) throws
NullPointerException

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
Sun Apr 3 12:29:16 2005
@@ -66,7 +66,7 @@
/**
* Construct a service descriptor for specified ReferenceDescriptor
*
- * @param designator the service reference
+ * @param type the service type
* @exception NullPointerException if the designator argument is null
*/
public ServiceDescriptor( final String type )

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
Sun Apr 3 12:29:16 2005
@@ -69,7 +69,7 @@
* @param dependencies a set of depedency descriprors that detail the
service
* that this component type is depedent on
* @param defaults the static configuration defaults
- * @param params static parameter defaults
+ * @param parts an array of part descriptors
* @exception NullPointerException if the descriptor, loggers, context,
services,
* or dependencies argument are null
*/

Added:
development/main/metro/meta/api/src/main/net/dpml/meta/info/TypeHolder.java
==============================================================================
--- (empty file)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/TypeHolder.java
Sun Apr 3 12:29:16 2005
@@ -0,0 +1,100 @@
+/*
+ * 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.meta.info;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Properties;
+import java.io.Serializable;
+
+/**
+ *
+ *
+ * @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 TypeHolder implements Serializable
+{
+ static final long serialVersionUID = 1L;
+
+ private final URI m_handler;
+ private final byte[] m_type;
+
+ public TypeHolder( URI handler, byte[] part )
+ {
+ m_handler = handler;
+ m_type = part;
+ }
+
+ public URI getTypeHandlerURI()
+ {
+ return m_handler;
+ }
+
+ public byte[] getByteArray()
+ {
+ return m_type;
+ }
+
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_handler.hashCode();
+ for( int i=0; i<m_type.length; i++ )
+ {
+ hash ^= new Byte( m_type[i] ).hashCode();
+ }
+ return hash;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof TypeHolder )
+ {
+ TypeHolder holder = (TypeHolder) other;
+ if( getTypeHandlerURI().equals( holder.getTypeHandlerURI() ) ==
false )
+ {
+ return false;
+ }
+ else if( Arrays.equals( getByteArray(), holder.getByteArray() )
== false )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public String toString()
+ {
+ return "[type-holder handler:" + m_handler + " size:" +
m_type.length + "]";
+ }
+
+}
+

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/SerializedTypeCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/SerializedTypeCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/SerializedTypeCreator.java
Sun Apr 3 12:29:16 2005
@@ -25,8 +25,8 @@
import java.io.ByteArrayInputStream;

import net.dpml.meta.info.Type;
+import net.dpml.meta.info.TypeHolder;
import net.dpml.meta.info.builder.TypeCreator;
-import net.dpml.meta.info.builder.TypeHolder;
import net.dpml.meta.info.builder.BuildException;

/**

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
Sun Apr 3 12:29:16 2005
@@ -465,7 +465,7 @@
* A utility method to build a {@link PartDescriptor}
* object from specified configuration.
*
- * @param parameter the part configuration
+ * @param config the part configuration
* @return the created PartDescriptor
* @throws BuildException if an error occurs
*/

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Sun Apr 3 12:29:16 2005
@@ -167,7 +167,6 @@
/**
* Returns the singleton instance of the transit system. If this method
* has already been invoked the server and monitor argument will be
ignored.
- * @param server JNDI server address
* @param monitor the bootstrap monitor
* @return the singleton transit instance
* @exception TransitException if an error occurs during establishment

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/RemoteCacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/RemoteCacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/RemoteCacheHandler.java
Sun Apr 3 12:29:16 2005
@@ -64,9 +64,7 @@

/**
* Creation of a new file based cache handler.
- * @param monitor the assigned monitor
- * @param hosts the assigned hosts
- * @param props the properties against which this instance will be
configured
+ * @param delegate the cache handler delegate
*/
public RemoteCacheHandler( CacheHandler delegate )
throws RemoteException

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
Sun Apr 3 12:29:16 2005
@@ -116,7 +116,7 @@

/**
* Notification of the creation of cache handler.
- * @param host the resource host
+ * @param cache the cache handler
*/
public void notifyCacheHandlerCreation( CacheHandler cache )
{



  • svn commit: r2196 - in development/main: metro metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/automation/builder/src/main/net/dpml/automation/builder metro/automation/builder/src/main/net/dpml/builder metro/automation/control/src/main/net/dpml/automation/control metro/automation/control/src/main/net/dpml/automation/model metro/automation/control/src/main/net/dpml/automation/part metro/automation/control/src/main/net/dpml/control metro/automation/part metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/builder/src/main/net/dpml/composition/builder metro/composition/builder/src/main/net/dpml/composition/builder/datatypes metro/composition/control/src/main/net/dpml/composition/control metro/composition/control/src/main/net/dpml/composition/models metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/testing/classic metro/composition/testing/classic/src metro/composition/testing/system metro/composition/testing/system/src/test/net/dpml/composition/testing metro/composition/testing/unit metro/meta/api/src/main/net/dpml/meta/info metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/spi/src/main/net/dpml/meta/info/builder transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/monitors, mcconnell, 04/02/2005

Archive powered by MHonArc 2.6.24.

Top of Page