|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.client.protocol.socket.SocketConnection
public class SocketConnection
This driver establishes exactly one connection to xmlBlaster-Server and uses this socket for asynchronous callbacks as well. This way we don't need to setup a callbackserver.
This "SOCKET:" driver needs to be registered in xmlBlaster.properties and will be started on xmlBlaster startup:ClientProtocolPlugin[SOCKET][1.0]=org.xmlBlaster.client.protocol.socket.SocketConnectionAll adjustable parameters are explained in
usage()
Field Summary | |
---|---|
private I_CallbackExtended |
cbClient
|
protected SocketCallbackImpl |
cbReceiver
SocketCallbackImpl listens on socket to receive callbacks |
protected Address |
clientAddress
|
private Global |
glob
|
private SocketUrl |
localSocketUrl
The info object holding hostname and port on this side |
private static java.util.logging.Logger |
log
|
protected java.lang.String |
loginName
|
private java.lang.String |
ME
|
private PluginInfo |
pluginInfo
|
protected java.lang.String |
sessionId
The unique client sessionId |
protected java.net.Socket |
sock
The socket connection to/from one client |
private SocketUrl |
socketUrl
The info object holding hostname and port on the other side |
private I_ProgressListener |
tmpProgressListener
Placeholder for the progess listener in case the registration happens before the cbReceiver has been registered |
(package private) boolean |
useRemoteLoginAsTunnel
Cluster node re-uses conection from remote node |
private boolean |
useUdpForOneway
Setting by plugin configuration, see xmlBlaster.properties, for example ClientProtocolPlugin[SOCKET_UDP][1.0]=org.xmlBlaster.client.protocol.socket.SocketConnection,useUdpForOneway=true |
Constructor Summary | |
---|---|
SocketConnection()
Called by plugin loader which calls init(Global, PluginInfo) thereafter. |
|
SocketConnection(Global glob)
Connect to xmlBlaster using plain socket with native message format. |
|
SocketConnection(Global glob,
java.applet.Applet ap)
Connect to xmlBlaster using plain socket messaging. |
Method Summary | |
---|---|
java.lang.String |
connect(java.lang.String connectQos)
Login to the server. |
void |
connectLowlevel(Address address)
Connects to xmlBlaster with one socket connection. |
boolean |
disconnect(java.lang.String qos)
Does a logout and removes the callback server. |
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. |
private SocketExecutor |
getCbReceiver()
Access handle of callback server. |
(package private) Global |
getGlobal()
|
SocketUrl |
getLocalSocketUrl()
A string with the local address and port (the client side). |
java.lang.String |
getLocalSocketUrlStr()
A string with the local address and port (the client side). |
java.lang.String |
getLoginName()
|
java.lang.String |
getProtocol()
Returns the protocol type. |
java.net.Socket |
getSocket()
Get the raw socket handle |
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 |
isConnected()
|
boolean |
isLoggedIn()
|
java.lang.String |
ping(java.lang.String qos)
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. |
(package private) void |
registerCbReceiver(SocketCallbackImpl cbReceiver)
Called by SocketCallbackImpl on creation |
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 the callback server. |
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()
Dump of the state, remove in future. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump of the state, 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 |
---|
private java.lang.String ME
private Global glob
private static java.util.logging.Logger log
private SocketUrl socketUrl
private SocketUrl localSocketUrl
protected java.net.Socket sock
protected SocketCallbackImpl cbReceiver
protected java.lang.String sessionId
protected java.lang.String loginName
protected Address clientAddress
private I_CallbackExtended cbClient
private PluginInfo pluginInfo
private boolean useUdpForOneway
private I_ProgressListener tmpProgressListener
boolean useRemoteLoginAsTunnel
Constructor Detail |
---|
public SocketConnection()
public SocketConnection(Global glob) throws XmlBlasterException
XmlBlasterException
public SocketConnection(Global glob, java.applet.Applet ap) throws XmlBlasterException
XmlBlasterException
Method Detail |
---|
public java.lang.String getLoginName()
public java.lang.String getType()
getType
in interface I_Plugin
public java.lang.String getVersion()
getVersion
in interface I_Plugin
public void init(Global glob, PluginInfo pluginInfo) throws XmlBlasterException
init
in interface I_Plugin
XmlBlasterException
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
public java.net.Socket getSocket() throws XmlBlasterException
XmlBlasterException
final Global getGlobal()
public void connectLowlevel(Address address) throws XmlBlasterException
connectLowlevel
in interface I_XmlBlasterConnection
address
- Contains the remote address,
e.g. the host and port where the remote server listens
XmlBlasterException
- ErrorCode.COMMUNICATION* if the server is not reachable,
in this case we can poll for the server.I_XmlBlasterConnection.connectLowlevel(Address)
public void resetConnection()
resetConnection
in interface I_XmlBlasterConnection
public SocketUrl getLocalSocketUrl()
public java.lang.String getLocalSocketUrlStr()
public void setConnectReturnQos(ConnectReturnQos connectReturnQos)
I_XmlBlasterConnection
setConnectReturnQos
in interface I_XmlBlasterConnection
I_XmlBlasterConnection.setConnectReturnQos(ConnectReturnQos)
public java.lang.String connect(java.lang.String connectQos) throws XmlBlasterException
connect
in interface I_XmlBlasterConnection
connectQos
- The encrypted connect QoS
XmlBlasterException
- if login failspublic final java.lang.String getProtocol()
getProtocol
in interface I_XmlBlasterConnection
public boolean disconnect(java.lang.String qos) throws XmlBlasterException
disconnect
in interface I_XmlBlasterConnection
sessionId
- The client sessionId
XmlBlasterException
public void shutdown() throws XmlBlasterException
shutdown
in interface I_XmlBlasterConnection
shutdown
in interface I_Plugin
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.public final boolean isLoggedIn()
isLoggedIn
in interface I_XmlBlasterConnection
public final boolean isConnected()
final void registerCbReceiver(SocketCallbackImpl cbReceiver)
private final SocketExecutor getCbReceiver()
public final java.lang.String subscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal) throws XmlBlasterException
subscribe
in interface I_XmlBlasterConnection
XmlBlasterException
public final java.lang.String[] unSubscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal) throws XmlBlasterException
unSubscribe
in interface I_XmlBlasterConnection
XmlBlasterException
public final java.lang.String publish(MsgUnitRaw msgUnit) throws XmlBlasterException
publish
in interface I_XmlBlasterConnection
XmlBlasterException
public final java.lang.String[] publishArr(MsgUnitRaw[] msgUnitArr) throws XmlBlasterException
publishArr
in interface I_XmlBlasterConnection
XmlBlasterException
public final void publishOneway(MsgUnitRaw[] msgUnitArr) throws XmlBlasterException
publishOneway
in interface I_XmlBlasterConnection
XmlBlasterException
public final java.lang.String[] erase(java.lang.String xmlKey_literal, java.lang.String qos_literal) throws XmlBlasterException
erase
in interface I_XmlBlasterConnection
XmlBlasterException
public final MsgUnitRaw[] get(java.lang.String xmlKey_literal, java.lang.String qos_literal) throws XmlBlasterException
get
in interface I_XmlBlasterConnection
XmlBlasterException
public java.lang.String ping(java.lang.String qos) throws XmlBlasterException
ping
in interface I_XmlBlasterConnection
XmlBlasterException
public java.lang.String toXml() throws XmlBlasterException
XmlBlasterException
public java.lang.String toXml(java.lang.String extraOffset) throws XmlBlasterException
XmlBlasterException
public I_ProgressListener registerProgressListener(I_ProgressListener listener)
registerProgressListener
in interface I_XmlBlasterConnection
listener
- Your listener, pass 0 to unregister.
public static java.lang.String usage()
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |