edu.columbia.cs.cgui.rjfc.server
Class RJFCServer

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.columbia.cs.cgui.rjfc.server.RJFCServer
All Implemented Interfaces:
Remote, Serializable, Server

public class RJFCServer
extends UnicastRemoteObject
implements Server

The standard Server that a RJFC Viewer will connect to. It is normally instantiated by an Application object, and handles all of the RMI connectivity.

See Also:
Viewer, Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RJFCServer(int port, String s, Application ra)
          Constructs RJFCServer object and exports it on specified port.
RJFCServer(String s, Application ra)
          Constructs RJFCServer object and exports it on default port.
 
Method Summary
 void disconnectDisplay(ClientInfo clientInfo)
          This method should be called remotely by clients when they are terminating their connection.
 Hashtable getClientHash()
          Called by an instance of Application to get the hashtable that indexes clients to their reference objects
 RJFrame getDisplay(ClientInfo ci)
          Called by an instance of Application to get the main display that corresponds to the specified client
 RJFCFactory getFactory(ClientInfo ci)
          Called by an instance of Application to get the factory that corresponds to the specified client
 void registerDisplay(RJFrame display, RJFCFactory f, ClientInfo clientInfo)
          This method should be called remotely by clients when they first initialize.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RJFCServer

public RJFCServer(String s,
                  Application ra)
           throws RemoteException
Constructs RJFCServer object and exports it on default port.
Parameters:
s - the name of the RMI object
ra - the application
Throws:
RemoteException - if there is an error thrown while remotely terminating objects on the client side.

RJFCServer

public RJFCServer(int port,
                  String s,
                  Application ra)
           throws RemoteException
Constructs RJFCServer object and exports it on specified port.
Parameters:
port - The port for exporting
s - the name of the RMI object
ra - the application
Throws:
RemoteException - if there is an error thrown while remotely terminating objects on the client side.
Method Detail

getDisplay

public RJFrame getDisplay(ClientInfo ci)
Called by an instance of Application to get the main display that corresponds to the specified client
Parameters:
ci - the client
Returns:
the corresponding display object

getClientHash

public Hashtable getClientHash()
Called by an instance of Application to get the hashtable that indexes clients to their reference objects
Returns:
the hashtable for this server

getFactory

public RJFCFactory getFactory(ClientInfo ci)
Called by an instance of Application to get the factory that corresponds to the specified client
Parameters:
ci - the client
Returns:
the corresponding factory

registerDisplay

public void registerDisplay(RJFrame display,
                            RJFCFactory f,
                            ClientInfo clientInfo)
                     throws RemoteException
This method should be called remotely by clients when they first initialize. It should pass the display hook to the server so that the server can use RMI to add components onto the display panel, and it should pass the factory so that the server or the application can remotely instantiate objects on the client's machine. The client's IP and port are also passed in, so that multiple connections can be differentiated.
Specified by:
registerDisplay in interface Server
Parameters:
display - the main display panel for the client's application
f - the factory to create the Swing components on the client side
ci - the ip and port numbers for the client
Throws:
RemoteException - if there is an error thrown while remotely instantiating objects on the client side.
See Also:
RJFrame, ClientInfo, RJFCFactory

disconnectDisplay

public void disconnectDisplay(ClientInfo clientInfo)
                       throws RemoteException
This method should be called remotely by clients when they are terminating their connection. The client's IP and port are passed in, so that the correct client can be disconnected.
Specified by:
disconnectDisplay in interface Server
Parameters:
ci - the ip and port numbers for the client
Throws:
RemoteException - if there is an error thrown while remotely terminating objects on the client side.
See Also:
ClientInfo