Author: sagara Date: Tue May 29 13:24:22 2012 New Revision: 1343712 URL: http://svn.apache.org/viewvc?rev=1343712&view=rev Log: AXIS2-5315 - Get rid of org.apache.axis2.client.async.Callback which has deprecated from 1.3 release.
Removed: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/async/AsyncResult.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/async/Callback.java Modified: axis/axis2/java/core/trunk/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/async/AsyncServiceWithTransportFailureTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleASyncTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java axis/axis2/java/core/trunk/modules/jibx/src/main/resources/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/OperationClient.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/ServiceClient.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CallbackReceiver.java Modified: axis/axis2/java/core/trunk/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java (original) +++ axis/axis2/java/core/trunk/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java Tue May 29 13:24:22 2012 @@ -23,7 +23,6 @@ import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.client.async.AxisCallback; -import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.description.AxisService; @@ -105,28 +104,7 @@ public class RPCServiceClient extends Se new DefaultObjectSupplier()); } - /** - * Invoke the nonblocking/Asynchronous call - * - * @param opName Operation QName (to get the body wrapper element) - * @param args an array of argument Objects - * @param callback object extending Callback which will receive notifications - * @throws AxisFault in case of a local processing error - * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated - */ - public void invokeNonBlocking(QName opName, - Object [] args, - Callback callback) - throws AxisFault { - OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); - // call the underlying implementation - if (notNullService) { - super.sendReceiveNonBlocking(opName, omElement, callback); - } else { - super.sendReceiveNonBlocking(omElement, callback); - } - } - + /** * Invoke the nonblocking/Asynchronous call * Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/async/AsyncServiceWithTransportFailureTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/async/AsyncServiceWithTransportFailureTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/async/AsyncServiceWithTransportFailureTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/async/AsyncServiceWithTransportFailureTest.java Tue May 29 13:24:22 2012 @@ -30,8 +30,7 @@ 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.MessageContext; import org.apache.axis2.context.ServiceContext; @@ -100,20 +99,34 @@ public class AsyncServiceWithTransportFa options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setUseSeparateListener(true); options.setAction(operationName.getLocalPart()); - - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope().getBody().getFirstElement()); + msgContext.getEnvelope().getBody().getFirstElement()); System.out.println("result = " - + result.getResponseEnvelope().getBody().getFirstElement()); - finish = true; + + msgContext.getEnvelope().getBody().getFirstElement()); + finish = true; } - + + public void onFault(MessageContext msgContext) { + TestingUtils.compareWithCreatedOMElement( + msgContext.getEnvelope().getBody().getFirstElement()); + System.out.println("result = " + + msgContext.getEnvelope().getBody().getFirstElement()); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); wasError = true; finish = true; + + } + + public void onComplete() { + } }; Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java Tue May 29 13:24:22 2012 @@ -28,10 +28,10 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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.axis2.description.AxisService; import org.apache.axis2.engine.util.TestConstants; import org.apache.axis2.integration.TestingUtils; @@ -81,17 +81,28 @@ public class CommonsHTTPEchoRawXMLTest e Options options = new Options(); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); - - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope().getBody().getFirstElement()); - finish = true; + msgContext.getEnvelope().getBody().getFirstElement()); + finish = true; } - + + public void onFault(MessageContext msgContext) { + TestingUtils.compareWithCreatedOMElement( + msgContext.getEnvelope().getBody().getFirstElement()); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { + } }; Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleASyncTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleASyncTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleASyncTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleASyncTest.java Tue May 29 13:24:22 2012 @@ -26,8 +26,7 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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; @@ -96,17 +95,29 @@ public class EchoRawXMLMultipleASyncTest options.setAction("urn:echoOMElement"); options.setTo(targetEPR); for (int i = 0; i < 5; i++) { - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope() + msgContext.getEnvelope() .getBody().getFirstElement()); - finish = true; + finish = true; } - + + public void onFault(MessageContext msgContext) { + TestingUtils.compareWithCreatedOMElement( + msgContext.getEnvelope() + .getBody().getFirstElement()); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { } }; sender.sendReceiveNonBlocking(payload, callback); @@ -140,19 +151,29 @@ public class EchoRawXMLMultipleASyncTest options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setUseSeparateListener(true); options.setAction(Constants.AXIS2_NAMESPACE_URI + "/" + operationName.getLocalPart()); - - - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope() + msgContext.getEnvelope() .getBody().getFirstElement()); - finish = true; + finish = true; } - + + public void onFault(MessageContext msgContext) { + TestingUtils.compareWithCreatedOMElement( + msgContext.getEnvelope() + .getBody().getFirstElement()); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { } }; Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java Tue May 29 13:24:22 2012 @@ -29,9 +29,9 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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.MessageContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.util.TestConstants; import org.apache.axis2.integration.TestingUtils; @@ -98,17 +98,28 @@ public class EchoRawXMLOnTwoChannelsTest options.setUseSeparateListener(true); options.setAction(operationName.getLocalPart()); - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope().getBody() + msgContext.getEnvelope().getBody() .getFirstElement()); - finish = true; + finish = true; } - + + public void onFault(MessageContext msgContext) { + TestingUtils.compareWithCreatedOMElement( + msgContext.getEnvelope().getBody() + .getFirstElement()); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { } }; Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java Tue May 29 13:24:22 2012 @@ -29,8 +29,7 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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; @@ -88,16 +87,25 @@ public class EchoRawXMLTest extends Util options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { TestingUtils.compareWithCreatedOMElement( - result.getResponseEnvelope().getBody().getFirstElement()); - finish = true; + msgContext.getEnvelope().getBody().getFirstElement()); + finish = true; } - + + public void onFault(MessageContext msgContext) { + msgContext.getEnvelope().getBody().getFirstElement(); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { } }; Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java Tue May 29 13:24:22 2012 @@ -34,8 +34,7 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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; @@ -113,21 +112,37 @@ public class EchoRawMTOMTest extends Uti options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, MessageContext.UTF_16); - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { - SOAPEnvelope envelope = result.getResponseEnvelope(); + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { + SOAPEnvelope envelope = msgContext.getEnvelope(); OMElement ele = (OMElement)envelope.getBody().getFirstElement().getFirstOMChild(); OMText binaryNode = (OMText)ele.getFirstOMChild(); // to the assert equal compareWithCreatedOMText(binaryNode); - finish = true; + finish = true; } + + public void onFault(MessageContext msgContext) { + SOAPEnvelope envelope = msgContext.getEnvelope(); + OMElement ele = (OMElement)envelope.getBody().getFirstElement().getFirstOMChild(); + OMText binaryNode = (OMText)ele.getFirstOMChild(); + + // to the assert equal + compareWithCreatedOMText(binaryNode); + finish = true; + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { + } }; ConfigurationContext configContext = Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java Tue May 29 13:24:22 2012 @@ -36,10 +36,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.axis2.description.AxisService; import org.apache.axis2.engine.Echo; import org.apache.axis2.integration.TestingUtils; @@ -111,18 +111,31 @@ public class EchoRawMTOMToBase64Test ext clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP); - Callback callback = new Callback() { - public void onComplete(AsyncResult result) { - SOAPEnvelope envelope = result.getResponseEnvelope(); + AxisCallback callback = new AxisCallback() { + + public void onMessage(MessageContext msgContext) { + SOAPEnvelope envelope = msgContext.getEnvelope(); OMElement data = (OMElement)envelope.getBody().getFirstElement().getFirstOMChild(); compareWithCreatedOMText(data.getText()); - finish = true; + finish = true; } + + public void onFault(MessageContext msgContext) { + SOAPEnvelope envelope = msgContext.getEnvelope(); + OMElement data = (OMElement)envelope.getBody().getFirstElement().getFirstOMChild(); + compareWithCreatedOMText(data.getText()); + finish = true; + + } + public void onError(Exception e) { log.info(e.getMessage()); - finish = true; + finish = true; + } + + public void onComplete() { } }; Modified: axis/axis2/java/core/trunk/modules/jibx/src/main/resources/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/main/resources/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jibx/src/main/resources/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl (original) +++ axis/axis2/java/core/trunk/modules/jibx/src/main/resources/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl Tue May 29 13:24:22 2012 @@ -472,10 +472,33 @@ } </xsl:if> <xsl:if test="$sync='false'"> - _operationClient.setCallback(new org.apache.axis2.client.async.Callback() { - public void onComplete(org.apache.axis2.client.async.AsyncResult async) { + _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { + public void onMessage(org.apache.axis2.context.MessageContext msgCtx) { try { - org.apache.axiom.om.OMElement result = async.getResponseEnvelope().getBody().getFirstElement(); + org.apache.axiom.om.OMElement result = msgCtx.getEnvelope().getBody().getFirstElement(); + if (result != null && "<xsl:value-of select='out-wrapper/@name'/>".equals(result.getLocalName()) && + "<xsl:value-of select='out-wrapper/@ns'/>".equals(result.getNamespace().getNamespaceURI())) { + org.jibx.runtime.impl.UnmarshallingContext uctx = getNewUnmarshalContext(result); + uctx.parsePastStartTag("<xsl:value-of select='out-wrapper/@ns'/>", "<xsl:value-of select='out-wrapper/@name'/>"); + int index; + <xsl:apply-templates select="out-wrapper/return-element" mode="interface-implementation"/> + _callback.receiveResult<xsl:value-of select="@method-name"/>(<xsl:value-of select="out-wrapper/return-element/@java-name"/>); + } else { + throw new org.apache.axis2.AxisFault("Missing expected result wrapper element {<xsl:value-of select='out-wrapper/@ns'/>}<xsl:value-of select='out-wrapper/@name'/>"); + } + } catch (Exception e) { + onError(e); + } finally { + try { + _messageContext.getTransportOut().getSender().cleanup(_messageContext); + } catch (org.apache.axis2.AxisFault axisFault) { + onError(axisFault); + } + } + } + public void onFault(org.apache.axis2.context.MessageContext msgCtx) { + try { + org.apache.axiom.om.OMElement result = msgCtx.getEnvelope().getBody().getFirstElement(); if (result != null && "<xsl:value-of select='out-wrapper/@name'/>".equals(result.getLocalName()) && "<xsl:value-of select='out-wrapper/@ns'/>".equals(result.getNamespace().getNamespaceURI())) { org.jibx.runtime.impl.UnmarshallingContext uctx = getNewUnmarshalContext(result); @@ -500,6 +523,9 @@ public void onError(Exception e) { _callback.receiveError<xsl:value-of select="@method-name"/>(e); } + + public void onComplete(){ + } }); org.apache.axis2.util.CallbackReceiver _callbackReceiver = null; Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/OperationClient.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/OperationClient.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/OperationClient.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/OperationClient.java Tue May 29 13:24:22 2012 @@ -24,7 +24,6 @@ import org.apache.axiom.util.UIDGenerato import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; 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; @@ -59,9 +58,7 @@ public abstract class OperationClient { protected Options options; - protected OperationContext oc; - - protected Callback callback; + protected OperationContext oc; protected AxisCallback axisCallback; @@ -122,19 +119,7 @@ public abstract class OperationClient { public abstract MessageContext getMessageContext(String messageLabel) throws AxisFault; - /** - * Set the callback to be executed when a message comes into the MEP and the - * operation client is executed. This is the way the operation client - * provides notification that a message has been received by it. Exactly - * when its executed and under what conditions is a function of the specific - * operation client. - * - * @param callback the callback to be used when the client decides its time to - * use it - * @deprecated Please use the AxisCallback interface rather than Callback, which has been deprecated - */ - public abstract void setCallback(Callback callback); - + /** * Set the callback to be executed when a message comes into the MEP and the * operation client is executed. This is the way the operation client Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/ServiceClient.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Tue May 29 13:24:22 2012 @@ -29,7 +29,6 @@ import org.apache.axiom.soap.SOAPHeaderB import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; 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.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; @@ -562,24 +561,7 @@ public class ServiceClient { return response.getEnvelope().getBody().getFirstElement(); } - /** - * Directly invoke an anonymous operation with an In-Out MEP without waiting for a response. - * This method sends your supplied XML with response notification to your callback handler. For - * more control, you can instead create a client for the operation and use that client to - * execute the exchange. - * - * @param elem the data to send (becomes the content of SOAP body) - * @param callback a Callback which will be notified upon completion - * @throws AxisFault in case of error - * @see #createClient(QName) - * @deprecated Please use the AxisCallback interface rather than Callback, which has been - * deprecated - */ - public void sendReceiveNonBlocking(OMElement elem, Callback callback) - throws AxisFault { - sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback); - } - + /** * Directly invoke an anonymous operation with an In-Out MEP without waiting for a response. * This method sends your supplied XML with response notification to your callback handler. For @@ -594,33 +576,7 @@ public class ServiceClient { public void sendReceiveNonBlocking(OMElement elem, AxisCallback callback) throws AxisFault { sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback); - } - - /** - * Directly invoke a named operation with an In-Out MEP without waiting for a response. This - * method sends your supplied XML with response notification to your callback handler. For more - * control, you can instead create a client for the operation and use that client to execute the - * exchange. - * - * @param operation name of operation to be invoked (non-<code>null</code>) - * @param elem the data to send (becomes the content of SOAP body) - * @param callback a Callback which will be notified upon completion - * @throws AxisFault in case of error - * @see #createClient(QName) - * @deprecated Please use the AxisCallback interface rather than Callback, which has been - * deprecated - */ - public void sendReceiveNonBlocking(QName operation, OMElement elem, Callback callback) - throws AxisFault { - MessageContext mc = new MessageContext(); - fillSOAPEnvelope(mc, elem); - OperationClient mepClient = createClient(operation); - // here a blocking invocation happens in a new thread, so the - // progamming model is non blocking - mepClient.setCallback(callback); - mepClient.addMessageContext(mc); - mepClient.execute(false); - } + } /** * Directly invoke a named operation with an In-Out MEP without waiting for a response. This Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Tue May 29 13:24:22 2012 @@ -32,9 +32,7 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; -import org.apache.axis2.client.async.AsyncResult; 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; @@ -146,9 +144,7 @@ class OutInAxisOperationClient extends O return oc.getMessageContext(messageLabel); } - public void setCallback(Callback callback) { - this.callback = callback; - } + /** * Executes the MEP. What this does depends on the specific MEP client. The @@ -230,7 +226,7 @@ class OutInAxisOperationClient extends O completed = true; } else { sc.getConfigurationContext().getThreadPool().execute( - new NonBlockingInvocationWorker(callback, mc, axisCallback)); + new NonBlockingInvocationWorker(mc, axisCallback)); } } } @@ -264,10 +260,7 @@ class OutInAxisOperationClient extends O } SyncCallBack internalCallback = null; - if (callback != null) { - callbackReceiver.addCallback(mc.getMessageID(), callback); - if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating callback"); - } else if (axisCallback != null) { + if (axisCallback != null) { callbackReceiver.addCallback(mc.getMessageID(), axisCallback); if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating axis callback"); } else { @@ -427,15 +420,11 @@ class OutInAxisOperationClient extends O * way transport. */ private class NonBlockingInvocationWorker implements Runnable { - private Callback callback; - private MessageContext msgctx; private AxisCallback axisCallback; - public NonBlockingInvocationWorker(Callback callback, - MessageContext msgctx , - AxisCallback axisCallback) { - this.callback = callback; + public NonBlockingInvocationWorker(MessageContext msgctx , + AxisCallback axisCallback) { this.msgctx = msgctx; this.axisCallback =axisCallback; } @@ -453,9 +442,7 @@ class OutInAxisOperationClient extends O // If a fault was found, create an AxisFault with a MessageContext so that // other programming models can deserialize the fault to an alternative form. AxisFault fault = new AxisFault(body.getFault(), response); - if (callback != null) { - callback.onError(fault); - } else if (axisCallback != null) { + if (axisCallback != null) { if (options.isExceptionToBeThrownOnSOAPFault()) { axisCallback.onError(fault); } else { @@ -464,10 +451,7 @@ class OutInAxisOperationClient extends O } } else { - if (callback != null) { - AsyncResult asyncResult = new AsyncResult(response); - callback.onComplete(asyncResult); - } else if (axisCallback != null) { + if (axisCallback != null) { axisCallback.onMessage(response); } @@ -475,16 +459,12 @@ class OutInAxisOperationClient extends O } } catch (Exception e) { - if (callback != null) { - callback.onError(e); - } else if (axisCallback != null) { + if (axisCallback != null) { axisCallback.onError(e); } } finally { - if (callback != null) { - callback.setComplete(true); - }else if (axisCallback != null) { + if (axisCallback != null) { axisCallback.onComplete(); } } Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java Tue May 29 13:24:22 2012 @@ -26,7 +26,6 @@ import org.apache.axis2.addressing.Addre import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; -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; @@ -223,18 +222,7 @@ class OutOnlyAxisOperationClient extends throw new AxisFault(Messages.getMessage("unknownMsgLabel", messageLabel)); } - /** - * Sets the message receiver to be executed when a message comes into the MEP - * and the MEP is executed. This is the way the MEP client provides - * notification that a message has been received by it. Exactly when its - * executed and under what conditions is a function of the specific MEP - * client. - */ - public void setCallback(Callback callback) { - throw new UnsupportedOperationException( - "This feature is not supported by this MEP"); - } - + /** * Executes the MEP. What this does depends on the specific MEP client. The * basic idea is to have the MEP client execute and do something with the Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Tue May 29 13:24:22 2012 @@ -33,7 +33,6 @@ import org.apache.axiom.soap.SOAPHeaderB import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; 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; @@ -637,20 +636,13 @@ public class AxisEngine { .lookupCallback(msgctx.getMessageID()); if (callback == null) return; // TODO: should we log this?? - if (callback instanceof Callback) { - // Instances of Callback only expect onComplete to be called - // for a successful MEP. Errors are reported through the - // Async Response object, which the Callback implementations - // all use. - ((Callback)callback).onError(e); - } else { - // The AxisCallback (which is OutInAxisOperationClient$SyncCallBack - // used to support async-on-the-wire under a synchronous API - // operation) need to be told the MEP is complete after being told - // of the error. - ((AxisCallback)callback).onError(e); - ((AxisCallback)callback).onComplete(); - } + // The AxisCallback (which is OutInAxisOperationClient$SyncCallBack + // used to support async-on-the-wire under a synchronous API + // operation) need to be told the MEP is complete after being told + // of the error. + ((AxisCallback)callback).onError(e); + ((AxisCallback)callback).onComplete(); + } } } Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CallbackReceiver.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CallbackReceiver.java?rev=1343712&r1=1343711&r2=1343712&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CallbackReceiver.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CallbackReceiver.java Tue May 29 13:24:22 2012 @@ -22,9 +22,7 @@ package org.apache.axis2.util; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.RelatesTo; -import org.apache.axis2.client.async.AsyncResult; import org.apache.axis2.client.async.AxisCallback; -import org.apache.axis2.client.async.Callback; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.engine.MessageReceiver; @@ -50,10 +48,6 @@ public class CallbackReceiver implements callbackStore = new ConcurrentHashMap(); } - public void addCallback(String msgID, Callback callback) throws AxisFault { - putIfAbsent(msgID, callback); - } - public void addCallback(String msgID, AxisCallback callback) throws AxisFault { putIfAbsent(msgID, callback); } @@ -107,34 +101,7 @@ public class CallbackReceiver implements axisCallback.onComplete(); return; } - - // THIS NEXT PART WILL EVENTUALLY GO AWAY WHEN Callback DOES - - // OK, this must be an old-style Callback - Callback callback = (Callback)callbackObj; - AsyncResult result = new AsyncResult(msgContext); - - // check whether the result is a fault. - try { - SOAPEnvelope envelope = result.getResponseEnvelope(); - - OperationContext opContext = msgContext.getOperationContext(); - if (opContext != null && !opContext.isComplete()) { - opContext.addMessageContext(msgContext); - } - - if (envelope.hasFault()) { - AxisFault axisFault = - Utils.getInboundFaultFromMessageContext(msgContext); - callback.onError(axisFault); - } else { - callback.onComplete(result); - } - } catch (Exception e) { - callback.onError(e); - } finally { - callback.setComplete(true); - } + } //to get the pending request