public interface IClientModel
This interface is provided as a guide for building the client-side model. This interface is not in any way fundamental to the operation of RMI, though the behaviors described here are critical to proper RMI operation.
The behaviors as described here are REQUIRED for any client implementation though the use of this particular interface is not.
Suggestion: Copy this interface to one's own code to use as a starting point and then modify it to suit one's specific needs.
Discussion point: Notice that this interface is completely decoupled from the notion of ITaskFactory's. Should this model work with factories or with the tasks directly? In the past, many people have had their models work with the factories. But some people have argued that the factory operations, e.g. creating a new factory, combining factories and even getting the product of the factory are completely separate, decoupled operations from the rest of the model and thus should be encapsulated separately. What do YOU believe?
Modifier and Type | Method and Description |
---|---|
java.lang.String |
connectTo(java.lang.String remoteHost)
Connects to the given remote host's Registry 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.
|
<T> java.lang.String |
runTask(ITask<T> task)
Runs the given ITask on the remote engine server, returning the String formatted
result, which is produced using the given ITask's ITaskResultFormatter object.
|
void |
sendMsgToComputeEngine(java.lang.String text)
Sends a string message to the connected compute engine using the IRemoteTaskViewAdapter STUB
received from the engine server.
|
void |
start()
Starts the client model by initializing the RMI system and creating a remote view adapter stub
for use by an engine server.
|
void |
stop()
Stops the client model by using the IRMIUtils to stop the RMI system.
|
void start()
void stop()
java.lang.String connectTo(java.lang.String remoteHost)
remoteHost
- The IP address or host name of the remote server.void sendMsgToComputeEngine(java.lang.String text)
text
- The message to be sent<T> java.lang.String runTask(ITask<T> task)
T
- The return type of the give ITasktask
- The task to run on the remote engine server.