xmlBlaster 2.2.0 client API

org.xmlBlaster.client.protocol.xmlrpc
Class XmlRpcCallbackServer

java.lang.Object
  extended by org.xmlBlaster.client.protocol.xmlrpc.XmlRpcCallbackServer
All Implemented Interfaces:
I_CallbackServer, I_Plugin

public class XmlRpcCallbackServer
extends java.lang.Object
implements I_CallbackServer

Example for a XmlRpc callback implementation.

You can use this default callback handling with your clients, but if you need other handling of callbacks, take a copy of this Callback implementation and add your own code.

The xmlBlaster callback client call the update() from XmlRpcCallbackImpl which delegates it to this update() method.

     -dispatch/callback/plugin/xmlrpc/port    Specify a port number where xmlrpc callback webserver listens.
                         Default is port 8081, the port 0 switches this feature off.
     -dispatch/callback/plugin/xmlrpc/hostname  Specify a hostname where xmlrp callback server runs.
                         Default is the localhost.
 
If the callback server can't be established because of the port is not free, this driver loops and tries with a port number one higher until it finds a free port to listen for callbacks.
The correct port is automatically transferred in the login - QoS - so that xmlBlaster can find the callback server.

Author:
Michele Laghi, Marcel Ruff.

Field Summary
 CallbackAddress callbackAddress
           
static int DEFAULT_CALLBACK_PORT
          XmlBlaster XMLRPC callback web server listen port is 8081
protected  PluginInfo pluginInfo
           
 
Constructor Summary
XmlRpcCallbackServer()
          You must call initialize after constructing me
 
Method Summary
 java.lang.String getCbAddress()
          Returns the current callback address.
 java.lang.String getCbProtocol()
          Returns the 'well known' protocol type.
 java.lang.String getType()
          Enforced by I_Plugin
 java.lang.String getVersion()
          Enforced by I_Plugin
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 void initialize(Global glob, java.lang.String name, CallbackAddress callbackAddress, I_CallbackExtended client)
          Construct a persistently named object.
 java.lang.String ping(java.lang.String str)
          Ping to check if the callback server is alive.
 void postInitialize()
           
 void shutdown()
          Shutdown the callback server.
 java.lang.String update(java.lang.String cbSessionId, java.lang.String updateKey, byte[] content, java.lang.String updateQos)
          The update method.
 void updateOneway(java.lang.String cbSessionId, java.lang.String updateKey, byte[] content, java.lang.String updateQos)
          The 'oneway' update method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CALLBACK_PORT

public static final int DEFAULT_CALLBACK_PORT
XmlBlaster XMLRPC callback web server listen port is 8081

See Also:
Constant Field Values

callbackAddress

public CallbackAddress callbackAddress

pluginInfo

protected PluginInfo pluginInfo
Constructor Detail

XmlRpcCallbackServer

public XmlRpcCallbackServer()
You must call initialize after constructing me

Method Detail

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)

initialize

public void initialize(Global glob,
                       java.lang.String name,
                       CallbackAddress callbackAddress,
                       I_CallbackExtended client)
                throws XmlBlasterException
Construct a persistently named object.

Specified by:
initialize in interface I_CallbackServer
Parameters:
client - Your implementation of I_CallbackExtended, or null if you don't want any updates.
glob - The global handle with your environment settings
name - The login name of the client, for logging only
callbackAddress - The address configuration of this callback server
Throws:
XmlBlasterException

postInitialize

public void postInitialize()
                    throws XmlBlasterException
Throws:
XmlBlasterException

getCbProtocol

public java.lang.String getCbProtocol()
Returns the 'well known' protocol type.

Specified by:
getCbProtocol in interface I_CallbackServer
Returns:
"XMLRPC"

getCbAddress

public java.lang.String getCbAddress()
                              throws XmlBlasterException
Returns the current callback address.

Specified by:
getCbAddress in interface I_CallbackServer
Returns:
Something like "http://myserver.com:8081/"
Throws:
XmlBlasterException

shutdown

public void shutdown()
Shutdown the callback server.

Specified by:
shutdown in interface I_CallbackServer
Specified by:
shutdown in interface I_Plugin

update

public java.lang.String update(java.lang.String cbSessionId,
                               java.lang.String updateKey,
                               byte[] content,
                               java.lang.String updateQos)
                        throws XmlBlasterException
The update method.

Gets invoked from XmlRpcCallbackImpl.java (which was called by xmlBlaster)

Throws:
XmlBlasterException

updateOneway

public void updateOneway(java.lang.String cbSessionId,
                         java.lang.String updateKey,
                         byte[] content,
                         java.lang.String updateQos)
The 'oneway' update method.

oneway is not natively supported by XmlRpc

Gets invoked from XmlRpcCallbackImpl.java (which was called by xmlBlaster)


ping

public java.lang.String ping(java.lang.String str)
Ping to check if the callback server is alive.

See Also:
I_CallbackDriver.ping(String)

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.