lime
Class LimeSystemTupleSpace

java.lang.Object
  extended bylime.LimeSystemTupleSpace

public class LimeSystemTupleSpace
extends java.lang.Object

The LimeSystemTupleSpace (LSTS) gives the Lime Application Programmer the ability to access the system context information including which hosts are present, which agents are present, and which tuple spaces are at the agents. We also introduce what we refer to as an anti-tuple for hosts, agents, and tuple spaces. An anti-tuple basically represents a component that was once present, but is no longer present. For example, when a host departs, its host tuple is replaced with a host anti-tuple. If that host space returns, its anti-tuple is removed and replaced with a "real" tuple.

Because engagement and disengagement are atomic, the LSTS at each host will be identical at all times, so there is no notion of sharing or federating the LSTS. It is simply a local tuple space.

A Host tuple has the format <_host, LimeServerID>

An Agent tuple has the format <_agent, AgentID, LimeServerID>

A TS tuple has the format <_tuplespace, String, AgentID>, where the string is the name of the tuple space.

The corresponding anti-tuples have the same format, but the tags are _host_gone, _agent_gone, and _tuplespace_gone.

At this point, the application programmer must be aware of the format of these tuples in order to properly access information from the LSTS.

The basic operations are a limited subset of the operations on the LimeTupleSpace. Namely: rd, rdp, rdg, addReaction, removeReaction. Operations which modify the tuple space are not allowed.

Version:
1.0 alpha
Author:
Amy L. Murphy, Gian Pietro Picco
See Also:
LimeTupleSpace

Field Summary
(package private)  LimeSystemTSMgr mgr
           
(package private)  AgentID owner
           
 
Constructor Summary
LimeSystemTupleSpace()
           
 
Method Summary
 RegisteredReaction[] addReaction(LimeSystemReaction[] reactions)
          Registers a group of reactions with the Lime System tuple space.
private  boolean isInReaction()
           
 lights.interfaces.ITuple rd(lights.interfaces.ITuple template)
          Retrieves a copy of a tuple that matches a given template.
 lights.interfaces.ITuple[] rdg(lights.interfaces.ITuple template)
          Retrieves all of the tuples that match a given template, or returns null if no matching tuple exists.
 lights.interfaces.ITuple rdp(lights.interfaces.ITuple template)
          Retrieves a copy of a tuple that matches a given template, or returns null if no matching tuple exists.
 void removeReaction(RegisteredReaction[] reactions)
          Deregisters a group of reactions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

AgentID owner

mgr

LimeSystemTSMgr mgr
Constructor Detail

LimeSystemTupleSpace

public LimeSystemTupleSpace()
Method Detail

rdp

public lights.interfaces.ITuple rdp(lights.interfaces.ITuple template)
                             throws TupleSpaceEngineException
Retrieves a copy of a tuple that matches a given template, or returns null if no matching tuple exists. The LSTS is searched. If multiple tuples match the template, one is selected non-deterministically.

Parameters:
template - the template the return tuple must be matched against.
Returns:
a copy of a tuple that matches the template, or null if the tuple cannot be found.
Throws:
TupleSpaceEngineException - if a problem is encountered in the underlying tuple space engine.

rd

public lights.interfaces.ITuple rd(lights.interfaces.ITuple template)
                            throws TupleSpaceEngineException
Retrieves a copy of a tuple that matches a given template. The LSTS is searched. If multiple tuples match the template, one is selected non-deterministically. If no matching tuple is present the operation blocks until such a tuple can be actually found in the tuple space.

Parameters:
template - the template the return tuple must be matched against.
Returns:
a copy of a tuple that matches the template.
Throws:
TupleSpaceEngineException - if a problem is encountered in the underlying tuple space engine.

rdg

public lights.interfaces.ITuple[] rdg(lights.interfaces.ITuple template)
                               throws TupleSpaceEngineException
Retrieves all of the tuples that match a given template, or returns null if no matching tuple exists.

Parameters:
template - the template the return tuple must be matched against.
Returns:
a copy of a tuple that matches the template, or null if the tuple cannot be found.
Throws:
TupleSpaceEngineException - if a problem is encountered in the underlying tuple space engine.

addReaction

public RegisteredReaction[] addReaction(LimeSystemReaction[] reactions)
                                 throws TupleSpaceEngineException
Registers a group of reactions with the Lime System tuple space. The operation is performed atomically, i.e., even if some of the reactions become suddenly enabled by the current state of the tuple space, none can fire until all of them have been registered.

Parameters:
reactions - an array containing the reactions to be registered.
Throws:
TupleSpaceEngineException - if a problem is encountered in the underlying tuple space engine.

removeReaction

public void removeReaction(RegisteredReaction[] reactions)
                    throws TupleSpaceEngineException,
                           NoSuchReactionException
Deregisters a group of reactions. The operation is performed atomically, i.e., the reactions are deregistered all together before any other operation or reaction is performed on the tuple space. This operation has all-or-nothing semantics, meaning that either all of the reactions are uninstalled, or none of them are. In other words, if at least one of the reactions specified in the array is not registered with the tuple space, then none of the reactions are disabled and NoSuchReactionException is raised.

Parameters:
reactions - an array containing the reactions to be deregistered.
Throws:
NoSuchReactionException - if some of the reactions are actually not registered.
TupleSpaceEngineException - if a problem is encountered in the underlying tuple space engine.

isInReaction

private boolean isInReaction()