tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r983640 - in /tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml: IntentProcessor.java PolicyConstants.java
Date Mon, 09 Aug 2010 13:37:46 GMT
Author: slaws
Date: Mon Aug  9 13:37:45 2010
New Revision: 983640

URL: http://svn.apache.org/viewvc?rev=983640&view=rev
Log:
TUSCANY-3647 - mark all qualified intents as mutually exclusive with one another if the qualifiable
intent is marked as mutuallyExclusive

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java?rev=983640&r1=983639&r2=983640&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
Mon Aug  9 13:37:45 2010
@@ -125,6 +125,14 @@ public class IntentProcessor extends Bas
         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 Bas
                         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 Bas
         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;
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java?rev=983640&r1=983639&r2=983640&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
Mon Aug  9 13:37:45 2010
@@ -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";



Mime
View raw message