summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java24
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java9
2 files changed, 20 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java
index 209ebedd8c..49aa6eb33f 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java
@@ -50,8 +50,9 @@ public class DefaultLocalSCAReferenceBindingProvider implements EndpointReferenc
protected InterfaceContractMapper interfaceContractMapper;
protected ExtensionPointRegistry extensionPoints;
protected Mediator mediator;
- protected InterfaceContract wsdlBindingInterfaceContract;
-
+ protected InterfaceContract componentTypeRefInterfaceContract;
+ protected InterfaceContract wsdlBindingInterfaceContract; // Computed lazily
+
public DefaultLocalSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpointReference endpointReference, SCABindingMapper mapper) {
this.extensionPoints = extensionPoints;
UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
@@ -65,8 +66,12 @@ public class DefaultLocalSCAReferenceBindingProvider implements EndpointReferenc
return DOMDataBinding.NAME;
}
- private InterfaceContract getWSDLInterfaceContract(InterfaceContract interfaceContract) {
- InterfaceContract wsdlInterfaceContract = (WSDLInterfaceContract)endpointReference.getGeneratedWSDLContract(interfaceContract);
+ protected InterfaceContract getWSDLBindingInterfaceContract() {
+ if (this.wsdlBindingInterfaceContract != null) {
+ return this.wsdlBindingInterfaceContract;
+ }
+
+ InterfaceContract wsdlInterfaceContract = (WSDLInterfaceContract)endpointReference.getGeneratedWSDLContract(componentTypeRefInterfaceContract);
// Validation may be unnecessary. This check may already be guaranteed at this point, not sure.
Endpoint target = endpointReference.getTargetEndpoint();
@@ -93,19 +98,16 @@ public class DefaultLocalSCAReferenceBindingProvider implements EndpointReferenc
if (wsdlInterfaceContract.getCallbackInterface() != null) {
wsdlInterfaceContract.getCallbackInterface().resetDataBinding(dataBinding);
}
+ this.wsdlBindingInterfaceContract = wsdlInterfaceContract;
+
return wsdlInterfaceContract;
-
}
@Override
public InterfaceContract getBindingInterfaceContract() {
- InterfaceContract componentTypeRefIC = endpointReference.getComponentTypeReferenceInterfaceContract();
- if (componentTypeRefIC.getInterface().isRemotable()) {
- this.wsdlBindingInterfaceContract = getWSDLInterfaceContract(componentTypeRefIC);
- }
-
// Since we want to disable DataTransformationInterceptor and handle copy in the binding
- return componentTypeRefIC;
+ this.componentTypeRefInterfaceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
+ return componentTypeRefInterfaceContract;
}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java
index 2c5b4f73e1..170908c82d 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java
@@ -23,6 +23,7 @@ import org.apache.tuscany.sca.binding.sca.transform.BindingSCATransformer;
import org.apache.tuscany.sca.binding.sca.transform.DefaultBindingSCATransformer;
import org.apache.tuscany.sca.binding.sca.transform.XMLWFBindingSCATransformer;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.provider.SCABindingMapper;
@@ -36,8 +37,12 @@ public class XMLWFLocalSCAReferenceBindingProvider extends DefaultLocalSCARefere
super(extensionPoints, endpointReference, mapper);
}
- protected BindingSCATransformer getBindingTransformer(Operation operation, InvocationChain chain) {
- Operation wsdlBindingOperation = interfaceContractMapper.map(wsdlBindingInterfaceContract.getInterface(), operation);
+ protected BindingSCATransformer getBindingTransformer(Operation operation, InvocationChain chain) {
+ InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();
+ if (!bindingInterfaceContract.getInterface().isRemotable()) {
+ throw new IllegalStateException("This method should only have been called for a remotable interface.");
+ }
+ Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), operation);
return new XMLWFBindingSCATransformer(mediator, operation, wsdlBindingOperation, chain);
}
}