com.ibm.tspaces
Interface TSCmd

All Known Implementing Classes:
TSCmdRMIImpl, TSCmdSocketImpl, TSCmdLocalImpl

public interface TSCmd

TSCmd is the Interface that the Client TupleSpace uses to comunicate with the Server. It is a Java Interface because there may be various implementations of the communication path used to communicate with the server.

Author:
John Thomas
See Also:
TupleSpace

Method Summary
 void close()
          This method is used to close the current connection to the server.
 SuperTuple command(java.lang.String cmdString_, SuperTuple argTuple_, java.lang.String tsName_, Transaction enclosingTransaction_)
          Issue a command to the TupleSpace galaxy tuple space and pass along a Tuple as an argument.
 SuperTuple command(java.lang.String cmdString_, SuperTuple argTuple_, java.lang.String tsName_, Transaction enclosingTransaction_, long timeout_)
          Issue a command to the TupleSpace galaxy tuple space and pass along a Tuple and a timeout value as arguments.
 void eventDeRegister(int seqNum)
          DeRegister for an event on the server.
 void eventRegister(int seqNum, Callback callback_, java.lang.String commandName_, java.lang.String tsName_, boolean newThread_)
          Register for an event on the server.
 

Method Detail

command

public SuperTuple command(java.lang.String cmdString_,
                          SuperTuple argTuple_,
                          java.lang.String tsName_,
                          Transaction enclosingTransaction_)
                   throws TupleSpaceCommunicationException,
                          TupleSpaceClientException,
                          TupleSpaceServerException
Issue a command to the TupleSpace galaxy tuple space and pass along a Tuple as an argument. The command is a text string that is recongized by the TupleSpace. The results of the command, if any, are returned as a tuple.
Parameters:
cmdString_ - The String that names the command.
argTuple_ - The argument Tuple, can be null.
tsName_ - The tuple space the command is acting on
enclosingTransaction_ - Transaction object that issued this command enclosingTransaction_ == null ---> standAlone transaction '' <> null ---> part of enclosingTransaction_
Returns:
A result Tuple, the format of which depends upon the command.
Throws:
TupleSpaceCommunicationException - There are problems connecting to the TupleSpace Server
TupleSpaceServerException - There was a problem executing the command on the server.
TupleSpaceClientException - There were problems preparing the command to be sent to the server.

command

public SuperTuple command(java.lang.String cmdString_,
                          SuperTuple argTuple_,
                          java.lang.String tsName_,
                          Transaction enclosingTransaction_,
                          long timeout_)
                   throws TupleSpaceCommunicationException,
                          TupleSpaceClientException,
                          TupleSpaceServerException
Issue a command to the TupleSpace galaxy tuple space and pass along a Tuple and a timeout value as arguments. The command is a text string that is recongized by the TupleSpace. The results of the command, if any, are returned as a tuple.
Parameters:
cmdString_ - The String that names the command.
argTuple_ - The argument Tuple, can be null.
tsName_ - The tuple space the command is acting on
enclosingTransaction_ - Transaction object that issued this command enclosingTransaction_ == null ---> standAlone transaction '' <> null ---> part of enclosingTransaction_
timeout_ - The time in ms until this command should report a timeout. Defaults to 0 which indicates no timeout.
Returns:
A result Tuple, the format of which depends upon the command.
Throws:
TupleSpaceCommunicationException - There are problems connecting to the TupleSpace Server
TupleSpaceServerException - There was a problem executing the command on the server.
TupleSpaceClientException - There were problems preparing the command to be sent to the server.

close

public void close()
This method is used to close the current connection to the server.

eventRegister

public void eventRegister(int seqNum,
                          Callback callback_,
                          java.lang.String commandName_,
                          java.lang.String tsName_,
                          boolean newThread_)
Register for an event on the server.

The eventRegister method for the TSCmd instance is called to warn it to expect an event to arrive. The client can then send the eventRegister command to the server.

Parameters:
seqNum - The sequence number assigned to the event
callback_ - what class object contains the call() method that will be called when the event happens.
commandName_ - the operation "WRITE" or "DELETE" to be on the watch for!
tsName_ - the Tuple Space name
newThread_ - If true, a new thread will be started for the callback

eventDeRegister

public void eventDeRegister(int seqNum)
DeRegister for an event on the server.

After sending the eventDeRegister command to the server, this method is called to tell it not to expect any more events to arrive.

Parameters:
seqNum - The sequence number assigned to the event