IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.event
Class CSServer

java.lang.Object
  extended bycom.ibm.btt.event.CSServer
All Implemented Interfaces:
ChannelSessionStateChangedListener, CSServerService, java.util.EventListener, Notifier

public class CSServer
extends java.lang.Object
implements CSServerService, ChannelSessionStateChangedListener

The CSServer class implements the C/S service on the server side.


Field Summary
protected  CSInactivityClientListener aCSInactivityClientListener
          Contains the listeners of the CSInactivityClientEvent events.
protected  CSNotificationListener aCSNotificationListener
          Contains the listeners of the CSNotificationEvent events.
static int INITIATED
          Flag indicating that the server is initiated.
protected static java.lang.Boolean sessionAffinity
          Attribute indicating whether this PERSISTENCE server configuration is supposed to work with affinity.
protected static java.lang.Boolean sessionPersistence
          Attribute indicating whether this server configuration is supposed to persist sessions or not.
static int STOPPED
          Flag indicating that the server is stopped.
static java.util.Hashtable synchronizedEvents
          Contains information about clients who are waiting for events.
protected static CSServer uniqueInstance
           
 
Fields inherited from interface com.ibm.btt.event.CSServerService
CS_INACTIVITY_CLIENT_EVENT, CS_SESSION_EXPIRED
 
Method Summary
 void addCSInactivityClientListener(CSInactivityClientListener newListener)
          Adds the specified CSInactivityClientListener to recieve CSInactivityClientEvents from this class.
 void addCSNotificationListener(CSNotificationListener newListener)
          Adds the specified CSNotificationListener to recieve CSNotificationEvents from this class.
 void addHandler(Handler aHandler, java.lang.String anEventName)
           
 void finalize()
          In the finalize method, if the server is running it is stopped.
 void fireAndSignalCSInactivityClientEvent(CSInactivityClientEvent anEvent, java.lang.String eventName)
          Method to support listener events.
 void fireHandleCSInactivityClientEvent(CSInactivityClientEvent event)
          Method to support listener events.
 void fireHandleCSNotificationEvent(CSNotificationEvent event)
          Supports listener events.
 long getAppSessionTimeout()
          Gets the appSessionTimeout.
 java.util.Hashtable getHandlersList()
           
 long getInactivityClientTimeout()
          Returns the value of the inactivityClientTimeout property.
static CSServer getInstance()
          Returns the unique instance of running on the application environment.
 long getMinTimeStamp()
          Returns the value of the minTimeStamp property.
 java.lang.String getName()
          Returns the name attribute value.
 NotificationEventsBuffer getNotificationEventsBuffer()
          Gets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.
 long getOutputTimeout()
          Gets the outputTimeout property (long) value.
 boolean getPermanentConnectionForEvents()
          Obtains the permanentConnectionForEvents attribute.
 long getPersistTimeout()
          Gets the persistTimeout property (long) value.
 java.lang.String getRootDirectory()
          Gets the _rootDirectory property (String) value.
 long getServerId()
          Gets the serverId property (long) value.
 int getServerStatus()
          Gets the _serverStatus property (int) value.
 java.util.Hashtable getSynchronizedEvents()
          Returns information about clients who are waiting for events
 long getTimeBetweenSessionCheck()
          Returns the value of the timeBetweenSessionCheck property.
protected static void initializePersistence()
          Updates the static attributes of CSServer sessionPersistence and sessionAffinity.
 void initiateServer()
          Initiates the server.
 boolean isSessionAffinity()
          Returns the value of the attribute sessionAffinity.
 boolean isSessionPersistence()
          Returns the value of the attribute sessionPersistence.
 void readExternal()
          Reads external settings from the property file.
 void removeCSInactivityClientListener(CSInactivityClientListener newListener)
          Removes the specified CSInactivityClientListener so that it no longer receives CSInactivityClientEvents from this class.
 void removeCSNotificationListener(CSNotificationListener newListener)
          Removes the specified CSNotificationListener so that it no longer receives CSNotificationEvents from this class.
 void removeHandler(Handler aHandler, java.lang.String anEventName)
           
 void sendEvent(java.lang.String ws, java.util.EventObject anEvent)
          Sends an event from server to the specified client workstation
 void sendEvent(java.lang.String ws, java.util.EventObject anEvent, boolean waitForDelivery)
          Sends an event from server to the specified client workstation If "waitForDelivery" is true, an exception is thrown if a problem occurs during the connection made to send the event.
 void sendEvent(java.lang.String ipAddress, int eventsPort, java.util.EventObject anEvent, boolean waitForDelivery)
          Sends an event from server to the specified ipAddress and port.
 void sessionAdded(ChannelSessionStateChangedEvent anEvent)
          sessionAdded method comment.
 void sessionRemoved(ChannelSessionStateChangedEvent anEvent)
          Fire and signal the inactivity timeout for the application to perform any necessary house keeping
 void setAppSessionTimeout(long appSessionTimeout)
          Sets the appSessionTimeout
 void setInactivityClientTimeout(long value)
          Sets the value of the inactivityClientTimeout property.
 void setMinTimeStamp(long value)
          Sets the value of the minTimeStamp property.
 void setName(java.lang.String aName)
          Sets the name attribute to aName.
 void setNotificationEventsBuffer(NotificationEventsBuffer buffer)
          Sets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.
 void setOutputTimeout(long aOutputTimeout)
          Sets the outputTimeout property (long) value.
 void setPermanentConnectionForEvents(boolean permConnection)
          Sets the permanentConnectionForEvents attribute.
 void setPersistTimeout(long aPersistTimeout)
          Sets the persistTimeout property (long) value.
 void setRootDirectory(java.lang.String rootDirectory)
          Sets the _rootDirectory property (java.lang.String) value.
static void setSessionAffinity(boolean newSessionAffinity)
          Updates the sessionAffinity attribute.
static void setSessionPersistence(boolean newSessionPersistence)
          Updates the sessionPersistence attribute.
 void setTimeBetweenSessionCheck(long value)
          Sets the value of the timeBetweenSessionCheck property.
 void signalEvent(java.lang.String anEventName)
          This method is to fire the event.
 void signalEvent(java.lang.String anEventName, java.util.Hashtable aParametersTable)
          This method is to fire the event.
 void stopServer()
          Stops the server.
 void terminate()
          This is called either from the application or from the context when it is destroyed or unchained.
 java.lang.String toString()
          Returns an XML representation.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uniqueInstance

protected static CSServer uniqueInstance

aCSNotificationListener

protected transient CSNotificationListener aCSNotificationListener
Contains the listeners of the CSNotificationEvent events.


INITIATED

public static final int INITIATED
Flag indicating that the server is initiated.

See Also:
Constant Field Values

STOPPED

public static final int STOPPED
Flag indicating that the server is stopped.

See Also:
Constant Field Values

synchronizedEvents

public static java.util.Hashtable synchronizedEvents
Contains information about clients who are waiting for events.


aCSInactivityClientListener

protected transient CSInactivityClientListener aCSInactivityClientListener
Contains the listeners of the CSInactivityClientEvent events.


sessionPersistence

protected static java.lang.Boolean sessionPersistence
Attribute indicating whether this server configuration is supposed to persist sessions or not. The value of this attribute is taken from Settings. It is static because CSServer service is not necessary by all the systems, for instance HTML client can avoid its use, but these systems could be interested in using session persistence.


sessionAffinity

protected static java.lang.Boolean sessionAffinity
Attribute indicating whether this PERSISTENCE server configuration is supposed to work with affinity. The value of this attribute is taken from Settings. It is static because CSServer service is not necessary by all the systems, for instance HTML client can avoid its use, but these systems could be interested in usinf session persistence.

Method Detail

readExternal

public void readExternal()
Reads external settings from the property file.


addCSInactivityClientListener

public void addCSInactivityClientListener(CSInactivityClientListener newListener)
Adds the specified CSInactivityClientListener to recieve CSInactivityClientEvents from this class.

Specified by:
addCSInactivityClientListener in interface CSServerService
Parameters:
newListener - com.ibm.dse.cs.servlet.CSInactivityClientListener

addCSNotificationListener

public void addCSNotificationListener(CSNotificationListener newListener)
Adds the specified CSNotificationListener to recieve CSNotificationEvents from this class.

Specified by:
addCSNotificationListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.event.CSNotificationListener

finalize

public void finalize()
In the finalize method, if the server is running it is stopped.


fireAndSignalCSInactivityClientEvent

public void fireAndSignalCSInactivityClientEvent(CSInactivityClientEvent anEvent,
                                                 java.lang.String eventName)
Method to support listener events.

Specified by:
fireAndSignalCSInactivityClientEvent in interface CSServerService
Parameters:
anEvent - com.ibm.btt.event.CSInactivityClientEvent
eventName - java.lang.String

fireHandleCSInactivityClientEvent

public void fireHandleCSInactivityClientEvent(CSInactivityClientEvent event)
Method to support listener events.

Specified by:
fireHandleCSInactivityClientEvent in interface CSServerService
Parameters:
event - com.ibm.btt.event.CSInactivityClientEvent

fireHandleCSNotificationEvent

public void fireHandleCSNotificationEvent(CSNotificationEvent event)
Supports listener events.

Specified by:
fireHandleCSNotificationEvent in interface CSServerService
Parameters:
event - com.ibm.btt.event.CSNotificationEvent

getAppSessionTimeout

public long getAppSessionTimeout()
Gets the appSessionTimeout.

Specified by:
getAppSessionTimeout in interface CSServerService
Returns:
long - Returns a long

getInactivityClientTimeout

public long getInactivityClientTimeout()
Returns the value of the inactivityClientTimeout property.

Specified by:
getInactivityClientTimeout in interface CSServerService
Returns:
long - The current value of inactivityClientTimeout.

getMinTimeStamp

public long getMinTimeStamp()
Returns the value of the minTimeStamp property.

Specified by:
getMinTimeStamp in interface CSServerService
Returns:
long - The current value of minTimeStamp.

getNotificationEventsBuffer

public NotificationEventsBuffer getNotificationEventsBuffer()
Gets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.

Returns:
com.ibm.btt.event.NotificationEventsBuffer

getOutputTimeout

public long getOutputTimeout()
Gets the outputTimeout property (long) value.

Returns:
long

getPersistTimeout

public long getPersistTimeout()
Gets the persistTimeout property (long) value.

Returns:
long

getRootDirectory

public java.lang.String getRootDirectory()
Gets the _rootDirectory property (String) value.

Returns:
String

getServerId

public long getServerId()
Gets the serverId property (long) value.

Returns:
long

getServerStatus

public int getServerStatus()
Gets the _serverStatus property (int) value.

Specified by:
getServerStatus in interface CSServerService
Returns:
int

getSynchronizedEvents

public java.util.Hashtable getSynchronizedEvents()
Returns information about clients who are waiting for events

Specified by:
getSynchronizedEvents in interface CSServerService
Returns:
java.util.Hashtable

getTimeBetweenSessionCheck

public long getTimeBetweenSessionCheck()
Returns the value of the timeBetweenSessionCheck property.

Specified by:
getTimeBetweenSessionCheck in interface CSServerService
Returns:
long - The current value of timeBetweenSessionCheck.

initializePersistence

protected static void initializePersistence()
Updates the static attributes of CSServer sessionPersistence and sessionAffinity. Gets these values from Settings.

Persistence:
Gets from the initialization file (dse.ini) the value of the tag initialization.sessionPersistence. If its value is "true" then the WSBCC assumes that the server is not configured to persist sessions. By default is "false".

Affinity:
Gets from the initialization file (dse.ini) the value of the tag initialization.sessionAffinity. If its value is "false" then the WSBCC assumes that does not exist session affinity. By default is "true".

These methods are specifical for HttpSession persistence.


initiateServer

public void initiateServer()
                    throws DSECSInvalidRequestException,
                           DSECSServerNotStartedException
Initiates the server. The server waits for client requests.

Specified by:
initiateServer in interface CSServerService
Throws:
DSECSInvalidRequestException
DSECSServerNotStartedException

isSessionAffinity

public boolean isSessionAffinity()
Returns the value of the attribute sessionAffinity. If this attribute has not been yet initialized, the initialization is invoked.

Specified by:
isSessionAffinity in interface CSServerService
Returns:
boolean

isSessionPersistence

public boolean isSessionPersistence()
Returns the value of the attribute sessionPersistence. If this attribute has not been yet initialized, the initialization is invoked.

Specified by:
isSessionPersistence in interface CSServerService
Returns:
boolean

removeCSInactivityClientListener

public void removeCSInactivityClientListener(CSInactivityClientListener newListener)
Removes the specified CSInactivityClientListener so that it no longer receives CSInactivityClientEvents from this class.

Specified by:
removeCSInactivityClientListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.event.CSInactivityClientListener

removeCSNotificationListener

public void removeCSNotificationListener(CSNotificationListener newListener)
Removes the specified CSNotificationListener so that it no longer receives CSNotificationEvents from this class.

Specified by:
removeCSNotificationListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.event.CSNotificationListener

sendEvent

public void sendEvent(java.lang.String ws,
                      java.util.EventObject anEvent)
Sends an event from server to the specified client workstation

Specified by:
sendEvent in interface CSServerService
Parameters:
ws - java.lang.String
anEvent - java.util.EventObject

sendEvent

public void sendEvent(java.lang.String ws,
                      java.util.EventObject anEvent,
                      boolean waitForDelivery)
               throws DSECSSocketException
Sends an event from server to the specified client workstation If "waitForDelivery" is true, an exception is thrown if a problem occurs during the connection made to send the event.

Specified by:
sendEvent in interface CSServerService
Parameters:
ws - java.lang.String
anEvent - java.util.EventObject
waitForDelivery - boolean
Throws:
DSECSSocketException

sessionAdded

public void sessionAdded(ChannelSessionStateChangedEvent anEvent)
sessionAdded method comment.

Specified by:
sessionAdded in interface ChannelSessionStateChangedListener
Parameters:
anEvent - com.ibm.btt.clientserver.ChannelSessionStateChangedEvent

sessionRemoved

public void sessionRemoved(ChannelSessionStateChangedEvent anEvent)
Fire and signal the inactivity timeout for the application to perform any necessary house keeping

Specified by:
sessionRemoved in interface ChannelSessionStateChangedListener
Parameters:
anEvent - com.ibm.btt.clientserver.ChannelSessionStateChangedEvent

setAppSessionTimeout

public void setAppSessionTimeout(long appSessionTimeout)
Sets the appSessionTimeout

Specified by:
setAppSessionTimeout in interface CSServerService
Parameters:
appSessionTimeout - long The appSessionTimeout to set

setInactivityClientTimeout

public void setInactivityClientTimeout(long value)
Sets the value of the inactivityClientTimeout property.

Specified by:
setInactivityClientTimeout in interface CSServerService
Parameters:
value - long The new value of the property.

setMinTimeStamp

public void setMinTimeStamp(long value)
Sets the value of the minTimeStamp property.

Specified by:
setMinTimeStamp in interface CSServerService
Parameters:
value - long The new value of the property.

setNotificationEventsBuffer

public void setNotificationEventsBuffer(NotificationEventsBuffer buffer)
Sets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.

Parameters:
buffer - com.ibm.btt.event.NotificationEventsBuffer

setOutputTimeout

public void setOutputTimeout(long aOutputTimeout)
Sets the outputTimeout property (long) value.

Specified by:
setOutputTimeout in interface CSServerService
Parameters:
aOutputTimeout - long

setPersistTimeout

public void setPersistTimeout(long aPersistTimeout)
Sets the persistTimeout property (long) value.

Specified by:
setPersistTimeout in interface CSServerService
Parameters:
aPersistTimeout - long

setRootDirectory

public void setRootDirectory(java.lang.String rootDirectory)
Sets the _rootDirectory property (java.lang.String) value.

Parameters:
rootDirectory - java.lang.String

setSessionAffinity

public static void setSessionAffinity(boolean newSessionAffinity)
Updates the sessionAffinity attribute.

Parameters:
newSessionAffinity - boolean

setSessionPersistence

public static void setSessionPersistence(boolean newSessionPersistence)
Updates the sessionPersistence attribute.

Parameters:
newSessionPersistence - boolean

setTimeBetweenSessionCheck

public void setTimeBetweenSessionCheck(long value)
Sets the value of the timeBetweenSessionCheck property.

Specified by:
setTimeBetweenSessionCheck in interface CSServerService
Parameters:
value - long The new value of the property.

stopServer

public void stopServer()
                throws DSECSInvalidRequestException
Stops the server.

Specified by:
stopServer in interface CSServerService
Throws:
DSECSInvalidRequestException

terminate

public void terminate()
               throws DSEException
This is called either from the application or from the context when it is destroyed or unchained.

Specified by:
terminate in interface Notifier
Throws:
DSEException

toString

public java.lang.String toString()
Returns an XML representation.

Returns:
java.lang.String

setPermanentConnectionForEvents

public void setPermanentConnectionForEvents(boolean permConnection)
Sets the permanentConnectionForEvents attribute.

Specified by:
setPermanentConnectionForEvents in interface CSServerService
Parameters:
permConnection - boolean

getPermanentConnectionForEvents

public boolean getPermanentConnectionForEvents()
Obtains the permanentConnectionForEvents attribute.

Specified by:
getPermanentConnectionForEvents in interface CSServerService
Returns:
boolean

sendEvent

public void sendEvent(java.lang.String ipAddress,
                      int eventsPort,
                      java.util.EventObject anEvent,
                      boolean waitForDelivery)
               throws DSECSSocketException
Sends an event from server to the specified ipAddress and port. If permanentConnectionForEvents is true, an exception is thrown. In case of dynamic connection, if "waitForDelivery" is true, an exception is thrown if a problem occurs during the connection made to send the event.

Specified by:
sendEvent in interface CSServerService
Parameters:
ipAddress - java.lang.String
eventsPort - int
anEvent - java.util.EventObject
waitForDelivery - boolean
Throws:
DSECSSocketException

getInstance

public static CSServer getInstance()
Returns the unique instance of running on the application environment.

Returns:
com.ibm.dse.base.CSServer

addHandler

public void addHandler(Handler aHandler,
                       java.lang.String anEventName)
                throws DSEInvalidArgumentException
Throws:
DSEInvalidArgumentException

getHandlersList

public java.util.Hashtable getHandlersList()

getName

public java.lang.String getName()
Description copied from interface: Notifier
Returns the name attribute value.

Specified by:
getName in interface Notifier

removeHandler

public void removeHandler(Handler aHandler,
                          java.lang.String anEventName)
                   throws DSEInvalidArgumentException,
                          DSEHandlerNotFoundException
Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException

setName

public void setName(java.lang.String aName)
Description copied from interface: Notifier
Sets the name attribute to aName.

Specified by:
setName in interface Notifier
Parameters:
aName - java.lang.String

signalEvent

public void signalEvent(java.lang.String anEventName)
                 throws DSEInvalidArgumentException
Description copied from interface: Notifier
This method is to fire the event. The fired event name is as specified name anEventName.

Specified by:
signalEvent in interface Notifier
Parameters:
anEventName - java.lang.String
Throws:
DSEInvalidArgumentException

signalEvent

public void signalEvent(java.lang.String anEventName,
                        java.util.Hashtable aParametersTable)
                 throws DSEInvalidArgumentException
Description copied from interface: Notifier
This method is to fire the event. The fired event name is as specified name anEventName and the second parameter is a Hashtable params in which user can put any information that needs to go with event object to event manager.

Specified by:
signalEvent in interface Notifier
Parameters:
anEventName - java.lang.String
aParametersTable - java.util.Hashtable
Throws:
DSEInvalidArgumentException

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005