public class CollabServer extends Server
Server
class
that provides specific support for the collaboration mechanism
within the IDV.
This class does 2 things. First it overwrites the base clas method createClient to create CollabClient objects. Second it routes the server calls (e.g., handleIncomingMessage, notifyClientAdd, etc.) to the CollabManager
DEFAULT_PORT
Constructor and Description |
---|
CollabServer(CollabManager collabManager,
int port)
Create the server with the given collaboratio manager.
|
Modifier and Type | Method and Description |
---|---|
protected Client |
createClient(java.net.Socket clientSocket)
Factory method for creating our own CollabClient object.
|
void |
handleIncomingMessage(Client client,
java.lang.String message)
Route the call to the CollabManager
|
protected void |
notifyClientAdd(Client client)
Gets called when we have added a new client.
|
protected void |
notifyClientRemove(Client client)
Gets called when we have removed a client.
|
protected void |
notifyServerStart()
Gets called when we are starting to listen
Route the call to the CollabManager
|
protected void |
notifyServerStop()
Gets called when we are done running on the server socket
Route the call to the CollabManager
|
addClient, addClient, getClients, getIsRunning, hasClients, initClient, logException, main, removeClient, startServer, startServer, stopServer, write, write
public CollabServer(CollabManager collabManager, int port)
collabManager
- The singleton collab managerport
- The port to open a listening socket onprotected Client createClient(java.net.Socket clientSocket) throws java.io.IOException
createClient
in class Server
clientSocket
- The socket we are connected to the client withjava.io.IOException
public void handleIncomingMessage(Client client, java.lang.String message)
handleIncomingMessage
in class Server
client
- The client the message came onmessage
- The messageprotected void notifyServerStop()
notifyServerStop
in class Server
protected void notifyServerStart()
notifyServerStart
in class Server
protected void notifyClientAdd(Client client)
notifyClientAdd
in class Server
client
- The new clientprotected void notifyClientRemove(Client client)
notifyClientRemove
in class Server
client
- The removed client