Author: isilval
Date: Fri Dec  1 09:23:09 2006
New Revision: 481306

URL: http://svn.apache.org/viewvc?view=rev&rev=481306
Log:
Eliminating createAsyncTargetInvoker from o.a.t.spi.component.Reference

Modified:
    
incubator/tuscany/java/samples/sca/greeterws-oneway/src/main/webapp/META-INF/tuscany/webapp.scdl
    
incubator/tuscany/java/samples/sca/helloworldws-async/src/main/webapp/META-INF/tuscany/webapp.scdl
    
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.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/extension/ReferenceExtension.java
    
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
    
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java

Modified: 
incubator/tuscany/java/samples/sca/greeterws-oneway/src/main/webapp/META-INF/tuscany/webapp.scdl
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/greeterws-oneway/src/main/webapp/META-INF/tuscany/webapp.scdl?view=diff&rev=481306&r1=481305&r2=481306
==============================================================================
--- 
incubator/tuscany/java/samples/sca/greeterws-oneway/src/main/webapp/META-INF/tuscany/webapp.scdl
 (original)
+++ 
incubator/tuscany/java/samples/sca/greeterws-oneway/src/main/webapp/META-INF/tuscany/webapp.scdl
 Fri Dec  1 09:23:09 2006
@@ -46,6 +46,16 @@
         <system:implementation.system 
class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
     </component>
 
+    <!-- Store infrastructure -->
+    <component name="store">
+        <system:implementation.system 
class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+    </component>
+
+    <!-- Resource host registry -->
+    <component name="resourceHostRegistry">
+        <system:implementation.system 
class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+    </component>
+
     <!-- Builder and BuilderRegistry -->
     <component name="builder">
         <system:implementation.system 
class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>

Modified: 
incubator/tuscany/java/samples/sca/helloworldws-async/src/main/webapp/META-INF/tuscany/webapp.scdl
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws-async/src/main/webapp/META-INF/tuscany/webapp.scdl?view=diff&rev=481306&r1=481305&r2=481306
==============================================================================
--- 
incubator/tuscany/java/samples/sca/helloworldws-async/src/main/webapp/META-INF/tuscany/webapp.scdl
 (original)
+++ 
incubator/tuscany/java/samples/sca/helloworldws-async/src/main/webapp/META-INF/tuscany/webapp.scdl
 Fri Dec  1 09:23:09 2006
@@ -46,6 +46,16 @@
         <system:implementation.system 
class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
     </component>
 
+    <!-- Store infrastructure -->
+    <component name="store">
+        <system:implementation.system 
class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+    </component>
+
+    <!-- Resource host registry -->
+    <component name="resourceHostRegistry">
+        <system:implementation.system 
class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+    </component>
+
     <!-- Builder and BuilderRegistry -->
     <component name="builder">
         <system:implementation.system 
class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>

Modified: 
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java?view=diff&rev=481306&r1=481305&r2=481306
==============================================================================
--- 
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
 (original)
+++ 
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
 Fri Dec  1 09:23:09 2006
@@ -243,13 +243,7 @@
                 invoker = component.createTargetInvoker(portName, 
inboundOperation, targetWire);
             } else if (target instanceof Reference) {
                 Reference reference = (Reference) target;
-                if (!(reference instanceof CompositeReference) && 
operationHasCallback) {
-                    // Notice that for bound references we only use async 
target invokers for callback operations
-                    invoker = reference.createAsyncTargetInvoker(sourceWire, 
inboundOperation);
-                } else {
-                    ServiceContract targetContract = 
targetWire.getServiceContract();
-                    invoker = reference.createTargetInvoker(targetContract, 
inboundOperation);
-                }
+                invoker = 
reference.createTargetInvoker(targetWire.getServiceContract(), 
inboundOperation);
             } else if (target instanceof CompositeService) {
                 CompositeService compServ = (CompositeService) target;
                 invoker = 
compServ.createTargetInvoker(targetWire.getServiceContract(), 
inboundChain.getOperation());

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=481306&r1=481305&r2=481306
==============================================================================
--- 
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
 Fri Dec  1 09:23:09 2006
@@ -79,14 +79,6 @@
     TargetInvoker createCallbackTargetInvoker(ServiceContract contract, 
Operation operation);
 
     /**
-     * Callback to create a [EMAIL PROTECTED] 
org.apache.tuscany.spi.wire.TargetInvoker} which issues a non-blocking dispatch
-     *
-     * @param wire      the outbound wire of the invocation source, used for 
callbacks
-     * @param operation the operation to invoke
-     */
-    TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation 
operation);
-    
-    /**
      * Get the ServiceContract for the binding
      * @return
      */

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=481306&r1=481305&r2=481306
==============================================================================
--- 
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
 Fri Dec  1 09:23:09 2006
@@ -89,10 +89,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation 
operation) {
-        throw new UnsupportedOperationException();
-    }
-
     public ServiceContract<?> getBindingServiceContract() {
         return bindingServiceContract;
     }

Modified: 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java?view=diff&rev=481306&r1=481305&r2=481306
==============================================================================
--- 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
 (original)
+++ 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
 Fri Dec  1 09:23:09 2006
@@ -71,37 +71,35 @@
     public TargetInvoker createTargetInvoker(ServiceContract contract, 
Operation operation) {
         Axis2TargetInvoker invoker;
         try {
-            boolean isOneWay = operation.isNonBlocking();
-            invoker = createOperationInvoker(serviceClient, operation, 
wsPortMetaData, false, isOneWay);
-        } catch (AxisFault e) {
-            throw new Axis2BindingRunTimeException(e);
-        }
-        return invoker;
-    }
-
-    public TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation 
operation) {
-        Axis2AsyncTargetInvoker invoker;
-        try {
-            // FIXME: SDODataBinding needs to pass in TypeHelper and 
classLoader
-            // as parameters.
-            invoker =
-                (Axis2AsyncTargetInvoker)createOperationInvoker(serviceClient,
-                                                                operation,
-                                                                wsPortMetaData,
-                                                                true,
-                                                                false);
-            // FIXME: This makes the (BIG) assumption that there is only one
-            // callback method
-            // Relaxing this assumption, however, does not seem to be trivial,
-            // it may depend on knowledge
-            // of what actual callback method was invoked by the service at the
-            // other end
-            Operation callbackOperation = findCallbackOperation();
-            Axis2CallbackInvocationHandler invocationHandler =
-                new Axis2CallbackInvocationHandler(inboundWire);
-            Axis2ReferenceCallbackTargetInvoker callbackInvoker =
-                new Axis2ReferenceCallbackTargetInvoker(callbackOperation, 
inboundWire, invocationHandler);
-            invoker.setCallbackTargetInvoker(callbackInvoker);
+            boolean operationHasCallback = contract.getCallbackName() != null;
+            if (operationHasCallback) {
+                // FIXME: SDODataBinding needs to pass in TypeHelper and 
classLoader
+                // as parameters.
+                Axis2AsyncTargetInvoker asyncInvoker =
+                    
(Axis2AsyncTargetInvoker)createOperationInvoker(serviceClient,
+                                                                    operation,
+                                                                    
wsPortMetaData,
+                                                                    true,
+                                                                    false);
+                // FIXME: This makes the (BIG) assumption that there is only 
one
+                // callback method
+                // Relaxing this assumption, however, does not seem to be 
trivial,
+                // it may depend on knowledge
+                // of what actual callback method was invoked by the service 
at the
+                // other end
+                Operation callbackOperation = findCallbackOperation();
+                Axis2CallbackInvocationHandler invocationHandler =
+                    new Axis2CallbackInvocationHandler(inboundWire);
+                Axis2ReferenceCallbackTargetInvoker callbackInvoker =
+                    new Axis2ReferenceCallbackTargetInvoker(callbackOperation, 
inboundWire, invocationHandler);
+                asyncInvoker.setCallbackTargetInvoker(callbackInvoker);
+                
+                invoker = asyncInvoker;
+            }
+            else {
+                boolean isOneWay = operation.isNonBlocking();
+                invoker = createOperationInvoker(serviceClient, operation, 
wsPortMetaData, false, isOneWay);
+            }
         } catch (AxisFault e) {
             throw new Axis2BindingRunTimeException(e);
         }

Modified: 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java?view=diff&rev=481306&r1=481305&r2=481306
==============================================================================
--- 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
 Fri Dec  1 09:23:09 2006
@@ -47,9 +47,11 @@
 
     public void testInvokeService() throws Exception {
         Axis2Reference axis2Reference = createAxis2Reference("testWebAppName", 
"testServiceName");
+        ServiceContract contract = new JavaServiceContract();
         Operation operation = new Operation<Type>("sayHi", null, null, null, 
false, null, NO_CONVERSATION);
-        TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(null, 
operation);
+        TargetInvoker targetInvoker = 
axis2Reference.createTargetInvoker(contract, operation);
         assertNotNull(targetInvoker);
+        assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker);
     }
 
     public void testAsyncTargetInvoker() throws Exception {
@@ -57,6 +59,7 @@
         //Create a mocked InboundWire, make the call of 
ServiceExtension.getInterface() returns a Class
         InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
         JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+        contract.setCallbackName("");
         contract.setCallbackClass(GreetingCallback.class);
         Operation<Type> callbackOp =
             new Operation<Type>("sayHiCallback", null, null, null, true, null, 
NO_CONVERSATION);
@@ -68,8 +71,9 @@
 
         axis2Reference.setInboundWire(inboundWire);
         Operation operation = new Operation<Type>("sayHi", null, null, null, 
true, null, NO_CONVERSATION);
-        TargetInvoker asyncTargetInvoker = 
axis2Reference.createAsyncTargetInvoker(null, operation);
+        TargetInvoker asyncTargetInvoker = 
axis2Reference.createTargetInvoker(contract, operation);
         assertNotNull(asyncTargetInvoker);
+        assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker);
     }
 
     private Axis2Reference createAxis2Reference(String webAppName, String 
serviceName) throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to