xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.socket
Class CallbackSocketDriver

java.lang.Object
  extended by org.xmlBlaster.protocol.socket.CallbackSocketDriver
All Implemented Interfaces:
I_CallbackDriver, I_Plugin

public class CallbackSocketDriver
extends java.lang.Object
implements I_CallbackDriver

One instance of this for each client to send him callback.

This is sort of a dummy needed by the plugin framework which assumed for CORBA/RMI/XMLRPC a separate callback connection

Author:
xmlBlaster@marcelruff.info

Field Summary
private  CallbackAddress callbackAddress
           
private  Global glob
           
private  SocketExecutor handler
           
private static java.util.logging.Logger log
           
private  java.lang.String loginName
           
private  java.lang.String ME
           
private  java.lang.String msgInfoParserClassName
           
private  PluginInfo pluginInfo
           
private  boolean useUdpForOneway
           
 
Constructor Summary
CallbackSocketDriver()
          Should not be instantiated by plugin loader.
CallbackSocketDriver(java.lang.String loginName)
          This constructor is called when the callback shall be delivered by a separate SOCKET connection which we open here (in initialize())
CallbackSocketDriver(java.lang.String loginName, SocketExecutor handler)
          This constructor is called when
1.on server side when the client arrives in HandleClient
2.the callback shall be tunneled through by the SAME SOCKET connection which the client already has established.
 
Method Summary
 CallbackAddress getCallbackAddress()
           
 SocketExecutor getHandler()
           
 java.lang.String getMsgInfoParserClassName()
          Which parser to use.
 java.lang.String getName()
          Get a human readable name of this driver
 PluginInfo getPluginInfo()
           
(package private)  I_ProgressListener getProgressListener()
           
 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.lang.String getVersion()
          Enforced by I_Plugin
 void init(Global glob, CallbackAddress callbackAddress)
          Intialize the driver.
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 boolean isAlive()
           
 java.lang.String ping(java.lang.String qos)
          Ping to check if callback server is alive.
 I_ProgressListener registerProgressListener(I_ProgressListener listener)
          Register a listener for to receive information about the progress of incoming data.
 java.lang.String[] sendUpdate(MsgUnitRaw[] msgArr)
          This sends the update to the client.
 void sendUpdateOneway(MsgUnitRaw[] msgArr)
          The oneway variant, without return value.
 void shutdown()
          I_Plugin.shutdown()
private  void shutdown(boolean delayed)
           
 
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

loginName

private java.lang.String loginName

handler

private SocketExecutor handler

callbackAddress

private CallbackAddress callbackAddress

pluginInfo

private PluginInfo pluginInfo

msgInfoParserClassName

private java.lang.String msgInfoParserClassName

useUdpForOneway

private boolean useUdpForOneway
Constructor Detail

CallbackSocketDriver

public CallbackSocketDriver()
Should not be instantiated by plugin loader. A dummy could be created temporary by reflection?


CallbackSocketDriver

public CallbackSocketDriver(java.lang.String loginName,
                            SocketExecutor handler)
This constructor is called when
1.on server side when the client arrives in HandleClient
2.the callback shall be tunneled through by the SAME SOCKET connection which the client already has established.


CallbackSocketDriver

public CallbackSocketDriver(java.lang.String loginName)
This constructor is called when the callback shall be delivered by a separate SOCKET connection which we open here (in initialize())

Method Detail

getName

public java.lang.String getName()
Description copied from interface: I_CallbackDriver
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:
"SOCKET"

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:
"server.mars.univers:6701"

init

public void init(Global glob,
                 CallbackAddress callbackAddress)
          throws XmlBlasterException
Description copied from interface: I_CallbackDriver
Intialize the driver.

Specified by:
init in interface I_CallbackDriver
callbackAddress - Contains the callback address, e.g. the stringified CORBA callback handle of the client or his email address.
Throws:
XmlBlasterException

sendUpdate

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

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'/>  <!-- Client processing state OK | ERROR ... see Constants.java -->
  </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).

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

getProgressListener

final I_ProgressListener getProgressListener()

shutdown

public void shutdown()
I_Plugin.shutdown()

Specified by:
shutdown in interface I_Plugin

shutdown

private void shutdown(boolean delayed)

isAlive

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

getPluginInfo

public PluginInfo getPluginInfo()
Returns:
the pluginInfo: Always null as we are loaded dynamically!

getCallbackAddress

public CallbackAddress getCallbackAddress()
Returns:
the callbackAddress

getMsgInfoParserClassName

public java.lang.String getMsgInfoParserClassName()
Which parser to use. The SOCKET protocol uses as a default setting the XbfParser

Returns:
The class name of the parser, "org.xmlBlaster.util.xbformat.XbfParser"

getHandler

public SocketExecutor getHandler()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.