summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-05 12:52:48 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-05 12:52:48 +0000
commit3f5faac5caf62666f4c1a24b3fcf8e7b92efea34 (patch)
tree722e20686d75b6199ff063f04cf29de03bda678f
parent25fdf5efc29317b6be404b98469b6d0e9b64d7cd (diff)
TUSCANY-3907 - Clone top level composites before adding them to the domain level composite so that they don't get build more than once. Also clone bindings when reference and services are cloned.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1154194 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java5
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java4
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java9
3 files changed, 16 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
index e157b78a7c..6e5e09adf6 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
@@ -53,7 +53,10 @@ public class ReferenceImpl extends AbstractReferenceImpl implements Reference, C
@Override
public Object clone() throws CloneNotSupportedException {
ReferenceImpl clone = (ReferenceImpl)super.clone();
- clone.bindings = new ArrayList<Binding>(bindings);
+ clone.bindings = new ArrayList<Binding>();
+ for (Binding binding : getBindings()){
+ clone.bindings.add((Binding)binding.clone());
+ }
clone.targets = new ArrayList<ComponentService>(targets);
// clone the endpoint references themselves and set the reference pointer back to
// this new refrence
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
index 618d0d6e7b..4a8fd70910 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
@@ -50,7 +50,9 @@ public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneab
public Object clone() throws CloneNotSupportedException {
ServiceImpl clone = (ServiceImpl)super.clone();
clone.bindings = new ArrayList<Binding>();
- clone.bindings.addAll(getBindings());
+ for (Binding binding : getBindings()){
+ clone.bindings.add((Binding)binding.clone());
+ }
return clone;
}
diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
index 920177e597..174b1320e7 100644
--- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
+++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
@@ -583,6 +583,15 @@ public class DeployerImpl implements Deployer {
for (Contribution contribution : contributionList) {
for (Composite composite : contribution.getDeployables()) {
+ // TUSCANY-3907 - clone the top level composite before we includr
+ // it so that the composite model retained within
+ // the CompositeModelResolver is not changed by the build
+ try {
+ composite = (Composite)composite.clone();
+ } catch (CloneNotSupportedException ex){
+ // it is supported on Composite
+ }
+
// Include the node composite in the top-level composite
domainComposite.getIncludes().add(composite);
}