|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object livespace.services.EntityContainer livespace.services.EntityClient
public class EntityClient
A container that populates its entity registry with available entities matching a type query and keeps them up to date with state changes.
NOTES:
EntityServer
Nested Class Summary |
---|
Nested classes/interfaces inherited from class livespace.services.EntityContainer |
---|
EntityContainer.EmitNotificationTask |
Field Summary | |
---|---|
protected livespace.services.EntityClient.DeadEntityWatcher |
deadEntityWatcher
|
protected boolean |
inhibitEventHandling
|
protected Subscription |
subscription
|
Fields inherited from class livespace.services.EntityContainer |
---|
containerId, elvin, entities, room, scheduler |
Constructor Summary | |
---|---|
EntityClient(Elvin elvin,
RoomEntity room,
String entityType)
Create an instance within a given room scope (ie discovered entities are visible only to the current room). |
|
EntityClient(Elvin elvin,
RoomEntity room,
String entityType,
EntityRegistry entities)
Create an instance within a given room scope (ie discovered entities are visible only to the current room). |
|
EntityClient(Elvin elvin,
String entityType)
Create an instance with no room scope (ie contained entities have global scope). |
Method Summary | |
---|---|
Notification |
createRequestNtfn(Entity entity,
String action)
Create the base template for a Livespace request notification, filling in all required fields. |
Notification |
createUpdateNtfn()
Create the base template for a Livespace update request, filling in all required fields. |
protected XmlInput |
createXmlInput()
Overriden to enable the XmlEntityCodec.clearUndefinedProperties setting so that
clients clear out any defunct properties. |
void |
dispose()
Dispose of the object (unregister listeners, close open resources etc). |
void |
forcePingAll(long responseTimeout)
Force client to ping all current entities for liveness. |
protected void |
handleNotification(NotificationEvent e)
|
protected void |
ping(Collection<Entity> pinged,
Entity entity)
Send a ping to an entity, adding it to pinged if successful. |
void |
propertyValueChanged(PropertyEvent e)
Handles property changes to entities in the registry by emitting the appropriate update requests. |
void |
setLivenessTimeouts(long livenessTimeout,
long scanInterval,
long pingTimeout)
Change liveness timeouts used for detecting dead entities. |
protected void |
subscribe(String entityType)
|
Methods inherited from class livespace.services.EntityContainer |
---|
close, connectionClosed, createEntity, createXmlOutput, emit, emitAsync, getOrCreateEntity, isClosed, isInResponseToMe, mutex, notificationReceived, read, registerEntityTree, setContainerRecursively, setContainerRecursively, setDefaultUpdaterForThread, setUpdateExecutor, shouldPublish, splitPropertyPath, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Subscription subscription
protected boolean inhibitEventHandling
protected livespace.services.EntityClient.DeadEntityWatcher deadEntityWatcher
Constructor Detail |
---|
public EntityClient(Elvin elvin, String entityType) throws IOException
RoomEntity
.
elvin
- The Elvin service.entityType
- The type of entity to discover. This is the
value returned by Entity.getType()
.
IOException
EntityClient(Elvin, RoomEntity, String)
public EntityClient(Elvin elvin, RoomEntity room, String entityType) throws IOException
elvin
- The Elvin connection.room
- The room the entities are part of. This may be null
meaning the entities are not part of a room.entityType
- The type of entity to discover. This is the
value returned by Entity.getType()
.
IOException
EntityClient(Elvin, RoomEntity, String, EntityRegistry)
public EntityClient(Elvin elvin, RoomEntity room, String entityType, EntityRegistry entities) throws IOException
elvin
- The Elvin connection.room
- The room the entities are part of. This may be null
meaning the entities are not part of a room.entityType
- The type of entity to discover. This is the
value returned by Entity.getType()
.entities
- The initial entity registry instance. This is to
allow a client to add a listener *before* the client
starts populating the registry. It is an error for the
the registry not to be empty.
IOException
Method Detail |
---|
public void dispose()
Disposable
dispose
in interface Disposable
dispose
in class EntityContainer
protected void subscribe(String entityType) throws IOException
IOException
public Notification createUpdateNtfn()
createUpdateNtfn()
public Notification createRequestNtfn(Entity entity, String action)
entity
- The entity to be updated. May be null to apply to
all entities of the class being managed by the client.
protected void handleNotification(NotificationEvent e)
handleNotification
in class EntityContainer
public void propertyValueChanged(PropertyEvent e)
public void setLivenessTimeouts(long livenessTimeout, long scanInterval, long pingTimeout)
livenessTimeout
- New max time before an entity may be
checked for liveness.scanInterval
- The interval between scans.pingTimeout
- Max time for server to respond to a ping.protected XmlInput createXmlInput()
XmlEntityCodec.clearUndefinedProperties
setting so that
clients clear out any defunct properties.
createXmlInput
in class EntityContainer
public void forcePingAll(long responseTimeout)
responseTimeout
- The maximum amount of time pinged entities
have to respond: after this they are counted as dead and
deleted.protected void ping(Collection<Entity> pinged, Entity entity)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |