org.jboss.soa.esb.listeners.message
Class HttpListener

java.lang.Object
  extended by org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
      extended by org.jboss.soa.esb.listeners.message.HttpListener
All Implemented Interfaces:
java.io.Serializable, org.jboss.remoting.ServerInvocationHandler, ManagedLifecycle

public class HttpListener
extends AbstractManagedLifecycle
implements org.jboss.remoting.ServerInvocationHandler

Http listener implementation using the JBoss Remoting channel. The listener will listen to messages on the configured listenHttpUrl. If this is not set, the default http://localhost:5400 will be used. This listener expects an Object message whose type is org.jboss.soa.esb.message.Message Sample listener Configuration:

  <HttpListener listenerClass="org.jboss.soa.esb.listeners.message.HttpListener"> 
        <action class=&quotorg.jboss.soa.esb.actions.routing.EchoRouter"/>     
  </HttpListener>
 

Author:
Johan Kumps
See Also:
Serialized Form

Field Summary
 java.lang.String listenHttpUrl
           
protected  org.apache.log4j.Logger logger
           
 
Fields inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
PARAM_TERMINATION_PERIOD
 
Constructor Summary
HttpListener(ConfigTree config)
          Constructor initialising this HttpListener
 
Method Summary
 void addListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
          Adds a callback handler that will listen for callbacks from the server invoker handler.
protected  void doDestroy()
          Handle the destroy of the managed instance.
protected  void doInitialise()
          Handle the initialisation of the managed instance.
protected  void doStart()
          Handle the start of the managed instance.
protected  void doStop()
          Handle the stop of the managed instance.
 java.lang.String getListenHttpUrl()
          Method getting the url this HttpListener instance is listening on
 java.lang.Object invoke(org.jboss.remoting.InvocationRequest invocationRequest)
           
 void removeListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
          Removes the callback handler that was listening for callbacks from the server invoker handler.
 void setInvoker(org.jboss.remoting.ServerInvoker invoker)
          set the invoker that owns this handler
 void setListenHttpUrl(java.lang.String listenHttpUrl)
          Method setting the listenHttpUrl property to listen on
 void setMBeanServer(javax.management.MBeanServer server)
          set the mbean server that the handler can reference
 
Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
addManagedLifecycleEventListener, changeState, destroy, getState, getTerminationPeriod, initialise, removeManagedLifecycleEventListener, start, stop, waitForStateChange, waitUntilDestroyed, waitUntilDestroyed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.log4j.Logger logger

listenHttpUrl

public java.lang.String listenHttpUrl
Constructor Detail

HttpListener

public HttpListener(ConfigTree config)
             throws ConfigurationException
Constructor initialising this HttpListener

Parameters:
commandListener -
listenerConfig -
actionDefinitionFactory -
Throws:
ConfigurationException
ListenerInitializationException
Method Detail

doInitialise

protected void doInitialise()
                     throws ManagedLifecycleException
Handle the initialisation of the managed instance.

Specified by:
doInitialise in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while initialisation.

doStart

protected void doStart()
                throws ManagedLifecycleException
Handle the start of the managed instance.

Specified by:
doStart in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while starting.

doStop

protected void doStop()
               throws ManagedLifecycleException
Handle the stop of the managed instance.

Specified by:
doStop in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while stopping.

doDestroy

protected void doDestroy()
                  throws ManagedLifecycleException
Handle the destroy of the managed instance.

Specified by:
doDestroy in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while destroying.

invoke

public java.lang.Object invoke(org.jboss.remoting.InvocationRequest invocationRequest)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.jboss.remoting.ServerInvocationHandler
Throws:
java.lang.Throwable

addListener

public void addListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
Adds a callback handler that will listen for callbacks from the server invoker handler.

Specified by:
addListener in interface org.jboss.remoting.ServerInvocationHandler
Parameters:
callbackHandler -

removeListener

public void removeListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
Removes the callback handler that was listening for callbacks from the server invoker handler.

Specified by:
removeListener in interface org.jboss.remoting.ServerInvocationHandler
Parameters:
callbackHandler -

setMBeanServer

public void setMBeanServer(javax.management.MBeanServer server)
set the mbean server that the handler can reference

Specified by:
setMBeanServer in interface org.jboss.remoting.ServerInvocationHandler
Parameters:
server -

setInvoker

public void setInvoker(org.jboss.remoting.ServerInvoker invoker)
set the invoker that owns this handler

Specified by:
setInvoker in interface org.jboss.remoting.ServerInvocationHandler
Parameters:
invoker -

getListenHttpUrl

public java.lang.String getListenHttpUrl()
Method getting the url this HttpListener instance is listening on

Returns:
the current listenHttpUrl

setListenHttpUrl

public void setListenHttpUrl(java.lang.String listenHttpUrl)
Method setting the listenHttpUrl property to listen on

Parameters:
listenHttpUrl - the listenHttpUrl to be used by this HttpListener instance