provided.client.model
Class ClientModel

java.lang.Object
  extended by provided.client.model.ClientModel

public class ClientModel
extends java.lang.Object

The model of the client system.

Author:
swong

Field Summary
private  IRemoteTaskViewAdapter clientTA
          The view adapter that the server can use to append messages to this client's view.
private  IRemoteTaskViewAdapter clientTAstub
          RMI stub for clientTA.
private  ICompute comp
          A reference to the proxy stub of the remote ICompute object.
private  IVoidLambda<java.lang.String> outputCmd
          output command used to put multiple strings up onto the view.
(package private)  IRMIUtils rmiUtils
          Factory for the Registry and other uses.
private  IRemoteTaskViewAdapter serverTA
          The adapter that connects all the way back to the remote system's view enabling this client to append messages to the server's view.
private  IViewAdapter view
          Adapter to the view
 
Constructor Summary
ClientModel(IViewAdapter view)
          Constructor for the class
 
Method Summary
 java.lang.String calcGetInfo(java.lang.String p)
          Gets the system information from the remote server by sending an entire GetInfo object to the remote server.
 java.lang.String calcPi(int numDigits)
          Calculates PI to the given number of decimal places by sending an entire Pi2 object to the remote ICompute object.
 java.lang.String connectTo(java.lang.String remoteHost)
          Connects to the given remote host and retrieves the stub to the ICompute object bound to the ICompute.BOUND_NAME name in the remote Registry on port IRMI_Defs.REGISTRY_PORT.
 void start()
          Starts the model by setting all the required RMI system properties, starts up the class server and installs the security manager.
 void stop()
          Stops the client by shutting down the class server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputCmd

private IVoidLambda<java.lang.String> outputCmd
output command used to put multiple strings up onto the view.


rmiUtils

IRMIUtils rmiUtils
Factory for the Registry and other uses.


view

private IViewAdapter view
Adapter to the view


comp

private ICompute comp
A reference to the proxy stub of the remote ICompute object.


serverTA

private IRemoteTaskViewAdapter serverTA
The adapter that connects all the way back to the remote system's view enabling this client to append messages to the server's view.


clientTA

private IRemoteTaskViewAdapter clientTA
The view adapter that the server can use to append messages to this client's view.


clientTAstub

private IRemoteTaskViewAdapter clientTAstub
RMI stub for clientTA. null=> clientTA needs to be exported, do not re-export otherwise.

Constructor Detail

ClientModel

public ClientModel(IViewAdapter view)
Constructor for the class

Parameters:
view - The adapter to the view.
Method Detail

start

public void start()
Starts the model by setting all the required RMI system properties, starts up the class server and installs the security manager.


stop

public void stop()
Stops the client by shutting down the class server.


connectTo

public java.lang.String connectTo(java.lang.String remoteHost)
Connects to the given remote host and retrieves the stub to the ICompute object bound to the ICompute.BOUND_NAME name in the remote Registry on port IRMI_Defs.REGISTRY_PORT.

Parameters:
remoteHost - The IP address or host name of the remote server.
Returns:
A status string on the connection.

calcPi

public java.lang.String calcPi(int numDigits)
Calculates PI to the given number of decimal places by sending an entire Pi2 object to the remote ICompute object.

Parameters:
numDigits - The number of digits to compute PI to.
Returns:
A status string on the computation.

calcGetInfo

public java.lang.String calcGetInfo(java.lang.String p)
Gets the system information from the remote server by sending an entire GetInfo object to the remote server.

Parameters:
p - A string passed to the GetInfo object to use as it pleases.
Returns:
A status string on the GetInfo task.