|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.ibm.tspaces.TupleSpace
A TupleSpace is a shared named collection (bag) of Tuples. The basic operations supported by the collection are to add a Tuple to the space (write), and to remove one from the space (take).
The collection is stored and administered across a network on one or more "Tuple Space Servers". Several threads on the same or different machines can be accessing the space simultaneously. Some will be adding tuples to the space and some removing them.
A client thread accesses the collection/space using the methods of an instance of this class. For each different Tuple Space a client wishes to access, it requires a separate instance of this class, even if they are managed by the same server. The details of how the operations are completed are hidden from the user. All they need is the name of the space, and the name of a server that manages that space.
Some of the primitive operations supported by the space are:
We have created some conventions for using Tuples:
(*) Top level Tuples are always sent from client to server with the following format:
(*) Field 0: A unique client side sequence number: used to identify which request
a response corresponds to.
(*) Field 1: A command tuple which is the actual request and looks like:
(*) Field 0: TupleSpace name (string)
(*) Field 1: Command (string)
(*) Field 2: Data Tuple
(*) Field 2: A unique id for the client and is the String
clientHostName + clientThreadIDName
(*) Top level Tuples are always sent from server to client with the following format:
(*) Field 0: Status (string) can be TupleSpace.OK or TupleSpace.EXCEPTION
(*) Field 1: Sequence Number (integer)
(*) Field 2: returnValue (supertuple) the returned tuple if all went ok else a Tuple with an exception message inside
The data tuple is interpreted according to the command:
(*) WRITE: The client is submitting a tuple to be added to the space.
The datatuple is that new tuple.
(*) TAKE: The client is submitting a tuple to be used to query
the space. The datatuple is that query tuple.
(*) READ:The client is submitting a tuple to be used to query
the space. The datatuple is that query tuple.
(*) COUNT:The client is submitting a tuple to be used to query
the space. The datatuple is that query tuple.
(*) SCAN:The client is submitting a tuple to be used to query
the space (scan it, actually). The datatuple is that query tuple.
(*) IN_REPLY: The Server is replying on the status of the IN command
sent by the client. The datatuple is the status report.
(*) OUT_REPLY: The Server is replying to the OUT command sent by
the client. The data tuple is the output tuple that is the
result of the query. The data tuple should not be NULL.
(*) READ_REPLY: The Server is replying to the READ command sent by
the client. The data tuple is the output tuple that is the
result of the query. The data tuple may be NULL if the
results of the read are empty.
(*) WRITE_REPLY: The Server is replying to the WRITE command sent by
the client. The data tuple contains a single value
(TupleID), which is the uniqueId of the Tuple within the space.
(*) COUNT_REPLY: The Server is replying to the COUNT command sent by
the client. The data tuple is the output tuple that is the
result of the count query. The data tuple contains a single
number, which is the result of the count. The count may be
ZERO, but it will not be NULL.
(*) SCAN_REPLY: The Server is replying to the SCAN command sent by
the client. The data tuple is the output tuple that is the
result of the scan query. The data tuple contains a set of
tuples that satisfy the scan query. The data tuple will
contain an "empty" tuple if the scan results are empty, but
the data tuple itself will not be NULL.
(*) ERROR_REPLY: The Server is replying to one of the client messages,
with an error. The data tuple contains an error message.
(There is room for growth here, when we get into unknown
class messages, and so on.)
(*) The communication protocol:
The communication between the client and server is handled by
an implementation of TSCmd.
TSCmd is an interface that has the following methods defined.
command(cmdnmae, argTuple, tsname, transactionid)
The Implementation of TSCmd must have a constructor that takes
the following arguments:
String - Host name
int - Host port
String - Username
String - Password
Field,
Tuple| Field Summary | |
static java.lang.String |
_ADMIN_TSNAME
the name of the admin tuple space. |
protected java.util.Vector |
_currTransactions
A list of the currently active transactions. |
static java.lang.String |
_DBTYPE_MMDB
|
static java.lang.String |
_DBTYPE_SMALLDB
|
static java.lang.String |
_DEFAULT_DBTYPE
|
static int |
_DEFAULT_INDEX_FIELD
|
static java.lang.String |
_DEFAULT_PASSWORD
|
static boolean |
_DEFAULT_PERSISTENCE
Whether a tuple space is persistent by default and its index -1 indicates no index and what type |
static java.lang.String |
_DEFAULT_USER
This is what is used if no user/password is specified |
protected static java.lang.String |
_defaultPassword
The password for this space. |
protected static java.lang.String |
_defaultUserName
The Userid used for TupleSpace operations. |
static int |
_FIRST_CMD
Indicates that the command being sent is the first one in a long transaction At the server side, the command will be preceded by a beginTrans |
static java.lang.String |
_GALAXY_TSNAME
the galaxy tuple space name. |
protected boolean |
_isPersistent
is this tuple space persistent? |
static int |
_NORMAL_CMD
Indicates that the command being sent is part of a larger transaction. |
protected java.lang.String |
_password
The password for this space. |
static int |
_STAND_ALONE_CMD
Indicates that the command being sent is not part of any bigger transaction At the server side, the command will be preceded by a beginTrans and succeeded by a commitTrans |
static java.lang.String |
_TOP_GROUP
the default top group that everyone is a part of. |
protected java.lang.String |
_tsName
The name of the tuple space. |
protected int |
_tsPort
The port for this space's server. |
protected java.lang.String |
_tsServer
The name of the machine running the TupleSpace server |
protected java.lang.String |
_userName
The username for this space. |
protected boolean |
_userNameAlreadyUsed
A flag to make sure we don't change the username after the connection has been verified. |
static java.lang.String |
_VERSION
Code Version.Level.Modification Change this when a new level of code is to be released |
static java.lang.String |
ABORT
The string used to signal an abort operation. |
static java.lang.String |
ABORTTRANS
|
static java.lang.String |
ADDFACTORY
|
static java.lang.String |
ADDHANDLER
|
static java.lang.String |
BEGINTRANS
|
static java.lang.String |
CHECKPOINT
|
static int |
CLI_ID
|
static java.lang.String |
CLOSE
|
static int |
CMD_FLAG
|
static int |
CMD_TUP
|
static java.lang.String |
COMMITTRANS
|
static java.lang.String |
CONSUMINGSCAN
|
static java.lang.String |
COUNT
|
protected static int |
DEFAULTCONNECTTRIES
the number of times to try to connect to the server before raising an exception to the caller. |
static java.lang.String |
DEFAULTHOST
The default name of the machine running the TupleSpace server. |
static java.lang.String |
DEFAULTNAME
The default name of a TupleSpace if one isn't specified. |
static int |
DEFAULTPORT
The default port number used to connect to the TupleSpace server if a port number isn't specified (the usual case). |
static java.lang.String |
DELETE
|
static java.lang.String |
DELETEALL
|
static java.lang.String |
DELETETUPLEBYID
|
static int |
EVENT_ACTION_FLD
|
static int |
EVENT_COMMAND_FLD
the fields of an event tuple, keep with the making of the event templates until things stabilize pw. |
static java.lang.String |
EVENT_DEREGISTER
|
static int |
EVENT_EAT_FLD
|
static java.lang.String |
EVENT_REGISTER
|
static int |
EVENT_SEQ_FLD
|
static int |
EVENT_TUPLE_FLD
|
static java.lang.String |
EXCEPTION
The string used between the server and tspace library to signal a problem. |
static java.lang.String |
INDEXCREATE
|
static java.lang.String |
INDEXDESTROY
|
static java.lang.String |
INDEXFIELD
|
static java.lang.String |
INDEXSTATUS
|
static java.lang.String |
MULTIUPDATE
|
static java.lang.String |
MULTIWRITE
|
static java.lang.String |
OK
The string used between the server to signal good the operation completely normally. |
static java.lang.String |
PERSISTENCE
configuration field names. |
static java.lang.String |
PURGEWAIT
|
static java.lang.String |
READ
|
static java.lang.String |
READTUPLEBYID
|
static java.lang.String |
RHONDA
|
static java.lang.String |
SCAN
|
static java.lang.String |
SCANALL
|
static int |
SEQ_NUM
The top level tuple sent to the server has four fields ( Seq #, CmdTuple, clientID, Flag) |
static java.lang.String |
SHUTDOWN
|
static java.lang.String |
STATUS
|
static java.lang.String |
TAKE
|
static java.lang.String |
TAKETUPLEBYID
|
static int |
TS_ARG
|
static int |
TS_CMD
|
static int |
TS_NAME
|
static int |
TS_RETURN_VALUE
|
static int |
TS_STATUS_CODE
|
static java.lang.String |
TSACCESS
|
static java.lang.String |
TSCMD_LOCAL_IMPL
|
static java.lang.String |
TSCMD_SOCKET_IMPL
|
static java.lang.String |
TSCREATE
|
static java.lang.String |
TSDBTYPE
|
static java.lang.String |
TSDESTROY
|
static java.lang.String |
TSEXISTS
|
static java.lang.String |
UPDATE
|
static java.lang.String |
WAITTOREAD
|
static java.lang.String |
WAITTOTAKE
|
static java.lang.String |
WRITE
|
| Constructor Summary | |
TupleSpace()
Create a default tuple space. |
|
TupleSpace(java.lang.String name_)
Create a named Tuple Space. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
java.lang.String userName_,
java.lang.String password_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
SuperTuple accessPermissions_,
java.lang.String userName_,
java.lang.String password_)
Actual constructor used to create or access a named Tuple Space. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
Tuple accessPermissions_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String userName_,
java.lang.String password_)
Create or access a named Tuple Space with the specified user and password . |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
java.lang.String userName_,
java.lang.String password_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
SuperTuple configuration_)
Create a named Tuple Space with the specified configuration to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
Create a named Tuple Space to be stored and managed by a specified Tuple Space Server. |
|
TupleSpace(java.lang.String name_,
SuperTuple configuration_)
Create a named Tuple Space with the specified configuration. |
|
TupleSpace(java.lang.String name_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
Create a named Tuple Space with the specified configuration, username and password. |
|
TupleSpace(Tuple configuration_)
Create a default tuple space. |
|
| Method Summary | |
void |
addFactory(java.lang.Class[] classes)
add a new factory to this tuple space as the topmost (most powerful) factory. |
void |
addHandler(java.lang.String name,
java.lang.Class[] classes)
Add a new handler to this tuple space. |
static void |
appletEnvironment(boolean setting)
Class method to set the connection environemt so that it it will follow the Applet sandbox rules. |
void |
checkpoint()
Tells CheckpointManager to checkpoint the space. |
static void |
cleanup()
this method is used to close the current connections to the server. |
static void |
cleanup(java.lang.String server_,
int port_)
this method is used to close the current connections to the specified server. |
SuperTuple |
command(java.lang.String cmdString_,
SuperTuple argTuple_)
Issue a command to the TupleSpace and pass along a Tuple as an argument. |
SuperTuple |
command(java.lang.String cmdString_,
SuperTuple argTuple_,
long timeout_)
Issue a command to the TupleSpace and pass along a Tuple as an argument. |
static void |
connectionTries(int connectionTries_)
Deprecated. Use setConnectionTries |
static void |
connectionWaitTime(int connectionWaitTime_)
Deprecated. Use setConnectionTries |
Tuple |
consumingScan(java.io.Serializable obj)
Retrieve and delete all Tuples from the space that match a Tuple template. |
Tuple |
consumingScan(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve and delete all Tuples from the space that match a Tuple template. |
Tuple |
consumingScan(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve and delete all Tuples from the space that match a Tuple template. |
Tuple |
consumingScan(SuperTuple template)
Retrieve and delete all Tuples from the space that match a Tuple template. |
Tuple |
count(SuperTuple template)
Count all tuples from the space that match a Tuple template. |
int |
countN(SuperTuple template)
Count all tuples from the space that match a Tuple template. |
int |
delete(SuperTuple template)
Delete all tuples that match this template. |
int |
deleteAll()
Delete all tuples in a space. |
void |
deleteTupleById(TupleID id_)
delete a specific tuple from the space. |
void |
destroy()
|
void |
eventDeRegister(int seqNum)
DeRegister for some event on the server. |
int |
eventRegister(java.lang.String commandName_,
SuperTuple argTuple_,
Callback callback_)
Register for an event on the server. |
int |
eventRegister(java.lang.String commandName_,
SuperTuple argTuple_,
Callback callback_,
boolean callbackThreads_)
Register for an event on the server. |
static boolean |
exists(java.lang.String tsName_,
java.lang.String tsServer_)
|
static boolean |
exists(java.lang.String tsName_,
java.lang.String tsServer_,
int tsPort_)
|
static int |
getCommandWaitTime()
Class method to get the commandWaitTime value. |
static int |
getConnectionTries()
Class method to get the connectionTries value. |
static int |
getConnectionWaitTime()
Class method to get the connectionWaitTime value. |
Tuple |
getFactoryStack()
Return a scan of all the factory names for this tuple space and their level numbers --- level 0 is the highest --- most recently added --- factory. |
Tuple |
getHandlerCommandNames(java.lang.String factoryName_)
Return a scan of all the handler names for this factory --- this feature is *NOT* supported for the built in commands --- TSFSmallTS handlers. |
java.lang.String |
getName()
Return the space name. |
protected static java.lang.String |
getPassword()
get the password |
int |
getPort()
Return the number of the port. |
java.lang.String |
getServer()
Return the name of the server. |
protected static java.lang.String |
getUserName()
gets the user name |
static java.lang.String |
getVersion()
Class Method to Return the TSpaces Code Version number. |
Tuple |
in(Tuple template)
Deprecated. Use waitToTake() instead. |
Tuple |
indexCreate(java.lang.String name,
java.lang.Class classtype,
ConfigTuple config,
boolean rebuild)
Create an index and specify Index Configuration. |
void |
indexDestroy(java.lang.String name)
Destroy an index. |
Tuple |
indexStatus(java.lang.String name)
Get back the status of a Field index. |
SuperTuple |
inp(SuperTuple template)
Deprecated. Use take() instead. |
static boolean |
isValidTSName(java.lang.String s)
|
static void |
main(java.lang.String[] argv)
Test routine. |
byte[] |
makeJarFile(java.lang.Class[] classes_)
For all the classes, if the class is in a jar file, grab the entire jar file otherwise for plain .class classes ship them in their own .jar file. |
TupleID[] |
multiUpdate(Tuple tuple)
Each field of the tuple should be a SuperTuple and is to be written to the space. |
TupleID[] |
multiWrite(Tuple tuple)
Each field of the tuple should be a SuperTuple and is to be written to the space. |
void |
out(Tuple tuple)
Deprecated. Use write() instead |
static java.lang.Object |
parseConfigTuple(java.lang.String fieldName_,
SuperTuple configTuple_)
|
Tuple |
read(java.io.Serializable obj)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
read(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
read(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve a Tuple from the space that matches the Tuple template. |
SubclassableTuple |
read(SubclassableTuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
SuperTuple |
read(SuperTuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
read(Tuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
SuperTuple |
readTupleById(TupleID id_)
read a specific tuple from the space. |
Tuple |
rhonda(Tuple tuple)
The rendevous primitive. |
Tuple |
scan(java.io.Serializable obj)
Retrieve all Tuples from the space that match a Tuple template. |
Tuple |
scan(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve all Tuples from the space that match a Tuple template. |
Tuple |
scan(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve all Tuples from the space that match a Tuple template. |
Tuple |
scan(SuperTuple template)
Retrieve all Tuples from the space that match a Tuple template. |
static void |
setCallbackThreads(boolean callbackThreads_)
Class method to set the default for specification of whether a new Thread will be used for Event Register callbacks. |
static void |
setClosingDownByForcingFinalizers(boolean val_)
Deprecated. No longer does anything - Use appletEnvoronment(true) |
static void |
setCommandWaitTime(int commandWaitTime_)
Class method to set the WaitTime for a command response to a new value. |
static void |
setConnectionTries(int connectionTries_)
Class method to set the connectionTries to a new value. |
static void |
setConnectionWaitTime(int connectionWaitTime_)
Class method to set the connectionWaitTime to a new value. |
static void |
setDebug(boolean status)
This static class method will cause debugging information to be displayed on on STDOUT. |
static void |
setPassword(java.lang.String pass_)
Set default password to be used for access control for all spaces See comments on setUserName() |
static void |
setTSCmdImpl(java.lang.String className_)
Set default the class name for the TSCmdImpl that will be used for this Virtual Machine. |
static void |
setUserName(java.lang.String name_)
Set default username to be used for access control for all spaces in this virtual mmachine It will be used in the TupleSpace Constructor if not specified as a parameter and it will also be used for static commands issued prior to the constructor which setup a server connection (i.e. |
void |
setUserName(java.lang.String name_,
java.lang.String password_)
Deprecated. There are new static setUser and setPassword methods |
static Tuple |
shutdown(java.lang.String tsServer_,
int tsPort_,
java.lang.String user_,
java.lang.String password_)
|
static Tuple |
status(java.lang.String tsServer_)
|
static Tuple |
status(java.lang.String tsServer_,
int tsPort_)
|
Tuple |
take(java.io.Serializable obj1)
Retrieve a Tuple from the space that has one Field matching the Serializables. |
Tuple |
take(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve a tuple from the space that has two Fields matching specified Serializables. |
Tuple |
take(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve a tuple from the space that has three Fields matching specified Serializables. |
SubclassableTuple |
take(SubclassableTuple template)
Retrieve a tuple from the space that matches a Tuple template. |
SuperTuple |
take(SuperTuple template)
Retrieve a tuple from the space that matches a Tuple template. |
Tuple |
take(Tuple template)
Retrieve a tuple from the space that matches a Tuple template. |
SuperTuple |
takeTupleById(TupleID id_)
take a specific tuple from the space. |
TupleID |
update(SuperTuple replacer)
Update the tuple in the space that matches the supplied Tuple It is assumed that the Tuple supplied has been retrieved from the space and contains a valid TupleID. |
TupleID |
update(SuperTuple template,
SuperTuple replacer)
Update the tuple in the space that matches the supplied tuple by replacing it with the replacer tuple. |
TupleID |
update(TupleID uniqueId,
SuperTuple replacer)
Update the tuple in the space that matches the supplied uniqueId by replacing it with the replacer tuple. |
Tuple |
waitToRead(java.io.Serializable obj)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToRead(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToRead(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve a Tuple from the space that matches the Tuple template. |
SubclassableTuple |
waitToRead(SubclassableTuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
SubclassableTuple |
waitToRead(SubclassableTuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
SuperTuple |
waitToRead(SuperTuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
SuperTuple |
waitToRead(SuperTuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToRead(Tuple template)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToRead(Tuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToTake(java.io.Serializable obj1)
Retrieve a tuple from the space that has one Field matching the Serializables. |
Tuple |
waitToTake(java.io.Serializable obj1,
java.io.Serializable obj2)
Retrieve a tuple from the space that has two Fields matching specified Serializables. |
Tuple |
waitToTake(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Retrieve a tuple from the space that has three Fields matching specified Serializables. |
SubclassableTuple |
waitToTake(SubclassableTuple template)
Retrieve a tuple from the space that matches a Tuple template. |
SubclassableTuple |
waitToTake(SubclassableTuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
SuperTuple |
waitToTake(SuperTuple template)
Retrieve a tuple from the space that matches a Tuple template. |
SuperTuple |
waitToTake(SuperTuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
Tuple |
waitToTake(Tuple template)
Retrieve a tuple from the space that matches a Tuple template. |
Tuple |
waitToTake(Tuple template,
long timeout)
Retrieve a Tuple from the space that matches the Tuple template. |
TupleID |
write(java.io.Serializable obj)
Add a Tuple to the Tuple Space that has a single field equal to the Object. |
TupleID |
write(java.io.Serializable obj1,
java.io.Serializable obj2)
Add a Tuple to the Tuple Space that has two fields equal to the Objects passed in. |
TupleID |
write(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
Add a Tuple to the Tuple Space that has two fields equal to the Serializables passed in. |
TupleID |
write(SuperTuple tuple)
Add the Tuple to the Tuple Space. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final java.lang.String _VERSION
public static final boolean _DEFAULT_PERSISTENCE
public static final int _DEFAULT_INDEX_FIELD
public static final java.lang.String _DEFAULT_DBTYPE
public static final java.lang.String _DBTYPE_MMDB
public static final java.lang.String _DBTYPE_SMALLDB
public static final java.lang.String DEFAULTNAME
public static final int DEFAULTPORT
public static final java.lang.String DEFAULTHOST
public static final java.lang.String EXCEPTION
public static final java.lang.String OK
public static final java.lang.String PERSISTENCE
public static final java.lang.String INDEXFIELD
public static final java.lang.String TSDBTYPE
public static final java.lang.String _GALAXY_TSNAME
public static final java.lang.String _ADMIN_TSNAME
public static final java.lang.String WRITE
public static final java.lang.String TAKE
public static final java.lang.String READ
public static final java.lang.String WAITTOTAKE
public static final java.lang.String WAITTOREAD
public static final java.lang.String UPDATE
public static final java.lang.String DELETETUPLEBYID
public static final java.lang.String READTUPLEBYID
public static final java.lang.String TAKETUPLEBYID
public static final java.lang.String MULTIWRITE
public static final java.lang.String MULTIUPDATE
public static final java.lang.String SCAN
public static final java.lang.String CONSUMINGSCAN
public static final java.lang.String SCANALL
public static final java.lang.String COUNT
public static final java.lang.String DELETE
public static final java.lang.String DELETEALL
public static final java.lang.String TSEXISTS
public static final java.lang.String EVENT_REGISTER
public static final java.lang.String EVENT_DEREGISTER
public static final java.lang.String STATUS
public static final java.lang.String ADDFACTORY
public static final java.lang.String ADDHANDLER
public static final java.lang.String TSCREATE
public static final java.lang.String TSACCESS
public static final java.lang.String TSDESTROY
public static final java.lang.String BEGINTRANS
public static final java.lang.String ABORTTRANS
public static final java.lang.String COMMITTRANS
public static final java.lang.String SHUTDOWN
public static final java.lang.String PURGEWAIT
public static final java.lang.String INDEXCREATE
public static final java.lang.String INDEXDESTROY
public static final java.lang.String INDEXSTATUS
public static final java.lang.String CHECKPOINT
public static final java.lang.String CLOSE
public static final java.lang.String ABORT
public static final java.lang.String RHONDA
public static final int SEQ_NUM
public static final int CMD_TUP
public static final int CLI_ID
public static final int CMD_FLAG
public static final int EVENT_COMMAND_FLD
public static final int EVENT_TUPLE_FLD
public static final int EVENT_SEQ_FLD
public static final int EVENT_ACTION_FLD
public static final int EVENT_EAT_FLD
public static final java.lang.String _DEFAULT_USER
public static final java.lang.String _DEFAULT_PASSWORD
public static final int TS_NAME
public static final int TS_CMD
public static final int TS_ARG
public static final int TS_STATUS_CODE
public static final int TS_RETURN_VALUE
protected static final int DEFAULTCONNECTTRIES
public static final java.lang.String _TOP_GROUP
protected static java.lang.String _defaultUserName
protected static java.lang.String _defaultPassword
public static int _STAND_ALONE_CMD
public static int _FIRST_CMD
public static int _NORMAL_CMD
public static final java.lang.String TSCMD_LOCAL_IMPL
public static final java.lang.String TSCMD_SOCKET_IMPL
protected boolean _isPersistent
protected java.lang.String _tsName
protected java.lang.String _tsServer
protected int _tsPort
protected java.lang.String _userName
protected java.lang.String _password
protected boolean _userNameAlreadyUsed
protected java.util.Vector _currTransactions
| Constructor Detail |
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
SuperTuple accessPermissions_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
If it is a new space, then the space will be created on the specified server with the specified name. The specified configuration and access permissions will be assigned to the new space. The User and password will be used to authorized the abilty to create new spaces.
If a space with the specified name (at the host:port) already exists, then the configuration and access tuples will be ignored and the User and password will be used to determine the access permissions for the space.
name_ - A string that identifies the TupleSpace on the specified TupleSpaceServer.tsServer_ - A string that identifies the TupleSpaceServer that
manages the TupleSpace. May be of form host:porttsPort_ - The specific port that the TupleSpaceServer uses to
listen for connections from TupleSpace clients.
This parameter will be ignored if the port is specified
as part of the tsServer_ parameter.configuration_ - the configuration tuple for this spaceaccessPermissions_ - the permissions Tuple for this spaceuserName_ - the user's tspaces namepassword_ - the user's tspaces password
A configuration tuple looks like:
Tuple(new Field(TupleSpace.PERSISTENCE, new Boolean( true)),
new Field(TupleSpace.INDEXFIELD, new Integer(-1)),
new Field(TupleSpace.TSDBTYPE, new String(DBTYPE_SMALLDB or DBTYPE_MMDB)))
Any of the fields can be left out and ordering doesn't matter. For fields that
are left out, the defaults --- true, -1, DBTYPE_MMDB --- apply.
The configuration tuple is only used when the space is initially created.
The accessPermision Tuple contains a single Field that contains an Acl object, as defined in java.security.acl. One can construct an Acl with code like the following.
Permissions[] p1 = {P_READ,P_WRITE};
Principal owner = ACLFactory.createPrincipal("Jim");
Principal grp = ACLFactory.createPrincipal("Jim");
Acl myacl = AclFactory("MyAcl",owner);
myacl.addEntry(owner,AclFactory.createAclEntry(owner,p1);
myacl.addEntry(owner,AclFactory.createAclEntry(grp,p1);
The accessPermision Tuple is only used when the space is initially created.
Acl,
AclFactory
public TupleSpace()
throws TupleSpaceException
public TupleSpace(Tuple configuration_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serverconfiguration_ - the configuration tuple for this spaceaccessPermissions_ - the permissions Tuple for this spaceuserName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.The parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.userName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
SuperTuple configuration_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.configuration_ - the configuration tuple for this spaceThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A character string that identifies the TupleSpace on
the default TupleSpaceServer.configuration_ - the configuration tupleuserName_ - the name of the user for this spacepassword_ - the password of the userThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServerThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServeruserName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
SuperTuple configuration_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServerconfiguration_ - the configuration tuple for this spaceThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServerconfiguration_ - the configuration tuple for this spaceuserName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serverThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serveruserName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serverconfiguration_ - the configuration tuple for this spaceThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
java.lang.String userName_,
java.lang.String password_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serverconfiguration_ - the configuration tuple for this spaceuserName_ - the user's tspaces namepassword_ - the user's tspaces passwordThe parameters are described in more detail above
public TupleSpace(java.lang.String name_,
java.lang.String tsServer_,
int tsPort_,
SuperTuple configuration_,
Tuple accessPermissions_)
throws TupleSpaceException
name_ - A string that identifies the TupleSpace.tsServer_ - A string that identifies the TupleSpaceServertsPort_ - The specific port that will be used to contact the serverconfiguration_ - the configuration tuple for this spaceaccessPermissions_ - the permissions Tuple for this spaceThe parameters are described in more detail above
| Method Detail |
public static void setTSCmdImpl(java.lang.String className_)
Note that this impl will then be used in any subsequent TupleSpace constructors. It can be changed in midstream without messing up any previously allocated Spaces. However, be careful about static commands that dynamically obtain a TSCmd implementation (exists(), status())
className_ - The class name for the TSCmd implementationpublic static void setUserName(java.lang.String name_)
name_ - The new usernamepublic static void setPassword(java.lang.String pass_)
name_ - The new passwordprotected static java.lang.String getUserName()
protected static java.lang.String getPassword()
public void setUserName(java.lang.String name_,
java.lang.String password_)
throws TupleSpaceException
name_ - The new usernamepassword_ - The new passwordpublic static final boolean isValidTSName(java.lang.String s)
public static void setClosingDownByForcingFinalizers(boolean val_)
val_ - if true then force them on shutdown, if false do notpublic static void appletEnvironment(boolean setting)
setting - true if we want to run in an Applet environmentpublic static void connectionTries(int connectionTries_)
connectionTries_ - the number of times to try connecting to the server before failingpublic static void setConnectionTries(int connectionTries_)
connectionTries_ - the number of times to try connecting to the server before failingpublic static int getConnectionTries()
public static void connectionWaitTime(int connectionWaitTime_)
connectionWaitTime_ - the wait time in seconds between times
to try and talk to the serverpublic static void setConnectionWaitTime(int connectionWaitTime_)
connectionWaitTime_ - the time in seconds to wait for a connectionpublic static int getConnectionWaitTime()
public static void setCommandWaitTime(int commandWaitTime_)
commandWaitTime_ - the time (ms) to wait for a command responsepublic static int getCommandWaitTime()
public static void setCallbackThreads(boolean callbackThreads_)
Note: The default setting of false will mean that there is only a single thread that all TupleSpace events and therefore it is important to not do anything in a callback that will block all future TupleSpace calls. This means that you must not issue new TupleSpace operations
Setting it to true on the otherhand, creates a new Thread for every callback, which is expensive. It can also introduce new Thread sysnronization problems that you must be careful to handle.
callbackThreads_ - boolean value to control whether new threads are
started for EventRegister callbacks.
public TupleID update(SuperTuple replacer)
throws TupleSpaceException
replacer - the tuple to be updated
public TupleID update(TupleID uniqueId,
SuperTuple replacer)
throws TupleSpaceException
uniqueID - The TupleID of the tuple to be replacedreplacer - the replacement tuple
public TupleID update(SuperTuple template,
SuperTuple replacer)
throws TupleSpaceException
Note that this command is non-blocking. If no match for the template is found, an exception is thrown and the replacer is not written to the space. Note that the template and replacer need not have the same signature.
template - a template or actual tuple to be removedreplacer - the replacement tuple
public TupleID[] multiWrite(Tuple tuple)
throws TupleSpaceException
tuple - a tuple of tuples each of which is to be written to the space.
public TupleID[] multiUpdate(Tuple tuple)
throws TupleSpaceException
tuple - a tuple of tuples each of which is to be written to the space.
public void deleteTupleById(TupleID id_)
throws TupleSpaceException
Example: TupleID id = _tuple.getTupleID(); ts.deleteTupleById(id);Also see the readTupleById() method.
id_ - the identifier of the tuple to be deleted
public SuperTuple readTupleById(TupleID id_)
throws TupleSpaceException
Example:
TupleID id = ts.write(tuple);
ts.readTupleById(id);
What is passed to the server is a null Tuple that contains only the
the TupleID to be returned. Here is the code from readTupleById()
readTupleById(TupleID id_) {
Tuple tuple = new Tuple();
tuple.setTupleID(id_);
return command(READTUPLEBYID, tuple);
id_ - the identifier of the tuple to be deleted
public SuperTuple takeTupleById(TupleID id_)
throws TupleSpaceException
Example:
eventRegister(TupleSpace.WRITE, template, this, true) ;
...
call(String type,String ts,int seq,SuperTuple tuple,boolean ex) {
...
SuperTuple t;
try {
TupleID id = tuple.getTupleID()
t = ts.takeTupleById(id);
} catch (TupleSpaceExeption tse) {
}
if ( t != null) {
//proceed to use tuple t.
// Note: it may have been updated
id_ - the identifier of the tuple to be deleted
public TupleID write(SuperTuple tuple)
throws TupleSpaceException
tuple - The Tuple to be added to the space.
public TupleID write(java.io.Serializable obj)
throws TupleSpaceException
obj - The Serializable for the Field.
public TupleID write(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - The Serializable for the first Field.obj2 - The Serializable for the second Field.
public TupleID write(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - The Serializable for the first Field.obj2 - The Serializable for the second Field.obj3 - The Serializable for the third Field.
public SuperTuple waitToTake(SuperTuple template)
throws TupleSpaceException
template - A template SuperTuple that is used to match a tuple in the space.
public SuperTuple waitToTake(SuperTuple template,
long timeout)
throws TupleSpaceException
See the waitToTake(SuperTuple template) for additional comments.
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public Tuple waitToTake(Tuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple waitToTake(Tuple template,
long timeout)
throws TupleSpaceException
See the waitToTake(Tuple template) for additional comments.
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public SubclassableTuple waitToTake(SubclassableTuple template)
throws TupleSpaceException
template - A template SubclassableTuple (one with at least one formal field)
that is used to match a tuple in the space.
public SubclassableTuple waitToTake(SubclassableTuple template,
long timeout)
throws TupleSpaceException
See the waitToTake(SubclassableTuple template) for additional comments.
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public Tuple waitToTake(java.io.Serializable obj1)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.
public Tuple waitToTake(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.
public Tuple waitToTake(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.obj3 - An Serializable to match the second Field against.
public SuperTuple take(SuperTuple template)
throws TupleSpaceException
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.
This version of take has a SuperTuple template param and thus is the
most general and returns a SuperTuple return tuple.
public Tuple take(Tuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public SubclassableTuple take(SubclassableTuple template)
throws TupleSpaceException
template - A template SubclassableTuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple take(java.io.Serializable obj1)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.
public Tuple take(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.
public Tuple take(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.obj3 - An Serializable to match the second Field against.
public SuperTuple waitToRead(SuperTuple template)
throws TupleSpaceException
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.
public SuperTuple waitToRead(SuperTuple template,
long timeout)
throws TupleSpaceException
See the waitToRead(SuperTuple template) for additional comments.
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public Tuple waitToRead(Tuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple waitToRead(Tuple template,
long timeout)
throws TupleSpaceException
See the waitToRead(SuperTuple template) for additional comments.
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public SubclassableTuple waitToRead(SubclassableTuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public SubclassableTuple waitToRead(SubclassableTuple template,
long timeout)
throws TupleSpaceException
See the waitToRead(Tuple template) for additional comments.
template - A template SubclassableTuple (one with at least one formal field)
that is used to match a tuple in the space.timeout - (ms) Time interval that the command will wait before
aborting the request and returning null.
public Tuple waitToRead(java.io.Serializable obj)
throws TupleSpaceException
obj - The Field of a tuple to match one in the space to
be returned.
public Tuple waitToRead(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - The Field of a tuple to match one in the space to
be returned.obj2 - The Field of a tuple to match one in the space to
be returned.
public Tuple waitToRead(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - The Field of a tuple to match one in the space to
be returned.obj2 - The Field of a tuple to match one in the space to
be returned.obj3 - The Field of a tuple to match one in the space to
be returned.
public SuperTuple read(SuperTuple template)
throws TupleSpaceException
template - A template SuperTuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple read(Tuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public SubclassableTuple read(SubclassableTuple template)
throws TupleSpaceException
template - A template SubclassableTuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple read(java.io.Serializable obj)
throws TupleSpaceException
obj - The Field of a tuple to match one in the space to
be returned.
public Tuple read(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - The Field of a tuple to match one in the space to
be returned.obj2 - The Field of a tuple to match one in the space to
be returned.
public Tuple read(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - The Field of a tuple to match one in the space to
be returned.obj2 - The Field of a tuple to match one in the space to
be returned.obj3 - The Field of a tuple to match one in the space to
be returned.
public Tuple scan(SuperTuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.Field.formal()
public Tuple scan(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - An object to match the first Field against.obj2 - An object to match the second Field against.obj3 - An Serializable to match the second Field against.Field.formal()
public Tuple scan(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.Field.formal()
public Tuple scan(java.io.Serializable obj)
throws TupleSpaceException
obj - An Serializable to match the first Field against.
public Tuple consumingScan(SuperTuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public Tuple consumingScan(java.io.Serializable obj1,
java.io.Serializable obj2,
java.io.Serializable obj3)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.obj3 - An Serializable to match the second Field against.
public Tuple consumingScan(java.io.Serializable obj1,
java.io.Serializable obj2)
throws TupleSpaceException
obj1 - An Serializable to match the first Field against.obj2 - An Serializable to match the second Field against.
public Tuple consumingScan(java.io.Serializable obj)
throws TupleSpaceException
obj - An Serializable to match the first Field against.
public Tuple count(SuperTuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public int countN(SuperTuple template)
throws TupleSpaceException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public int delete(SuperTuple template)
throws TupleSpaceException
template - A template Tuple that is used to match tuples in the space.
public int deleteAll()
throws TupleSpaceException
public Tuple indexCreate(java.lang.String name,
java.lang.Class classtype,
ConfigTuple config,
boolean rebuild)
throws TupleSpaceException
name - Field name that is being indexedclass - Class of Objects that are contained in this indexconfig - Instance of ConfigTuple that describes Index attributes.rebuild - true if Index should be rebuilt.
false if it should not be rebuilt.Field,
ConfigTuple
public Tuple indexStatus(java.lang.String name)
throws TupleSpaceException
name - Field name that is being indexedconfig - Instance of ConfigTuple that describes Index attributes.
public void indexDestroy(java.lang.String name)
throws TupleSpaceException
name - Field name that is being indexed
public void checkpoint()
throws TupleSpaceException
public Tuple rhonda(Tuple tuple)
throws TupleSpaceException
For example:
// Issue Rhonda operator For Rock Paper Sissors
// pass a Tuple template with my Id and choice of R, P, or S
// It will return any existing rhonda matching template or wait until
// one appears.
Tuple myTuple = new Tuple(new Field(Id),new Field(RPS));
Tuple otherTuple = ts.rhonda(myTuple)
String opponent = (String)otherTuple.getField(0).getValue();
String answer = (String)otherTuple.getField(1).getValue();
tuple - The data tuple (to "out")
public byte[] makeJarFile(java.lang.Class[] classes_)
throws java.io.IOException,
TupleSpaceClientException
classes_ - the classes to make it from
public void addHandler(java.lang.String name,
java.lang.Class[] classes)
throws TupleSpaceException
classes - the classes for the handler the handler should be the last one
public Tuple getFactoryStack()
throws TupleSpaceException
TSFactory#updateFactoryInfo
public Tuple getHandlerCommandNames(java.lang.String factoryName_)
throws TupleSpaceException,
TupleSpaceClientException,
TupleSpaceServerException
factoryName_ - the name of the factory we are interested in.TSFactory#addHandler
public void addFactory(java.lang.Class[] classes)
throws TupleSpaceException
classes - the classes_ all the classes needed to implement the factory that aren't
part of the TupleSpace library with the factory itself being the first one. The factory
itself is the class that is derived in some fashion from TSFactory that the user wants to
be the implementation of the new factory.
public void destroy()
throws TupleSpaceException
public static java.lang.Object parseConfigTuple(java.lang.String fieldName_,
SuperTuple configTuple_)
throws TupleSpaceException
public static boolean exists(java.lang.String tsName_,
java.lang.String tsServer_)
throws TupleSpaceException
public static boolean exists(java.lang.String tsName_,
java.lang.String tsServer_,
int tsPort_)
throws TupleSpaceException
public static Tuple status(java.lang.String tsServer_)
throws TupleSpaceException
public static Tuple status(java.lang.String tsServer_,
int tsPort_)
throws TupleSpaceException
public static Tuple shutdown(java.lang.String tsServer_,
int tsPort_,
java.lang.String user_,
java.lang.String password_)
throws TupleSpaceException
public int eventRegister(java.lang.String commandName_,
SuperTuple argTuple_,
Callback callback_)
throws TupleSpaceException
This is a convenience method that will call the real method with the "newThread" value set to the default. The default can be changed using the setCallbackThreads method.
commandName_ - the operation "WRITE" or "DELETE" to be on the watch for!argTuple_ - the tuple to be on the look at for happening on the above commandNamecallback_ - what class object contains the call() method that will be called
when the event happens.
public int eventRegister(java.lang.String commandName_,
SuperTuple argTuple_,
Callback callback_,
boolean callbackThreads_)
throws TupleSpaceException
An event is the exection of a "WRITE" or "DELETE" on some tuple. The selection of which tuples you are interested in is via a template tuple
You must have a class that implements Callback. The Callback interface defines a call() method tht is given control when the event occurs. The call() method should returns false for deregistering after a call is executed
If you have the newThread parameter set to false, then MAKE SURE you don't do much in your callback handler, the thread that handles communication to the tuple space server(s) for this VM will be calling you personally and you don't want to tie that guy up. If you issue another TupleSpace command in the callback without having created a new thread, then it will hang. On the otherhand, it is expensive to create a new Thread so if you don't need to do much, then it is better to use the existing global callbackThread. Also, multiple Threads can cause sysncronization problems that you must be prepared to handle.
This code will first call the TSCmd instance to warn it to expect event to arrive and then will send the Register command to the server.
commandName_ - the operation "WRITE" or "DELETE" to be on the watch for!argTuple_ - the tuple to be on the look at for happening on the above commandNamecallback_ - what class object contains the call() method that will be called
when the event happens.callbackThreads - If true, a new Thread will be created to handle the callback.
public void eventDeRegister(int seqNum)
throws TupleSpaceException
seqNum - the sequence number of the event to be deregisterd.public static void cleanup()
public static void cleanup(java.lang.String server_,
int port_)
public SuperTuple command(java.lang.String cmdString_,
SuperTuple argTuple_)
throws TupleSpaceException
cmdString_ - The String that names the command.argTuple_ - The argument Tuple, can be null.TupleSpaceHandler
public SuperTuple command(java.lang.String cmdString_,
SuperTuple argTuple_,
long timeout_)
throws TupleSpaceException
cmdString_ - The String that names the command.argTuple_ - The argument Tuple, can be null.timeout_ - Timeout value (ms)TupleSpaceHandlerpublic java.lang.String getName()
public java.lang.String getServer()
public int getPort()
public static java.lang.String getVersion()
public void out(Tuple tuple)
throws TupleSpaceException,
TupleSpaceCommunicationException,
TupleSpaceClientException,
TupleSpaceServerException
tuple - The Tuple to be added to the space.
public Tuple in(Tuple template)
throws TupleSpaceException,
TupleSpaceCommunicationException,
TupleSpaceClientException,
TupleSpaceServerException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.
public SuperTuple inp(SuperTuple template)
throws TupleSpaceException,
TupleSpaceCommunicationException,
TupleSpaceClientException,
TupleSpaceServerException
template - A template Tuple (one with at least one formal field)
that is used to match a tuple in the space.public static void setDebug(boolean status)
status - is true to turn on the debug outputpublic static void main(java.lang.String[] argv)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||