com.j_spaces.map
Class Command

java.lang.Object
  extended by com.j_spaces.core.client.MetaDataEntry
      extended by com.j_spaces.map.Command
All Implemented Interfaces:
IMetaDataEntry, IReplicatable, Serializable, Entry

public class Command
extends MetaDataEntry
implements IReplicatable, Entry

Command is an Entry which is used to define notification events fired by Central (~Remote) space . This is used as a way for a local space to synchronize its change with all other local spaces which are connected to same Central (~Remote) space. When a local space takes/updates an entry, an appropriate Command is written to the Central (~Remote) space to have it notify all its local spaces so that all local spaces can learn about the change and synchronize with one other. For internal use only!

Since:
2.5
See Also:
Serialized Form

Nested Class Summary
static class Command.Action
          The command action types.
 
Field Summary
 Command.Action action
          The action performed.
 String cacheID
          The cache id.
 String[] uids
          The Entries uids.
 
Constructor Summary
Command()
          No arguments constructor.
Command(String[] uids, Command.Action action, String cacheID)
          Constructor with uid, action and cacheID.
Command(String uid, Command.Action action, String cacheID)
          Constructor with uid and action.
 
Method Summary
static String[] __getSpaceIndexedFields()
          Make an index for hash-based load balancing.
static Command createTakeCommand(String[] uids, String cacheID)
          Utility method to create a command with uids and take action.
static Command createTakeCommand(String uid, String cacheID)
          Utility method to create a command with uid and take action.
static Command createUpdateCommand(String[] uids, String cacheID)
          Utility method to create a command with uids and update action.
static Command createUpdateCommand(String uid, String cacheID)
          Utility method to create a command with uid and update action.
 String getCacheID()
          Returns the cache id.
 
Methods inherited from class com.j_spaces.core.client.MetaDataEntry
__getEntryInfo, __setEntryInfo, isFifo, isNOWriteLeaseMode, isTransient, makePersistent, makeTransient, setFifo, setNOWriteLeaseMode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheID

public String cacheID
The cache id.


uids

public String[] uids
The Entries uids.


action

public Command.Action action
The action performed.

Constructor Detail

Command

public Command()
No arguments constructor.


Command

public Command(String uid,
               Command.Action action,
               String cacheID)
Constructor with uid and action.

Parameters:
uid - UID of the entry that is being affected (taken or updated)
action - defines what happened to the entry with uid. ACTION_TAKE/ACTION_UPDATE
cacheID - a unique cache id

Command

public Command(String[] uids,
               Command.Action action,
               String cacheID)
Constructor with uid, action and cacheID.

Parameters:
uids - UIDs of the entries that are being affected (taken or updated)
action - defines what happened to the entries with uids. taken/updated
cacheID - a unique cache id
Method Detail

createTakeCommand

public static Command createTakeCommand(String uid,
                                        String cacheID)
Utility method to create a command with uid and take action. Such command defines that entry with uid is taken from the cache.

Parameters:
uid - of the entry being affected
cacheID - a unique cache id
Returns:
a command defining that entry with uid is taken from the cache.

createTakeCommand

public static Command createTakeCommand(String[] uids,
                                        String cacheID)
Utility method to create a command with uids and take action. Such command defines that entries with uids are taken to the cache.

Parameters:
uids - of the entries being affected
cacheID - a unique cache id
Returns:
a command defining that entries with uids are taken from the cache.

createUpdateCommand

public static Command createUpdateCommand(String uid,
                                          String cacheID)
Utility method to create a command with uid and update action. Such command defines that entry with uid is updated in the cache.

Parameters:
uid - of the entry being affected
cacheID - a unique cache id
Returns:
a command defining that entry with uid is updated in the cache.

createUpdateCommand

public static Command createUpdateCommand(String[] uids,
                                          String cacheID)
Utility method to create a command with uids and update action. Such command defines that entries with uids are updated in the cache.

Parameters:
uids - of the entries being affected
cacheID - a unique cache id
Returns:
a command defining that entries with uids are updated in the cache.

getCacheID

public String getCacheID()
Returns the cache id.

Returns:
the cache id

__getSpaceIndexedFields

public static String[] __getSpaceIndexedFields()
Make an index for hash-based load balancing.

Returns:
the cache id