summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-19 14:03:07 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-19 14:03:07 +0000
commitc79fbcb63cc5b097533f0d36b43e4c32782c71b1 (patch)
tree29f852f32a3660588ce49fcc642317ea8d7ba02a /sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache
parent7fc8467572a9691e152123f44c38076f08ec0bd4 (diff)
Resolve operation policy and take account of it in base policy processor.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1186226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java29
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java14
2 files changed, 40 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
index 091b3c01d3..966c0ac275 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
@@ -81,6 +81,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -365,7 +366,7 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
// Resolve the interface contract
InterfaceContract interfaceContract = contract.getInterfaceContract();
if (interfaceContract != null) {
- extensionProcessor.resolve(interfaceContract, resolver, context);
+ extensionProcessor.resolve(interfaceContract, resolver, context);
}
// Resolve bindings
@@ -382,6 +383,32 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
Binding binding = contract.getCallback().getBindings().get(i);
extensionProcessor.resolve(binding, resolver, context);
}
+ }
+ }
+ }
+
+ /*
+ * Resolve policy that's been attached to interface operations
+ */
+ protected <C extends Contract> void resolveContractOperationPolicy(List<C> contracts, ModelResolver resolver, ProcessorContext context){
+ if (contracts != null){
+ for (Contract contract : contracts) {
+ InterfaceContract interfaceContract = contract.getInterfaceContract();
+ if (interfaceContract != null) {
+
+ // Resolve any policy on the interface operations
+ if (interfaceContract.getInterface() != null){
+ for (Operation op : interfaceContract.getInterface().getOperations()){
+ policyProcessor.resolvePolicies(op, resolver, context);
+ }
+ }
+
+ if (interfaceContract.getCallbackInterface() != null){
+ for (Operation op : interfaceContract.getCallbackInterface().getOperations()){
+ policyProcessor.resolvePolicies(op, resolver, context);
+ }
+ }
+ }
}
}
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
index 55a31e1bc0..55e4cc53ae 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -103,6 +103,7 @@ import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.policy.ExtensionType;
import org.apache.tuscany.sca.policy.Intent;
@@ -1112,8 +1113,17 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
implementation.getPolicySets().addAll(policySets);
}
- implementation.getRequiredIntents().addAll(intents);
-
+ implementation.getRequiredIntents().addAll(intents);
+
+ // resolve any policy on implementation operations
+ for (Operation op : implementation.getOperations()){
+ policyProcessor.resolvePolicies(op, resolver, context);
+ }
+
+ // resolve any policy on interface operations
+ resolveContractOperationPolicy(implementation.getServices(), resolver, context);
+ resolveContractOperationPolicy(implementation.getReferences(), resolver, context);
+
component.setImplementation(implementation);
}