From 795192db99a24c86319cd6870ecaaaac75a07a79 Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 5 Mar 2009 01:39:10 +0000 Subject: Add the @replace attribute for wire git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@750278 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/assembly/Wire.java | 19 +++++++++++++++++++ .../apache/tuscany/sca/assembly/impl/WireImpl.java | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java index 8980365bfa..e1eb26f0c1 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java @@ -54,6 +54,25 @@ public interface Wire extends Base, Extensible, PolicySubject, Cloneable { * @param target the target of the wire */ void setTarget(ComponentService target); + + /** + * A boolean value, with the default of "false". When a wire element has + * @replace="false", the wire is added to the set of wires which apply to + * the reference identified by the @source attribute. When a wire element + * has @replace="true", the wire is added to the set of wires which apply to + * the reference identified by the @source attribute - but any wires for that + * reference specified by means of the @target attribute of the reference + * are removed from the set of wires which apply to the reference. + * + * @return + */ + boolean isReplace(); + + /** + * Set the replace flag for the wire + * @param replace + */ + void setReplace(boolean replace); /** * Returns a clone of the wire. diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java index 99ed9b6d10..9f8af0907d 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java @@ -24,8 +24,8 @@ import java.util.List; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Wire; -import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.ExtensionType; +import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; /** @@ -36,6 +36,7 @@ import org.apache.tuscany.sca.policy.PolicySet; public class WireImpl extends ExtensibleImpl implements Wire, Cloneable { private ComponentReference source; private ComponentService target; + private boolean replace; private List requiredIntents = new ArrayList(); private List policySets = new ArrayList(); private List applicablePolicySets = new ArrayList(); @@ -93,4 +94,12 @@ public class WireImpl extends ExtensibleImpl implements Wire, Cloneable { public void setRequiredIntents(List intents) { this.requiredIntents = intents; } + + public boolean isReplace() { + return replace; + } + + public void setReplace(boolean replace) { + this.replace = replace; + } } -- cgit v1.2.3