xmlBlaster 2.1.0 API

org.xmlBlaster.engine.dispatch
Class CbDispatchConnection

java.lang.Object
  extended by org.xmlBlaster.util.dispatch.DispatchConnection
      extended by org.xmlBlaster.engine.dispatch.CbDispatchConnection
All Implemented Interfaces:
I_Timeout

public final class CbDispatchConnection
extends DispatchConnection

Holding all necessary infos to establish callback connections and invoke their update().

Author:
xmlBlaster@marcelruff.info, michele@laghi.eu
See Also:
DispatchConnection

Nested Class Summary
(package private)  class CbDispatchConnection.Holder
           
 
Field Summary
private  I_CallbackDriver cbDriver
           
private  java.lang.String cbKey
           
private static java.util.logging.Logger log
           
 java.lang.String ME
           
private  I_AdminSession session
           
private  SessionName sessionName
           
private  boolean useRemoteLoginAsTunnel
           
 
Fields inherited from class org.xmlBlaster.util.dispatch.DispatchConnection
address, connectionsHandler, glob, myId, physicalConnectionOk, PING_THREAD_NAME, previousBytesRead, previousBytesWritten, retryCounter, serverAcceptsRequests, state
 
Constructor Summary
CbDispatchConnection(Global glob, CbDispatchConnectionsHandler connectionsHandler, AddressBase address)
           
 
Method Summary
 void connectLowlevel()
          Connect on protocol layer and try an initial low level ping.
 java.lang.String doPing(java.lang.String data)
          Does the real ping to the remote server instance.
 void doSend(MsgQueueEntry[] msgArr_, boolean isAsyncMode)
          Send the messages back to the client.
private  void exportCrypt(java.util.ArrayList holderList, MethodName methodName)
          We export/encrypt the message (call the interceptor)
protected  boolean forcePingFailure()
           
 I_AdminSession getAdminSession()
           
 java.lang.String getDriverName()
          The name of the protocol driver
 java.lang.String getName()
           
 void loadPlugin()
          Load the appropriate protocol driver
protected  void reconnect()
          On reconnect polling try to establish the connection.
 I_ProgressListener registerProgressListener(I_ProgressListener listener)
          Should be overwritten by extending classes.
 void resetConnection()
          Nothing to do here
 void setAddress(AddressBase address)
           
 void shutdown(boolean delayed)
          Stop all callback drivers of this client.
 java.lang.String toString()
           
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class org.xmlBlaster.util.dispatch.DispatchConnection
finalize, getAddress, getState, handleTransition, initialize, isAlive, isConnectionWasDown, isDead, isPolling, isUndef, ping, ping, send, setConnectionWasDown, spanPingTimer, timeout
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

ME

public final java.lang.String ME

cbDriver

private I_CallbackDriver cbDriver

cbKey

private java.lang.String cbKey

session

private I_AdminSession session

sessionName

private SessionName sessionName

useRemoteLoginAsTunnel

private boolean useRemoteLoginAsTunnel
Constructor Detail

CbDispatchConnection

public CbDispatchConnection(Global glob,
                            CbDispatchConnectionsHandler connectionsHandler,
                            AddressBase address)
                     throws XmlBlasterException
Parameters:
connectionsHandler - The DevliveryConnectionsHandler witch i belong to
address - The address i shall connect to
Throws:
XmlBlasterException
Method Detail

getName

public final java.lang.String getName()
Specified by:
getName in class DispatchConnection
Returns:
A nice name for logging

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setAddress

public void setAddress(AddressBase address)
                throws XmlBlasterException
Overrides:
setAddress in class DispatchConnection
Throws:
XmlBlasterException

getDriverName

public final java.lang.String getDriverName()
The name of the protocol driver

Specified by:
getDriverName in class DispatchConnection

loadPlugin

public final void loadPlugin()
                      throws XmlBlasterException
Load the appropriate protocol driver

Specified by:
loadPlugin in class DispatchConnection
Throws:
XmlBlasterException

registerProgressListener

public I_ProgressListener registerProgressListener(I_ProgressListener listener)
Description copied from class: DispatchConnection
Should be overwritten by extending classes.

Specified by:
registerProgressListener in class DispatchConnection

connectLowlevel

public final void connectLowlevel()
                           throws XmlBlasterException
Description copied from class: DispatchConnection
Connect on protocol layer and try an initial low level ping.

Specified by:
connectLowlevel in class DispatchConnection
Throws:
XmlBlasterException - with ErrorCode.COMMUNICATION* if server is not reachable or other exceptions on other errors
See Also:
DispatchConnection.connectLowlevel()

exportCrypt

private void exportCrypt(java.util.ArrayList holderList,
                         MethodName methodName)
                  throws XmlBlasterException
We export/encrypt the message (call the interceptor)

Parameters:
holderList - list of Holder instances
methodName - UPDATE or UPDATE_ONEWAY
Throws:
XmlBlasterException

doSend

public void doSend(MsgQueueEntry[] msgArr_,
                   boolean isAsyncMode)
            throws XmlBlasterException
Send the messages back to the client.

Specified by:
doSend in class DispatchConnection
Parameters:
msgArr - Should be a copy of the original, since we export it which changes/encrypts the content

The RETURN value is transferred in the msgArr[i].getReturnObj(), for oneway updates it is null

Throws:
XmlBlasterException

doPing

public final java.lang.String doPing(java.lang.String data)
                              throws XmlBlasterException
Description copied from class: DispatchConnection
Does the real ping to the remote server instance.

Specified by:
doPing in class DispatchConnection
Parameters:
data - QoS, never null
Returns:
ping return QoS, never null
Throws:
XmlBlasterException
See Also:
DispatchConnection.doPing(String)

resetConnection

public final void resetConnection()
Nothing to do here

Specified by:
resetConnection in class DispatchConnection

reconnect

protected final void reconnect()
                        throws XmlBlasterException
On reconnect polling try to establish the connection.

Specified by:
reconnect in class DispatchConnection
Throws:
XmlBlasterException

shutdown

public final void shutdown(boolean delayed)
                    throws XmlBlasterException
Stop all callback drivers of this client.

Overrides:
shutdown in class DispatchConnection
Throws:
XmlBlasterException

toXml

public final java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Specified by:
toXml in class DispatchConnection
Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state as an XML ASCII string

getAdminSession

public I_AdminSession getAdminSession()

forcePingFailure

protected boolean forcePingFailure()
Specified by:
forcePingFailure in class DispatchConnection
Returns:
true if the implementation has to throw an exception in case the ping is invoked when there is an ongoing write or read operation on the same connection. Normally it shall give false on the callback and true on the client side. The client side shall give true because otherwise if such a situation arizes it will never go in polling and no reconnect will be triggered.

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.