diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-05 22:38:31 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-05 22:38:31 +0000 |
commit | 0d1ab3019c3865455a05c3bbd01bc7658de3f732 (patch) | |
tree | 160bab70264b3229ee56e4977cab84c68277bb4f /branches/sca-java-1.3.3/modules/assembly-xml/src/main/java | |
parent | 763f57649fbcd29c9e38f13e395ad0969ade989e (diff) |
Merge fix for TUSCANY-2662 from trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@711727 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.3/modules/assembly-xml/src/main/java')
4 files changed, 26 insertions, 1 deletions
diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java index 06b208540a..80c5e807fe 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java @@ -249,8 +249,29 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement reference.setMultiplicity(Multiplicity.ONE_N); } else if (ZERO_N.equals(value)) { reference.setMultiplicity(Multiplicity.ZERO_N); + } else if (ONE_ONE.equals(value)) { + reference.setMultiplicity(Multiplicity.ONE_ONE); } } + + protected XAttr writeMultiplicity(AbstractReference reference) { + Multiplicity multiplicity = reference.getMultiplicity(); + if (multiplicity != null) { + String value = null; + if (Multiplicity.ZERO_ONE.equals(multiplicity)) { + value = ZERO_ONE; + } else if (Multiplicity.ONE_N.equals(multiplicity)) { + value = ONE_N; + } else if (Multiplicity.ZERO_N.equals(multiplicity)) { + value = ZERO_N; + } else if (Multiplicity.ONE_ONE.equals(multiplicity)) { + value = ONE_ONE; + return null; + } + return new XAttr(MULTIPLICITY, value); + } + return null; + } /** * Returns the value of a constrainingType attribute. diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java index 3da39732e9..07e1507449 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java @@ -278,6 +278,7 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()), + writeMultiplicity(reference), writeTargets(reference), policyProcessor.writePolicies(reference)); diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index b55e4f5fb8..5aae007739 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -743,6 +743,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt for (ComponentReference reference : component.getReferences()) { writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()), new XAttr(AUTOWIRE, reference.getAutowire()), + writeMultiplicity(reference), writeTargets(reference), policyProcessor.writePolicies(reference)); @@ -829,6 +830,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt // Write <reference> element writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()), new XAttr(PROMOTE, promote), + writeMultiplicity(reference), policyProcessor.writePolicies(reference)); //write extended attributes diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java index 35a1c553b2..7b0751437a 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java @@ -42,8 +42,8 @@ import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; -import org.apache.tuscany.sca.policy.PolicyFactory; import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.policy.PolicyFactory; import org.w3c.dom.Document; /** @@ -214,6 +214,7 @@ public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements // Write <reference> elements for (AbstractReference reference : constrainingType.getReferences()) { writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()), + writeMultiplicity(reference), policyProcessor.writePolicies(reference)); extensionProcessor.write(reference.getInterfaceContract(), writer); |