xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.stomp
Class XbStompDriver

java.lang.Object
  extended by org.xmlBlaster.protocol.stomp.XbStompDriver
All Implemented Interfaces:
org.codehaus.stomp.StompHandlerFactory, I_Driver, XbStompDriverMBean, I_AdminPlugin, I_AdminService, I_AdminUsage, I_Plugin

public class XbStompDriver
extends java.lang.Object
implements I_Driver, org.codehaus.stomp.StompHandlerFactory, XbStompDriverMBean

XbStomp driver class to invoke the xmlBlaster server over STOMP protocol.

Author:
Dieter Saken
See Also:
XmlBlaster protocol integration, Stomp website, Stomp protocol describtion

Field Summary
private  AddressServer addressServer
           
private  I_Authenticate authenticate
          The singleton handle for this authentication server
private  java.util.Set<XbStompInOutBridge> clientSet
          Remember all client connections
private  int connectCounter
           
protected  ContextNode contextNode
           
private  Global glob
          The global handle
private  boolean isShutdown
           
private  java.net.URI location
           
private static java.util.logging.Logger log
           
protected  java.lang.Object mbeanHandle
          My JMX registration
private  java.lang.String ME
           
private  javax.net.ServerSocketFactory serverSocketFactory
           
private  SocketUrl socketUrl
          The socket address info object holding hostname (useful for multi homed hosts) and port
private  org.codehaus.stomp.tcp.TcpTransportServer tcpServer
           
 
Constructor Summary
XbStompDriver()
           
 
Method Summary
 void activate()
          Activate xmlBlaster access through this protocol so that a client can contact us.
 boolean addClient(XbStompInOutBridge client)
           
 int clearClients()
           
 int countClients()
           
 org.codehaus.stomp.StompHandler createStompHandler(org.codehaus.stomp.StompHandler outputHandler)
          Callback StompHandlerFactory on new client connection
protected  org.codehaus.stomp.tcp.TcpTransportServer createTcpServer()
           
 void deActivate()
          Deactivate xmlBlaster access (standby), no clients can connect.
protected  void doStart()
           
protected  void doStop()
           
 XbStompInOutBridge findClient(java.lang.String loginName)
           
 java.lang.String freeBlockingCallbackThread(java.lang.String loginName)
           
 java.lang.String[] getClientDump()
           
 XbStompInOutBridge[] getClients()
           
 java.lang.String getEnvPrefix()
          The command line key prefix
 java.net.URI getLocation()
          Stomp specific url syntax
 java.lang.String getName()
          Get a human readable name of this driver
 java.lang.String getProtocolId()
          Access the xmlBlaster internal name of the protocol driver.
 java.lang.String getRawAddress()
          Return the address how to access this driver.
 javax.net.ServerSocketFactory getServerSocketFactory()
           
 org.codehaus.stomp.tcp.TcpTransportServer getTcpServer()
           
 java.lang.String getType()
          The unique name of the plugin (together with the version).
 java.lang.String getUsageUrl()
           
 java.lang.String getVersion()
          The version of the plugin
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager.
 boolean isActive()
          Access the current state
 boolean isShutdown()
          Check status
 void join()
          Joins with the background thread until the transport is stopped
 boolean removeClient(XbStompInOutBridge client)
           
 void setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)
          Sets the ServerSocketFactory to use to listen for STOMP frames
 void setUsageUrl(java.lang.String url)
           
 java.lang.String[] showBlockingCallbackTreads(java.lang.String loginName)
           
 void shutdown()
          Shutdown the plugin, free resources.
 java.lang.String usage()
          Command line usage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

ME

private java.lang.String ME

glob

private Global glob
The global handle


socketUrl

private SocketUrl socketUrl
The socket address info object holding hostname (useful for multi homed hosts) and port


location

private java.net.URI location

serverSocketFactory

private javax.net.ServerSocketFactory serverSocketFactory

tcpServer

private org.codehaus.stomp.tcp.TcpTransportServer tcpServer

addressServer

private AddressServer addressServer

authenticate

private I_Authenticate authenticate
The singleton handle for this authentication server


mbeanHandle

protected java.lang.Object mbeanHandle
My JMX registration


contextNode

protected ContextNode contextNode

isShutdown

private boolean isShutdown

clientSet

private java.util.Set<XbStompInOutBridge> clientSet
Remember all client connections


connectCounter

private int connectCounter
Constructor Detail

XbStompDriver

public XbStompDriver()
Method Detail

activate

public void activate()
              throws XmlBlasterException
Description copied from interface: I_Driver
Activate xmlBlaster access through this protocol so that a client can contact us.

Specified by:
activate in interface I_Driver
Specified by:
activate in interface I_AdminService
Throws:
XmlBlasterException

deActivate

public void deActivate()
Description copied from interface: I_Driver
Deactivate xmlBlaster access (standby), no clients can connect.

Specified by:
deActivate in interface I_Driver
Specified by:
deActivate in interface I_AdminService

freeBlockingCallbackThread

public java.lang.String freeBlockingCallbackThread(java.lang.String loginName)
Specified by:
freeBlockingCallbackThread in interface XbStompDriverMBean

showBlockingCallbackTreads

public java.lang.String[] showBlockingCallbackTreads(java.lang.String loginName)
Specified by:
showBlockingCallbackTreads in interface XbStompDriverMBean

getName

public java.lang.String getName()
Description copied from interface: I_Driver
Get a human readable name of this driver

Specified by:
getName in interface I_Driver

getProtocolId

public java.lang.String getProtocolId()
Description copied from interface: I_Driver
Access the xmlBlaster internal name of the protocol driver.

Specified by:
getProtocolId in interface I_Driver
Returns:
e.g. "IOR" "EMAIL" "XMLRPC" depending on driver

getRawAddress

public java.lang.String getRawAddress()
Description copied from interface: I_Driver
Return the address how to access this driver.

Specified by:
getRawAddress in interface I_Driver
Specified by:
getRawAddress in interface XbStompDriverMBean
Returns:
e.g. "http:/www.mars.universe:8080/RPC2" or "IOR:000034100..."

getEnvPrefix

public java.lang.String getEnvPrefix()
The command line key prefix

Returns:
The configured type in xmlBlasterPlugins.xml, defaults to "plugin/stomp"

usage

public java.lang.String usage()
Command line usage.

Enforced by interface I_Driver.

Specified by:
usage in interface I_Driver
Specified by:
usage in interface I_AdminUsage
Returns:
a human readable usage help string

getType

public java.lang.String getType()
Description copied from interface: I_AdminPlugin
The unique name of the plugin (together with the version).

Specified by:
getType in interface I_AdminPlugin
Specified by:
getType in interface I_Plugin
Returns:
For example "IOR"

getVersion

public java.lang.String getVersion()
Description copied from interface: I_AdminPlugin
The version of the plugin

Specified by:
getVersion in interface I_AdminPlugin
Specified by:
getVersion in interface I_Plugin
Returns:
For example "1.0"

init

public void init(Global glob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
Description copied from interface: I_Plugin
This method is called by the PluginManager.

Example how options are evaluated:

   // An entry in xmlBlaster.properties (in one line):
   MimeSubscribePlugin[ContentLenFilter][1.0]=\
                 org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
                 DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20

  // Access it like this:
  java.util.Properties props = pluginInfo.getParameters();
  String maxLen = (String)props.get("DEFAULT_MAX_LEN");
  String throwLen = (String)props.get("THROW_EXCEPTION_FOR_LEN");
 

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException

shutdown

public void shutdown()
              throws XmlBlasterException
Description copied from interface: I_AdminPlugin
Shutdown the plugin, free resources.

Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
Throws:
XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.


isShutdown

public boolean isShutdown()
Description copied from interface: I_AdminPlugin
Check status

Specified by:
isShutdown in interface I_AdminPlugin
Returns:
true if down

getClients

public XbStompInOutBridge[] getClients()

findClient

public XbStompInOutBridge findClient(java.lang.String loginName)

addClient

public boolean addClient(XbStompInOutBridge client)

removeClient

public boolean removeClient(XbStompInOutBridge client)

clearClients

public int clearClients()

countClients

public int countClients()
Specified by:
countClients in interface XbStompDriverMBean

getClientDump

public java.lang.String[] getClientDump()
Specified by:
getClientDump in interface XbStompDriverMBean

createStompHandler

public org.codehaus.stomp.StompHandler createStompHandler(org.codehaus.stomp.StompHandler outputHandler)
Callback StompHandlerFactory on new client connection

Specified by:
createStompHandler in interface org.codehaus.stomp.StompHandlerFactory

join

public void join()
          throws java.io.IOException,
                 java.net.URISyntaxException,
                 java.lang.InterruptedException
Joins with the background thread until the transport is stopped

Throws:
java.io.IOException
java.net.URISyntaxException
java.lang.InterruptedException

getLocation

public java.net.URI getLocation()
                         throws java.net.URISyntaxException
Stomp specific url syntax

Returns:
"tcp://localhost:61613"
Throws:
java.net.URISyntaxException

getServerSocketFactory

public javax.net.ServerSocketFactory getServerSocketFactory()

setServerSocketFactory

public void setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)
Sets the ServerSocketFactory to use to listen for STOMP frames


getTcpServer

public org.codehaus.stomp.tcp.TcpTransportServer getTcpServer()
                                                       throws java.io.IOException,
                                                              java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

createTcpServer

protected org.codehaus.stomp.tcp.TcpTransportServer createTcpServer()
                                                             throws java.io.IOException,
                                                                    java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

doStart

protected void doStart()
                throws java.lang.Exception
Throws:
java.lang.Exception

doStop

protected void doStop()
               throws java.lang.Exception
Throws:
java.lang.Exception

isActive

public boolean isActive()
Description copied from interface: I_AdminService
Access the current state

Specified by:
isActive in interface I_AdminService
Returns:
true if active

getUsageUrl

public java.lang.String getUsageUrl()
Specified by:
getUsageUrl in interface I_AdminUsage
Returns:
A link on javadoc for JMX usage

setUsageUrl

public void setUsageUrl(java.lang.String url)
Specified by:
setUsageUrl in interface I_AdminUsage

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.