xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.xmlrpc
Class CallbackXmlRpcDriverSingleChannel

java.lang.Object
  extended by org.xmlBlaster.protocol.xmlrpc.CallbackXmlRpcDriverSingleChannel
All Implemented Interfaces:
I_CallbackDriver, I_Timeout, I_Plugin

public class CallbackXmlRpcDriverSingleChannel
extends java.lang.Object
implements I_CallbackDriver, I_Timeout

This object sends a MsgUnitRaw back to a client using XMLRPC interface, in the same JVM.

The I_CallbackDriver.update() method of the client will be invoked

Author:
Michele Laghi (michele@laghi.eu), Marcel Ruff.
See Also:
XmlRpcDriver

Field Summary
private  java.util.concurrent.LinkedBlockingQueue<UpdateEvent> ackQueue
           
private  CallbackAddress callbackAddress
           
private  long counter
           
private  java.lang.Thread currentThread
           
private  Global glob
           
private  java.lang.String lastRespanLocation
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  java.lang.String sessionId
           
private  Timestamp timestamp
           
private  long updateAckTimeout
           
private  java.util.concurrent.LinkedBlockingQueue<UpdateEvent> updateQueue
           
private  long updateTimeout
           
private  java.lang.ref.WeakReference<XmlBlasterImpl> xblImpl
           
 
Constructor Summary
CallbackXmlRpcDriverSingleChannel()
           
 
Method Summary
 java.util.concurrent.LinkedBlockingQueue<UpdateEvent> getAckQueue()
           
 java.lang.String getName()
          Get a human readable name of this driver
 long getPingInterval()
           
 java.lang.String getProtocolId()
          Access the xmlBlaster internal name of the protocol driver.
 java.lang.String getRawAddress()
          Get the address how to access this driver.
 java.lang.String getType()
          Enforced by I_Plugin
 java.util.concurrent.LinkedBlockingQueue<UpdateEvent> getUpdateQueue()
           
 java.lang.String getVersion()
          Enforced by I_Plugin
 void init(Global global, CallbackAddress cbAddress)
          Get callback reference here.
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 void interrupt()
           
 boolean isAlive()
           
 java.lang.String ping(java.lang.String qos)
          Ping to check if callback server is alive.
 void register(java.lang.String sessionId_, XmlBlasterImpl xblImpl_)
           
 I_ProgressListener registerProgressListener(I_ProgressListener listener)
          Register a listener for to receive information about the progress of incoming data.
 void respan(java.lang.String location)
           
 java.lang.String[] sendUpdate(MsgUnitRaw[] msgArr)
          This sends the update to the client.
 void sendUpdateOneway(MsgUnitRaw[] msgArr)
          The oneway variant, without return value.
 void setCurrentThread(java.lang.Thread currThread)
           
 void shutdown()
          This method shuts down the driver.
 void timeout(java.lang.Object userData)
          You will be notified about the timeout through this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

callbackAddress

private CallbackAddress callbackAddress

sessionId

private java.lang.String sessionId

updateQueue

private java.util.concurrent.LinkedBlockingQueue<UpdateEvent> updateQueue

ackQueue

private java.util.concurrent.LinkedBlockingQueue<UpdateEvent> ackQueue

updateAckTimeout

private long updateAckTimeout

updateTimeout

private long updateTimeout

counter

private long counter

xblImpl

private java.lang.ref.WeakReference<XmlBlasterImpl> xblImpl

timestamp

private Timestamp timestamp

currentThread

private java.lang.Thread currentThread

lastRespanLocation

private java.lang.String lastRespanLocation
Constructor Detail

CallbackXmlRpcDriverSingleChannel

public CallbackXmlRpcDriverSingleChannel()
Method Detail

getName

public java.lang.String getName()
Get a human readable name of this driver

Specified by:
getName in interface I_CallbackDriver

getProtocolId

public java.lang.String getProtocolId()
Access the xmlBlaster internal name of the protocol driver.

Specified by:
getProtocolId in interface I_CallbackDriver
Returns:
"XMLRPC"

getType

public java.lang.String getType()
Enforced by I_Plugin

Specified by:
getType in interface I_Plugin

getVersion

public java.lang.String getVersion()
Enforced by I_Plugin

Specified by:
getVersion in interface I_Plugin

init

public void init(Global glob,
                 PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin).

Specified by:
init in interface I_Plugin
See Also:
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)

getRawAddress

public java.lang.String getRawAddress()
Get the address how to access this driver.

Specified by:
getRawAddress in interface I_CallbackDriver
Returns:
"http://server.mars.universe:8080/"

register

public void register(java.lang.String sessionId_,
                     XmlBlasterImpl xblImpl_)
              throws XmlBlasterException
Throws:
XmlBlasterException

init

public void init(Global global,
                 CallbackAddress cbAddress)
          throws XmlBlasterException
Get callback reference here.

This method is enforced by interface I_CallbackDriver and is called by xmlBlaster after instantiation of this class, telling us the address to callback.

Specified by:
init in interface I_CallbackDriver
Parameters:
callbackAddress - Contains the stringified XMLRPC callback handle of the client
Throws:
XmlBlasterException

sendUpdate

public final java.lang.String[] sendUpdate(MsgUnitRaw[] msgArr)
                                    throws XmlBlasterException
This sends the update to the client.

This method is enforced by interface I_CallbackDriver and is called by

Specified by:
sendUpdate in interface I_CallbackDriver
Parameters:
msgArr - Array of all messages to send, is guaranteed to never be null
Returns:
Clients should return a qos as follows. An empty qos string "" is valid as well and interpreted as OK
  <qos>
     <state id='OK'/>
  </qos>
 
Throws:
e.id="CallbackFailed", - should be caught and handled appropriate
XmlBlasterException

sendUpdateOneway

public void sendUpdateOneway(MsgUnitRaw[] msgArr)
                      throws XmlBlasterException
The oneway variant, without return value.

Specified by:
sendUpdateOneway in interface I_CallbackDriver
Parameters:
msgArr - Array of all messages to send, is guaranteed to never be null
Throws:
XmlBlasterException - Is never from the client (oneway).

respan

public final void respan(java.lang.String location)
                  throws XmlBlasterException
Throws:
XmlBlasterException

getPingInterval

public final long getPingInterval()

ping

public final java.lang.String ping(java.lang.String qos)
                            throws XmlBlasterException
Ping to check if callback server is alive. This ping checks the availability on the application level.

Specified by:
ping in interface I_CallbackDriver
Parameters:
qos - Currently an empty string ""
Returns:
Currently an empty string ""
Throws:
XmlBlasterException - If client not reachable
See Also:
org.xmlBlaster.protocol.I_XmlBlaster#ping(String)

registerProgressListener

public I_ProgressListener registerProgressListener(I_ProgressListener listener)
Description copied from interface: I_CallbackDriver
Register a listener for to receive information about the progress of incoming data. Only one listener is supported, the last call overwrites older calls.

Specified by:
registerProgressListener in interface I_CallbackDriver
Parameters:
listener - Your listener, pass 0 to unregister.
Returns:
The previously registered listener or 0

shutdown

public void shutdown()
This method shuts down the driver.

Specified by:
shutdown in interface I_Plugin

isAlive

public boolean isAlive()
Specified by:
isAlive in interface I_CallbackDriver
Returns:
true if the plugin is still alive, false otherwise

getUpdateQueue

public java.util.concurrent.LinkedBlockingQueue<UpdateEvent> getUpdateQueue()

getAckQueue

public java.util.concurrent.LinkedBlockingQueue<UpdateEvent> getAckQueue()

timeout

public void timeout(java.lang.Object userData)
Description copied from interface: I_Timeout
You will be notified about the timeout through this method.

Specified by:
timeout in interface I_Timeout
Parameters:
userData - You get bounced back your userData which you passed with Timeout.addTimeoutListener()

setCurrentThread

public void setCurrentThread(java.lang.Thread currThread)

interrupt

public void interrupt()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.