summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-23 13:05:00 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-23 13:05:00 +0000
commite9fc3c9cf81db2869a9d2e5a0b3f08a89829508a (patch)
tree01c3374fbadea3ef4c6f79e1d3f41ca2511114cb /sca-java-2.x/trunk/modules/core/src
parent4f538657ed8baff04cdf01adff8db3c7e82aa3b9 (diff)
TUSCANY-3873 - A stop gap solution to running the appliesTo algorithm against a matched endpoint reference. Waiting on the discussion from TUSCANY-3877 before producing the full solution.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1138864 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
index f00520b836..800d3ef05b 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
@@ -38,6 +38,7 @@ import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
import org.apache.tuscany.sca.assembly.builder.BuilderContext;
import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.PolicyBuilder;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@@ -86,6 +87,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
protected CompositeActivator compositeActivator;
protected Monitor monitor;
protected UnknownEndpointHandler unknownEndpointHandler;
+ protected CompositeBuilder policyAppliesToBuilder;
public EndpointReferenceBinderImpl(ExtensionPointRegistry extensionPoints) {
@@ -103,6 +105,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
this.unknownEndpointHandler = utils.getUtility(UnknownEndpointHandler.class);
this.builders = extensionPoints.getExtensionPoint(BuilderExtensionPoint.class);
+
this.compositeActivator = extensionPoints.getExtensionPoint(CompositeActivator.class);
}
@@ -424,11 +427,24 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
endpointReference.setTargetEndpoint(matchedEndpoint);
Binding binding = matchedEndpoint.getBinding();
endpointReference.setBinding(binding);
- // TUSCANY-3873 - if no policy on the reference add policy from the service
+ // TUSCANY-3873 - add policy from the service
// we don't care about intents at this stage
- if (endpointReference.getPolicySets().isEmpty()){
- endpointReference.getPolicySets().addAll(matchedEndpoint.getPolicySets());
+ endpointReference.getPolicySets().addAll(matchedEndpoint.getPolicySets());
+ // TODO - we need to re-run the appliesTo processing here but there is some question about what
+ // appliesTo means. It's also difficult to get to the PolicyAppliesToBuilder from here and
+ // need a new EntensionInterface to support access. So for now I'm just cheating and looking to
+ // see if the XPath expression contains the binding type as a string while we discuss appliesTo
+
+ List<PolicySet> psToRemove = new ArrayList<PolicySet>();
+
+ for (PolicySet ps : endpointReference.getPolicySets() ) {
+ if (!ps.getAppliesTo().contains(endpointReference.getBinding().getType().getLocalPart())){
+ psToRemove.add(ps);
+ }
}
+
+ endpointReference.getPolicySets().removeAll(psToRemove);
+
build(endpointReference);
endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
endpointReference.setUnresolved(false);
@@ -794,7 +810,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
}
}
- if(!eprLanguage.equals(epLanguage)){
+ if(!eprLanguage.getNamespaceURI().equals(epLanguage.getNamespaceURI())){
matchAudit.append("No match because the policy sets on either side have policies in differnt languages " +
eprLanguage +
" and " +