|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.Observable
|
+--ocsf.server.ObservableServer
|
+--ocsf.server.ObservableOriginatorServer
The ObservableOriginatorServer is a subclass
of ObservableServer that sends
OriginatorMessage instances to its observers.
This class should be used when the observers need to know
the orginator of the messages received. The originator
is null when the message sent concerns the server.
Project Name: OCSF (Object Client-Server Framework)
OriginatorMessage| Field Summary |
| Fields inherited from class ocsf.server.ObservableServer |
CLIENT_CONNECTED, CLIENT_DISCONNECTED, CLIENT_EXCEPTION, LISTENING_EXCEPTION, SERVER_CLOSED, SERVER_STARTED, SERVER_STOPPED |
| Constructor Summary | |
ObservableOriginatorServer(int port)
Constructs a new server. |
|
| Method Summary | |
protected void |
clientConnected(ocsf.server.ConnectionToClient client)
Method called each time a new client connection is accepted. |
protected void |
clientDisconnected(ocsf.server.ConnectionToClient client)
Method called each time a client connection is disconnected. |
protected void |
clientException(ocsf.server.ConnectionToClient client,
java.lang.Throwable exception)
Method called each time an exception is raised by a client connection. |
protected void |
handleMessageFromClient(java.lang.Object message,
ocsf.server.ConnectionToClient client)
This method is used to handle messages coming from the client. |
protected void |
listeningException(java.lang.Throwable exception)
Method called each time an exception is raised while listening. |
protected void |
serverClosed()
Method called each time the server is closed. |
protected void |
serverStarted()
Method called each time the server is started. |
protected void |
serverStopped()
Method called each time the server is stopped. |
| Methods inherited from class ocsf.server.ObservableServer |
close, getClientConnections, getNumberOfClients, getPort, isListening, listen, sendToAllClients, setBacklog, setPort, setTimeout, stopListening |
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ObservableOriginatorServer(int port)
port - the port on which to listen.| Method Detail |
protected void handleMessageFromClient(java.lang.Object message,
ocsf.server.ConnectionToClient client)
handleMessageFromClient in class ObservableServermessage - The message received from the client.client - The connection to the client.ObservableOriginatorServerprotected void clientConnected(ocsf.server.ConnectionToClient client)
OriginatorMessage instance
containing a reference to that client and
the message defined by the static variable CLIENT_CONNECTED.
clientConnected in class ObservableServerclient - the connection connected to the client.protected void clientDisconnected(ocsf.server.ConnectionToClient client)
OriginatorMessage instance
containing a reference to that client and
the message defined by the static variable CLIENT_DISCONNECTED.
clientDisconnected in class ObservableServerclient - the connection connected to the client.
protected void clientException(ocsf.server.ConnectionToClient client,
java.lang.Throwable exception)
OriginatorMessage instance
containing a reference to that client and
the message defined by the static variable CLIENT_EXCEPTION
to which is appended the exception message.
clientException in class ObservableServerclient - the client that raised the exception.exception - the exception raised.protected void listeningException(java.lang.Throwable exception)
OriginatorMessage instance
containing the message defined by the static variable LISTENING_EXCEPTION
to which is appended the exception message.
The originator is set to null.
listeningException in class ObservableServerexception - the exception raised.protected void serverStarted()
OriginatorMessage instance
containing the message defined by the static variable SERVER_STARTED.
The originator is set to null.
serverStarted in class ObservableServerprotected void serverStopped()
OriginatorMessage instance
containing the message defined by the static variable SERVER_STOPPED.
The originator is set to null.
serverStopped in class ObservableServerprotected void serverClosed()
OriginatorMessage instance
containing the message defined by the static variable SERVER_CLOSED.
The originator is set to null.
serverClosed in class ObservableServer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||