Package nl.tue.id.oocsi.client.behavior
Class OOCSIAwareness
java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<java.lang.String>
nl.tue.id.oocsi.client.behavior.OOCSIAwareness
public class OOCSIAwareness extends OOCSISystemCommunicator<java.lang.String>
OOCSIAwareness is a system-level primitive that allows for local representations of different OOCSI clients on the
same channel and the data they share on that channel. The local representation will be about several keys or all
data. This realizes synchronization on data without aggregation.
- Author:
- matsfunk
-
Nested Class Summary
Nested classes/interfaces inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
OOCSISystemCommunicator.SystemFilter<K>
-
Field Summary
Fields inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
channelName, client, HANDLE
-
Constructor Summary
Constructors Constructor Description OOCSIAwareness(OOCSIClient client, java.lang.String channelName)
create a new awareness process on the given channel for ALL dataOOCSIAwareness(OOCSIClient client, java.lang.String channelName, int timeout, java.lang.String... keys)
create a new awareness process on the given channel for the specified data (as keys), a timeout is specified to "forget" nodes on the channel, unless they post data during the timeout durationOOCSIAwareness(OOCSIClient client, java.lang.String channelName, java.lang.String... keys)
create a new awareness process on the given channel for the specified data (as keys) -
Method Summary
Modifier and Type Method Description boolean
containsNode(java.lang.Object nodeName)
check whether a node given by nodeName is representedjava.lang.Object
get(java.lang.String nodeName, java.lang.String key)
get data with key from node with given namejava.lang.Double
get(java.lang.String nodeName, java.lang.String key, double defaultValue)
get data with key from node with given namefloat
get(java.lang.String nodeName, java.lang.String key, float defaultValue)
get data with key from node with given namejava.lang.Integer
get(java.lang.String nodeName, java.lang.String key, int defaultValue)
get data with key from node with given namejava.lang.Long
get(java.lang.String nodeName, java.lang.String key, long defaultValue)
get data with key from node with given namejava.lang.String
get(java.lang.String nodeName, java.lang.String key, java.lang.String defaultValue)
get data with key from node with given nameboolean
isEmpty()
check whether nodes are locally representedjava.util.List<java.lang.String>
keys()
retrieve all keys that will be represented from node data (configured in constructor)java.util.Set<java.lang.String>
nodes()
retrieve set of node namesjava.util.Map<java.lang.String,java.lang.Object>
remove(java.lang.String key)
remove a node from the local representationint
size()
retrieve the number of nodesMethods inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
addFilter, getHandle, message, message, message, subscribe, triggerHandler, updateFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
OOCSIAwareness
create a new awareness process on the given channel for ALL data- Parameters:
client
-channelName
-
-
OOCSIAwareness
create a new awareness process on the given channel for the specified data (as keys)- Parameters:
client
-channelName
-keys
-
-
OOCSIAwareness
public OOCSIAwareness(OOCSIClient client, java.lang.String channelName, int timeout, java.lang.String... keys)create a new awareness process on the given channel for the specified data (as keys), a timeout is specified to "forget" nodes on the channel, unless they post data during the timeout duration- Parameters:
client
-channelName
-timeout
-keys
-
-
-
Method Details
-
size
public int size()retrieve the number of nodes- Returns:
-
isEmpty
public boolean isEmpty()check whether nodes are locally represented- Returns:
-
containsNode
public boolean containsNode(java.lang.Object nodeName)check whether a node given by nodeName is represented- Parameters:
nodeName
-- Returns:
-
get
public java.lang.Integer get(java.lang.String nodeName, java.lang.String key, int defaultValue)get data with key from node with given name- Parameters:
nodeName
-key
-defaultValue
-- Returns:
-
get
public java.lang.Long get(java.lang.String nodeName, java.lang.String key, long defaultValue)get data with key from node with given name- Parameters:
nodeName
-key
-defaultValue
-- Returns:
-
get
public java.lang.Double get(java.lang.String nodeName, java.lang.String key, double defaultValue)get data with key from node with given name- Parameters:
nodeName
-key
-defaultValue
-- Returns:
-
get
public float get(java.lang.String nodeName, java.lang.String key, float defaultValue)get data with key from node with given name- Parameters:
nodeName
-key
-defaultValue
-- Returns:
-
get
public java.lang.String get(java.lang.String nodeName, java.lang.String key, java.lang.String defaultValue)get data with key from node with given name- Parameters:
nodeName
-key
-defaultValue
-- Returns:
-
get
public java.lang.Object get(java.lang.String nodeName, java.lang.String key)get data with key from node with given name- Parameters:
nodeName
-key
-- Returns:
-
remove
public java.util.Map<java.lang.String,java.lang.Object> remove(java.lang.String key)remove a node from the local representation- Parameters:
key
-- Returns:
-
nodes
public java.util.Set<java.lang.String> nodes()retrieve set of node names- Returns:
-
keys
public java.util.List<java.lang.String> keys()retrieve all keys that will be represented from node data (configured in constructor)- Returns:
-