You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/03/08 18:23:03 UTC
svn commit: r516108 -
/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java
Author: svkrish
Date: Thu Mar 8 09:23:03 2007
New Revision: 516108
URL: http://svn.apache.org/viewvc?view=rev&rev=516108
Log:
fix to skip copying if one end of wire is servicebinding or reference binding
Modified:
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java?view=diff&rev=516108&r1=516107&r2=516108
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java Thu Mar 8 09:23:03 2007
@@ -24,6 +24,8 @@
import java.util.Set;
import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
import org.apache.tuscany.spi.databinding.DataBinding;
import org.apache.tuscany.spi.databinding.DataBindingRegistry;
import org.apache.tuscany.spi.extension.AtomicComponentExtension;
@@ -72,98 +74,95 @@
boolean implAllowsPassByReference = false;
boolean methodAllowsPassByReference = false;
- if (target.getServiceContract().getInterfaceClass() != null) {
- Class ic = target.getServiceContract().getInterfaceClass();
- implAllowsPassByReference = ic.getAnnotation(Remotable.class) != null;
- }
- if (!implAllowsPassByReference && target.getContainer() instanceof AtomicComponentExtension) {
- implAllowsPassByReference =
- ((AtomicComponentExtension) target.getContainer()).isAllowsPassByReference();
- }
- boolean srcAllowsPassByReference = false;
- if (source.getContainer() instanceof ServiceBindingExtension) {
- srcAllowsPassByReference =
- ((ServiceBindingExtension) source.getContainer()).allowsPassByReference();
- }
+ //if the source is a service binding or the target is a reference binding do no
+ //add interceptor since the bindings will ensure passbyvalue semantics
+ if ( !(source.getContainer() instanceof ServiceBinding ||
+ target.getContainer() instanceof ReferenceBinding ) ) {
+
+ if (target.getContainer() instanceof AtomicComponentExtension) {
+ implAllowsPassByReference =
+ ((AtomicComponentExtension) target.getContainer()).isAllowsPassByReference();
+ }
- Map<Operation<?>, InboundInvocationChain> chains = target.getInvocationChains();
- for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
- targetOperation = entry.getKey();
- methodAllowsPassByReference = false;
+ Map<Operation<?>, InboundInvocationChain> chains = target.getInvocationChains();
+ for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
+ targetOperation = entry.getKey();
+ methodAllowsPassByReference = false;
+
+ if (target.getContainer() instanceof AtomicComponentExtension) {
+ methodAllowsPassByReference =
+ ((AtomicComponentExtension) target.getContainer()).
+ getPassByReferenceMethods().contains(targetOperation.getName());
+ }
- if (target.getContainer() instanceof AtomicComponentExtension) {
- methodAllowsPassByReference =
- ((AtomicComponentExtension) target.getContainer()).
- getPassByReferenceMethods().contains(targetOperation.getName());
- }
-
- if (target.getServiceContract().isRemotable()
- && (!srcAllowsPassByReference && !implAllowsPassByReference && !methodAllowsPassByReference)) {
- sourceOperation =
- getSourceOperation(source.getInvocationChains().keySet(), targetOperation.getName());
-
- if (null != sourceOperation) {
- argsDataBindings = resolveArgsDataBindings(targetOperation);
- resultDataBinding = resolveResultDataBinding(targetOperation);
- passByValueInterceptor = new PassByValueInterceptor();
- passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
- passByValueInterceptor.setArgsDataBindings(argsDataBindings);
- passByValueInterceptor.setResultDataBinding(resultDataBinding);
- entry.getValue().addInterceptor(0, passByValueInterceptor);
- tailInterceptor = source.getInvocationChains().get(sourceOperation).getTailInterceptor();
- if (tailInterceptor != null) {
- tailInterceptor.setNext(passByValueInterceptor);
- }
- }
- }
- }
-
- // Check if there's a callback
- Map callbackOperations = source.getServiceContract().getCallbackOperations();
- implAllowsPassByReference = false;
-
- if (callbackOperations != null && !callbackOperations.isEmpty()) {
- if (source.getContainer() instanceof AtomicComponentExtension) {
- implAllowsPassByReference =
- ((AtomicComponentExtension) source.getContainer()).isAllowsPassByReference();
- }
-
- Object targetAddress = source.getContainer().getName();
- Map<Operation<?>, InboundInvocationChain> callbackChains = source.getTargetCallbackInvocationChains();
- for (Map.Entry<Operation<?>, InboundInvocationChain> entry : callbackChains.entrySet()) {
- targetOperation = entry.getKey();
- methodAllowsPassByReference = false;
-
- if (source.getContainer() instanceof AtomicComponentExtension) {
- methodAllowsPassByReference =
- ((AtomicComponentExtension) source.getContainer()).
- getPassByReferenceMethods().contains(targetOperation.getName());
- }
-
- if (source.getServiceContract().isRemotable()
- && (!implAllowsPassByReference && !methodAllowsPassByReference)) {
- sourceOperation =
- getSourceOperation(target.getSourceCallbackInvocationChains(targetAddress).keySet(),
- targetOperation.getName());
-
- argsDataBindings = resolveArgsDataBindings(targetOperation);
- resultDataBinding = resolveResultDataBinding(targetOperation);
-
- passByValueInterceptor = new PassByValueInterceptor();
- passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
- passByValueInterceptor.setArgsDataBindings(argsDataBindings);
- passByValueInterceptor.setResultDataBinding(resultDataBinding);
-
- entry.getValue().addInterceptor(0, passByValueInterceptor);
- tailInterceptor =
- target.getSourceCallbackInvocationChains(targetAddress).get(sourceOperation)
- .getTailInterceptor();
- if (tailInterceptor != null) {
- tailInterceptor.setNext(passByValueInterceptor);
- }
- }
- }
+ if (target.getServiceContract().isRemotable()
+ && (!implAllowsPassByReference && !methodAllowsPassByReference)) {
+ sourceOperation =
+ getSourceOperation(source.getInvocationChains().keySet(), targetOperation.getName());
+
+ if (null != sourceOperation) {
+ argsDataBindings = resolveArgsDataBindings(targetOperation);
+ resultDataBinding = resolveResultDataBinding(targetOperation);
+ passByValueInterceptor = new PassByValueInterceptor();
+ passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
+ passByValueInterceptor.setArgsDataBindings(argsDataBindings);
+ passByValueInterceptor.setResultDataBinding(resultDataBinding);
+ entry.getValue().addInterceptor(0, passByValueInterceptor);
+ tailInterceptor = source.getInvocationChains().get(sourceOperation).getTailInterceptor();
+ if (tailInterceptor != null) {
+ tailInterceptor.setNext(passByValueInterceptor);
+ }
+ }
+ }
+ }
+
+ // Check if there's a callback
+ Map callbackOperations = source.getServiceContract().getCallbackOperations();
+ implAllowsPassByReference = false;
+
+ if (callbackOperations != null && !callbackOperations.isEmpty()) {
+ if (source.getContainer() instanceof AtomicComponentExtension) {
+ implAllowsPassByReference =
+ ((AtomicComponentExtension) source.getContainer()).isAllowsPassByReference();
+ }
+
+ Object targetAddress = source.getContainer().getName();
+ Map<Operation<?>, InboundInvocationChain> callbackChains = source.getTargetCallbackInvocationChains();
+ for (Map.Entry<Operation<?>, InboundInvocationChain> entry : callbackChains.entrySet()) {
+ targetOperation = entry.getKey();
+ methodAllowsPassByReference = false;
+
+ if (source.getContainer() instanceof AtomicComponentExtension) {
+ methodAllowsPassByReference =
+ ((AtomicComponentExtension) source.getContainer()).
+ getPassByReferenceMethods().contains(targetOperation.getName());
+ }
+
+ if (source.getServiceContract().isRemotable()
+ && (!implAllowsPassByReference && !methodAllowsPassByReference)) {
+ sourceOperation =
+ getSourceOperation(target.getSourceCallbackInvocationChains(targetAddress).keySet(),
+ targetOperation.getName());
+
+ argsDataBindings = resolveArgsDataBindings(targetOperation);
+ resultDataBinding = resolveResultDataBinding(targetOperation);
+
+ passByValueInterceptor = new PassByValueInterceptor();
+ passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
+ passByValueInterceptor.setArgsDataBindings(argsDataBindings);
+ passByValueInterceptor.setResultDataBinding(resultDataBinding);
+
+ entry.getValue().addInterceptor(0, passByValueInterceptor);
+ tailInterceptor =
+ target.getSourceCallbackInvocationChains(targetAddress).get(sourceOperation)
+ .getTailInterceptor();
+ if (tailInterceptor != null) {
+ tailInterceptor.setNext(passByValueInterceptor);
+ }
+ }
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org