public class DefaultSimpUserRegistry extends Object implements SimpUserRegistry, SmartApplicationListener
SimpUserRegistry
that
listens ApplicationContext events of type AbstractSubProtocolEvent
to
keep track of user presence and subscription information.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
DefaultSimpUserRegistry() |
Modifier and Type | Method and Description |
---|---|
Set<SimpSubscription> |
findSubscriptions(SimpSubscriptionMatcher matcher)
Find subscriptions with the given matcher.
|
int |
getOrder()
Get the order value of this object.
|
SimpUser |
getUser(String userName)
Get the user for the given name.
|
Set<SimpUser> |
getUsers()
Return a snapshot of all connected users.
|
void |
onApplicationEvent(ApplicationEvent event)
Handle an application event.
|
boolean |
supportsEventType(Class<? extends ApplicationEvent> eventType)
Determine whether this listener actually supports the given event type.
|
boolean |
supportsSourceType(Class<?> sourceType)
Determine whether this listener actually supports the given source type.
|
String |
toString() |
public SimpUser getUser(String userName)
SimpUserRegistry
getUser
in interface SimpUserRegistry
userName
- the name of the user to look upnull
if not connectedpublic Set<SimpUser> getUsers()
SimpUserRegistry
getUsers
in interface SimpUserRegistry
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
SimpUserRegistry
findSubscriptions
in interface SimpUserRegistry
matcher
- the matcher to usepublic boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
SmartApplicationListener
supportsEventType
in interface SmartApplicationListener
public boolean supportsSourceType(Class<?> sourceType)
SmartApplicationListener
supportsSourceType
in interface SmartApplicationListener
public void onApplicationEvent(ApplicationEvent event)
ApplicationListener
onApplicationEvent
in interface ApplicationListener<ApplicationEvent>
event
- the event to respond topublic int getOrder()
Ordered
Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup
values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE