jmsnell 2002/11/12 21:24:20 Modified: java/src/org/apache/axis/ime/internal MessageExchangeSendContext.java FirstComeFirstServeDispatchPolicy.java MessageExchangeProvider.java MessageExchangeImpl.java MessageExchangeReceiveContext.java java/src/org/apache/axis/ime/internal/util/handler HandlerMessageExchange.java java/src/org/apache/axis/ime MessageExchange.java Added: java/src/org/apache/axis/ime/event MessageSendEvent.java MessageCorrelatedEvent.java MessageFaultEvent.java MessageReceiveEvent.java MessageStatusEvent.java java/src/org/apache/axis/ime MessageExchangeEvent.java MessageExchangeEventListener.java Removed: java/src/org/apache/axis/ime/internal MessageExchangeSendListener.java java/src/org/apache/axis/ime MessageExchangeFaultListener.java MessageExchangeStatusListener.java MessageContextListener.java Log: Commiting some changes made by the Sonic folks Revision Changes Path 1.2 +7 -14 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeSendContext.java Index: MessageExchangeSendContext.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeSendContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MessageExchangeSendContext.java 29 Oct 2002 05:15:29 -0000 1.1 +++ MessageExchangeSendContext.java 13 Nov 2002 05:24:19 -0000 1.2 @@ -56,8 +56,7 @@ import org.apache.axis.MessageContext; import org.apache.axis.ime.MessageExchangeCorrelator; -import org.apache.axis.ime.MessageExchangeFaultListener; -import org.apache.axis.ime.MessageExchangeStatusListener; +import org.apache.axis.ime.MessageExchangeEventListener; import java.io.Serializable; @@ -70,6 +69,7 @@ * For thread safety, instances of this class are immutable * * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public final class MessageExchangeSendContext implements Serializable { @@ -77,20 +77,17 @@ public static MessageExchangeSendContext newInstance( MessageExchangeCorrelator correlator, MessageContext context, - MessageExchangeFaultListener faultListener, - MessageExchangeStatusListener statusListener) { + MessageExchangeEventListener eventListener) { MessageExchangeSendContext mectx = new MessageExchangeSendContext(); mectx.correlator = correlator; mectx.context = context; - mectx.faultListener = faultListener; - mectx.statusListener = statusListener; + mectx.eventListener = eventListener; return mectx; } protected MessageExchangeCorrelator correlator; - protected MessageExchangeFaultListener faultListener; - protected MessageExchangeStatusListener statusListener; + protected MessageExchangeEventListener eventListener; protected MessageContext context; protected MessageExchangeSendContext() { @@ -104,11 +101,7 @@ return this.context; } - public MessageExchangeFaultListener getMessageExchangeFaultListener() { - return this.faultListener; - } - - public MessageExchangeStatusListener getMessageExchangeStatusListener() { - return this.statusListener; + public MessageExchangeEventListener getMessageExchangeEventListener() { + return this.eventListener; } } 1.3 +18 -11 xml-axis/java/src/org/apache/axis/ime/internal/FirstComeFirstServeDispatchPolicy.java Index: FirstComeFirstServeDispatchPolicy.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/FirstComeFirstServeDispatchPolicy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FirstComeFirstServeDispatchPolicy.java 29 Oct 2002 23:33:40 -0000 1.2 +++ FirstComeFirstServeDispatchPolicy.java 13 Nov 2002 05:24:20 -0000 1.3 @@ -56,14 +56,16 @@ import org.apache.axis.MessageContext; import org.apache.axis.ime.MessageExchangeCorrelator; -import org.apache.axis.ime.MessageContextListener; -import org.apache.axis.ime.MessageExchangeFaultListener; +import org.apache.axis.ime.MessageExchangeEventListener; +import org.apache.axis.ime.event.MessageFaultEvent; +import org.apache.axis.ime.event.MessageReceiveEvent; import org.apache.axis.ime.internal.util.KeyedBuffer; import org.apache.axis.components.logger.LogFactory; import org.apache.commons.logging.Log; /** * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public class FirstComeFirstServeDispatchPolicy implements ReceivedMessageDispatchPolicy { @@ -104,19 +106,24 @@ if (receiveContext == null) RECEIVE.put(correlator,context); else { - MessageExchangeFaultListener faultListener = - receiveContext.getMessageExchangeFaultListener(); - MessageContextListener contextListener = - receiveContext.getMessageContextListener(); + MessageExchangeEventListener eventListener = + receiveContext.getMessageExchangeEventListener(); MessageContext msgContext = context.getMessageContext(); try { - contextListener.onReceive( - correlator, msgContext); + MessageReceiveEvent receiveEvent = + new org.apache.axis.ime.event.MessageReceiveEvent( + correlator, + receiveContext, + context.getMessageContext()); + eventListener.onEvent(receiveEvent); } catch (Exception exception) { - if (faultListener != null) - faultListener.onFault( - correlator, exception); + if (eventListener != null) { + MessageFaultEvent faultEvent = new MessageFaultEvent( + correlator, + exception); + eventListener.onEvent(faultEvent); + } } } if (log.isDebugEnabled()) { 1.9 +13 -7 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java Index: MessageExchangeProvider.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MessageExchangeProvider.java 29 Oct 2002 23:33:40 -0000 1.8 +++ MessageExchangeProvider.java 13 Nov 2002 05:24:20 -0000 1.9 @@ -60,10 +60,10 @@ import org.apache.axis.Handler; import org.apache.axis.MessageContext; import org.apache.axis.ime.MessageExchange; -import org.apache.axis.ime.MessageContextListener; +import org.apache.axis.ime.MessageExchangeEventListener; import org.apache.axis.ime.MessageExchangeCorrelator; import org.apache.axis.ime.MessageExchangeFactory; -import org.apache.axis.ime.MessageExchangeFaultListener; +import org.apache.axis.ime.event.MessageSendEvent; import org.apache.axis.ime.internal.util.WorkerPool; import org.apache.axis.ime.internal.util.KeyedBuffer; import org.apache.axis.ime.internal.util.NonPersistentKeyedBuffer; @@ -74,6 +74,7 @@ /** * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public abstract class MessageExchangeProvider implements MessageExchangeFactory { @@ -99,7 +100,7 @@ return null; } - protected abstract MessageExchangeSendListener getMessageExchangeSendListener(); + protected abstract MessageExchangeEventListener getMessageExchangeEventListener(); protected abstract ReceivedMessageDispatchPolicy getReceivedMessageDispatchPolicy(); @@ -142,7 +143,7 @@ if (initialized) throw new IllegalStateException(Messages.getMessage("illegalStateException00")); for (int n = 0; n < THREAD_COUNT; n++) { - WORKERS.addWorker(new MessageSender(WORKERS, SEND, getMessageExchangeSendListener(), getSendHandler())); + WORKERS.addWorker(new MessageSender(WORKERS, SEND, getMessageExchangeEventListener(), getSendHandler())); WORKERS.addWorker(new MessageReceiver(WORKERS, RECEIVE, getReceivedMessageDispatchPolicy(), getReceiveHandler())); } initialized = true; @@ -280,13 +281,13 @@ protected WorkerPool pool; protected KeyedBuffer channel; - protected MessageExchangeSendListener listener; + protected MessageExchangeEventListener listener; protected Handler handler; protected MessageSender( WorkerPool pool, KeyedBuffer channel, - MessageExchangeSendListener listener, + MessageExchangeEventListener listener, Handler handler) { this.pool = pool; this.channel = channel; @@ -307,7 +308,12 @@ if (context != null) { if (handler != null) handler.invoke(context.getMessageContext()); - listener.onSend(context); + + MessageSendEvent sendEvent = new MessageSendEvent( + context.getMessageExchangeCorrelator(), + context, + context.getMessageContext()); + listener.onEvent(sendEvent); } } } catch (Throwable t) { 1.9 +31 -53 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java Index: MessageExchangeImpl.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MessageExchangeImpl.java 30 Oct 2002 00:07:53 -0000 1.8 +++ MessageExchangeImpl.java 13 Nov 2002 05:24:20 -0000 1.9 @@ -60,11 +60,12 @@ import org.apache.axis.i18n.Messages; import org.apache.axis.ime.MessageExchange; import org.apache.axis.ime.MessageExchangeConstants; -import org.apache.axis.ime.MessageExchangeFaultListener; -import org.apache.axis.ime.MessageExchangeStatusListener; import org.apache.axis.ime.MessageExchangeCorrelator; -import org.apache.axis.ime.MessageContextListener; import org.apache.axis.ime.MessageExchangeLifecycle; +import org.apache.axis.ime.MessageExchangeEventListener; +import org.apache.axis.ime.MessageExchangeEvent; +import org.apache.axis.ime.event.MessageReceiveEvent; +import org.apache.axis.ime.event.MessageFaultEvent; import org.apache.axis.components.uuid.UUIDGenFactory; import org.apache.axis.components.logger.LogFactory; import org.apache.commons.logging.Log; @@ -73,6 +74,7 @@ /** * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageExchangeImpl implements MessageExchange, MessageExchangeLifecycle { @@ -83,8 +85,7 @@ public static final long NO_TIMEOUT = -1; public static final long DEFAULT_TIMEOUT = 1000 * 30; - private MessageExchangeFaultListener faultListener; - private MessageExchangeStatusListener statusListener; + private MessageExchangeEventListener eventListener; private MessageExchangeProvider provider; protected Holder holder; @@ -106,7 +107,7 @@ */ public MessageExchangeCorrelator send( MessageContext context, - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Enter: MessageExchangeImpl::send"); @@ -125,16 +126,13 @@ provider.processReceive( MessageExchangeReceiveContext.newInstance( correlator, - listener, - faultListener, - statusListener)); + listener)); } provider.processSend( MessageExchangeSendContext.newInstance( correlator, context, - faultListener, - statusListener)); + listener)); if (log.isDebugEnabled()) { log.debug("Exit: MessageExchangeImpl::send"); } @@ -179,7 +177,7 @@ } holder = new Holder(); Listener listener = new Listener(holder); - setMessageExchangeFaultListener(listener); + setMessageExchangeEventListener(listener); try { this.receive(correlator,listener); if (timeout != NO_TIMEOUT) @@ -205,7 +203,7 @@ * @see org.apache.axis.ime.MessageExchange#receive(MessageContextListener) */ public void receive( - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault { receive(null,listener); } @@ -215,7 +213,7 @@ */ public void receive( MessageExchangeCorrelator correlator, - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Enter: MessageExchangeImpl::receive"); @@ -223,9 +221,7 @@ provider.processReceive( MessageExchangeReceiveContext.newInstance( correlator, - listener, - faultListener, - statusListener)); + listener)); if (log.isDebugEnabled()) { log.debug("Exit: MessageExchangeImpl::receive"); } @@ -253,7 +249,7 @@ } holder = new Holder(); Listener listener = new Listener(holder); - setMessageExchangeFaultListener(listener); + setMessageExchangeEventListener(listener); try { this.send(context,listener); if (timeout != NO_TIMEOUT) @@ -278,31 +274,16 @@ /** * see org.apache.axis.ime.MessageExchange#setMessageExchangeFaultListener(MessageExchangeFaultListener) */ - public synchronized void setMessageExchangeFaultListener( - MessageExchangeFaultListener listener) { - this.faultListener = listener; - } - - /** - * see org.apache.axis.ime.MessageExchange#getMessageExchangeFaultListener() - */ - public synchronized MessageExchangeFaultListener getMessageExchangeFaultListener() { - return this.faultListener; - } - - /** - * see org.apache.axis.ime.MessageExchange#setMessageExchangeStatusListener(MessageExchangeStatusListener) - */ - public synchronized void setMessageExchangeStatusListener( - MessageExchangeStatusListener listener) { - this.statusListener = listener; + public synchronized void setMessageExchangeEventListener( + MessageExchangeEventListener listener) { + this.eventListener = listener; } /** * see org.apache.axis.ime.MessageExchange#getMessageExchangeStatusListener() */ - public synchronized MessageExchangeStatusListener getMessageExchangeStatusListener() { - return this.statusListener; + public synchronized MessageExchangeEventListener getMessageExchangeEventListener() { + return this.eventListener; } /** @@ -428,8 +409,7 @@ } public class Listener - extends MessageContextListener - implements MessageExchangeFaultListener { + implements MessageExchangeEventListener { protected Holder holder; @@ -440,21 +420,19 @@ /** * @see org.apache.axis.ime.MessageExchangeReceiveListener#onReceive(MessageExchangeCorrelator, MessageContext) */ - public void onReceive( - MessageExchangeCorrelator correlator, - MessageContext context) { - holder.set(correlator, context); + public void onEvent( + MessageExchangeEvent event) { + if (event instanceof MessageReceiveEvent) { + MessageReceiveEvent receiveEvent = (MessageReceiveEvent)event; + holder.set( + receiveEvent.getMessageExchangeCorrelator(), + receiveEvent.getMessageContext()); + } + else if (event instanceof MessageFaultEvent) { + MessageFaultEvent faultEvent = (MessageFaultEvent)event; + holder.set(faultEvent.getMessageExchangeCorrelator(), faultEvent.getException()); } - - /** - * @see org.apache.axis.ime.MessageExchangeFaultListener#onFault(MessageExchangeCorrelator, Throwable) - */ - public void onFault( - MessageExchangeCorrelator correlator, - Throwable exception) { - holder.set(correlator, exception); } - } 1.2 +59 -20 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeReceiveContext.java Index: MessageExchangeReceiveContext.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeReceiveContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MessageExchangeReceiveContext.java 29 Oct 2002 05:15:29 -0000 1.1 +++ MessageExchangeReceiveContext.java 13 Nov 2002 05:24:20 -0000 1.2 @@ -1,32 +1,79 @@ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Axis" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ package org.apache.axis.ime.internal; -import org.apache.axis.ime.MessageContextListener; -import org.apache.axis.ime.MessageExchangeFaultListener; -import org.apache.axis.ime.MessageExchangeStatusListener; import org.apache.axis.ime.MessageExchangeCorrelator; +import org.apache.axis.ime.MessageExchangeEventListener; /** * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageExchangeReceiveContext { public static MessageExchangeReceiveContext newInstance( MessageExchangeCorrelator correlator, - MessageContextListener listener, - MessageExchangeFaultListener faultListener, - MessageExchangeStatusListener statusListener) { + MessageExchangeEventListener listener) { MessageExchangeReceiveContext mectx = new MessageExchangeReceiveContext(); mectx.correlator = correlator; mectx.listener = listener; - mectx.faultListener = faultListener; - mectx.statusListener = statusListener; return mectx; } - protected MessageContextListener listener; - protected MessageExchangeFaultListener faultListener; - protected MessageExchangeStatusListener statusListener; + protected MessageExchangeEventListener listener; protected MessageExchangeCorrelator correlator; protected MessageExchangeReceiveContext() {} @@ -35,15 +82,7 @@ return this.correlator; } - public MessageContextListener getMessageContextListener() { + public MessageExchangeEventListener getMessageExchangeEventListener() { return this.listener; } - - public MessageExchangeFaultListener getMessageExchangeFaultListener() { - return this.faultListener; - } - - public MessageExchangeStatusListener getMessageExchangeStatusListener() { - return this.statusListener; - } } 1.1 xml-axis/java/src/org/apache/axis/ime/event/MessageSendEvent.java Index: MessageSendEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime.event; import org.apache.axis.ime.MessageExchangeCorrelator; import org.apache.axis.ime.internal.MessageExchangeSendContext; import org.apache.axis.MessageContext; /** * The MessageSendEvent is used to indicate that a message has been dispatched. * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageSendEvent extends MessageCorrelatedEvent { protected MessageExchangeSendContext sendContext; public MessageSendEvent( MessageExchangeCorrelator correlator, MessageExchangeSendContext sendContext, MessageContext context) { super(correlator, context); this.sendContext = sendContext; } public MessageExchangeSendContext getMessageExchangeSendContext() { return sendContext; } } 1.1 xml-axis/java/src/org/apache/axis/ime/event/MessageCorrelatedEvent.java Index: MessageCorrelatedEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime.event; import org.apache.axis.ime.MessageExchangeEvent; import org.apache.axis.ime.MessageExchangeCorrelator; import org.apache.axis.MessageContext; import java.io.Serializable; /** * MessageCorrelatedEvent is the base abstract class for all * events which are associated with a particular message. * It contains a reference to the message via the MessageContext. * * @author Ray Chun ([EMAIL PROTECTED]) */ public abstract class MessageCorrelatedEvent implements MessageExchangeEvent, Serializable { protected MessageExchangeCorrelator correlator; protected MessageContext context; public MessageCorrelatedEvent( MessageExchangeCorrelator correlator) { this.correlator = correlator; } public MessageCorrelatedEvent( MessageExchangeCorrelator correlator, MessageContext context) { this.correlator = correlator; this.context = context; } public MessageExchangeCorrelator getMessageExchangeCorrelator() { return correlator; } public MessageContext getMessageContext() { return context; } } 1.1 xml-axis/java/src/org/apache/axis/ime/event/MessageFaultEvent.java Index: MessageFaultEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime.event; import org.apache.axis.ime.MessageExchangeCorrelator; /** * The MessageFaultEvent is used to indicate an exception in the * processing of a message. * * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageFaultEvent extends MessageCorrelatedEvent { protected Throwable exception; public MessageFaultEvent( MessageExchangeCorrelator correlator, Throwable exception) { super(correlator); this.exception = exception; } public Throwable getException() { return exception; } } 1.1 xml-axis/java/src/org/apache/axis/ime/event/MessageReceiveEvent.java Index: MessageReceiveEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime.event; import org.apache.axis.ime.MessageExchangeCorrelator; import org.apache.axis.ime.internal.MessageExchangeReceiveContext; import org.apache.axis.MessageContext; /** * The MessageReceiveEvent is used to notify listeners that a message * has been received. * * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageReceiveEvent extends MessageCorrelatedEvent { protected MessageExchangeReceiveContext receiveContext; public MessageReceiveEvent( MessageExchangeCorrelator correlator, MessageExchangeReceiveContext receiveContext, MessageContext context) { super(correlator, context); this.receiveContext = receiveContext; } public MessageExchangeReceiveContext getMessageExchangeReceiveContext() { return receiveContext; } } 1.1 xml-axis/java/src/org/apache/axis/ime/event/MessageStatusEvent.java Index: MessageStatusEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime.event; import org.apache.axis.ime.MessageExchangeCorrelator; import org.apache.axis.ime.MessageExchangeStatus; /** * The MessageExchangeStatus event is used to provide status * notifications to registered listeners. * * @author Ray Chun ([EMAIL PROTECTED]) */ public class MessageStatusEvent extends MessageCorrelatedEvent { protected MessageExchangeStatus status; public MessageStatusEvent( MessageExchangeCorrelator correlator, MessageExchangeStatus status) { super(correlator); this.status = status; } public MessageExchangeStatus getMessageExchangeStatus() { return status; } } 1.4 +20 -11 xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerMessageExchange.java Index: HandlerMessageExchange.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerMessageExchange.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HandlerMessageExchange.java 29 Oct 2002 23:58:02 -0000 1.3 +++ HandlerMessageExchange.java 13 Nov 2002 05:24:20 -0000 1.4 @@ -59,11 +59,12 @@ import org.apache.axis.TargetedChain; import org.apache.axis.MessageContext; import org.apache.axis.ime.MessageExchangeCorrelator; -import org.apache.axis.ime.MessageContextListener; -import org.apache.axis.ime.MessageExchangeFaultListener; +import org.apache.axis.ime.MessageExchangeEventListener; +import org.apache.axis.ime.MessageExchangeEvent; +import org.apache.axis.ime.event.MessageFaultEvent; +import org.apache.axis.ime.event.MessageSendEvent; import org.apache.axis.ime.internal.MessageExchangeProvider; import org.apache.axis.ime.internal.MessageExchangeSendContext; -import org.apache.axis.ime.internal.MessageExchangeSendListener; import org.apache.axis.ime.internal.ReceivedMessageDispatchPolicy; import org.apache.axis.ime.internal.FirstComeFirstServeDispatchPolicy; import org.apache.axis.components.logger.LogFactory; @@ -89,7 +90,7 @@ /** * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createSendMessageContextListener() */ - protected MessageExchangeSendListener getMessageExchangeSendListener() { + protected MessageExchangeEventListener getMessageExchangeEventListener() { return new Listener(handler); } @@ -114,7 +115,7 @@ } public class Listener - implements MessageExchangeSendListener { + implements MessageExchangeEventListener { private Handler handler; @@ -125,13 +126,19 @@ /** * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext) */ - public void onSend( - MessageExchangeSendContext context) { + public void onEvent( + MessageExchangeEvent event) { + if (!(event instanceof MessageSendEvent)) + return; + + MessageSendEvent sendEvent = (MessageSendEvent)event; + MessageExchangeSendContext context = sendEvent.getMessageExchangeSendContext(); + if (log.isDebugEnabled()) { log.debug("Enter: HandlerMessageExchange.Listener::onSend"); } - MessageExchangeFaultListener listener = - context.getMessageExchangeFaultListener(); + MessageExchangeEventListener listener = + context.getMessageExchangeEventListener(); try { MessageContext msgContext = context.getMessageContext(); @@ -147,10 +154,12 @@ RECEIVE.put(correlator, context); } catch (Exception exception) { - if (listener != null) - listener.onFault( + if (listener != null) { + MessageFaultEvent faultEvent = new MessageFaultEvent( context.getMessageExchangeCorrelator(), exception); + listener.onEvent(faultEvent); + } } finally { if (log.isDebugEnabled()) { log.debug("Exit: HandlerMessageExchange.Listener::onSend"); 1.7 +7 -13 xml-axis/java/src/org/apache/axis/ime/MessageExchange.java Index: MessageExchange.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchange.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MessageExchange.java 29 Oct 2002 06:39:57 -0000 1.6 +++ MessageExchange.java 13 Nov 2002 05:24:20 -0000 1.7 @@ -65,6 +65,7 @@ * models for receiving inbound messages. * * @author James M Snell ([EMAIL PROTECTED]) + * @author Ray Chun ([EMAIL PROTECTED]) */ public interface MessageExchange { @@ -93,7 +94,7 @@ */ public MessageExchangeCorrelator send( MessageContext context, - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault; /** @@ -150,7 +151,7 @@ * @throws AxisFault */ public void receive( - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault; /** @@ -162,7 +163,7 @@ */ public void receive( MessageExchangeCorrelator correlator, - MessageContextListener listener) + MessageExchangeEventListener listener) throws AxisFault; /** @@ -187,17 +188,10 @@ long timeout) throws AxisFault; - public void setMessageExchangeFaultListener( - MessageExchangeFaultListener listener); - - public MessageExchangeFaultListener getMessageExchangeFaultListener(); - - public void setMessageExchangeStatusListener( - MessageExchangeStatusListener listener); - - public MessageExchangeStatusListener getMessageExchangeStatusListener(); - + public void setMessageExchangeEventListener( + MessageExchangeEventListener listener); + public MessageExchangeEventListener getMessageExchangeEventListener(); /** * @param String The id of the feature to enable 1.1 xml-axis/java/src/org/apache/axis/ime/MessageExchangeEvent.java Index: MessageExchangeEvent.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime; import java.io.Serializable; /** * The base interface for all MessageExchange events, such as message receipt * notification, delivery acknowledgement, exception notification, and status. * * @author Ray Chun ([EMAIL PROTECTED]) */ public interface MessageExchangeEvent extends Serializable { } 1.1 xml-axis/java/src/org/apache/axis/ime/MessageExchangeEventListener.java Index: MessageExchangeEventListener.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.axis.ime; import java.io.Serializable; /** * The base interface to be extended by all MessageExchangeEvent listeners. * * @author Ray Chun ([EMAIL PROTECTED]) */ public interface MessageExchangeEventListener extends Serializable { public void onEvent( MessageExchangeEvent event); }