Author: sagara Date: Wed May 30 05:43:31 2012 New Revision: 1344110 URL: http://svn.apache.org/viewvc?rev=1344110&view=rev Log: AXIS2-5315 - Removed Callback usage from Sandesha2
Modified: axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java Modified: axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java (original) +++ axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java Wed May 30 05:43:31 2012 @@ -42,7 +42,6 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.RelatesTo; import org.apache.axis2.client.async.AxisCallback; -import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; @@ -1020,15 +1019,7 @@ public class FaultManager { if ((msgReceiver != null) && (msgReceiver instanceof CallbackReceiver)) { Object callback = ((CallbackReceiver)msgReceiver).lookupCallback(context.getMessageID()); - if (callback instanceof Callback) { - try { - ((CallbackReceiver)msgReceiver).addCallback(context.getMessageID(),(Callback)callback); - } catch (AxisFault axisFault) { - throw new SandeshaException(axisFault); - } - - ((Callback)callback).onError(fault); - } else if(callback instanceof AxisCallback) { + if(callback instanceof AxisCallback) { try { ((CallbackReceiver)msgReceiver).addCallback(context.getMessageID(),(AxisCallback)callback); } catch (AxisFault axisFault) { Modified: axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java (original) +++ axis/axis2/java/sandesha/trunk/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java Wed May 30 05:43:31 2012 @@ -45,7 +45,7 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; @@ -1114,7 +1114,7 @@ public class SandeshaUtil { MessageReceiver msgReceiver = axisOperation.getMessageReceiver(); Object callback = ((CallbackReceiver)msgReceiver).lookupCallback(msgCtx.getMessageID()); client.setAxisService(msgCtx.getAxisService()); - client.sendReceiveNonBlocking(msgCtx.getEnvelope().getBody().cloneOMElement().getFirstElement(), (Callback)callback); + client.sendReceiveNonBlocking(msgCtx.getEnvelope().getBody().cloneOMElement().getFirstElement(), (AxisCallback)callback); } } Modified: axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java (original) +++ axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java Wed May 30 05:43:31 2012 @@ -34,10 +34,10 @@ import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.AsyncResult; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.context.MessageContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.client.SandeshaClient; import org.apache.sandesha2.client.SandeshaClientConstants; @@ -124,17 +124,17 @@ public class Scenario_2_1 { serviceClient.setOptions(clientOptions); - Callback callback1 = new TestCallback ("Callback 1"); + AxisCallback callback1 = new TestCallback ("Callback 1"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1); - Callback callback2 = new TestCallback ("Callback 2"); + AxisCallback callback2 = new TestCallback ("Callback 2"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2); - Callback callback3 = new TestCallback ("Callback 3"); + AxisCallback callback3 = new TestCallback ("Callback 3"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3); - while (!callback3.isComplete()) { + while (!((TestCallback)callback3).isComplete()) { Thread.sleep(1000); } @@ -156,17 +156,18 @@ public class Scenario_2_1 { return echoStringElement; } - class TestCallback extends Callback { + class TestCallback implements AxisCallback { String name = null; + boolean completed = false; public TestCallback (String name) { this.name = name; } - public void onComplete(AsyncResult result) { + public void onComplete(MessageContext msgCtx) { //System.out.println("On Complete Called for " + text); - SOAPBody body = result.getResponseEnvelope().getBody(); + SOAPBody body = msgCtx.getEnvelope().getBody(); OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse)); if (echoStringResponseElem==null) { @@ -188,6 +189,22 @@ public class Scenario_2_1 { System.out.println("Error reported for test call back"); e.printStackTrace(); } + + public void onComplete() { + completed = true; + } + + public void onFault(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public void onMessage(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public boolean isComplete(){ + return completed; + } } private ConfigurationContext getConfigurationContext () throws AxisFault { Modified: axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java (original) +++ axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java Wed May 30 05:43:31 2012 @@ -34,16 +34,17 @@ import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.AsyncResult; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.context.MessageContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.client.SandeshaClient; import org.apache.sandesha2.client.SandeshaClientConstants; import org.apache.sandesha2.client.SequenceReport; import org.apache.sandesha2.interop.RMInteropServiceCallbackHandlerImpl; import org.apache.sandesha2.interop.RMInteropServiceStub; +import org.apache.sandesha2.interop.rm1_1_clients.Scenario_2_1.TestCallback; import org.tempuri.EchoString; import org.tempuri.EchoStringRequestBodyType; @@ -137,17 +138,17 @@ public class Scenario_2_2 { serviceClient.setOptions(clientOptions); - Callback callback1 = new TestCallback ("Callback 1"); + AxisCallback callback1 = new TestCallback ("Callback 1"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1); - Callback callback2 = new TestCallback ("Callback 2"); + AxisCallback callback2 = new TestCallback ("Callback 2"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2); - Callback callback3 = new TestCallback ("Callback 3"); + AxisCallback callback3 = new TestCallback ("Callback 3"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3); - while (!callback3.isComplete()) { + while (!((TestCallback)callback3).isComplete()) { Thread.sleep(1000); } @@ -172,17 +173,18 @@ public class Scenario_2_2 { return echoStringElement; } - class TestCallback extends Callback { + class TestCallback implements AxisCallback { String name = null; + boolean complete = false; public TestCallback (String name) { this.name = name; } - public void onComplete(AsyncResult result) { + public void onComplete(MessageContext msgCtx) { //System.out.println("On Complete Called for " + text); - SOAPBody body = result.getResponseEnvelope().getBody(); + SOAPBody body = msgCtx.getEnvelope().getBody(); OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse)); if (echoStringResponseElem==null) { @@ -201,10 +203,25 @@ public class Scenario_2_2 { } public void onError (Exception e) { - // TODO Auto-generated method stub System.out.println("Error reported for test call back"); e.printStackTrace(); } + + public void onComplete() { + complete = true; + } + + public void onFault(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public void onMessage(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public boolean isComplete(){ + return complete; + } } Modified: axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java (original) +++ axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java Wed May 30 05:43:31 2012 @@ -33,16 +33,17 @@ import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.AsyncResult; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.context.MessageContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.client.SandeshaClient; import org.apache.sandesha2.client.SandeshaClientConstants; import org.apache.sandesha2.client.SequenceReport; import org.apache.sandesha2.interop.RMInteropServiceCallbackHandlerImpl; import org.apache.sandesha2.interop.RMInteropServiceStub; +import org.apache.sandesha2.interop.rm1_1_clients.Scenario_2_1.TestCallback; import org.apache.sandesha2.util.SandeshaUtil; import org.tempuri.EchoString; import org.tempuri.EchoStringRequestBodyType; @@ -139,17 +140,17 @@ public class Scenario_2_3 { serviceClient.setOptions(clientOptions); - Callback callback1 = new TestCallback ("Callback 1"); + AxisCallback callback1 = new TestCallback ("Callback 1"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1); - Callback callback2 = new TestCallback ("Callback 2"); + AxisCallback callback2 = new TestCallback ("Callback 2"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2); - Callback callback3 = new TestCallback ("Callback 3"); + AxisCallback callback3 = new TestCallback ("Callback 3"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3); - while (!callback3.isComplete()) { + while (!((TestCallback)callback3).isComplete()) { Thread.sleep(1000); } @@ -173,17 +174,18 @@ public class Scenario_2_3 { return echoStringElement; } - class TestCallback extends Callback { + class TestCallback implements AxisCallback { String name = null; + boolean complete = false; public TestCallback (String name) { this.name = name; } - public void onComplete(AsyncResult result) { + public void onComplete(MessageContext msgCtx) { //System.out.println("On Complete Called for " + text); - SOAPBody body = result.getResponseEnvelope().getBody(); + SOAPBody body = msgCtx.getEnvelope().getBody(); OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse)); if (echoStringResponseElem==null) { @@ -202,10 +204,26 @@ public class Scenario_2_3 { } public void onError (Exception e) { - // TODO Auto-generated method stub System.out.println("Error reported for test call back"); e.printStackTrace(); } + + public void onComplete() { + complete = true; + + } + + public void onFault(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public void onMessage(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public boolean isComplete(){ + return complete; + } } private ConfigurationContext getConfigurationContext () throws AxisFault { Modified: axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java (original) +++ axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java Wed May 30 05:43:31 2012 @@ -35,15 +35,16 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.AsyncResult; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.context.MessageContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.client.SandeshaClient; import org.apache.sandesha2.client.SandeshaClientConstants; import org.apache.sandesha2.interop.RMInteropServiceCallbackHandlerImpl; import org.apache.sandesha2.interop.RMInteropServiceStub; +import org.apache.sandesha2.interop.rm1_1_clients.Scenario_2_1.TestCallback; import org.apache.sandesha2.util.SandeshaUtil; import org.tempuri.EchoString; import org.tempuri.EchoStringRequestBodyType; @@ -124,16 +125,16 @@ public class Scenario_3_1 { serviceClient.setOptions(clientOptions); - Callback callback1 = new TestCallback ("Callback 1"); + AxisCallback callback1 = new TestCallback ("Callback 1"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1); - Callback callback2 = new TestCallback ("Callback 2"); + AxisCallback callback2 = new TestCallback ("Callback 2"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2); - Callback callback3 = new TestCallback ("Callback 3"); + AxisCallback callback3 = new TestCallback ("Callback 3"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3); - while (!callback3.isComplete()) { + while (!((TestCallback)callback3).isComplete()) { Thread.sleep(1000); } @@ -160,17 +161,18 @@ public class Scenario_3_1 { return echoStringElement; } - class TestCallback extends Callback { + class TestCallback implements AxisCallback { String name = null; + boolean complete = false; public TestCallback (String name) { this.name = name; } - public void onComplete(AsyncResult result) { + public void onComplete(MessageContext msgCtx) { //System.out.println("On Complete Called for " + text); - SOAPBody body = result.getResponseEnvelope().getBody(); + SOAPBody body = msgCtx.getEnvelope().getBody(); OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse)); if (echoStringResponseElem==null) { @@ -189,10 +191,25 @@ public class Scenario_3_1 { } public void onError (Exception e) { - // TODO Auto-generated method stub System.out.println("Error reported for test call back"); e.printStackTrace(); } + + public void onComplete() { + complete = true; + } + + public void onFault(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public void onMessage(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public boolean isComplete(){ + return complete; + } } private ConfigurationContext getConfigurationContext () throws AxisFault { Modified: axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java URL: http://svn.apache.org/viewvc/axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java?rev=1344110&r1=1344109&r2=1344110&view=diff ============================================================================== --- axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java (original) +++ axis/axis2/java/sandesha/trunk/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java Wed May 30 05:43:31 2012 @@ -32,10 +32,10 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.client.async.AsyncResult; -import org.apache.axis2.client.async.Callback; +import org.apache.axis2.client.async.AxisCallback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.context.MessageContext; import org.apache.neethi.Policy; import org.apache.neethi.PolicyEngine; import org.apache.rampart.RampartMessageData; @@ -44,6 +44,7 @@ import org.apache.sandesha2.client.Sande import org.apache.sandesha2.client.SandeshaClientConstants; import org.apache.sandesha2.interop.RMInteropServiceCallbackHandlerImpl; import org.apache.sandesha2.interop.RMInteropServiceStub; +import org.apache.sandesha2.interop.rm1_1_clients.Scenario_2_1.TestCallback; import org.apache.sandesha2.util.SandeshaUtil; import org.tempuri.EchoString; import org.tempuri.EchoStringRequestBodyType; @@ -128,16 +129,16 @@ public class Scenario_4_2 { serviceClient.setOptions(clientOptions); - Callback callback1 = new TestCallback ("Callback 1"); + AxisCallback callback1 = new TestCallback ("Callback 1"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1); - Callback callback2 = new TestCallback ("Callback 2"); + AxisCallback callback2 = new TestCallback ("Callback 2"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2); - Callback callback3 = new TestCallback ("Callback 3"); + AxisCallback callback3 = new TestCallback ("Callback 3"); serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3); - while (!callback3.isComplete()) { + while (!((TestCallback)callback3).isComplete()) { Thread.sleep(1000); } @@ -164,17 +165,18 @@ public class Scenario_4_2 { return echoStringElement; } - class TestCallback extends Callback { + class TestCallback implements AxisCallback { String name = null; + boolean complete = false; public TestCallback (String name) { this.name = name; } - public void onComplete(AsyncResult result) { + public void onComplete(MessageContext msgCtx) { //System.out.println("On Complete Called for " + text); - SOAPBody body = result.getResponseEnvelope().getBody(); + SOAPBody body = msgCtx.getEnvelope().getBody(); OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse)); if (echoStringResponseElem==null) { @@ -193,10 +195,25 @@ public class Scenario_4_2 { } public void onError (Exception e) { - // TODO Auto-generated method stub System.out.println("Error reported for test call back"); e.printStackTrace(); } + + public void onComplete() { + complete = true; + } + + public void onFault(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public void onMessage(MessageContext msgCtx) { + onComplete(msgCtx); + } + + public boolean isComplete(){ + return complete; + } } private ConfigurationContext getConfigurationContext () throws AxisFault {