|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.novanic.eventservice.service.registry.DefaultEventRegistry
public class DefaultEventRegistry
The EventRegistry handles the users/clients and the events per domain. Users can be registered for a domain/context
to receive events for the according domain.
User specific events can be handled domain-less, when the user is registered.
The EventRegistry is used by EventServiceImpl.
The client id is required, because the connection to every client must be kept open.
EventServiceImpl| Constructor Summary | |
|---|---|
protected |
DefaultEventRegistry(EventServiceConfiguration aConfiguration)
Creates a new EventRegistry with a configuration ( EventServiceConfiguration). |
| Method Summary | |
|---|---|
void |
addEvent(Domain aDomain,
Event anEvent)
Adds an event to a domain. |
void |
addEventUserSpecific(java.lang.String aUserId,
Event anEvent)
Adds an event directly to a user. |
EventServiceConfiguration |
getConfiguration()
Returns the initialized EventServiceConfiguration |
EventFilter |
getEventFilter(Domain aDomain,
java.lang.String aUserId)
Returns the EventFilter for the user domain combination. |
java.util.Set<Domain> |
getListenDomains()
Returns all registered/activated domains. |
java.util.Set<Domain> |
getListenDomains(java.lang.String aUserId)
Returns all domains where the user is registered to. |
java.util.Set<java.lang.String> |
getRegisteredUserIds()
Returns all registered users/clients. |
java.util.Set<java.lang.String> |
getRegisteredUserIds(Domain aDomain)
Returns all registered users/client of a specific Domain. |
boolean |
isUserRegistered(Domain aDomain,
java.lang.String aUserId)
Checks if the user is registered for the corresponding domain. |
boolean |
isUserRegistered(java.lang.String aUserId)
Checks if the user is registered for any domain. |
java.util.List<DomainEvent> |
listen(java.lang.String aUserId)
The listen method returns all events for the user (events for all domains where the user is registered and user specific events). |
void |
registerUnlistenEvent(java.lang.String aUserId,
UnlistenEventListener.Scope anUnlistenScope,
UnlistenEvent anUnlistenEvent)
Registers an UnlistenEvent which is triggered on a
timeout or when a user/client leaves a Domain. |
void |
registerUser(Domain aDomain,
java.lang.String aUserId,
EventFilter anEventFilter)
Registers a user for listening for the corresponding domain. |
void |
removeEventFilter(Domain aDomain,
java.lang.String aUserId)
EventFilters can be removed for a user domain combination with that method. |
void |
setEventFilter(Domain aDomain,
java.lang.String aUserId,
EventFilter anEventFilter)
The EventFilter for a user domain combination can be set or
changed with that method. |
void |
unlisten(Domain aDomain,
java.lang.String aUserId)
This method causes a stop of listening for a domain ( listen(String)). |
void |
unlisten(java.lang.String aUserId)
This method causes a stop of listening for all domains ( listen(String)). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected DefaultEventRegistry(EventServiceConfiguration aConfiguration)
EventServiceConfiguration).
The EventRegistryFactory should be used instead of calling that constructor directly.
aConfiguration - configurationEventRegistryFactory.getEventRegistry()| Method Detail |
|---|
public boolean isUserRegistered(java.lang.String aUserId)
isUserRegistered in interface EventRegistryaUserId - the user to check
public boolean isUserRegistered(Domain aDomain,
java.lang.String aUserId)
isUserRegistered in interface EventRegistryaDomain - the domain to checkaUserId - the user to check
public void registerUser(Domain aDomain,
java.lang.String aUserId,
EventFilter anEventFilter)
listen(String)) is called. The EventFilter
is optional and can be NULL.
registerUser in interface EventRegistryaDomain - the domain to listenaUserId - the user to registeranEventFilter - EventFilter to filter the domain events (optional, can be NULL)
public void setEventFilter(Domain aDomain,
java.lang.String aUserId,
EventFilter anEventFilter)
EventFilter for a user domain combination can be set or
changed with that method. The EventFilter can be removed
with the method EventRegistry.removeEventFilter(de.novanic.eventservice.client.event.domain.Domain, String)
or when that method is called with NULL as the EventFilter
parameter value.
setEventFilter in interface EventRegistryaDomain - domainaUserId - useranEventFilter - new EventFilter
public EventFilter getEventFilter(Domain aDomain,
java.lang.String aUserId)
getEventFilter in interface EventRegistryaDomain - domainaUserId - user
public void removeEventFilter(Domain aDomain,
java.lang.String aUserId)
removeEventFilter in interface EventRegistryaDomain - domainaUserId - userpublic java.util.List<DomainEvent> listen(java.lang.String aUserId)
EventServiceConfiguration.
listen in interface EventRegistryaUserId - user
public void unlisten(Domain aDomain,
java.lang.String aUserId)
listen(String)).
unlisten in interface EventRegistryaDomain - domain to stop listeningaUserId - userpublic void unlisten(java.lang.String aUserId)
listen(String)).
unlisten in interface EventRegistryaUserId - userpublic java.util.Set<Domain> getListenDomains(java.lang.String aUserId)
getListenDomains in interface ListenDomainAccessorgetListenDomains in interface EventRegistryaUserId - user id
public java.util.Set<Domain> getListenDomains()
getListenDomains in interface ListenDomainAccessorgetListenDomains in interface EventRegistrypublic java.util.Set<java.lang.String> getRegisteredUserIds()
Domain,
the method EventRegistry.getRegisteredUserIds(de.novanic.eventservice.client.event.domain.Domain)
can be used instead.
getRegisteredUserIds in interface EventRegistrypublic java.util.Set<java.lang.String> getRegisteredUserIds(Domain aDomain)
Domain.
To get all the registered users/client (of all domains), the method EventRegistry.getRegisteredUserIds()
can be used instead.
getRegisteredUserIds in interface EventRegistryaDomain - domain
public void addEvent(Domain aDomain,
Event anEvent)
addEvent in interface EventRegistryaDomain - domain for the eventanEvent - event to add
public void addEventUserSpecific(java.lang.String aUserId,
Event anEvent)
addEventUserSpecific in interface EventRegistryaUserId - useranEvent - event
public void registerUnlistenEvent(java.lang.String aUserId,
UnlistenEventListener.Scope anUnlistenScope,
UnlistenEvent anUnlistenEvent)
UnlistenEvent which is triggered on a
timeout or when a user/client leaves a Domain. An
UnlistenEvent is hold at the server side and can
contain custom data. Other users/clients can use the custom data when the event is for example triggered by a timeout.
registerUnlistenEvent in interface EventRegistryaUserId - user to register the UnlistenEvent toanUnlistenScope - scope of the unlisten events to receiveanUnlistenEvent - UnlistenEvent which should
be transferred to other users/clients when a timeout occurs or a domain is leaved.public EventServiceConfiguration getConfiguration()
EventServiceConfiguration
getConfiguration in interface EventRegistryEventServiceConfiguration
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||