xmlBlaster 2.2.0 client API

org.xmlBlaster.client.protocol.local
Class LocalConnection

java.lang.Object
  extended by org.xmlBlaster.client.protocol.local.LocalConnection
All Implemented Interfaces:
I_XmlBlasterConnection, I_Plugin

public class LocalConnection
extends java.lang.Object
implements I_XmlBlasterConnection

A local connections.

This driver may be used to get in vm direct calls into XmlBlaster. Some sutiations this may be used is to write a plgin for the client that gets started in the standalone XmlBlaster, or to be used when XMlBlaster is access in the same embedded anvironment, such as JBoss.

There is one very important requirement for this to work: The client that gets the XmlBlasterAccess from wich this driver is instantiated MUST have access to the serverside engine.Global singleton, it MUST use a cloned Global for each connection that contains the engine.Global in the cloned globals objectEntry at key: ServerNodeScope.

Author:
Michele Laghi, Marcel Ruff., Peter Antman.
See Also:
LocalCallbackImpl, org.xmlBlaster.protocol.local.CallbackLocalDriver

Field Summary
protected  Address clientAddress
           
protected  ConnectReturnQos connectReturnQos
           
 
Constructor Summary
LocalConnection()
          Called by plugin loader which calls init(Global, PluginInfo) thereafter.
 
Method Summary
 java.lang.String connect(java.lang.String connectQos)
          Login to the server.
 void connectLowlevel(Address address)
          Initialize the driver and verify if the remote side is reachable on the low-level protocol layer.
 boolean disconnect(java.lang.String disconnectQos)
          Does a logout.
 java.lang.String[] erase(java.lang.String xmlKey_literal, java.lang.String qos_literal)
          Delete messages.
 MsgUnitRaw[] get(java.lang.String xmlKey_literal, java.lang.String qos_literal)
          Synchronous access a message.
 java.lang.String getProtocol()
           
 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).
 boolean isLoggedIn()
           
 java.lang.String ping(java.lang.String str)
          Check server.
 java.lang.String publish(MsgUnitRaw msgUnit)
          Publish a message.
 java.lang.String[] publishArr(MsgUnitRaw[] msgUnitArr)
          Publish multiple messages in one sweep.
 void publishOneway(MsgUnitRaw[] msgUnitArr)
          Publish multiple messages in one sweep.
 I_ProgressListener registerProgressListener(I_ProgressListener listener)
          Register a listener for to receive information about the progress of incoming data.
 void resetConnection()
          Reset the driver on problems.
 void setConnectReturnQos(ConnectReturnQos connectReturnQos)
          Pass the driver the decrypted and parsed ConnectReturnQos directly after a connect.
 void shutdown()
          Shut down.
 java.lang.String subscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal)
          Enforced by I_XmlBlasterConnection interface (failsafe mode).
 java.lang.String toXml()
           
 java.lang.String toXml(java.lang.String extraOffset)
          Dump of the server, remove in future.
 java.lang.String[] unSubscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal)
          Unsubscribe from messages.
static 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

connectReturnQos

protected ConnectReturnQos connectReturnQos

clientAddress

protected Address clientAddress
Constructor Detail

LocalConnection

public LocalConnection()
Called by plugin loader which calls init(Global, PluginInfo) thereafter.

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)
          throws XmlBlasterException
This method is called by the PluginManager (enforced by I_Plugin).

The given global must contain the serverside org.xmlBlaster.engine.Global in its ObjectEntry "ServerNodeScope"

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

getProtocol

public final java.lang.String getProtocol()
Specified by:
getProtocol in interface I_XmlBlasterConnection
Returns:
The connection protocol name "LOCAL"

connectLowlevel

public void connectLowlevel(Address address)
                     throws XmlBlasterException
Description copied from interface: I_XmlBlasterConnection
Initialize the driver and verify if the remote side is reachable on the low-level protocol layer. Calling this method multiple times will do noting if a low level connection is available.

Specified by:
connectLowlevel in interface I_XmlBlasterConnection
Parameters:
address - Contains the remote address, e.g. the host and port where the remote server listens
Throws:
XmlBlasterException - ErrorCode.COMMUNICATION* if the server is not reachable, in this case we can poll for the server.
Other errors if for example a malformed address is passed, in this case we stop and give up.
See Also:
I_XmlBlasterConnection.connectLowlevel(Address)

resetConnection

public void resetConnection()
Description copied from interface: I_XmlBlasterConnection
Reset the driver on problems. This method is called by the dispatcher framework on transition to POLLING, the protocol plugin must be able to establish a new connection after this call with a call to connectLowLevel().

Specified by:
resetConnection in interface I_XmlBlasterConnection

connect

public java.lang.String connect(java.lang.String connectQos)
                         throws XmlBlasterException
Login to the server.

Specified by:
connect in interface I_XmlBlasterConnection
Parameters:
connectQos - The encrypted connect QoS
Returns:
ConnectReturnQos XML string
Throws:
XmlBlasterException - if login fails

setConnectReturnQos

public void setConnectReturnQos(ConnectReturnQos connectReturnQos)
Description copied from interface: I_XmlBlasterConnection
Pass the driver the decrypted and parsed ConnectReturnQos directly after a connect. Some driver take the secretSessionId from it or a returned remote address

Specified by:
setConnectReturnQos in interface I_XmlBlasterConnection
See Also:
I_XmlBlasterConnection.setConnectReturnQos(ConnectReturnQos)

disconnect

public boolean disconnect(java.lang.String disconnectQos)
Does a logout.

Specified by:
disconnect in interface I_XmlBlasterConnection
Parameters:
sessionId - The client sessionId

shutdown

public void shutdown()
              throws XmlBlasterException
Shut down. Is called by logout()

Specified by:
shutdown in interface I_XmlBlasterConnection
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.


isLoggedIn

public boolean isLoggedIn()
Specified by:
isLoggedIn in interface I_XmlBlasterConnection
Returns:
true if you are logged in

subscribe

public final java.lang.String subscribe(java.lang.String xmlKey_literal,
                                        java.lang.String qos_literal)
                                 throws XmlBlasterException
Enforced by I_XmlBlasterConnection interface (failsafe mode). Subscribe to messages.

Specified by:
subscribe in interface I_XmlBlasterConnection
Throws:
XmlBlasterException

unSubscribe

public final java.lang.String[] unSubscribe(java.lang.String xmlKey_literal,
                                            java.lang.String qos_literal)
                                     throws XmlBlasterException
Unsubscribe from messages.

Specified by:
unSubscribe in interface I_XmlBlasterConnection
Throws:
XmlBlasterException
See Also:
RequestBroker

publish

public final java.lang.String publish(MsgUnitRaw msgUnit)
                               throws XmlBlasterException
Publish a message.

Specified by:
publish in interface I_XmlBlasterConnection
Throws:
XmlBlasterException

publishArr

public final java.lang.String[] publishArr(MsgUnitRaw[] msgUnitArr)
                                    throws XmlBlasterException
Publish multiple messages in one sweep.

Specified by:
publishArr in interface I_XmlBlasterConnection
Throws:
XmlBlasterException
See Also:
RequestBroker

publishOneway

public final void publishOneway(MsgUnitRaw[] msgUnitArr)
                         throws XmlBlasterException
Publish multiple messages in one sweep.

Specified by:
publishOneway in interface I_XmlBlasterConnection
Throws:
XmlBlasterException
See Also:
RequestBroker

erase

public final java.lang.String[] erase(java.lang.String xmlKey_literal,
                                      java.lang.String qos_literal)
                               throws XmlBlasterException
Delete messages.

Specified by:
erase in interface I_XmlBlasterConnection
Throws:
XmlBlasterException
See Also:
RequestBroker

get

public final MsgUnitRaw[] get(java.lang.String xmlKey_literal,
                              java.lang.String qos_literal)
                       throws XmlBlasterException
Synchronous access a message.

Specified by:
get in interface I_XmlBlasterConnection
Throws:
XmlBlasterException
See Also:
RequestBroker

ping

public java.lang.String ping(java.lang.String str)
                      throws XmlBlasterException
Check server.

Specified by:
ping in interface I_XmlBlasterConnection
Returns:
The StatusQosData string
Throws:
XmlBlasterException
See Also:
CORBA xmlBlaster.idl

toXml

public java.lang.String toXml()
                       throws XmlBlasterException
Throws:
XmlBlasterException

toXml

public java.lang.String toXml(java.lang.String extraOffset)
                       throws XmlBlasterException
Dump of the server, remove in future.

Throws:
XmlBlasterException

registerProgressListener

public I_ProgressListener registerProgressListener(I_ProgressListener listener)
Register a listener for to receive information about the progress of incoming data. Only one listener is supported, the last call overwrites older calls. This implementation does nothing here, it just returns null.

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

usage

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

These variables may be set in xmlBlaster.properties as well. Don't use the "-" prefix there.


xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.