public class DefaultEventRegistry extends Object implements EventRegistry, ListenDomainAccessor
EventServiceImpl
.
EventServiceImpl
Modifier | Constructor and Description |
---|---|
protected |
DefaultEventRegistry(EventServiceConfiguration aConfiguration)
Creates a new EventRegistry with a configuration (
EventServiceConfiguration ). |
Modifier and Type | Method and Description |
---|---|
void |
addEvent(Domain aDomain,
Event anEvent)
Adds an event to a domain.
|
void |
addEventUserSpecific(String aUserId,
Event anEvent)
Adds an event directly to a user.
|
EventServiceConfiguration |
getConfiguration()
Returns the initialized
EventServiceConfiguration |
EventFilter |
getEventFilter(Domain aDomain,
String aUserId)
Returns the EventFilter for the user domain combination.
|
Set<Domain> |
getListenDomains()
Returns all registered/activated domains.
|
Set<Domain> |
getListenDomains(String aUserId)
Returns all domains where the user is registered to.
|
Set<String> |
getRegisteredUserIds()
Returns all registered users/clients.
|
Set<String> |
getRegisteredUserIds(Domain aDomain)
Returns all registered users/client of a specific
Domain . |
boolean |
isUserRegistered(Domain aDomain,
String aUserId)
Checks if the user is registered for the corresponding domain.
|
boolean |
isUserRegistered(String aUserId)
Checks if the user is registered for any domain.
|
List<DomainEvent> |
listen(ConnectionStrategyServerConnector aServerEventListener,
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(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,
String aUserId,
EventFilter anEventFilter)
Registers a user for listening for the corresponding domain.
|
void |
removeEventFilter(Domain aDomain,
String aUserId)
EventFilters can be removed for a user domain combination with that method.
|
void |
setEventFilter(Domain aDomain,
String aUserId,
EventFilter anEventFilter)
The
EventFilter for a user domain combination can be set or
changed with that method. |
void |
unlisten(Domain aDomain,
String aUserId)
This method causes a stop of listening for a domain (
listen(de.novanic.eventservice.service.connection.strategy.connector.ConnectionStrategyServerConnector , String) ). |
void |
unlisten(String aUserId)
This method causes a stop of listening for all domains (
listen(de.novanic.eventservice.service.connection.strategy.connector.ConnectionStrategyServerConnector , String) ). |
protected DefaultEventRegistry(EventServiceConfiguration aConfiguration)
EventServiceConfiguration
).
The EventRegistryFactory
should be used instead of calling that constructor directly.aConfiguration
- configurationEventRegistryFactory.getEventRegistry()
public boolean isUserRegistered(String aUserId)
isUserRegistered
in interface EventRegistry
aUserId
- the user to checkpublic boolean isUserRegistered(Domain aDomain, String aUserId)
isUserRegistered
in interface EventRegistry
aDomain
- the domain to checkaUserId
- the user to checkpublic void registerUser(Domain aDomain, String aUserId, EventFilter anEventFilter)
listen(de.novanic.eventservice.service.connection.strategy.connector.ConnectionStrategyServerConnector , String)
) is called. The EventFilter
is optional and can be NULL.registerUser
in interface EventRegistry
aDomain
- the domain to listenaUserId
- the user to registeranEventFilter
- EventFilter to filter the domain events (optional, can be NULL)public void setEventFilter(Domain aDomain, 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 EventRegistry
aDomain
- domainaUserId
- useranEventFilter
- new EventFilterpublic EventFilter getEventFilter(Domain aDomain, String aUserId)
getEventFilter
in interface EventRegistry
aDomain
- domainaUserId
- userpublic void removeEventFilter(Domain aDomain, String aUserId)
removeEventFilter
in interface EventRegistry
aDomain
- domainaUserId
- userpublic List<DomainEvent> listen(ConnectionStrategyServerConnector aServerEventListener, String aUserId)
listen
in interface EventRegistry
aServerEventListener
- ConnectionStrategyServerConnector
for the listening methodaUserId
- userpublic void unlisten(Domain aDomain, String aUserId)
listen(de.novanic.eventservice.service.connection.strategy.connector.ConnectionStrategyServerConnector , String)
).unlisten
in interface EventRegistry
aDomain
- domain to stop listeningaUserId
- userpublic void unlisten(String aUserId)
listen(de.novanic.eventservice.service.connection.strategy.connector.ConnectionStrategyServerConnector , String)
).unlisten
in interface EventRegistry
aUserId
- userpublic Set<Domain> getListenDomains(String aUserId)
getListenDomains
in interface ListenDomainAccessor
getListenDomains
in interface EventRegistry
aUserId
- user idpublic Set<Domain> getListenDomains()
getListenDomains
in interface ListenDomainAccessor
getListenDomains
in interface EventRegistry
public Set<String> getRegisteredUserIds()
Domain
,
the method EventRegistry.getRegisteredUserIds(de.novanic.eventservice.client.event.domain.Domain)
can be used instead.getRegisteredUserIds
in interface EventRegistry
public Set<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 EventRegistry
aDomain
- domainpublic void addEvent(Domain aDomain, Event anEvent)
addEvent
in interface EventRegistry
aDomain
- domain for the eventanEvent
- event to addpublic void addEventUserSpecific(String aUserId, Event anEvent)
addEventUserSpecific
in interface EventRegistry
aUserId
- useranEvent
- eventpublic void registerUnlistenEvent(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 EventRegistry
aUserId
- 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 EventRegistry
EventServiceConfiguration
Copyright © 2012. All Rights Reserved.