ucar.unidata.idv.collab
Class CollabServer

java.lang.Object
  extended by ucar.unidata.collab.Server
      extended by ucar.unidata.idv.collab.CollabServer

public class CollabServer
extends Server

This is an extension of 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

Version:
$Revision: 1.3 $Date: 2005/05/13 18:30:37 $
Author:
IDV development team

Field Summary
 
Fields inherited from class ucar.unidata.collab.Server
DEFAULT_PORT
 
Constructor Summary
CollabServer(CollabManager collabManager, int port)
          Create the server with the given collaboratio manager.
 
Method Summary
protected  Client createClient(Socket clientSocket)
          Factory method for creating our own CollabClient object.
 void handleIncomingMessage(Client client, 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
 
Methods inherited from class ucar.unidata.collab.Server
addClient, addClient, getClients, getIsRunning, hasClients, initClient, logException, main, removeClient, startServer, startServer, stopServer, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollabServer

public CollabServer(CollabManager collabManager,
                    int port)
Create the server with the given collaboratio manager. Have it open its connection on the given port

Parameters:
collabManager - The singleton collab manager
port - The port to open a listening socket on
Method Detail

createClient

protected Client createClient(Socket clientSocket)
                       throws IOException
Factory method for creating our own CollabClient object. We are overwriting the base class method to create the CollabClient

Overrides:
createClient in class Server
Parameters:
clientSocket - The socket we are connected to the client with
Returns:
The new client
Throws:
IOException

handleIncomingMessage

public void handleIncomingMessage(Client client,
                                  String message)
Route the call to the CollabManager

Overrides:
handleIncomingMessage in class Server
Parameters:
client - The client the message came on
message - The message

notifyServerStop

protected void notifyServerStop()
Gets called when we are done running on the server socket Route the call to the CollabManager

Overrides:
notifyServerStop in class Server

notifyServerStart

protected void notifyServerStart()
Gets called when we are starting to listen Route the call to the CollabManager

Overrides:
notifyServerStart in class Server

notifyClientAdd

protected void notifyClientAdd(Client client)
Gets called when we have added a new client. Route the call to the CollabManager

Overrides:
notifyClientAdd in class Server
Parameters:
client - The new client

notifyClientRemove

protected void notifyClientRemove(Client client)
Gets called when we have removed a client. Route the call to the CollabManager

Overrides:
notifyClientRemove in class Server
Parameters:
client - The removed client