com.ibm.dse.cs.servlet
Class CSServer

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.cs.servlet.CSServer

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  CSSessionManager csSessionManagerThread
          Thread which performs the expired session check.
static int INITIATED
          Flag indicating that the server is initiated.
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.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Fields inherited from interface com.ibm.dse.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 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.
protected  void fireHandleCSInactivityClientEvent(CSInactivityClientEvent event)
          Method to support listener events.
 void fireHandleCSNotificationEvent(CSNotificationEvent event)
          Supports listener events.
protected  CSSessionManager getCSSessionManagerThread()
          Returns the value of the csSessionManagerThread property.
 long getInactivityClientTimeout()
          Returns the value of the inactivityClientTimeout property.
 long getMinTimeStamp()
          Returns the value of the minTimeStamp property.
 NotificationEventsBuffer getNotificationEventsBuffer()
          Gets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.
 long getOutputTimeout()
          Gets the outputTimeout property (long) value.
 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.
 long getTimeBetweenSessionCheck()
          Returns the value of the timeBetweenSessionCheck property.
 java.lang.Object initializeFrom(Tag aTag)
          Actualizes all attributes that are defined in SGML file.
 void initiateServer()
          Initiates the server.
 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 sendEvent(java.lang.String ws, java.util.EventObject anEvent)
          Sends an event from server to the specified client workstation
 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
protected  void setCSSessionManagerThread(CSSessionManager newCSSessionManagerThread)
          Sets the value of the csSessionManagerThread property.
 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.dse.clientserver.NotificationEventsBuffer) value.
protected  void setOutputTimeout(long aOutputTimeout)
          Sets the outputTimeout property (long) value.
protected  void setPersistTimeout(long aPersistTimeout)
          Sets the persistTimeout property (long) value.
 void setRootDirectory(java.lang.String rootDirectory)
          Sets the _rootDirectory property (java.lang.String) value.
 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.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.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
 

Field Detail

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.

STOPPED

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

synchronizedEvents

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

csSessionManagerThread

protected CSSessionManager csSessionManagerThread
Thread which performs the expired session check.

aCSInactivityClientListener

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

CSServer

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

CSServer

public CSServer(java.lang.String aName)
         throws java.io.IOException,
                DSECSServerServiceAlreadyExistsException
This constructor creates a CSServer object.
Parameters:
s - java.lang.String
Method Detail

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

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.
Parameters:
event - com.ibm.dse.cs.servlet.CSInactivityClientEvent

fireHandleCSInactivityClientEvent

protected void fireHandleCSInactivityClientEvent(CSInactivityClientEvent event)
Method to support listener events.
Parameters:
event - com.ibm.dse.cs.servlet.CSInactivityClientEvent

fireHandleCSNotificationEvent

public void fireHandleCSNotificationEvent(CSNotificationEvent event)
Supports listener events.
Parameters:
event - com.ibm.dse.clientserver.CSNotificationEvent

getCSSessionManagerThread

protected CSSessionManager getCSSessionManagerThread()
Returns the value of the csSessionManagerThread property.
Returns:
com.ibm.dse.clientserver.ExpiredSessionsChecker - The current value of csSessionManagerThread.

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.
Returns:
long - The current value of minTimeStamp.

getNotificationEventsBuffer

public NotificationEventsBuffer getNotificationEventsBuffer()
Gets the _notificationEventsBuffer property (com.ibm.dse.clientserver.NotificationEventsBuffer) value.
Returns:
com.ibm.dse.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

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.dse.base.Tag
Returns:
java.lang.Object

initiateServer

public void initiateServer()
                    throws DSECSInvalidRequestException,
                           DSECSServerNotStartedException
Initiates the server. The server waits for client requests.
Specified by:
initiateServer in interface CSServerService

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.dse.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.dse.clientserver.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:
wk - java.lang.String
anEvent - Event

sessionAdded

public void sessionAdded(ChannelSessionStateChangedEvent anEvent)
sessionAdded method comment.
Specified by:
sessionAdded in interface ChannelSessionStateChangedListener
Parameters:
anEvent - com.ibm.dse.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.dse.clientserver.ChannelSessionStateChangedEvent

setCSSessionManagerThread

protected void setCSSessionManagerThread(CSSessionManager newCSSessionManagerThread)
Sets the value of the csSessionManagerThread property.
Parameters:
newExpiredSessionsCheckerThread - com.ibm.dse.clientserver.ExpiredSessionsChecker - The new value of the property csSessionManagerThread.

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.
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.dse.clientserver.NotificationEventsBuffer

setOutputTimeout

protected void setOutputTimeout(long aOutputTimeout)
Sets the outputTimeout property (long) value.
Parameters:
aOutputTimeout - long

setPersistTimeout

protected void setPersistTimeout(long aPersistTimeout)
Sets the persistTimeout property (long) value.
Parameters:
aPersistTimeout - long

setRootDirectory

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

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

terminate

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

toString

public java.lang.String toString()
Returns an XML representation.
Overrides:
toString in class Service
Returns:
java.lang.String