IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.cs.servlet
Class CSServer

java.lang.Object
  extended by com.ibm.btt.base.DSENotifier
      extended by com.ibm.btt.base.Service
          extended by com.ibm.btt.cs.servlet.CSServer
All Implemented Interfaces:
Notifier, ChannelSessionStateChangedListener, CSServerService, java.io.Externalizable, java.io.Serializable, java.util.EventListener

public class CSServer
extends Service
implements CSServerService, ChannelSessionStateChangedListener

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

See Also:
Serialized Form

Field Summary
protected  CSInactivityClientListener aCSInactivityClientListener
          Contains the listeners of the CSInactivityClientEvent events.
protected  CSNotificationListener aCSNotificationListener
          Contains the listeners of the CSNotificationEvent events.
protected  CSProcessorInactivityListener aCSProcessorInactivityListener
          Contains the listeners of the CSProcessorInactivityEvent events.
(package private)  CSReplyErrorEventListener aCSReplyErrorEventListener
           
protected  CSSessionManager csSessionManager
          Schedular which performs the expired session check.
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
 
Fields inherited from class com.ibm.btt.base.Service
externalizer, name
 
Fields inherited from class com.ibm.btt.base.DSENotifier
handlersList
 
Fields inherited from interface com.ibm.btt.clientserver.CSServerService
CS_INACTIVITY_CLIENT_EVENT, CS_SESSION_EXPIRED
 
Constructor Summary
CSServer()
          This constructor creates a CSServer object.
CSServer(java.lang.String aName)
          This constructor creates a CSServer object.
 
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 addCSProcessorInactivityListener(CSProcessorInactivityListener newListener)
          Adds the specified CSProcessorInactivityListener to recieve CSProcessorInactivityEvents from this class.
 void addCSReplyErrorEventListener(CSReplyErrorEventListener newListener)
          Adds the specified CSReplyErrorEventListener to receive CSReplyErrorEvents from this class.
 void checkExpiredSessions()
          When an expired session is found, fire an event and mark the session as expired.
 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 fireAndSignalCSProcessorInactivityEvent(CSProcessorInactivityEvent anEvent, java.lang.String eventName)
          Method to support listener events.
 void fireAndSignalCSReplyErrorEvent(CSReplyErrorEvent anEvent, java.lang.String eventName)
          method to discrimate exceptions
 void fireHandleCSInactivityClientEvent(CSInactivityClientEvent event)
          Method to support listener events.
 void fireHandleCSNotificationEvent(CSNotificationEvent event)
          Supports listener events.
 void fireHandleCSProcessorInactivityEvent(CSProcessorInactivityEvent event)
          Method to support listener events.
protected  void fireHandleCSReplyErrorEvent(CSReplyErrorEvent event)
          method for the discrimatation of exceptions requeriment for the WSBCC 430 release
 long getAppSessionTimeout()
          Gets the appSessionTimeout
 long getInactivityClientTimeout()
          Returns the value of the inactivityClientTimeout property.
static CSServer getInstance()
          Get the instance from the context hierarchy.
 long getMinTimeStamp()
          Returns the value of the minTimeStamp property.
 NotificationEventsBuffer getNotificationEventsBuffer()
          Gets the _notificationEventsBuffer property (com.ibm.btt.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.
 java.lang.Object initializeFrom(Tag aTag)
          Actualizes all attributes that are defined in SGML file.
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 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 removeCSProcessorInactivityListener(CSProcessorInactivityListener newListener)
          Adds the specified CSProcessorInactivityListener to recieve CSProcessorInactivityEvents from this class.
 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 setNotificationEventsBuffer(NotificationEventsBuffer buffer)
          Sets the _notificationEventsBuffer property (com.ibm.btt.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 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 com.ibm.btt.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.btt.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.base.Notifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent
 
Methods inherited from interface com.ibm.btt.base.Externalizable
getName, setName
 

Field Detail

aCSReplyErrorEventListener

CSReplyErrorEventListener aCSReplyErrorEventListener

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


csSessionManager

protected CSSessionManager csSessionManager
Schedular which performs the expired session check.


aCSInactivityClientListener

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


aCSProcessorInactivityListener

protected transient CSProcessorInactivityListener aCSProcessorInactivityListener
Contains the listeners of the CSProcessorInactivityEvent 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.

Constructor Detail

CSServer

public CSServer()
         throws DSECSServerServiceAlreadyExistsException
This constructor creates a CSServer object.

Throws:
DSECSServerServiceAlreadyExistsException

CSServer

public CSServer(java.lang.String aName)
         throws java.io.IOException,
                DSECSServerServiceAlreadyExistsException
This constructor creates a CSServer object.

Parameters:
s - java.lang.String
Throws:
java.io.IOException
DSECSServerServiceAlreadyExistsException
Method Detail

getInstance

public static CSServer getInstance()
Get the instance from the context hierarchy.

Returns:
the CSServer instance

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.btt.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.clientserver.CSNotificationListener

addCSProcessorInactivityListener

public void addCSProcessorInactivityListener(CSProcessorInactivityListener newListener)
Adds the specified CSProcessorInactivityListener to recieve CSProcessorInactivityEvents from this class.

Specified by:
addCSProcessorInactivityListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.cs.servlet.CSProcessorInactivityListener

checkExpiredSessions

public void checkExpiredSessions()
                          throws DSEInvalidRequestException,
                                 DSEObjectNotFoundException
When an expired session is found, fire an event and mark the session as expired. Method called from the ExpiredSessionsChecker thread. It is synchronized with the addSession and removeSession methods.

Specified by:
checkExpiredSessions in interface CSServerService
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

finalize

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

Overrides:
finalize in class java.lang.Object

fireAndSignalCSInactivityClientEvent

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

Specified by:
fireAndSignalCSInactivityClientEvent in interface CSServerService
Parameters:
event - com.ibm.btt.cs.servlet.CSInactivityClientEvent

fireAndSignalCSProcessorInactivityEvent

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

Specified by:
fireAndSignalCSProcessorInactivityEvent in interface CSServerService
Parameters:
event - com.ibm.btt.cs.servlet.CSProcessorInactivityEvent

fireHandleCSInactivityClientEvent

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

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

fireHandleCSNotificationEvent

public void fireHandleCSNotificationEvent(CSNotificationEvent event)
Supports listener events.

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

fireHandleCSProcessorInactivityEvent

public void fireHandleCSProcessorInactivityEvent(CSProcessorInactivityEvent event)
Method to support listener events.

Specified by:
fireHandleCSProcessorInactivityEvent in interface CSServerService
Parameters:
event - com.ibm.btt.cs.servlet.CSProcessorInactivityEvent

getAppSessionTimeout

public long getAppSessionTimeout()
Gets the appSessionTimeout

Specified by:
getAppSessionTimeout in interface CSServerService
Returns:
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.btt.clientserver.NotificationEventsBuffer) value.

Returns:
com.ibm.btt.clientserver.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:
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.

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
Actualizes all attributes that are defined in SGML file.

Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
java.lang.Object

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.cs.servlet.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.clientserver.CSNotificationListener

removeCSProcessorInactivityListener

public void removeCSProcessorInactivityListener(CSProcessorInactivityListener newListener)
Adds the specified CSProcessorInactivityListener to recieve CSProcessorInactivityEvents from this class.

Specified by:
removeCSProcessorInactivityListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.cs.servlet.CSProcessorInactivityListener

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 - Event

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 - Event
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 - 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.btt.clientserver.NotificationEventsBuffer) value.

Parameters:
buffer - com.ibm.btt.clientserver.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
Overrides:
terminate in class Service
Throws:
DSEException

toString

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

Overrides:
toString in class Service
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
port - int
anEvent - Event
waitForDelivery - boolean
Throws:
DSECSSocketException

addCSReplyErrorEventListener

public void addCSReplyErrorEventListener(CSReplyErrorEventListener newListener)
Adds the specified CSReplyErrorEventListener to receive CSReplyErrorEvents from this class.

Specified by:
addCSReplyErrorEventListener in interface CSServerService
Parameters:
newListener - com.ibm.btt.cs.servlet.CSReplyErrorEventListener

fireHandleCSReplyErrorEvent

protected void fireHandleCSReplyErrorEvent(CSReplyErrorEvent event)
method for the discrimatation of exceptions requeriment for the WSBCC 430 release


fireAndSignalCSReplyErrorEvent

public void fireAndSignalCSReplyErrorEvent(CSReplyErrorEvent anEvent,
                                           java.lang.String eventName)
method to discrimate exceptions


IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010