summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-sca-runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-sca-runtime/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java (renamed from sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCAReferenceBindingProvider.java)84
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingInvoker.java92
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingProviderFactory.java2
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCABindingProviderFactory.java56
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java43
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAReferenceBindingProvider.java6
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/BindingSCATransformer.java26
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/DefaultBindingSCATransformer.java54
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/XMLWFBindingSCATransformer.java74
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory1
10 files changed, 375 insertions, 63 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java
index 199ab0a103..209ebedd8c 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCAReferenceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/DefaultLocalSCAReferenceBindingProvider.java
@@ -22,13 +22,18 @@ package org.apache.tuscany.sca.binding.local;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.binding.local.LocalSCABindingInvoker;
+import org.apache.tuscany.sca.binding.sca.transform.BindingSCATransformer;
+import org.apache.tuscany.sca.binding.sca.transform.DefaultBindingSCATransformer;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
import org.apache.tuscany.sca.interfacedef.Compatibility;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider;
@@ -36,42 +41,85 @@ import org.apache.tuscany.sca.provider.SCABindingMapper;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+import org.oasisopen.sca.ServiceRuntimeException;
import org.oasisopen.sca.ServiceUnavailableException;
-public class LocalSCAReferenceBindingProvider implements EndpointReferenceAsyncProvider {
+public class DefaultLocalSCAReferenceBindingProvider implements EndpointReferenceAsyncProvider {
private RuntimeEndpointReference endpointReference;
- private InterfaceContractMapper interfaceContractMapper;
- private ExtensionPointRegistry extensionPoints;
- private Mediator mediator;
+ protected InterfaceContractMapper interfaceContractMapper;
+ protected ExtensionPointRegistry extensionPoints;
+ protected Mediator mediator;
+ protected InterfaceContract wsdlBindingInterfaceContract;
- public LocalSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpointReference endpointReference, SCABindingMapper mapper) {
+ public DefaultLocalSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpointReference endpointReference, SCABindingMapper mapper) {
this.extensionPoints = extensionPoints;
UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
this.mediator = utilities.getUtility(Mediator.class);
this.endpointReference = endpointReference;
}
+
+ protected String getDataBinding() {
+ return DOMDataBinding.NAME;
+ }
+
+ private InterfaceContract getWSDLInterfaceContract(InterfaceContract interfaceContract) {
+ InterfaceContract wsdlInterfaceContract = (WSDLInterfaceContract)endpointReference.getGeneratedWSDLContract(interfaceContract);
+
+ // Validation may be unnecessary. This check may already be guaranteed at this point, not sure.
+ Endpoint target = endpointReference.getTargetEndpoint();
+ InterfaceContract targetInterfaceContract = target.getComponentServiceInterfaceContract();
+ try {
+ interfaceContractMapper.checkCompatibility(wsdlInterfaceContract, targetInterfaceContract,
+ Compatibility.SUBSET, true, false);
+ } catch (IncompatibleInterfaceContractException exc) {
+ throw new ServiceRuntimeException(exc);
+ }
+
+ String dataBinding = getDataBinding();
+
+ // Clone
+ try {
+ wsdlInterfaceContract = (WSDLInterfaceContract)wsdlInterfaceContract.clone();
+ } catch (CloneNotSupportedException exc) {
+ throw new ServiceRuntimeException(exc);
+ }
+
+ if (wsdlInterfaceContract.getInterface() != null) {
+ wsdlInterfaceContract.getInterface().resetDataBinding(dataBinding);
+ }
+ if (wsdlInterfaceContract.getCallbackInterface() != null) {
+ wsdlInterfaceContract.getCallbackInterface().resetDataBinding(dataBinding);
+ }
+ return wsdlInterfaceContract;
+
+ }
@Override
public InterfaceContract getBindingInterfaceContract() {
- RuntimeEndpoint endpoint = (RuntimeEndpoint) endpointReference.getTargetEndpoint();
- if (endpoint != null) {
- return endpoint.getComponentTypeServiceInterfaceContract();
- } else {
- return endpointReference.getComponentTypeReferenceInterfaceContract();
+ 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;
}
+
+
@Override
public Invoker createInvoker(Operation operation) {
Invoker result = null;
-
+ BindingSCATransformer bindingTransformer = null;
+
Endpoint target = endpointReference.getTargetEndpoint();
if (target != null) {
RuntimeComponentService service = (RuntimeComponentService) target.getService();
if (service != null) { // not a callback wire
+
InvocationChain chain = ((RuntimeEndpoint) target).getInvocationChain(operation);
boolean passByValue = false;
@@ -90,15 +138,19 @@ public class LocalSCAReferenceBindingProvider implements EndpointReferenceAsyncP
passByValue = false;
} else if (interfaceContractMapper.isCompatibleWithoutUnwrapByValue(operation, targetOp, Compatibility.SUBSET)) {
passByValue = true;
+ } else {
+ throw new IllegalStateException();
}
+ bindingTransformer = getBindingTransformer(operation, chain);
}
+
// it turns out that the chain source and target operations are
// the same, and are the operation
// from the target, not sure if thats by design or a bug. The
// SCA binding invoker needs to know
// the source and target class loaders so pass in the real
// source operation in the constructor
- result = chain == null ? null : new LocalSCABindingInvoker(chain, operation, mediator, passByValue, endpointReference, extensionPoints);
+ result = chain == null ? null : new LocalSCABindingInvoker(chain, operation, passByValue, endpointReference, extensionPoints, bindingTransformer);
}
}
@@ -109,6 +161,10 @@ public class LocalSCAReferenceBindingProvider implements EndpointReferenceAsyncP
return result;
}
+
+ protected BindingSCATransformer getBindingTransformer(Operation operation, InvocationChain chain) {
+ return new DefaultBindingSCATransformer(mediator, operation, chain);
+ }
@Override
public boolean supportsOneWayInvocation() {
@@ -143,4 +199,6 @@ public class LocalSCAReferenceBindingProvider implements EndpointReferenceAsyncP
public void setEndpointReference(RuntimeEndpointReference endpointReference){
this.endpointReference = endpointReference;
}
+
+
}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingInvoker.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingInvoker.java
index a2eb53d5bb..5fca1ea593 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingInvoker.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.binding.local;
+import org.apache.tuscany.sca.binding.sca.transform.BindingSCATransformer;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.invocation.AsyncResponseInvoker;
@@ -41,28 +42,26 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
*/
public class LocalSCABindingInvoker extends InterceptorAsyncImpl {
private InvocationChain chain;
- private Mediator mediator;
- private Operation sourceOperation;
- private Operation targetOperation;
private boolean passByValue;
private RuntimeEndpointReference epr;
private RuntimeEndpoint ep;
private ExtensionPointRegistry registry;
+ private BindingSCATransformer bindingSCATransformer;
/**
* Construct a SCABindingInvoker that delegates to the service invocation chain
*/
- public LocalSCABindingInvoker(InvocationChain chain, Operation sourceOperation, Mediator mediator,
- boolean passByValue, RuntimeEndpointReference epr, ExtensionPointRegistry registry) {
+ public LocalSCABindingInvoker(InvocationChain chain, Operation sourceOperation,
+ boolean passByValue, RuntimeEndpointReference epr, ExtensionPointRegistry registry,
+ BindingSCATransformer bindingSCATransformer) {
super();
this.chain = chain;
- this.mediator = mediator;
- this.sourceOperation = sourceOperation;
- this.targetOperation = chain.getTargetOperation();
+
this.passByValue = passByValue;
this.epr = epr;
this.ep = (RuntimeEndpoint)epr.getTargetEndpoint();
this.registry = registry;
+ this.bindingSCATransformer = bindingSCATransformer;
}
/**
@@ -78,35 +77,36 @@ public class LocalSCABindingInvoker extends InterceptorAsyncImpl {
public void setNext(Invoker next) {
// NOOP
}
-
+
public Message processRequest(Message msg){
if (passByValue) {
- msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation));
+ Object transformedBody = bindingSCATransformer.transformInput(msg.getBody());
+ msg.setBody(transformedBody);
} // end if
-
+
ep.getInvocationChains();
if ( !ep.getCallbackEndpointReferences().isEmpty() ) {
RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) ep.getCallbackEndpointReferences().get(0);
// Place a link to the callback EPR into the message headers...
msg.getHeaders().put("ASYNC_CALLBACK", asyncEPR );
} // end if
-
+
if( ep.isAsyncInvocation() ) {
// Get the message ID
String msgID = (String)msg.getHeaders().get("MESSAGE_ID");
-
+
String operationName = msg.getOperation().getName();
-
+
// Create a response invoker and add it to the message headers
AsyncResponseInvoker<RuntimeEndpointReference> respInvoker =
- new AsyncResponseInvoker<RuntimeEndpointReference>(ep, null, epr, msgID, operationName, getMessageFactory());
+ new AsyncResponseInvoker<RuntimeEndpointReference>(ep, null, epr, msgID, operationName, getMessageFactory());
respInvoker.setBindingType("SCA_LOCAL");
msg.getHeaders().put("ASYNC_RESPONSE_INVOKER", respInvoker);
} // end if
-
+
return msg;
} // end method processRequest
-
+
/**
* Regular (sync) processing of response message
*/
@@ -114,54 +114,54 @@ public class LocalSCABindingInvoker extends InterceptorAsyncImpl {
if (passByValue) {
// Note source and target operation swapped so result is in source class loader
if (msg.isFault()) {
- msg.setFaultBody(mediator.copyFault(msg.getBody(), sourceOperation, targetOperation));
+ Object transformedFault = bindingSCATransformer.transformFault(msg.getBody());
+ msg.setFaultBody(transformedFault);
} else {
- if (sourceOperation.getOutputType() != null) {
- msg.setBody(mediator.copyOutput(msg.getBody(), sourceOperation, targetOperation));
- } // end if
+ Object transformedOutput = bindingSCATransformer.transformOutput(msg.getBody());
+ msg.setBody(transformedOutput);
} // end if
} // end if
-
+
return msg;
} // end method processResponse
-
+
public void invokeAsyncRequest(Message msg) throws Throwable {
- try{
- msg = processRequest(msg);
- InvokerAsyncRequest theNext = (InvokerAsyncRequest)getNext();
- if( theNext != null ) theNext.invokeAsyncRequest(msg);
- postProcessRequest(msg);
- } catch (Throwable e) {
- postProcessRequest(msg, e);
- } // end try
+ try{
+ msg = processRequest(msg);
+ InvokerAsyncRequest theNext = (InvokerAsyncRequest)getNext();
+ if( theNext != null ) theNext.invokeAsyncRequest(msg);
+ postProcessRequest(msg);
+ } catch (Throwable e) {
+ postProcessRequest(msg, e);
+ } // end try
} // end method invokeAsyncRequest
-
+
public void invokeAsyncResponse(Message msg) {
msg = processResponse(msg);
-
+
// Handle async response Relates_To message ID value
@SuppressWarnings("unchecked")
- AsyncResponseInvoker<RuntimeEndpointReference> respInvoker =
- (AsyncResponseInvoker<RuntimeEndpointReference>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
+ AsyncResponseInvoker<RuntimeEndpointReference> respInvoker =
+ (AsyncResponseInvoker<RuntimeEndpointReference>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
// TODO - this deals with the Local case only - not distributed
if( respInvoker != null && "SCA_LOCAL".equals(respInvoker.getBindingType()) ) {
- RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress();
- msg.setFrom(responseEPR);
- String msgID = respInvoker.getRelatesToMsgID();
- msg.getHeaders().put("RELATES_TO", msgID);
+ RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress();
+ msg.setFrom(responseEPR);
+ String msgID = respInvoker.getRelatesToMsgID();
+ msg.getHeaders().put("RELATES_TO", msgID);
} // end if
-
+
InvokerAsyncResponse thePrevious = (InvokerAsyncResponse)getPrevious();
if (thePrevious != null ) thePrevious.invokeAsyncResponse(msg);
} // end method invokeAsyncResponse
-
+
public boolean isLocalSCABIndingInvoker() {
return true;
}
-
- private MessageFactory getMessageFactory() {
- FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
- return modelFactories.getFactory(MessageFactory.class);
- } // end method getMessageFactory
+
+ private MessageFactory getMessageFactory() {
+ FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ return modelFactories.getFactory(MessageFactory.class);
+ } // end method getMessageFactory
}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingProviderFactory.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingProviderFactory.java
index 4ba66fb47a..0d61d9e407 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingProviderFactory.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/LocalSCABindingProviderFactory.java
@@ -40,7 +40,7 @@ public class LocalSCABindingProviderFactory implements BindingProviderFactory<Lo
@Override
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
- return new LocalSCAReferenceBindingProvider(extensionPoints, endpointReference, scaBindingMapper);
+ return new DefaultLocalSCAReferenceBindingProvider(extensionPoints, endpointReference, scaBindingMapper);
}
@Override
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCABindingProviderFactory.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCABindingProviderFactory.java
new file mode 100644
index 0000000000..f9c1b05ab6
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCABindingProviderFactory.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.local;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.SCABindingMapper;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+
+public class XMLWFLocalSCABindingProviderFactory implements BindingProviderFactory<LocalSCABinding> {
+ private ExtensionPointRegistry extensionPoints;
+ private SCABindingMapper scaBindingMapper;
+
+ public XMLWFLocalSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ this.scaBindingMapper = utilities.getUtility(SCABindingMapper.class);
+ }
+
+ @Override
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
+ return new XMLWFLocalSCAReferenceBindingProvider(extensionPoints, endpointReference, scaBindingMapper);
+ }
+
+ @Override
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
+ return new LocalSCAServiceBindingProvider(endpoint, scaBindingMapper);
+ }
+
+ @Override
+ public Class<LocalSCABinding> getModelType() {
+ return LocalSCABinding.class;
+ }
+
+}
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
new file mode 100644
index 0000000000..2c5b4f73e1
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/local/XMLWFLocalSCAReferenceBindingProvider.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.local;
+
+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.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.provider.SCABindingMapper;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+
+public class XMLWFLocalSCAReferenceBindingProvider extends DefaultLocalSCAReferenceBindingProvider {
+
+ public XMLWFLocalSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
+ RuntimeEndpointReference endpointReference,
+ SCABindingMapper mapper) {
+ super(extensionPoints, endpointReference, mapper);
+ }
+
+ protected BindingSCATransformer getBindingTransformer(Operation operation, InvocationChain chain) {
+ Operation wsdlBindingOperation = interfaceContractMapper.map(wsdlBindingInterfaceContract.getInterface(), operation);
+ return new XMLWFBindingSCATransformer(mediator, operation, wsdlBindingOperation, chain);
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAReferenceBindingProvider.java
index 2cc71f1744..5b47443df8 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAReferenceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAReferenceBindingProvider.java
@@ -20,7 +20,7 @@
package org.apache.tuscany.sca.binding.sca.provider;
import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.local.LocalSCAReferenceBindingProvider;
+import org.apache.tuscany.sca.binding.local.DefaultLocalSCAReferenceBindingProvider;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
@@ -47,8 +47,8 @@ public class DelegatingSCAReferenceBindingProvider implements EndpointReferenceA
// reset the EPR to binding.sca EPR because the local optimization assumes
// this to be the case.
- if (provider instanceof LocalSCAReferenceBindingProvider){
- ((LocalSCAReferenceBindingProvider)provider).setEndpointReference(endpointReference);
+ if (provider instanceof DefaultLocalSCAReferenceBindingProvider){
+ ((DefaultLocalSCAReferenceBindingProvider)provider).setEndpointReference(endpointReference);
}
}
}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/BindingSCATransformer.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/BindingSCATransformer.java
new file mode 100644
index 0000000000..e84668fb1d
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/BindingSCATransformer.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.sca.transform;
+
+public interface BindingSCATransformer {
+ Object transformInput(Object body);
+ Object transformOutput(Object body);
+ Object transformFault(Object body);
+}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/DefaultBindingSCATransformer.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/DefaultBindingSCATransformer.java
new file mode 100644
index 0000000000..77e93f8672
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/DefaultBindingSCATransformer.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.sca.transform;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+
+public class DefaultBindingSCATransformer implements BindingSCATransformer {
+
+ private Mediator mediator;
+ private Operation sourceOperation;
+ private Operation targetOperation;
+
+ public DefaultBindingSCATransformer(Mediator mediator, Operation sourceOperation, InvocationChain chain) {
+ this.mediator = mediator;
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = chain.getTargetOperation();
+ }
+
+ @Override
+ public Object transformInput(Object body) {
+ return mediator.copyInput(body, sourceOperation, targetOperation);
+ }
+
+ @Override
+ public Object transformOutput(Object body) {
+ return mediator.copyOutput(body, sourceOperation, targetOperation);
+ }
+
+ @Override
+ public Object transformFault(Object body) {
+ return mediator.copyFault(body, sourceOperation, targetOperation);
+ }
+
+}
+
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/XMLWFBindingSCATransformer.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/XMLWFBindingSCATransformer.java
new file mode 100644
index 0000000000..cc366c1f7a
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/transform/XMLWFBindingSCATransformer.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.sca.transform;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+
+public class XMLWFBindingSCATransformer implements BindingSCATransformer {
+
+ private Mediator mediator;
+ private Operation sourceOperation;
+ private Operation wsdlBindingOperation;
+ private Operation targetOperation;
+
+ public XMLWFBindingSCATransformer(Mediator mediator, Operation sourceOperation, Operation wsdlBindingOperation, InvocationChain chain) {
+ this.mediator = mediator;
+ this.sourceOperation = sourceOperation;
+ this.wsdlBindingOperation = wsdlBindingOperation;
+ this.targetOperation = chain.getTargetOperation();
+ }
+
+ @Override
+ public Object transformInput(Object body) {
+ Map<String, Object> map1 = new HashMap<String, Object>();
+ Object intermediate = mediator.mediateInput(body, sourceOperation, wsdlBindingOperation, map1);
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ Object result = mediator.mediateInput(intermediate, wsdlBindingOperation, targetOperation, map2);
+ return result;
+ }
+
+ @Override
+ public Object transformOutput(Object body) {
+ Map<String, Object> map1 = new HashMap<String, Object>();
+ Object intermediate = mediator.mediateOutput(body, wsdlBindingOperation, targetOperation, map1);
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ Object result = mediator.mediateOutput(intermediate, sourceOperation, wsdlBindingOperation, map2);
+
+ return result;
+
+ }
+
+ @Override
+ public Object transformFault(Object body) {
+ Map<String, Object> map1 = new HashMap<String, Object>();
+ Object intermediate = mediator.mediateFault(body, wsdlBindingOperation, targetOperation, map1);
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ Object result = mediator.mediateFault(intermediate, sourceOperation, wsdlBindingOperation, map2);
+ return result;
+
+ }
+
+}
+
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
index 3a089bc284..a7b1572226 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -17,4 +17,5 @@
# Implementation class for the binding extension
org.apache.tuscany.sca.binding.sca.provider.RuntimeSCABindingProviderFactory;model=org.apache.tuscany.sca.assembly.SCABinding
+#org.apache.tuscany.sca.binding.local.XMLWFLocalSCABindingProviderFactory;model=org.apache.tuscany.sca.binding.local.LocalSCABinding
org.apache.tuscany.sca.binding.local.LocalSCABindingProviderFactory;model=org.apache.tuscany.sca.binding.local.LocalSCABinding