xmlBlaster 2.2.0 API

org.xmlBlaster.client.protocol.socket
Class SocketCallbackImpl

java.lang.Object
  extended by org.xmlBlaster.util.protocol.RequestReplyExecutor
      extended by org.xmlBlaster.util.protocol.socket.SocketExecutor
          extended by org.xmlBlaster.client.protocol.socket.SocketCallbackImpl
All Implemented Interfaces:
java.lang.Runnable, I_CallbackServer, I_AdminPlugin, I_AdminUsage, I_Plugin, RequestReplyExecutorMBean, SocketExecutorMBean

public class SocketCallbackImpl
extends SocketExecutor
implements java.lang.Runnable, I_CallbackServer

Used for client to receive xmlBlaster callbacks over plain sockets.

One instance of this for each client, as a separate thread blocking on the socket input stream waiting for messages from xmlBlaster.

Author:
Marcel Ruff.
See Also:
MsgInfo, The protocol.socket requirement

Field Summary
private  boolean acceptRemoteLoginAsTunnel
           
private  I_Authenticate authenticateCore
           
private  CallbackAddress callbackAddress
           
private  java.lang.Thread callbackListenerThread
           
private  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  PluginInfo pluginInfo
           
private  SocketExecutor remoteLoginAsTunnelSocketExecutor
           
private  java.lang.String secretSessionId
           
protected  java.net.Socket sock
          The socket connection to/from one client
private  SocketConnection sockCon
          The connection manager 'singleton'
private  SocketUrl socketUrl
          A unique name for this client socket
private  boolean threadRunning
          Stop the thread
private  boolean useRemoteLoginAsTunnel
          For cluster environment only
 
Fields inherited from class org.xmlBlaster.util.protocol.socket.SocketExecutor
iStream, loginName, maxChunkSize, msgInfoParserClassName, oStream, running, soLingerTimeout, soTimeout
 
Fields inherited from class org.xmlBlaster.util.protocol.RequestReplyExecutor
addressConfig, addressServer, cbClient, compressZlib, compressZlibStream, contextNode, mbeanHandle, minSizeForCompression, ONEWAY, pingResponseTimeout, prefix, progressListener, responseListenerMap, responseTimeout, updateResponseTimeout, useEmailExpiryTimestamp, WAIT_ON_RESPONSE
 
Constructor Summary
SocketCallbackImpl()
          Called by plugin loader which calls init(Global, PluginInfo) thereafter.
 
Method Summary
 I_Authenticate getAuthenticateCore()
           
 java.lang.String getCbAddress()
          Returns the callback address.
 java.lang.String getCbProtocol()
          Returns the protocol type.
(package private)  SocketConnection getSocketConnection()
           
 SocketExecutor getSocketExecutor()
           
 java.lang.String getType()
          Enforced by I_Plugin
 java.lang.String getVersion()
          Enforced by I_Plugin
protected  boolean hasConnection()
           
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 void initialize(Global glob, java.lang.String loginName, CallbackAddress callbackAddress, I_CallbackExtended cbClient)
          Initialize and start the callback server A thread receiving all messages from xmlBlaster, and delivering them back to the client code.
 void run()
          Starts the callback thread
 void setAuthenticateCore(I_Authenticate authenticateImpl)
           
 void setRunning(boolean run)
           
 void shutdown()
          Shutdown callback only.
 void shutdownSocket()
          Shutdown SOCKET connection and callback Called by SocketConnection.shutdown() on problems
 
Methods inherited from class org.xmlBlaster.util.protocol.socket.SocketExecutor
getCbMsgInfoParserClassName, getGlobalKey, getInputStream, getMsgInfoParserClassName, getOutputStream, getSoLingerTimeout, getSoTimeout, getUsageUrl, initialize, ping, sendMessage, sendUpdate, setLoginName, setSoLingerTimeout, setSoTimeout, setUsageUrl, usage, useUdpForOneway
 
Methods inherited from class org.xmlBlaster.util.protocol.RequestReplyExecutor
addResponseListener, clearResponseListenerMap, executeException, executeResponse, freePendingThreads, getAddressServer, getCbClient, getDefaultPingResponseTimeout, getDefaultResponseTimeout, getDefaultUpdateResponseTimeout, getExpiryTimestamp, getMinSizeForCompression, getPendingRequestList, getPingResponseTimeout, getProgressListener, getResponseListener, getResponseTimeout, getResponseTimeout, getResponseTimeout, getResponseTimeoutPropertyName, getUpdateResponseTimeout, getXmlBlasterCore, initialize, initializeCb, interruptInvocation, isCompressZlib, isCompressZlibStream, isShutdown, isShutdownCompletly, isUseEmailExpiryTimestamp, receiveReply, registerProgressListener, removeResponseListener, requestAndBlockForReply, setCbClient, setCompressZlib, setCompressZlibStream, setMinSizeForCompression, setPingResponseTimeout, setResponseTimeout, setUpdateResponseTimeout, setUseEmailExpiryTimestamp, setXmlBlasterCore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmlBlaster.util.protocol.RequestReplyExecutorMBean
getMinSizeForCompression, getPingResponseTimeout, getResponseTimeout, getResponseTimeout, getUpdateResponseTimeout, interruptInvocation, isCompressZlib, isCompressZlibStream, isUseEmailExpiryTimestamp, setCompressZlib, setCompressZlibStream, setMinSizeForCompression, setPingResponseTimeout, setResponseTimeout, setUpdateResponseTimeout, setUseEmailExpiryTimestamp
 
Methods inherited from interface org.xmlBlaster.util.admin.I_AdminPlugin
isShutdown
 

Field Detail

ME

private java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

sockCon

private SocketConnection sockCon
The connection manager 'singleton'


socketUrl

private SocketUrl socketUrl
A unique name for this client socket


callbackAddress

private CallbackAddress callbackAddress

pluginInfo

private PluginInfo pluginInfo

sock

protected java.net.Socket sock
The socket connection to/from one client


threadRunning

private boolean threadRunning
Stop the thread


useRemoteLoginAsTunnel

private boolean useRemoteLoginAsTunnel
For cluster environment only


remoteLoginAsTunnelSocketExecutor

private SocketExecutor remoteLoginAsTunnelSocketExecutor

acceptRemoteLoginAsTunnel

private boolean acceptRemoteLoginAsTunnel

secretSessionId

private java.lang.String secretSessionId

authenticateCore

private I_Authenticate authenticateCore

callbackListenerThread

private java.lang.Thread callbackListenerThread
Constructor Detail

SocketCallbackImpl

public SocketCallbackImpl()
Called by plugin loader which calls init(Global, PluginInfo) thereafter. A thread receiving all messages from xmlBlaster, and delivering them back to the client code.

After polling -> alive NO new instance is created, but only initialize() is called

Method Detail

getType

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

Specified by:
getType in interface I_AdminPlugin
Specified by:
getType in interface I_Plugin
Specified by:
getType in class RequestReplyExecutor
Returns:
"SOCKET" or "EMAIL", never null

getVersion

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

Specified by:
getVersion in interface I_AdminPlugin
Specified by:
getVersion in interface I_Plugin
Overrides:
getVersion in class SocketExecutor
Returns:
For example "1.0"

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)

setRunning

public void setRunning(boolean run)
Overrides:
setRunning in class SocketExecutor

getSocketExecutor

public SocketExecutor getSocketExecutor()

initialize

public final void initialize(Global glob,
                             java.lang.String loginName,
                             CallbackAddress callbackAddress,
                             I_CallbackExtended cbClient)
                      throws XmlBlasterException
Initialize and start the callback server A thread receiving all messages from xmlBlaster, and delivering them back to the client code.

Same SocketCallback instance is called several times by SocketConnection.connectLowLevel() (on polling->alive)

Specified by:
initialize in interface I_CallbackServer
Parameters:
glob - The global handle with your environment settings
loginName - The login name of the client, for logging only
callbackAddress - The address configuration of this callback server
cbClient - Your implementation to receive the callback messages from xmlBlaster
Throws:
XmlBlasterException

hasConnection

protected boolean hasConnection()
Overrides:
hasConnection in class RequestReplyExecutor

getCbProtocol

public final java.lang.String getCbProtocol()
Returns the protocol type.

Specified by:
getCbProtocol in interface I_CallbackServer
Returns:
The configured [type] in xmlBlaster.properties, defaults to "SOCKET"

getCbAddress

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

This is no listen socket, as we need no callback server. It is just the client side socket data of the established connection to xmlBlaster.

Specified by:
getCbAddress in interface I_CallbackServer
Returns:
"socket://192.168.2.1:34520"
Throws:
XmlBlasterException

run

public void run()
Starts the callback thread

Specified by:
run in interface java.lang.Runnable

getSocketConnection

final SocketConnection getSocketConnection()

shutdown

public void shutdown()
Shutdown callback only.

Specified by:
shutdown in interface I_CallbackServer
Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
Overrides:
shutdown in class SocketExecutor

shutdownSocket

public void shutdownSocket()
Shutdown SOCKET connection and callback Called by SocketConnection.shutdown() on problems


getAuthenticateCore

public I_Authenticate getAuthenticateCore()

setAuthenticateCore

public void setAuthenticateCore(I_Authenticate authenticateImpl)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.