Interface IPushSessionContext
public interface IPushSessionContext
What a Push Notification (PN) API instance needs from the session it belongs to: the application, the user, the worker to post callbacks to, the disposal state and the engine. An interface, so that the API can be driven in a test without a gyro, the way
IUploadSessionContext lets the file upload service be.The user is asked for at every call, never held: a session may authenticate its user after the API was created.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptiondescribe()Describes the session for a log line.getAppID()Gets the canonical ID of the session's application.default PushChannelPropsGets the session's Push Notification channel (P4-06): thePushChannelPropsthe client created under$env.Gets the server's Push Notification engine.default StringGets the host name the client used to reach this server (P4-07): what a subscription the channel stores records as itsdomain, as the HTTPsubscriberecords the request's server name.default StringGets the address the client connected from (P4-07): what a subscription the channel stores records as its last address, as the HTTPsubscriberecords the request's.longGets the ID of the session's authenticated user.Gets the name of the session's authenticated user.booleanChecks whether the session is disposed of.booleanownsClient(IClientSessionGyro client) Checks whether a client session belongs to this session: for an application session, one of its client sessions; for a client session, never.booleanpost(WorkerTask<?, ?, ?> task) Posts a task to the session's worker.
Method Details
getAppID
String getAppID()Gets the canonical ID of the session's application.- Returns:
- The application ID, never null.
getUserID
long getUserID()Gets the ID of the session's authenticated user.- Returns:
- The user ID (
IZS.USERS.uid), or -1 when the session has no authenticated user.
getUserName
String getUserName()Gets the name of the session's authenticated user.- Returns:
- The user name, or null when the session has no authenticated user.
isDisposed
boolean isDisposed()Checks whether the session is disposed of.- Returns:
- true if disposed.
post
Posts a task to the session's worker.- Parameters:
task- The task.- Returns:
- true if queued, false if the worker is disposed of.
getEngine
PushEngine getEngine()Gets the server's Push Notification engine.- Returns:
- The engine, or null while none is running in this server.
ownsClient
Checks whether a client session belongs to this session: for an application session, one of its client sessions; for a client session, never.- Parameters:
client- The client session.- Returns:
- true when the client session is this session's.
describe
getChannel
Gets the session's Push Notification channel (P4-06): thePushChannelPropsthe client created under$env.- Returns:
- The channel, or null when the session has none - an application session, a Designer, Design Viewer or VSViewer session, or a client built before P4 - so that every client-bound call fails
no_device.
getHostName
Gets the host name the client used to reach this server (P4-07): what a subscription the channel stores records as itsdomain, as the HTTPsubscriberecords the request's server name.- Returns:
- The host name, or null when the session has none - an application session, or a connection that reported none.
getRemoteAddress
Gets the address the client connected from (P4-07): what a subscription the channel stores records as its last address, as the HTTPsubscriberecords the request's.- Returns:
- The textual IP address, or null when unknown.