You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2006/09/25 00:42:19 UTC
svn commit: r449517 - in /incubator/tuscany/java/sca:
kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/
kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/
kernel/spi/src/main/java/org/apache/tuscany/spi/compone...
Author: rfeng
Date: Sun Sep 24 15:42:18 2006
New Revision: 449517
URL: http://svn.apache.org/viewvc?view=rev&rev=449517
Log:
Add binding service contract to Reference and Service
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
incubator/tuscany/java/sca/services/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java Sun Sep 24 15:42:18 2006
@@ -101,4 +101,11 @@
throw new UnsupportedOperationException();
}
+ public ServiceContract<?> getBindingServiceContract() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setBindingServiceContract(ServiceContract<?> serviceContract) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java Sun Sep 24 15:42:18 2006
@@ -87,4 +87,12 @@
public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
throw new UnsupportedOperationException();
}
+
+ public ServiceContract<?> getBindingServiceContract() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setBindingServiceContract(ServiceContract<?> serviceContract) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java Sun Sep 24 15:42:18 2006
@@ -198,9 +198,15 @@
inboundWire.addInvocationChain(operation, chain);
}
OutboundWire outboundWire = new OutboundWireImpl();
- outboundWire.setServiceContract(contract);
+
+ // [rfeng] Check if the Reference has the binding contract
+ ServiceContract<?> bindingContract = reference.getBindingServiceContract();
+ if (bindingContract == null) {
+ bindingContract = contract;
+ }
+ outboundWire.setServiceContract(bindingContract);
outboundWire.setContainer(reference);
- for (Operation<?> operation : contract.getOperations().values()) {
+ for (Operation<?> operation : bindingContract.getOperations().values()) {
OutboundInvocationChain chain = createOutboundChain(operation);
chain.addInterceptor(new InvokerInterceptor());
outboundWire.addInvocationChain(operation, chain);
@@ -268,15 +274,25 @@
public void createWires(Service service, String targetName, ServiceContract<?> contract) {
InboundWire inboundWire = new InboundWireImpl();
- OutboundWire outboundWire = new OutboundWireImpl();
- inboundWire.setServiceContract(contract);
+
+ // [rfeng] Check if the Reference has the binding contract
+ ServiceContract<?> bindingContract = service.getBindingServiceContract();
+ if (bindingContract == null) {
+ bindingContract = contract;
+ }
+ inboundWire.setServiceContract(bindingContract);
inboundWire.setContainer(service);
+ for (Operation<?> operation : bindingContract.getOperations().values()) {
+ InboundInvocationChain inboundChain = createInboundChain(operation);
+ inboundWire.addInvocationChain(operation, inboundChain);
+ }
+
+ OutboundWire outboundWire = new OutboundWireImpl();
outboundWire.setServiceContract(contract);
outboundWire.setTargetName(new QualifiedName(targetName));
outboundWire.setContainer(service);
+
for (Operation<?> operation : contract.getOperations().values()) {
- InboundInvocationChain inboundChain = createInboundChain(operation);
- inboundWire.addInvocationChain(operation, inboundChain);
OutboundInvocationChain outboundChain = createOutboundChain(operation);
outboundWire.addInvocationChain(operation, outboundChain);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java Sun Sep 24 15:42:18 2006
@@ -85,5 +85,20 @@
* @param operation the operation to invoke
*/
TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation operation);
+
+ /**
+ * Get the ServiceContract for the binding
+ * @return
+ */
+ ServiceContract<?> getBindingServiceContract();
+
+
+ /**
+ * Set the ServiceContract for the binding. This contract will be used for the outbound wire.
+ * If not set, it will be the same as the ServideContract from the interface.
+ *
+ * @param serviceContract
+ */
+ void setBindingServiceContract(ServiceContract<?> serviceContract);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java Sun Sep 24 15:42:18 2006
@@ -79,4 +79,19 @@
* @param operation the callback operation the target invoker dispatches to
*/
TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation);
+
+ /**
+ * Get the ServiceContract for the binding
+ * @return
+ */
+ ServiceContract<?> getBindingServiceContract();
+
+
+ /**
+ * Set the ServiceContract for the binding. This contract will be used for the inbound wire.
+ * If not set, it will be the same as the ServideContract from the interface.
+
+ * @param serviceContract
+ */
+ void setBindingServiceContract(ServiceContract<?> serviceContract);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java Sun Sep 24 15:42:18 2006
@@ -92,4 +92,13 @@
throw new UnsupportedOperationException();
}
+ protected ServiceContract<?> bindingServiceContract;
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ public void setBindingServiceContract(ServiceContract<?> serviceContract) {
+ this.bindingServiceContract = serviceContract;
+ }
+
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java Sun Sep 24 15:42:18 2006
@@ -86,5 +86,13 @@
public Class<?> getInterface() {
return interfaze;
}
+
+ protected ServiceContract<?> bindingServiceContract;
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+ public void setBindingServiceContract(ServiceContract<?> serviceContract) {
+ this.bindingServiceContract = serviceContract;
+ }
}
Modified: incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Sun Sep 24 15:42:18 2006
@@ -132,7 +132,6 @@
try {
// Set the default binding
ServiceContract<?> inboundContract = boundReferenceDefinition.getServiceContract();
- inboundContract.setDataBinding(OM_DATA_BINDING);
// FIXME: We need to define how the WSDL PortType is honored in the case that
// both the binding.ws and interface.wsdl are in place
@@ -157,7 +156,8 @@
}
Reference reference = new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding,
- outboundContract, workContext);
+ inboundContract, workContext);
+ reference.setBindingServiceContract(outboundContract);
return reference;
Modified: incubator/tuscany/java/sca/services/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java?view=diff&rev=449517&r1=449516&r2=449517
==============================================================================
--- incubator/tuscany/java/sca/services/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java (original)
+++ incubator/tuscany/java/sca/services/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java Sun Sep 24 15:42:18 2006
@@ -26,6 +26,8 @@
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.builder.WirePostProcessorExtension;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.SCAObject;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.wire.InboundInvocationChain;
@@ -76,19 +78,28 @@
* org.apache.tuscany.spi.wire.OutboundWire)
*/
public void process(InboundWire source, OutboundWire target) {
+ SCAObject container = source.getContainer();
+ // Either Service or Reference
+ boolean isReference = (container instanceof Reference);
+
Map<Operation<?>, InboundInvocationChain> chains = source.getInvocationChains();
for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
Operation<?> sourceOperation = entry.getKey();
Operation<?> targetOperation =
- getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName());
+ getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName());
String sourceDataBinding = getDataBinding(sourceOperation);
String targetDataBinding = getDataBinding(targetOperation);
if (sourceDataBinding == null || targetDataBinding == null || !sourceDataBinding.equals(targetDataBinding)) {
// Add the interceptor to the source side
DataBindingInteceptor interceptor =
- new DataBindingInteceptor(source, sourceOperation, target, targetOperation);
+ new DataBindingInteceptor(source, sourceOperation, target, targetOperation);
interceptor.setMediator(mediator);
- entry.getValue().addInterceptor(0, interceptor);
+ if (isReference) {
+ target.getInvocationChains().get(targetOperation).addInterceptor(0, interceptor);
+ } else {
+ entry.getValue().addInterceptor(0, interceptor);
+ }
+
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org