kom.gateway
Class Gateway

java.lang.Object
  |
  +--kom.gateway.Gateway

public class Gateway
extends java.lang.Object
implements java.lang.Runnable, Preload, java.util.Observer

Gateway is a class containing all state information for connected clients. This class should be preloaded.


Field Summary
(package private)  ClientObservable clientObservable
           
(package private) static ServerConfig config
           
 java.lang.String fullServletBase
           
 GetMail mailGetter
           
(package private)  NumberObservable maxClientObservable
           
 NewsNotifier newsNotifier
           
protected  boolean sleeping
           
protected  boolean stopped
           
protected  java.lang.Thread thread
           
 
Constructor Summary
Gateway()
          Default constructor
 
Method Summary
 boolean addClient(java.lang.String cursor, Environment env)
          Adds a new client to the clientObservable list
 void addClientObserver(java.util.Observer observer)
          Adds an observer
 void addMaxClientObserver(java.util.Observer observer)
          Adds an observer to maxClientObservable
 void changeClient(java.lang.String client)
          Client data change notification
 void deleteClient(java.lang.String cursor)
          Deletes a client with the specified cursor
 Environment getClient(java.lang.String cursor)
          Gets a client with specified cursor
 ClientObservable getClientObservable()
          Gets clientObservable
 java.util.Hashtable getClients()
          Gets a copy of the client table
 NumberObservable getMaxClientObservable()
          Gets maxClientObservable
 void logout(java.lang.String cursor)
          Removes client on logout
static void printStackTrace(java.lang.Throwable x, java.lang.String debugmessage)
           
 void run()
          Implements Runnable.
 void setConfig(HTTPConfig conf)
          Implements Preload
 void stop()
           
 void update(java.util.Observable obs, java.lang.Object obj)
          Implements Observer
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

config

static ServerConfig config

thread

protected java.lang.Thread thread

stopped

protected boolean stopped

sleeping

protected boolean sleeping

clientObservable

ClientObservable clientObservable

maxClientObservable

NumberObservable maxClientObservable

fullServletBase

public java.lang.String fullServletBase

mailGetter

public GetMail mailGetter

newsNotifier

public NewsNotifier newsNotifier
Constructor Detail

Gateway

public Gateway()
Default constructor
Method Detail

stop

public void stop()

addClientObserver

public void addClientObserver(java.util.Observer observer)
Adds an observer
Parameters:
observer - The Observer to be added

addMaxClientObserver

public void addMaxClientObserver(java.util.Observer observer)
Adds an observer to maxClientObservable
Parameters:
observer - The Observer to be added

getClientObservable

public ClientObservable getClientObservable()
Gets clientObservable

getMaxClientObservable

public NumberObservable getMaxClientObservable()
Gets maxClientObservable

addClient

public boolean addClient(java.lang.String cursor,
                         Environment env)
Adds a new client to the clientObservable list

changeClient

public void changeClient(java.lang.String client)
Client data change notification
Parameters:
client - The client (cursor) which has changed

getClients

public java.util.Hashtable getClients()
Gets a copy of the client table

getClient

public Environment getClient(java.lang.String cursor)
Gets a client with specified cursor

deleteClient

public void deleteClient(java.lang.String cursor)
Deletes a client with the specified cursor

setConfig

public void setConfig(HTTPConfig conf)
Implements Preload
Specified by:
setConfig in interface Preload

logout

public void logout(java.lang.String cursor)
Removes client on logout
Parameters:
cursor - Client id

run

public void run()
Implements Runnable. Runs until time-out or interruption
Specified by:
run in interface java.lang.Runnable

update

public void update(java.util.Observable obs,
                   java.lang.Object obj)
Implements Observer
Specified by:
update in interface java.util.Observer
Parameters:
obs - Observer
obj - Object

printStackTrace

public static void printStackTrace(java.lang.Throwable x,
                                   java.lang.String debugmessage)