summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-27 17:53:50 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-27 17:53:50 +0000
commit0237e9c85245ae1236c9644c1c15f7e7053cfd81 (patch)
tree8c92e1330bcfcb23d8e15ee48b6bc0cf7c219e4c /java/sca/modules/assembly/src
parent08112844bcf38cb003d8865fe1a73c17836d269d (diff)
Move the reference/service resetting outside the loop as they don't need to be there.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@808553 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly/src')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java38
1 files changed, 21 insertions, 17 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
index 1a45366d72..389f163a95 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
@@ -58,29 +58,33 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon
public Object clone() throws CloneNotSupportedException {
CompositeImpl clone = (CompositeImpl)super.clone();
+ // clone the child components
clone.components = new ArrayList<Component>();
for (Component component : getComponents()) {
Component clonedComponent = (Component)component.clone();
- for (Service service : clone.getServices()) {
- CompositeService compositeService = (CompositeService)service;
- // Force the promoted component/service to be rebuilt against the clone
- if (compositeService.getPromotedComponent() != null) {
- compositeService.getPromotedComponent().setUnresolved(true);
- }
- if (compositeService.getPromotedService() != null) {
- compositeService.getPromotedService().setUnresolved(true);
- }
+ clone.components.add(clonedComponent);
+ }
+
+ // reset the references and services so the get re-resolved
+ for (Service service : clone.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ // Force the promoted component/service to be rebuilt against the clone
+ if (compositeService.getPromotedComponent() != null) {
+ compositeService.getPromotedComponent().setUnresolved(true);
}
- for (Reference reference : clone.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- for (ComponentReference ref : compositeReference.getPromotedReferences()) {
- // Force the promoted reference to be rebuilt against the clone
- ref.setUnresolved(true);
- }
+ if (compositeService.getPromotedService() != null) {
+ compositeService.getPromotedService().setUnresolved(true);
+ }
+ }
+ for (Reference reference : clone.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ for (ComponentReference ref : compositeReference.getPromotedReferences()) {
+ // Force the promoted reference to be rebuilt against the clone
+ ref.setUnresolved(true);
}
-
- clone.components.add(clonedComponent);
}
+
+ // clone the wires
clone.wires = new ArrayList<Wire>();
for (Wire wire : getWires()) {
clone.wires.add((Wire)wire.clone());