org.jboss.soa.esb.listeners.gateway.mina
Class DefaultMessageHandler

java.lang.Object
  extended by org.apache.mina.core.service.IoHandlerAdapter
      extended by org.jboss.soa.esb.listeners.gateway.mina.DefaultMessageHandler
All Implemented Interfaces:
org.apache.mina.core.service.IoHandler, MessageHandler

public class DefaultMessageHandler
extends org.apache.mina.core.service.IoHandlerAdapter
implements MessageHandler

DefaultMessageHandler recieves messages and packages the bytes sent into a ESB Message object.

The bytes array will be available in the default body location: bytes[] payload = message.getBody().get();

Author:
tom.fennelly@jboss.com, Daniel Bevenius

Constructor Summary
DefaultMessageHandler()
           
 
Method Summary
 void exceptionCaught(org.apache.mina.core.session.IoSession session, java.lang.Throwable cause)
           
 void messageReceived(org.apache.mina.core.session.IoSession session, java.lang.Object message)
          Extracts the payload as a bytes array and creates a new ESB Message object populating the EBS Message body with the bytes array.
 void sessionCreated(org.apache.mina.core.session.IoSession session)
          Called when a new connection has been created.
 void setServiceInvoker(ServiceInvoker invoker)
          Sets the service invoker that should be used.
 
Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
messageSent, sessionClosed, sessionIdle, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.core.service.IoHandler
messageSent, sessionClosed, sessionIdle, sessionOpened
 

Constructor Detail

DefaultMessageHandler

public DefaultMessageHandler()
Method Detail

setServiceInvoker

public final void setServiceInvoker(ServiceInvoker invoker)
Sets the service invoker that should be used.

Specified by:
setServiceInvoker in interface MessageHandler
Parameters:
invoker - The ServiceInvoker that this message handler should use.

sessionCreated

public void sessionCreated(org.apache.mina.core.session.IoSession session)
Called when a new connection has been created.

Specified by:
sessionCreated in interface org.apache.mina.core.service.IoHandler
Overrides:
sessionCreated in class org.apache.mina.core.service.IoHandlerAdapter
Parameters:
session - The MINA IoSession.

exceptionCaught

public void exceptionCaught(org.apache.mina.core.session.IoSession session,
                            java.lang.Throwable cause)
Specified by:
exceptionCaught in interface org.apache.mina.core.service.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.core.service.IoHandlerAdapter

messageReceived

public void messageReceived(org.apache.mina.core.session.IoSession session,
                            java.lang.Object message)
                     throws java.lang.Exception
Extracts the payload as a bytes array and creates a new ESB Message object populating the EBS Message body with the bytes array.

Specified by:
messageReceived in interface org.apache.mina.core.service.IoHandler
Overrides:
messageReceived in class org.apache.mina.core.service.IoHandlerAdapter
Parameters:
session - The MINA IoSession.
message - The MINA message object.
Throws:
java.lang.Exception