FileDocCategorySizeDatePackage
MessageExchangeTransportImpl.javaAPI DocGlassfish v2 API5752Wed Jul 04 08:20:22 BST 2007com.sun.enterprise.jbi.serviceengine.comm

MessageExchangeTransportImpl

public abstract class MessageExchangeTransportImpl extends Object implements MessageExchangeTransport
author
bhavanishankar@dev.java.net

Fields Summary
javax.jbi.messaging.MessageExchange
me
protected javax.jbi.messaging.NormalizedMessage
msg
protected static final Logger
logger
Constructors Summary
protected MessageExchangeTransportImpl(javax.jbi.messaging.MessageExchange me)


       
        this.me = me;
    
Methods Summary
protected java.lang.StringextractFaultCode(java.lang.String completeFaultCode)

        StringTokenizer tokenizer = new StringTokenizer(completeFaultCode, ":");
        if(tokenizer.countTokens() > 1) tokenizer.nextToken();
        return tokenizer.nextToken();
    
public javax.jbi.messaging.NormalizedMessagegetMessage()

        return msg;
    
public javax.jbi.messaging.MessageExchangegetMessageExchange()

        return me;
    
protected voidinvokeHandlersForInbound()

        for (JBIHandler handler : JBIHandlerFactory.getInstance().getHandlers())
            try {
            handler.handleInbound(this);
        } catch (Exception e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new ServiceEngineException(e);
        }
    
protected voidinvokeHandlersForOutbound()

        for (JBIHandler handler : JBIHandlerFactory.getInstance().getHandlers())
            try {
            handler.handleOutbound(this);
        } catch (Exception e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            // throw new ServiceEngineException(e);
        }
    
protected voidpreReceive()

        invokeHandlersForOutbound();
    
protected voidpreSend()

        invokeHandlersForInbound();
    
public java.lang.ExceptionreceiveError()

        preReceive();
        return me.getError();
    
protected voidsend()

        preSend();
        MessageSender messageSender = new MessageSender();
        messageSender.setMessageExchange(me);
        messageSender.send();
        Exception exception = messageSender.getException();
        if(exception != null)
            throw exception;
    
public voidsendError(java.lang.Exception exception)

        try {
            logger.log(Level.SEVERE, 
                    "Sending error to the consumer - " + exception);
            if(exception != null) {
                me.setError(exception);
            }
            me.setStatus(ExchangeStatus.ERROR);
            send();
        } catch(Exception ex) {
            // Can't do much here.
            logger.log(Level.SEVERE, ex.getMessage(), ex);
        }
    
public voidsendStatus(javax.jbi.messaging.ExchangeStatus status)

        try {
            me.setStatus(status);
            MessageSender messageSender = new MessageSender();
            messageSender.setMessageExchange(me);
            messageSender.send();
        } catch(Exception ex) {
            // Can't do much here.
            logger.log(Level.SEVERE, ex.getMessage(), ex);
        }