provided.client.model.task
Class GetInfo

java.lang.Object
  extended by provided.client.model.task.GetInfo
All Implemented Interfaces:
java.io.Serializable, ITask<java.lang.String>

public class GetInfo
extends java.lang.Object
implements ITask<java.lang.String>, java.io.Serializable

Task that gets the server's system properties plus demonstrates that it can carry internal data to a remote system when the entire object is serialized and sent over.

Author:
swong
See Also:
Serialized Form

Field Summary
private  double[] dArray
          An array carried along to prove that internal data is transmitted too.
private  java.lang.String input
          Input string given to the constructor
private static long serialVersionUID
          Serialversion UID for well-defined serialization
private  ILocalTaskViewAdapter taskView
          Adapter to the local view.
 
Constructor Summary
GetInfo(java.lang.String input)
          Constructor for the class.
 
Method Summary
 java.lang.String execute()
          Display the internal string on the server's console.
private  void readObject(java.io.ObjectInputStream stream)
          Reinitializes transient fields upon deserialization.
 void setTaskViewAdapter(ILocalTaskViewAdapter viewAdapter)
          Sets the task view adapter to a new value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serialversion UID for well-defined serialization

See Also:
Constant Field Values

taskView

private transient ILocalTaskViewAdapter taskView
Adapter to the local view. Marked "transient" so that it is not serialized and instead is reattached at the destination (the server).


input

private java.lang.String input
Input string given to the constructor


dArray

private double[] dArray
An array carried along to prove that internal data is transmitted too.

Constructor Detail

GetInfo

public GetInfo(java.lang.String input)
Constructor for the class.

Parameters:
input - A string to carry around.
Method Detail

execute

public java.lang.String execute()
                         throws java.rmi.RemoteException
Display the internal string on the server's console. Get the server's system properties and calculate the sum of the internal data.

Specified by:
execute in interface ITask<java.lang.String>
Returns:
the server's system properties and the sum of the internal array as a string.
Throws:
java.rmi.RemoteException - thrown when a network error occurs.

readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reinitializes transient fields upon deserialization. See the Serializable marker interface docs. taskView is set to a default value for now (ILocalTaskViewAdapter.DEFAULT_ADAPTER).

Parameters:
stream - The object stream with the serialized data
Throws:
java.io.IOException
java.lang.ClassNotFoundException

setTaskViewAdapter

public void setTaskViewAdapter(ILocalTaskViewAdapter viewAdapter)
Sets the task view adapter to a new value. Tests connection by sending a string representation of the dArray structure. Called by the server to attach the task to its view.

Specified by:
setTaskViewAdapter in interface ITask<java.lang.String>
Parameters:
viewAdapter - the adapter to the view.