You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/09/07 12:52:58 UTC

svn commit: r573538 - /incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java

Author: svkrish
Date: Fri Sep  7 03:52:57 2007
New Revision: 573538

URL: http://svn.apache.org/viewvc?rev=573538&view=rev
Log:
added resolve method

Modified:
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java?rev=573538&r1=573537&r2=573538&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java Fri Sep  7 03:52:57 2007
@@ -28,10 +28,13 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
@@ -212,5 +215,39 @@
         }
         return new XAttr(Constants.POLICY_SETS, qnames);
     }
+    
+    private void resolvePolicies(PolicySetAttachPoint policySetAttachPoint, ModelResolver resolver) {
+        List<Intent> requiredIntents = new ArrayList<Intent>();
+        Intent resolvedIntent = null;
+        
+        if ( policySetAttachPoint instanceof Binding ) {
+            if ( policySetAttachPoint.getType().isUnresolved() ) {
+                IntentAttachPointType resolved = 
+                    resolver.resolveModel(IntentAttachPointType.class, policySetAttachPoint.getType());
+                policySetAttachPoint.setType(resolved);
+            }
+        }
+        
+        if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) {
+            for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+                resolvedIntent = resolver.resolveModel(Intent.class, intent);
+                requiredIntents.add(resolvedIntent);
+            }
+            policySetAttachPoint.getRequiredIntents().clear();
+            policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+        }
+        
+        if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) {
+            List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+            PolicySet resolvedPolicySet = null;
+            for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+                resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+                resolvedPolicySets.add(resolvedPolicySet);
+            }
+            policySetAttachPoint.getPolicySets().clear();
+            policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+        }
+    }
+
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org