@Service public abstract class AbstractEventController extends Object implements org.osgi.service.event.EventHandler
AbstractEventController
handles the processing and routing of events.Modifier and Type | Field and Description |
---|---|
static String |
EVENT_TOPIC_CANCEL |
Constructor and Description |
---|
AbstractEventController(PersistentStore persistentStore,
org.osgi.framework.BundleContext bundleContext,
org.osgi.service.event.EventAdmin eventAdmin)
Establishes
AbstractEventController as a listener to events published by the OSGi
eventing framework on the event's root topic |
Modifier and Type | Method and Description |
---|---|
void |
adminCancelDownload(String userId,
String downloadIdentifier)
Called by
ddf.catalog.event.retrievestatus.DownloadStatusInfoImpl.cancelDownload to
fire a cancel event. |
void |
deregisterUserSession(org.cometd.bayeux.server.ServerSession serverSession,
org.cometd.bayeux.server.ServerMessage serverMessage)
Listens to the /meta/disconnect
Channel for clients disconnecting and
deregisters the user. |
abstract String |
getControllerRootTopic()
Obtains the root topic of the controller that should be used when registering the eventhandler.
|
org.cometd.bayeux.server.ServerSession |
getSessionById(String userId,
String sessionId)
Obtains the
ServerSession associated with a given userId or sessionId. |
org.cometd.bayeux.server.ServerSession |
getSessionBySessionId(String sessionId)
Obtains the
ServerSession associated with a given sessionId. |
org.cometd.bayeux.server.ServerSession |
getSessionByUserId(String userId)
Obtains the
ServerSession associated with a given user id. |
protected String |
getUserId(org.cometd.bayeux.server.ServerSession serverSession,
org.apache.shiro.subject.Subject subject) |
protected void |
queuePersistedMessages(org.cometd.bayeux.server.ServerSession serverSession,
List<Map<String,Object>> messages,
String topic) |
void |
registerUserSession(org.cometd.bayeux.server.ServerSession serverSession,
org.cometd.bayeux.server.ServerMessage serverMessage)
Enables private message delivery to a given user.
|
public static final String EVENT_TOPIC_CANCEL
public AbstractEventController(PersistentStore persistentStore, org.osgi.framework.BundleContext bundleContext, org.osgi.service.event.EventAdmin eventAdmin)
AbstractEventController
as a listener to events published by the OSGi
eventing framework on the event's root topicbundleContext
- public org.cometd.bayeux.server.ServerSession getSessionByUserId(String userId)
ServerSession
associated with a given user id.userId
- The id of the user associated with the ServerSession
to be retrieved.ServerSession
associated with the received userId or null if the user does
not have an established ServerSession
public org.cometd.bayeux.server.ServerSession getSessionBySessionId(String sessionId)
ServerSession
associated with a given sessionId. Retrieval using getSessionByUserId(String)
is the preferred method. This method is used when a userId is not
available.sessionId
- The sessionId associated with the ServerSession
to be retrieved.ServerSession
associated with the received sessionId or null if the session
does not have an established ServerSession
public org.cometd.bayeux.server.ServerSession getSessionById(String userId, String sessionId)
ServerSession
associated with a given userId or sessionId. ItsessionId
- The sessionId associated with the ServerSession
to be retrieved.ServerSession
associated with the received sessionId or null if the session
does not have an established ServerSession
@Listener(value="/meta/disconnect") public void deregisterUserSession(org.cometd.bayeux.server.ServerSession serverSession, org.cometd.bayeux.server.ServerMessage serverMessage)
Channel
for clients disconnecting and
deregisters the user. This should be invoked in order to remove AbstractEventController
references to invalid ServerSession
s.serverSession
- The ServerSession
object associated with the client that is
disconnectingserverMessage
- The ServerMessage
that was sent from the client on the
/meta/disconnect Channelpublic void adminCancelDownload(String userId, String downloadIdentifier)
ddf.catalog.event.retrievestatus.DownloadStatusInfoImpl.cancelDownload
to
fire a cancel event.userId
- The Id assigned to the user who is downloading.downloadIdentifier
- The randomly generated downloadId string assigned to the download at
its start.public void registerUserSession(org.cometd.bayeux.server.ServerSession serverSession, org.cometd.bayeux.server.ServerMessage serverMessage) throws IllegalArgumentException
SecurityPolicy
. See
Obtaining user and session information for private message delivery for more information.serverSession
- The ServerSession
on which to deliver messages to the user for the
user.serverMessage
- The ServerMessage
containing the userId property with which to
associate the ServerSession
.IllegalArgumentException
- when the received ServerSession
or the ServerSession
's id is null.protected void queuePersistedMessages(org.cometd.bayeux.server.ServerSession serverSession, List<Map<String,Object>> messages, String topic)
protected String getUserId(org.cometd.bayeux.server.ServerSession serverSession, org.apache.shiro.subject.Subject subject)
public abstract String getControllerRootTopic()
This work is licensed under a Creative Commons Attribution 4.0 International License.