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 Type
    Method
    Description
    Describes the session for a log line.
    Gets the canonical ID of the session's application.
    Gets the session's Push Notification channel (P4-06): the PushChannelProps the client created under $env.
    Gets the server's Push Notification engine.
    default String
    Gets the host name the client used to reach this server (P4-07): what a subscription the channel stores records as its domain, as the HTTP subscribe records the request's server name.
    default String
    Gets the address the client connected from (P4-07): what a subscription the channel stores records as its last address, as the HTTP subscribe records the request's.
    long
    Gets the ID of the session's authenticated user.
    Gets the name of the session's authenticated user.
    boolean
    Checks whether the session is disposed of.
    boolean
    Checks whether a client session belongs to this session: for an application session, one of its client sessions; for a client session, never.
    boolean
    post(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

      boolean post(WorkerTask<?,?,?> task)
      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

      boolean ownsClient(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.
      Parameters:
      client - The client session.
      Returns:
      true when the client session is this session's.
    • describe

      String describe()
      Describes the session for a log line.
      Returns:
      A short description.
    • getChannel

      default PushChannelProps getChannel()
      Gets the session's Push Notification channel (P4-06): the PushChannelProps the 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

      default String getHostName()
      Gets the host name the client used to reach this server (P4-07): what a subscription the channel stores records as its domain, as the HTTP subscribe records 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

      default String getRemoteAddress()
      Gets the address the client connected from (P4-07): what a subscription the channel stores records as its last address, as the HTTP subscribe records the request's.
      Returns:
      The textual IP address, or null when unknown.