summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-31 10:34:23 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-31 10:34:23 +0000
commitb624b481d8900141f221c041858deea1aef04a71 (patch)
tree8ad7c06934083b7512e6aa52db8461c319772047 /sca-java-2.x/trunk/modules
parent51d1c4868bebe4f3b72ab2652178e058b0505ece (diff)
Add a spec version to Endpoint and only do full matching if the target endpoint is and OASIS endpoint
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1195400 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java20
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java12
-rw-r--r--sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java12
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java31
4 files changed, 74 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
index 14a3e466ef..014913cfa8 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
@@ -34,6 +34,7 @@ import org.apache.tuscany.sca.policy.PolicySubject;
* @tuscany.spi.extension.asclient
*/
public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable {
+
/**
* Get the structural URI of the service binding
* @return structural URI of the service/binding
@@ -156,4 +157,23 @@ public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable {
*/
boolean isAsyncInvocation();
+ /**
+ * Get the spec version for this endpoint. This is intended to help
+ * interop scenarios where having an OASIS endpoint talk to an
+ * OSOA endpoint implies some restrictions.
+ *
+ * @return the spec version, namespace for either SCA-1.0 or SCA-1.1
+ */
+ String getSpecVersion();
+
+ /**
+ * Set the spec version for this endpoint. This is intended to help
+ * interop scenarios where having an OASIS endpoint talk to an
+ * OSOA endpoint implies some restrictions. If unset it defaults
+ * to the namespace for SCA-1.1
+ *
+ * @param specVersion the spec version, namspace for either SCA-1.0 or SCA-1.1
+ */
+ void setSpecVersion(String specVersion);
+
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
index 2ea516cd04..195fa4303e 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.assembly.impl;
import java.util.ArrayList;
import java.util.List;
+import org.apache.tuscany.sca.assembly.Base;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentService;
@@ -57,6 +58,7 @@ public class EndpointImpl implements Endpoint {
protected List<PolicySet> policySets = new ArrayList<PolicySet>();
protected List<Intent> requiredIntents = new ArrayList<Intent>();
protected boolean remote = false;
+ protected String specVersion = Base.SCA11_NS;
protected EndpointImpl(ExtensionPointRegistry registry) {
this.registry = registry;
@@ -305,5 +307,15 @@ public class EndpointImpl implements Endpoint {
public void setDeployedURI(String deployedURI) {
this.deployedURI = deployedURI;
}
+
+ @Override
+ public String getSpecVersion() {
+ return specVersion;
+ }
+
+ @Override
+ public void setSpecVersion(String specVersion){
+ this.specVersion = specVersion;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
index 107af627a1..39a13dcef5 100644
--- a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
+++ b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
@@ -365,4 +365,16 @@ public class TestRuntimeWire implements RuntimeEndpoint {
// TODO Auto-generated method stub
}
+
+ @Override
+ public String getSpecVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setSpecVersion(String specVersion) {
+ // TODO Auto-generated method stub
+
+ }
}
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 b0be5cb3e8..23d8f1a188 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
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Base;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Callback;
import org.apache.tuscany.sca.assembly.ComponentReference;
@@ -647,6 +648,25 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
private boolean haveMatchingPolicy(EndpointReference endpointReference, Endpoint endpoint, Audit matchAudit, BuilderContext builderContext){
matchAudit.append("Match policy of " + endpointReference.toString() + " to " + endpoint.toString() + " ");
+ if (!endpoint.getSpecVersion().equals(Base.SCA11_NS)){
+ // the thing we need to check here is asyncInvocation as only OASIS supports that
+ if (endpointReference.isAsyncInvocation()){
+ // this definitely won't mactch anything but OASIS so fail
+ matchAudit.append("No match because the endpoint reference is configured for asyncInvocation " +
+ "and the target endpoint is not an OASIS endpoint, specVersion = " +
+ endpoint.getSpecVersion());
+ matchAudit.appendSeperator();
+ return false;
+ } else {
+ // Assume it matches as we don't know how to do policy
+ // matching with anything but OASIS endpoints
+ matchAudit.append("Match because the target endpoint is not an OASIS endpoint, specVersion = " +
+ endpoint.getSpecVersion());
+ matchAudit.appendSeperator();
+ return true;
+ }
+ }
+
List<PolicySet> referencePolicySets = new ArrayList<PolicySet>();
Binding binding = null;
@@ -1001,7 +1021,16 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
matchAudit.append("Match because there is no interface contract on the reference ");
matchAudit.appendSeperator();
return true;
- }
+ }
+
+ if (!endpoint.getSpecVersion().equals(Base.SCA11_NS)){
+ // Assume it matches as we don't know how to do policy
+ // matching with anything but OASIS endpoint
+ matchAudit.append("Match because the target endpoint is not an OASIS endpoint, specVersion = " +
+ endpoint.getSpecVersion());
+ matchAudit.appendSeperator();
+ return true;
+ }
/* For testing this code turns off remote interface matching completely
if (endpoint.isRemote()){