You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/05/01 11:16:27 UTC

svn commit: r533980 - in /incubator/tuscany/java/sca/modules: assembly/src/main/java/org/apache/tuscany/assembly/ assembly/src/main/java/org/apache/tuscany/assembly/impl/ assembly/src/main/java/org/apache/tuscany/assembly/util/ core-spring/src/main/jav...

Author: jsdelfino
Date: Tue May  1 02:16:24 2007
New Revision: 533980

URL: http://svn.apache.org/viewvc?view=rev&rev=533980
Log:
First cut of the model processing to handle wires and configuration in nested composites. Integrated with the spring-based mini-core and added a test case and sample showing a recursive composition.

Added:
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite   (with props)
Removed:
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/context/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/CalculatorClient.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/CalculatorTestCase.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/NestedCalculatorTestCaseFIXME.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeException.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/TestBeanCalculator.composite
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/TestBeanCalculator.composite
Modified:
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentProperty.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentReference.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentService.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Property.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Reference.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Service.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractPropertyImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractReferenceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractServiceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/BaseImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentPropertyImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentReferenceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentServiceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeReferenceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeServiceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ContractImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/PropertyImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ReferenceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ServiceImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/WireImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanReferenceImpl.java
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/BeanBaseJavaImplementationImpl.java

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Component.java Tue May  1 02:16:24 2007
@@ -31,6 +31,20 @@
  * @version $Rev$ $Date$
  */
 public interface Component extends Base, IntentAttachPoint, PolicySetAttachPoint, Visitable {
+    
+    /**
+     * Returns the URI of the component.
+     *  
+     * @return the URI of the component
+     */
+    String getURI();
+    
+    /**
+     * Sets the URI of the component.
+     * 
+     * @param uri the URI of the component
+     */
+    void setURI(String uri);
 
     /**
      * Returns the name of the component.
@@ -108,4 +122,13 @@
      * @param autowire whether component references should be autowired
      */
     void setAutowire(boolean autowire);
+
+    /**
+     * Returns a clone of the component.
+     * 
+     * @return a clone of the component
+     * @throws CloneNotSupportedException
+     */
+    Object clone() throws CloneNotSupportedException;
+
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentProperty.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentProperty.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentProperty.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentProperty.java Tue May  1 02:16:24 2007
@@ -23,7 +23,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public interface ComponentProperty extends Property {
+public interface ComponentProperty extends Property, Cloneable {
 
     /**
      * Returns the property defined by the component implementation.
@@ -70,4 +70,11 @@
      * @param file a URI to a file containing the property value
      */
     void setFile(String file);
+    
+    /**
+     * Clone the component property.
+     * 
+     * @return a clone of the component property
+     */
+    Object clone() throws CloneNotSupportedException;
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentReference.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentReference.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentReference.java Tue May  1 02:16:24 2007
@@ -64,4 +64,10 @@
      */
     List<CompositeReference> promotedAs();
     
+    /**
+     * Clone the component reference.
+     * 
+     * @return a clone of the component reference
+     */
+    Object clone() throws CloneNotSupportedException;
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentService.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentService.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/ComponentService.java Tue May  1 02:16:24 2007
@@ -49,4 +49,10 @@
      */
     List<CompositeService> promotedAs();
     
+    /**
+     * Clone the component service.
+     * 
+     * @return a clone of the component service
+     */
+    Object clone() throws CloneNotSupportedException;
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java Tue May  1 02:16:24 2007
@@ -99,9 +99,11 @@
     void setAutowire(boolean autowire);
 
     /**
-     * Returns a copy of the composite. 
-     * @return a copy of the composite.
+     * Returns a clone of the component type.
+     * 
+     * @return a clone of the component type
+     * @throws CloneNotSupportedException
      */
-    Composite copy();
-    
+    Object clone() throws CloneNotSupportedException;
+
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Property.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Property.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Property.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Property.java Tue May  1 02:16:24 2007
@@ -29,5 +29,13 @@
  * @version $Rev$ $Date$
  */
 public interface Property extends AbstractProperty, PolicySetAttachPoint {
+    
+    /**
+     * Returns a clone of the property.
+     * 
+     * @return a clone of the property
+     * @throws CloneNotSupportedException
+     */
+    Object clone() throws CloneNotSupportedException;
 
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Reference.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Reference.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Reference.java Tue May  1 02:16:24 2007
@@ -52,4 +52,13 @@
      * @return the targets of this reference.
      */
     List<ComponentService> getTargets();
+
+    /**
+     * Returns a clone of the reference.
+     * 
+     * @return a clone of the reference
+     * @throws CloneNotSupportedException
+     */
+    Object clone() throws CloneNotSupportedException;
+
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Service.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Service.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Service.java Tue May  1 02:16:24 2007
@@ -26,4 +26,12 @@
  */
 public interface Service extends AbstractService, Contract {
 
+    /**
+     * Returns a clone of the service.
+     * 
+     * @return a clone of the service
+     * @throws CloneNotSupportedException
+     */
+    Object clone() throws CloneNotSupportedException;
+
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java Tue May  1 02:16:24 2007
@@ -56,4 +56,12 @@
      */
     void setTarget(ComponentService target);
 
+    /**
+     * Returns a clone of the wire.
+     * 
+     * @return a clone of the wire
+     * @throws CloneNotSupportedException
+     */
+    Object clone() throws CloneNotSupportedException;
+
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractPropertyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractPropertyImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractPropertyImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractPropertyImpl.java Tue May  1 02:16:24 2007
@@ -47,21 +47,6 @@
     protected AbstractPropertyImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected AbstractPropertyImpl(AbstractProperty other) {
-        super(other);
-        value = other.getValue();
-        many = other.isMany();
-        mustSupply = other.isMustSupply();
-        name = other.getName();
-        xsdElement = other.getXSDElement();
-        xsdType = other.getXSDType();
-        requiredIntents.addAll(other.getRequiredIntents());
-    }
-
     public Object getValue() {
         return value;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractReferenceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractReferenceImpl.java Tue May  1 02:16:24 2007
@@ -35,15 +35,6 @@
     protected AbstractReferenceImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected AbstractReferenceImpl(AbstractReference other) {
-        super(other);
-        multiplicity = other.getMultiplicity();
-    }
-
     public Multiplicity getMultiplicity() {
         return multiplicity;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractServiceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/AbstractServiceImpl.java Tue May  1 02:16:24 2007
@@ -33,12 +33,4 @@
     protected AbstractServiceImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param service
-     */
-    protected AbstractServiceImpl(AbstractService other) {
-        super(other);
-    }
-
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/BaseImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/BaseImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/BaseImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/BaseImpl.java Tue May  1 02:16:24 2007
@@ -39,16 +39,7 @@
      */
     protected BaseImpl() {
     }
-
-    /**
-     * Copy constructor
-     * @param other
-     */
-    protected BaseImpl(Base other) {
-        unresolved = other.isUnresolved();
-        extensions.addAll(other.getExtensions());
-    }
-
+    
     public List<Object> getExtensions() {
         return extensions;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java Tue May  1 02:16:24 2007
@@ -36,10 +36,11 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentImpl extends BaseImpl implements Component {
+public class ComponentImpl extends BaseImpl implements Component, Cloneable {
     private ConstrainingType constrainingType;
     private Implementation implementation;
     private String name;
+    private String uri;
     private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
     private List<ComponentReference> references = new ArrayList<ComponentReference>();
     private List<ComponentService> services = new ArrayList<ComponentService>();
@@ -53,25 +54,31 @@
     protected ComponentImpl() {
     }
     
-    protected ComponentImpl(Component other) {
-        super(other);
-        
-        // Copy ComponentImpl attributes
-        constrainingType = other.getConstrainingType();
-        implementation = other.getImplementation();
-        name = other.getName();
-        for (ComponentProperty property: other.getProperties()) {
-            properties.add(new ComponentPropertyImpl(property));
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        ComponentImpl clone = (ComponentImpl)super.clone();
+
+        clone.properties = new ArrayList<ComponentProperty>();
+        for (ComponentProperty property: getProperties()) {
+            clone.properties.add((ComponentProperty)property.clone());
         }
-        for (ComponentReference reference: other.getReferences()) {
-            references.add(new ComponentReferenceImpl(reference));
+        clone.references = new ArrayList<ComponentReference>();
+        for (ComponentReference reference: getReferences()) {
+            clone.references.add((ComponentReference)reference.clone());
         }
-        for (ComponentService service: other.getServices()) {
-            services.add(new ComponentServiceImpl(service));
+        clone.services = new ArrayList<ComponentService>();
+        for (ComponentService service: getServices()) {
+            clone.services.add((ComponentService)service.clone());
         }
-        requiredIntents.addAll(other.getRequiredIntents());
-        policySets.addAll(other.getPolicySets());
-        autowire = other.isAutowire();
+        return clone;
+    }
+    
+    public String getURI() {
+        return uri;
+    }
+    
+    public void setURI(String uri) {
+        this.uri = uri;
     }
 
     public ConstrainingType getConstrainingType() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentPropertyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentPropertyImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentPropertyImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentPropertyImpl.java Tue May  1 02:16:24 2007
@@ -27,7 +27,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty {
+public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable {
     private String file;
     private Property property;
     private String source;
@@ -38,17 +38,11 @@
     protected ComponentPropertyImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected ComponentPropertyImpl(ComponentProperty other) {
-        super(other);
-        file = other.getFile();
-        property = other.getProperty();
-        source = other.getSource();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
-
+    
     public Object getValue() {
         if (super.getValue() == null && property != null) {
             return property.getValue();

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentReferenceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentReferenceImpl.java Tue May  1 02:16:24 2007
@@ -31,7 +31,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference {
+public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
     private Reference reference;
     private boolean autowire;
     private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
@@ -42,16 +42,11 @@
     protected ComponentReferenceImpl() {
     }
 
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected ComponentReferenceImpl(ComponentReference other) {
-        super(other);
-        reference = other.getReference();
-        autowire = other.isAutowire();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
-
+    
     public Reference getReference() {
         return reference;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentServiceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentServiceImpl.java Tue May  1 02:16:24 2007
@@ -31,7 +31,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentServiceImpl extends ServiceImpl implements ComponentService {
+public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable {
     private Service service;
     private List<CompositeService> promotedAs = new ArrayList<CompositeService>();
     
@@ -41,15 +41,11 @@
     protected ComponentServiceImpl() {
     }
 
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected ComponentServiceImpl(ComponentService other) {
-        super(other);
-        service = other.getService();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
-
+    
     public Service getService() {
         return service;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java Tue May  1 02:16:24 2007
@@ -35,7 +35,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentTypeImpl extends BaseImpl implements ComponentType {
+public class ComponentTypeImpl extends BaseImpl implements ComponentType, Cloneable {
     private String uri;
     private ConstrainingType constrainingType;
     private List<Property> properties = new ArrayList<Property>();
@@ -50,25 +50,23 @@
     protected ComponentTypeImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected ComponentTypeImpl(ComponentType other) {
-        super(other);
-        uri = other.getURI();
-        constrainingType = other.getConstrainingType();
-        for (Service service: other.getServices()) {
-            services.add(new ServiceImpl(service));
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        ComponentTypeImpl clone = (ComponentTypeImpl)super.clone();
+        
+        clone.services = new ArrayList<Service>();
+        for (Service service: getServices()) {
+            clone.services.add((Service)service.clone());
         }
-        for (Reference reference: other.getReferences()) {
-            references.add(new ReferenceImpl(reference));
+        clone.references = new ArrayList<Reference>();
+        for (Reference reference: getReferences()) {
+            clone.references.add((Reference)reference.clone());
         }
-        for (Property property: other.getProperties()) {
-            properties.add(new PropertyImpl(property));
+        clone.properties = new ArrayList<Property>();
+        for (Property property: getProperties()) {
+            clone.properties.add((Property)property.clone());
         }
-        requiredIntents.addAll(other.getRequiredIntents());
-        policySets.addAll(other.getPolicySets());
+        return clone;
     }
     
     public String getURI() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java Tue May  1 02:16:24 2007
@@ -26,15 +26,10 @@
 
 import org.apache.tuscany.assembly.Component;
 import org.apache.tuscany.assembly.Composite;
-import org.apache.tuscany.assembly.CompositeReference;
-import org.apache.tuscany.assembly.CompositeService;
-import org.apache.tuscany.assembly.Property;
-import org.apache.tuscany.assembly.Reference;
-import org.apache.tuscany.assembly.Service;
 import org.apache.tuscany.assembly.Wire;
 import org.apache.tuscany.assembly.util.Visitor;
 
-public class CompositeImpl extends ComponentTypeImpl implements Composite {
+public class CompositeImpl extends ComponentTypeImpl implements Composite, Cloneable {
     private List<Component> components = new ArrayList<Component>();
     private List<Composite> includes = new ArrayList<Composite>();
     private QName name;
@@ -48,43 +43,21 @@
     protected CompositeImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected CompositeImpl(Composite other) {
-        
-        // Copy BaseImpl attributes
-        setUnresolved(other.isUnresolved());
-        getExtensions().addAll(other.getExtensions());
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        CompositeImpl clone = (CompositeImpl)super.clone();
         
-        // Copy ComponentTypeImpl attributes
-        setURI(other.getURI());
-        setConstrainingType(other.getConstrainingType());
-        for (Property property: other.getProperties()) {
-            getProperties().add(new PropertyImpl(property));
-        }
-        getRequiredIntents().addAll(other.getRequiredIntents());
-        getPolicySets().addAll(other.getPolicySets());
-
-        // Copy CompositeImpl attributes
-        name = other.getName();
-        autowire = other.isAutowire();
-        local = other.isLocal();
-        for (Component component: other.getComponents()) {
-            components.add(new ComponentImpl(component));
-        }
-        for (Service service: other.getServices()) {
-            getServices().add(new CompositeServiceImpl((CompositeService)service));
-        }
-        for (Reference reference: other.getReferences()) {
-            getReferences().add(new CompositeReferenceImpl((CompositeReference)reference));
-        }
-        for (Wire wire: other.getWires()) {
-            wires.add(new WireImpl(wire));
+        clone.components = new ArrayList<Component>();
+        for (Component component: getComponents()) {
+            clone.components.add((Component)component.clone());
+        }
+        clone.wires = new ArrayList<Wire>();
+        for (Wire wire: getWires()) {
+            clone.wires.add((Wire)wire.clone());
         }
+        return clone;
     }
-
+    
     public List<Component> getComponents() {
         return components;
     }
@@ -139,11 +112,6 @@
                 return false;
         }
         return true;
-    }
-    
-    public Composite copy() {
-        CompositeImpl copy = new CompositeImpl(this);
-        return copy;
     }
     
     @Override

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeReferenceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeReferenceImpl.java Tue May  1 02:16:24 2007
@@ -30,7 +30,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference {
+public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable {
     private List<ComponentReference> promotedReferences = new ArrayList<ComponentReference>();
 
     /**
@@ -38,14 +38,10 @@
      */
     protected CompositeReferenceImpl() {
     }
-
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected CompositeReferenceImpl(CompositeReference other) {
-        super(other);
-        promotedReferences.addAll(other.getPromotedReferences());
+    
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
 
     public List<ComponentReference> getPromotedReferences() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeServiceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeServiceImpl.java Tue May  1 02:16:24 2007
@@ -27,7 +27,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class CompositeServiceImpl extends ServiceImpl implements CompositeService {
+public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable {
     private ComponentService promotedService;
 
     /**
@@ -36,15 +36,11 @@
     protected CompositeServiceImpl() {
     }
 
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected CompositeServiceImpl(CompositeService other) {
-        super(other);
-        promotedService = other.getPromotedService();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
-    
+
     public ComponentService getPromotedService() {
         return promotedService;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ContractImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ContractImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ContractImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ContractImpl.java Tue May  1 02:16:24 2007
@@ -36,17 +36,6 @@
     protected ContractImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    public ContractImpl(AbstractContract other) {
-        super(other);
-        interfaceContract = other.getInterfaceContract();
-        name = other.getName();
-        requiredIntents.addAll(other.getRequiredIntents());
-    }
-
     public String getName() {
         return name;
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/PropertyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/PropertyImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/PropertyImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/PropertyImpl.java Tue May  1 02:16:24 2007
@@ -30,7 +30,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class PropertyImpl extends AbstractPropertyImpl implements Property {
+public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable {
     private List<PolicySet> policySets = new ArrayList<PolicySet>();
 
     /**
@@ -39,12 +39,9 @@
     protected PropertyImpl() {
     }
     
-    /**
-     * Copy constructor.
-     */
-    protected PropertyImpl(Property other) {
-        super(other);
-        policySets.addAll(other.getPolicySets());
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
 
     public List<PolicySet> getPolicySets() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ReferenceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ReferenceImpl.java Tue May  1 02:16:24 2007
@@ -33,7 +33,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ReferenceImpl extends AbstractReferenceImpl implements Reference {
+public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable {
     private List<Binding> bindings = new ArrayList<Binding>();
     private boolean wiredByImpl;
     private List<PolicySet> policySets = new ArrayList<PolicySet>();
@@ -46,17 +46,14 @@
     protected ReferenceImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param reference
-     */
-    protected ReferenceImpl(Reference other) {
-        super(other);
-        bindings.addAll(other.getBindings());
-        wiredByImpl = other.isWiredByImpl();
-        policySets.addAll(other.getPolicySets());
-        targets.addAll(other.getTargets());
-        callback = other.getCallback();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        ReferenceImpl clone = (ReferenceImpl)super.clone();
+        clone.bindings = new ArrayList<Binding>();
+        clone.bindings.addAll(getBindings());
+        clone.targets = new ArrayList<ComponentService>();
+        clone.targets.addAll(getTargets());
+        return clone;
     }
 
     public List<Binding> getBindings() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ServiceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ServiceImpl.java Tue May  1 02:16:24 2007
@@ -32,7 +32,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ServiceImpl extends AbstractServiceImpl implements Service {
+public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable {
     private List<Binding> bindings = new ArrayList<Binding>();
     private List<PolicySet> policySets = new ArrayList<PolicySet>();
     private Callback callback;
@@ -43,15 +43,12 @@
     protected ServiceImpl() {
     }
     
-    /**
-     * Copy constructor.
-     * @param other
-     */
-    protected ServiceImpl(Service other) {
-        super(other);
-        bindings.addAll(other.getBindings());
-        policySets.addAll(other.getPolicySets());
-        callback = other.getCallback();
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        ServiceImpl clone = (ServiceImpl)super.clone();
+        clone.bindings = new ArrayList<Binding>();
+        clone.bindings.addAll(getBindings());
+        return clone;
     }
 
     public List<Binding> getBindings() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/WireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/WireImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/WireImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/WireImpl.java Tue May  1 02:16:24 2007
@@ -32,7 +32,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class WireImpl extends BaseImpl implements Wire {
+public class WireImpl extends BaseImpl implements Wire, Cloneable {
     private ComponentReference source;
     private ComponentService target;
     private List<Intent> requiredIntents = new ArrayList<Intent>();
@@ -44,16 +44,9 @@
     protected WireImpl() {
     }
 
-    /**
-     * Copy constructor.
-     * @param wire
-     */
-    protected WireImpl(Wire other) {
-        super(other);
-        source = other.getSource();
-        target = other.getTarget();
-        requiredIntents.addAll(other.getRequiredIntents());
-        policySets.addAll(other.getPolicySets());
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
     }
 
     public ComponentReference getSource() {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java Tue May  1 02:16:24 2007
@@ -89,16 +89,21 @@
         List<Composite> includes = new ArrayList<Composite>();
         collectIncludes(composite, includes);
         
-        // Then copy them
+        // Then clone them
         for (Composite include : includes) {
-            include = include.copy();
-            composite.getComponents().addAll(include.getComponents());
-            composite.getServices().addAll(include.getServices());
-            composite.getReferences().addAll(include.getReferences());
-            composite.getProperties().addAll(include.getProperties());
-            composite.getWires().addAll(include.getWires());
-            composite.getPolicySets().addAll(include.getPolicySets());
-            composite.getRequiredIntents().addAll(include.getRequiredIntents());
+            Composite clone;
+            try {
+                clone = (Composite)include.clone();
+            } catch (CloneNotSupportedException e) {
+                throw new RuntimeException(e);
+            }
+            composite.getComponents().addAll(clone.getComponents());
+            composite.getServices().addAll(clone.getServices());
+            composite.getReferences().addAll(clone.getReferences());
+            composite.getProperties().addAll(clone.getProperties());
+            composite.getWires().addAll(clone.getWires());
+            composite.getPolicySets().addAll(clone.getPolicySets());
+            composite.getRequiredIntents().addAll(clone.getRequiredIntents());
         }
         
         // Clear the list of includes
@@ -335,7 +340,38 @@
      * @param problems
      */
     public void configureComponents(Composite composite, List<Base> problems) {
+        configureComponents(composite, null, problems);
+    }
+
+    /**
+     * Configure components in the composite.
+     * 
+     * @param composite
+     * @param uri
+     * @param problems
+     */
+    private void configureComponents(Composite composite, String uri, List<Base> problems) {
+        
+        // Process nested composites recursively
+        for (Component component: composite.getComponents()) {
 
+            // Initialize component URI
+            String componentURI;
+            if (uri == null) {
+                componentURI = component.getName();
+            } else {
+                componentURI = uri + "/" + component.getName(); 
+            }
+            component.setURI(componentURI);
+            
+            Implementation implementation = component.getImplementation();
+            if (implementation instanceof Composite) {
+                
+                // Process nested composite
+                configureComponents((Composite)implementation, componentURI, problems);
+            }
+        }
+        
         // Initialize all component services and references
         Map<String, Component> components = new HashMap<String, Component>();
         for (Component component : composite.getComponents()) {
@@ -711,7 +747,7 @@
         ComponentService componentService = compositeService.getPromotedService();
         if (componentService != null) {
             Service service = componentService.getService();
-            if (service instanceof CompositeService) {
+            if (componentService.getName() != null && service instanceof CompositeService) {
                 
                 // Continue to follow the service promotion chain
                 return getPromotedComponentService((CompositeService)service);
@@ -808,11 +844,12 @@
                 // Create a new component service to represent this composite service
                 // on the promoted component
                 ComponentService newComponentService = assemblyFactory.createComponentService();
-                newComponentService.setName(compositeService.getName());
+                newComponentService.setName(null);
                 newComponentService.setService(compositeService);
                 SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
                 Component component = scaBinding.getComponent();
                 component.getServices().add(newComponentService);
+                newComponentService.getBindings().add(scaBinding);
                 
                 // Change the composite service to now promote the newly created
                 // component service directly
@@ -843,7 +880,9 @@
             for (ComponentReference promotedReference: promotedReferences) {
 
                 // Override the configuration of the promoted reference
+                SCABinding scaBinding = promotedReference.getBinding(SCABinding.class);
                 promotedReference.getBindings().clear();
+                promotedReference.getBindings().add(scaBinding);
                 promotedReference.getBindings().addAll(compositeReference.getBindings());
             }
         }
@@ -860,7 +899,9 @@
                         for (ComponentReference promotedReference: promotedReferences) {
                             
                             // Override the configuration of the promoted reference
+                            SCABinding scaBinding = promotedReference.getBinding(SCABinding.class);
                             promotedReference.getBindings().clear();
+                            promotedReference.getBindings().add(scaBinding);
                             promotedReference.getBindings().addAll(componentReference.getBindings());
                             
                             // Wire the promoted reference to the actual non-composite
@@ -948,9 +989,14 @@
             if (implementation instanceof Composite) {
                 
                 Composite compositeImplementation = (Composite)implementation;
-                Composite copy = compositeImplementation.copy();
-                component.setImplementation(copy);
-                expandComposites(copy, problems);
+                Composite clone;
+                try {
+                    clone = (Composite)compositeImplementation.clone();
+                } catch (CloneNotSupportedException e) {
+                    throw new RuntimeException(e);
+                }
+                component.setImplementation(clone);
+                expandComposites(clone, problems);
             }
         }
     }

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanComponentImpl.java Tue May  1 02:16:24 2007
@@ -39,12 +39,13 @@
  *
  *  @version $Rev$ $Date$
  */
-public class BeanComponentImpl extends ChildBeanDefinition implements Component {
+public class BeanComponentImpl extends ChildBeanDefinition implements Component, Cloneable {
 	private static final long serialVersionUID = 1L;
 	
 	private ConstrainingType constrainingType;
 	private Implementation implementation;
 	private String name;
+        private String uri;
 	private List<ComponentService> services = new ArrayList<ComponentService>();
 	private List<Intent> requiredIntents = new ArrayList<Intent>();
 	private List<PolicySet> policySets = new ArrayList<PolicySet>();
@@ -56,6 +57,25 @@
 		super((String)"");
 		this.beanRegistry = beanRegistry;
 	}
+        
+        @Override
+        public Object clone() throws CloneNotSupportedException {
+            BeanComponentImpl clone = (BeanComponentImpl)super.clone();
+
+            clone.getProperties().clear();
+            for (ComponentProperty property: getProperties()) {
+                clone.getProperties().add((ComponentProperty)property.clone());
+            }
+            clone.getReferences().clear();
+            for (ComponentReference reference: getReferences()) {
+                clone.getReferences().add((ComponentReference)reference.clone());
+            }
+            clone.getServices().clear();
+            for (ComponentService service: getServices()) {
+                clone.getServices().add((ComponentService)service.clone());
+            }
+            return clone;
+        }
 	
 	public String getParentName() {
 		//TODO find a better name for bean definitions representing component types
@@ -70,6 +90,17 @@
 		return implementation;
 	}
 
+        public String getURI() {
+            return uri;
+        }
+        
+        public void setURI(String uri) {
+            this.uri = uri;
+                
+            // Register this bean definition in the bean registry
+            this.beanRegistry.registerBeanDefinition(uri, this);
+        }
+
 	public String getName() {
 		return name;
 	}
@@ -125,9 +156,6 @@
 
 	public void setName(String name) {
 		this.name = name;
-		
-		// Register this bean definition in the bean registry
-		this.beanRegistry.registerBeanDefinition(name, this);
 	}
 
 	public List<Intent> getRequiredIntents() {

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanReferenceImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/assembly/bean/impl/BeanReferenceImpl.java Tue May  1 02:16:24 2007
@@ -39,18 +39,12 @@
 	public String getBeanName() {
 		//TODO handle multiplicity
 		ComponentService componentService = reference.getTargets().get(0);
-		String uri;
 		if (!componentService.isUnresolved()) {
 			SCABinding binding = componentService.getBinding(SCABinding.class);
-			uri = binding.getURI();
+                        return binding.getComponent().getURI();
 		} else {
-			uri = componentService.getName();
+			return null;
 		}
-		int i = uri.indexOf('/');
-		if (i != -1) {
-			uri = uri.substring(0, i);
-		}
-		return uri;
 	}
 	
 	public boolean equals(Object other) {

Added: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java Tue May  1 02:16:24 2007
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.bean.runtime;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.Base;
+import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.bean.impl.BeanAssemblyFactory;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.assembly.util.CompositeUtil;
+import org.apache.tuscany.assembly.util.PrintUtil;
+import org.apache.tuscany.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.contribution.service.ContributionException;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.bean.impl.BeanJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
+import org.apache.tuscany.implementation.java.introspect.DefaultJavaClassIntrospector;
+import org.apache.tuscany.implementation.java.introspect.JavaClassIntrospectorExtension;
+import org.apache.tuscany.implementation.java.introspect.JavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.interfacedef.java.JavaFactory;
+import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
+import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
+import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.interfacedef.java.xml.JavaInterfaceProcessor;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+
+/**
+ * A mini test runtime that uses the SCA assembly model variant implementation
+ * backed by Spring bean definitions.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ComponentContext {
+
+    private DefaultListableBeanFactory beanFactory;
+    
+    public ComponentContext(String... compositeFiles) {
+
+        // Create Spring bean factory
+        beanFactory = new DefaultListableBeanFactory();
+
+        // Create SCA assembly and SCA Java factories
+        AssemblyFactory assemblyFactory = new BeanAssemblyFactory(new DefaultAssemblyFactory(), beanFactory);
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper interfaceContractMapper = new DefaultInterfaceContractMapper();
+        JavaFactory javaFactory = new DefaultJavaFactory();
+        JavaInterfaceIntrospectorExtensionPoint interfaceIntrospector = new DefaultJavaInterfaceIntrospector(javaFactory);
+        JavaImplementationFactory javaImplementationFactory = new BeanJavaImplementationFactory(beanFactory);
+        JavaClassIntrospectorExtensionPoint classIntrospector = new DefaultJavaClassIntrospector();
+        
+        BaseJavaClassIntrospectorExtension[] extensions = new BaseJavaClassIntrospectorExtension[] {
+            new ConstructorProcessor(assemblyFactory),
+            new AllowsPassByReferenceProcessor(assemblyFactory),
+            new ContextProcessor(assemblyFactory),
+            new ConversationProcessor(assemblyFactory),
+            new DestroyProcessor(assemblyFactory),
+            new EagerInitProcessor(assemblyFactory),
+            new InitProcessor(assemblyFactory),
+            new PropertyProcessor(assemblyFactory),
+            new ReferenceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+            new ResourceProcessor(assemblyFactory),
+            new ScopeProcessor(assemblyFactory),
+            new ServiceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+            new HeuristicPojoProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+            new PolicyProcessor(assemblyFactory, policyFactory)
+        };
+        for (JavaClassIntrospectorExtension e : extensions) {
+            classIntrospector.addExtension(e);
+        }
+
+        // Populate ArtifactProcessor registry
+        DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+        CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory,
+                                                                       interfaceContractMapper, staxProcessors);
+        staxProcessors.addExtension(compositeProcessor);
+        staxProcessors.addExtension(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new JavaInterfaceProcessor(javaFactory, interfaceIntrospector));
+        staxProcessors.addExtension(new JavaImplementationProcessor(assemblyFactory, policyFactory, javaImplementationFactory, classIntrospector));
+        
+        // Create a resolver
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        DefaultArtifactResolver resolver = new DefaultArtifactResolver(classLoader);
+
+        try {
+            
+            // Read the composite files
+            List<Composite> composites = new ArrayList<Composite>();
+            for (String compositeFile: compositeFiles) {
+                InputStream is = classLoader.getResourceAsStream(compositeFile);
+                Composite composite = staxProcessors.read(is, Composite.class);
+                resolver.add(composite);
+                composites.add(composite);
+            }
+            
+            for (Composite composite: composites) {
+                
+                // Resolve the composite
+                compositeProcessor.resolve(composite, resolver);
+            }
+            
+            // Wire the top level component's composite
+            wire(composites.get(0), assemblyFactory, interfaceContractMapper);
+            
+        } catch (ContributionException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    private void wire(Composite composite, AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) {
+        CompositeUtil compositeUtil = new CompositeUtil(assemblyFactory, interfaceContractMapper);
+
+        List<Base> problems = new ArrayList<Base>() {
+            private static final long serialVersionUID = 4819831446590718923L;
+            
+            @Override
+            public boolean add(Base o) {
+                //TODO Use a monitor to report configuration problems
+                
+                // Uncommenting the following two lines can be useful to detect
+                // and troubleshoot SCA assembly XML composite configuration
+                // problems.
+                
+                System.err.println("Composite configuration problem:");
+                new PrintUtil(System.err).print(o);
+                return super.add(o);
+            }
+        };
+        
+
+        // Collect and fuse includes
+        compositeUtil.fuseIncludes(composite, problems);
+
+        // Expand nested composites
+        compositeUtil.expandComposites(composite, problems);
+        
+        // Configure all components
+        compositeUtil.configureComponents(composite, problems);
+        
+        // Wire the composite
+        compositeUtil.wireComposite(composite, problems);
+        
+        // Activate composite services
+        compositeUtil.activateCompositeServices(composite, problems);
+        
+        // Wire composite references
+        compositeUtil.wireCompositeReferences(composite, problems);
+       
+//        if (!problems.isEmpty()) {
+//            throw new VariantRuntimeException(new RuntimeException("Problems in the composite..."));
+//        }
+    }
+
+    public <B> B getService(Class<B> businessInterface, String serviceName) {
+        Object bean = beanFactory.getBean(serviceName);
+        return businessInterface.cast(bean);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/core/bean/runtime/ComponentContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/BeanBaseJavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/BeanBaseJavaImplementationImpl.java?view=diff&rev=533980&r1=533979&r2=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/BeanBaseJavaImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/BeanBaseJavaImplementationImpl.java Tue May  1 02:16:24 2007
@@ -37,7 +37,7 @@
  *
  *  @version $Rev$ $Date$
  */
-public class BeanBaseJavaImplementationImpl extends RootBeanDefinition implements BaseJavaImplementation {
+public class BeanBaseJavaImplementationImpl extends RootBeanDefinition implements BaseJavaImplementation, Cloneable {
 	private static final long serialVersionUID = 1L;
 	
 	private List<Service> services = new ArrayList<Service>();
@@ -58,6 +58,25 @@
 		this.beanRegistry.registerBeanDefinition(name, this);
 	}
 
+        @Override
+        public Object clone() throws CloneNotSupportedException {
+            BeanBaseJavaImplementationImpl clone = (BeanBaseJavaImplementationImpl)super.clone();
+            
+            clone.getServices().clear();
+            for (Service service: getServices()) {
+                clone.getServices().add((Service)service.clone());
+            }
+            clone.getReferences().clear();
+            for (Reference reference: getReferences()) {
+                clone.getReferences().add((Reference)reference.clone());
+            }
+            clone.getProperties().clear();
+            for (Property property: getProperties()) {
+                clone.getProperties().add((Property)property.clone());
+            }
+            return clone;
+        }
+        
 	public Class<?> getJavaClass() {
 		return super.getBeanClass();
 	}

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java Tue May  1 02:16:24 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 calculator;
+
+import org.apache.tuscany.core.bean.runtime.ComponentContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * Calculator service and invoke it.
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {
+
+        ComponentContext context = new ComponentContext("org/apache/tuscany/core/spring/Calculator.composite");
+
+        CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/CalculatorClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java Tue May  1 02:16:24 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 calculator;
+
+import org.apache.tuscany.core.bean.runtime.ComponentContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * Calculator service and invoke it.
+ */
+public class NestedCalculatorClient {
+    public static void main(String[] args) throws Exception {
+
+        ComponentContext context = new ComponentContext(
+                                            "org/apache/tuscany/core/spring/OuterCalculator.composite",
+                                            "org/apache/tuscany/core/spring/InnerCalculator.composite",
+                                            "org/apache/tuscany/core/spring/InnerOperations.composite");
+
+        CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java Tue May  1 02:16:24 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.spring;
+
+import org.apache.tuscany.core.bean.runtime.ComponentContext;
+
+import junit.framework.TestCase;
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+    private ComponentContext context;
+    private CalculatorService calculatorService;
+
+    protected void setUp() throws Exception {
+        context = new ComponentContext("org/apache/tuscany/core/spring/Calculator.composite");
+
+        calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+    }
+
+    protected void tearDown() throws Exception {
+        context = null;
+        calculatorService = null;
+    }
+
+    public void testCalculator() throws Exception {
+        // Calculate
+        assertEquals(calculatorService.add(3, 2), 5.0);
+        assertEquals(calculatorService.subtract(3, 2), 1.0);
+        assertEquals(calculatorService.multiply(3, 2), 6.0);
+        assertEquals(calculatorService.divide(3, 2), 1.5);
+
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/CalculatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java Tue May  1 02:16:24 2007
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.spring;
+
+import org.apache.tuscany.core.bean.runtime.ComponentContext;
+
+import junit.framework.TestCase;
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NestedCalculatorTestCase extends TestCase {
+
+    private ComponentContext context;
+    private CalculatorService calculatorService;
+
+    protected void setUp() throws Exception {
+        context = new ComponentContext(
+                          "org/apache/tuscany/core/spring/OuterCalculator.composite",
+                          "org/apache/tuscany/core/spring/InnerCalculator.composite",
+                          "org/apache/tuscany/core/spring/InnerOperations.composite");
+
+        calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorServiceComponent");
+    }
+
+    protected void tearDown() throws Exception {
+        context = null;
+        calculatorService = null;
+    }
+
+    public void testCalculator() throws Exception {
+        // Calculate
+        assertEquals(calculatorService.add(3, 2), 5.0);
+        assertEquals(calculatorService.subtract(3, 2), 1.0);
+        assertEquals(calculatorService.multiply(3, 2), 6.0);
+        assertEquals(calculatorService.divide(3, 2), 1.5);
+
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/NestedCalculatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite?view=auto&rev=533980
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite Tue May  1 02:16:24 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:calc="http://sample.calculator"
+	name="calc:TestBeanCalculator">
+
+    <service name="CalculatorService" promote="CalculatorServiceComponent">
+        <interface.java interface="calculator.CalculatorService"/>
+    </service>
+
+    <component name="CalculatorServiceComponent">
+		<implementation.java class="calculator.CalculatorServiceImpl"/>
+        <reference name="addService" target="AddServiceComponent"/>
+        <reference name="subtractService" target="SubtractServiceComponent"/>
+        <reference name="multiplyService" target="MultiplyServiceComponent"/>
+        <reference name="divideService" target="DivideServiceComponent"/>
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/Calculator.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org