|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.databeans.AbstractDataObject
dsto.dfc.databeans.DataObject
livespace.services.EntityRegistry
public class EntityRegistry
A registry of Entity
's. This is a data
object whose properties are entity ID's and values are the entiites
themselves.
Field Summary |
---|
Fields inherited from class dsto.dfc.databeans.DataObject |
---|
propertyToValue, typeInfo |
Fields inherited from class dsto.dfc.databeans.AbstractDataObject |
---|
listeners |
Fields inherited from interface dsto.dfc.databeans.IDataObject |
---|
OVERRIDE, PERSISTENT, PERSISTENT_OVERRIDE, TRANSIENT, TRANSIENT_OVERRIDE |
Constructor Summary | |
---|---|
EntityRegistry()
|
Method Summary | |
---|---|
void |
add(Entity entity)
Add an entity to the registry. |
void |
clear()
Remove all entities. |
boolean |
contains(Entity entity)
|
boolean |
containsId(String id)
Test if a given ID exists in the registry. |
Entity |
find(String id)
Find an entity with a given ID. |
protected int |
getEventNestingLevel()
|
Iterator<Entity> |
iterator()
Create an iterator over all the values in the object. |
Object |
mutex()
The mutex that must be held to ensure thread safety. |
Entity |
peek(String id)
Peek to see if an entity exists. |
void |
remove(Entity entity)
Remove an entity. |
void |
remove(String id)
Remove an entity with a given ID. |
void |
setValue(Object name,
Object value,
int mode)
Set the value of a given property. |
Entity |
singleton()
Get the entity that is the sole entry in the registry, This is usually used for entity types where only one instance will exist (eg room). |
int |
size()
The number of entities in the registry. |
Set<Entity> |
snapshot()
Create a snapshot of the current entities. |
Entity[] |
toArray()
|
void |
waitForEntities(int count)
Wait a default amount of time for a given number of entities to arrive. |
Entity |
waitForEntity()
Wait up to a default amount of time for a single entity to arrive. |
Entity |
waitForEntity(String id)
Wait for an entity with a given ID to appear and then return it. |
Methods inherited from class dsto.dfc.databeans.DataObject |
---|
getTypeInfo, getValue, isTransient, propertyIterator, setTypeInfo, shallowClone |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EntityRegistry()
Method Detail |
---|
public Object mutex()
EntityContainer.mutex()
,
Entity.mutex()
public void clear()
public Iterator<Entity> iterator()
DataObject
iterator
in interface Iterable<Entity>
iterator
in class DataObject
public void add(Entity entity) throws IllegalArgumentException
entity
- The entity to add.
IllegalArgumentException
- if ID is null or already in use.public void remove(Entity entity) throws IllegalStateException
entity
-
IllegalStateException
- if another entity with the same ID
is in the registry.public void remove(String id)
public void setValue(Object name, Object value, int mode)
IDataObject
setValue
in interface IDataObject
setValue
in class DataObject
name
- A property name.value
- The new value. On most objects using null removes
the property.mode
- The mode for the value. This is a bitwise OR of
TRANSIENT and/or OVERRIDE. Using TRANSIENT specifies the
value is to be marked transient (ie isTransient (name)
will return true). Not all data object implementations
support dynamic transience. OVERRIDE must be set if an
existing value is to be overwritten: if not set and a
value is already defined, then nothing is changed. The
IDataObject.setValue (name, value) call corresponds to
IDataBean.setValue (name, value, OVERRIDE).IDataObject.setValue(Object, Object)
public Entity peek(String id)
id
- The entity ID.
find(String)
public Entity find(String id) throws IllegalArgumentException
id
- The entity ID.
IllegalArgumentException
- if no entity with the ID exists.peek(String)
public boolean containsId(String id)
public boolean contains(Entity entity)
public Entity singleton() throws IllegalStateException
IllegalStateException
- if there is not exactly one entity
in the registry.public int size()
public Set<Entity> snapshot()
iterator()
public Entity[] toArray()
protected int getEventNestingLevel()
EventListenerList.getEventNestingLevel()
public Entity waitForEntity() throws SynchronizationException
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.SizeSynchronizer.waitForEntity(EntityRegistry)
public void waitForEntities(int count) throws SynchronizationException
count
- The required minimum number of entities.
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.SizeSynchronizer.waitForEntities(EntityRegistry, int)
public Entity waitForEntity(String id) throws SynchronizationException
id
- The entity ID.
SynchronizationException
- if the entity does not appear
within the default timeout period.PropertySynchronizer.waitForNonNullProperty(IDataObject, String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |