diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-09 13:37:45 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-09 13:37:45 +0000 |
commit | 8e2125680930c7336a74ced55d848d5dde8b6926 (patch) | |
tree | 20f4fe20be9a6101224a3b6ee2ea7c918de5e419 /sca-java-2.x/trunk/modules/assembly-xml/src | |
parent | f9625fd2531392d27caa68184be11a03d5d67860 (diff) |
TUSCANY-3647 - mark all qualified intents as mutually exclusive with one another if the qualifiable intent is marked as mutuallyExclusive
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@983640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src')
2 files changed, 23 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java index 296677d8b8..c7eb7f49d8 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java @@ -125,6 +125,14 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr readExcludedIntents(intent, reader); readConstrainedTypes(intent, reader); + + String mutuallyExclusiveString = reader.getAttributeValue(null, MUTUALLY_EXCLUSIVE); + if (mutuallyExclusiveString != null && + mutuallyExclusiveString.equals("true")){ + intent.setMutuallyExclusive(true); + } else { + intent.setMutuallyExclusive(false); + } Intent current = intent; int event = reader.getEventType(); @@ -146,6 +154,7 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr boolean isDefault = defaultQ == null ? false : Boolean.parseBoolean(defaultQ); String qualifiedIntentName = intentLocalName + QUALIFIER + qualifierName; Intent qualified = policyFactory.createIntent(); + qualified.setUnresolved(false); qualified.setType(intent.getType()); qualified.setName(new QName(qualifiedIntentName)); if (isDefault) { @@ -198,6 +207,19 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr if (intent.getQualifiedIntents().size() == 1) { intent.setDefaultQualifiedIntent(intent.getQualifiedIntents().get(0)); } + + // set all qualified intents as excluding one another if the qualifiable + // intent is set to be mutually exclusive + if (intent.isMutuallyExclusive()){ + for (Intent qualifiedIntent : intent.getQualifiedIntents()){ + for (Intent excludedIntent : intent.getQualifiedIntents()){ + if (qualifiedIntent != excludedIntent){ + qualifiedIntent.getExcludedIntents().add(excludedIntent); + } + } + } + } + return intent; } diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java index a02abd86ed..2498f3df67 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java @@ -52,6 +52,7 @@ public interface PolicyConstants { String EXTERNAL_ATTACHMENT = "externalAttachment"; String INTENTS = "intents"; String POLICY_SETS = "policySets"; + String MUTUALLY_EXCLUSIVE = "mutuallyExclusive"; String ALWAYS_PROVIDES = "alwaysProvides"; String MAY_PROVIDE = "mayProvide"; |