Class PerspectiveProjectSession

All Implemented Interfaces:
Lifecycle, AuditingContext, LoggingContext, PerspectiveElement, PropertyTreeOwner, Session, InternalSession, SessionKernel

public class PerspectiveProjectSession extends AbstractSession<SecuredPerspectiveProjectSession>
Contains a running Perspective project for a session. Includes the pages, bindings, property trees, and property change scripts. Runs the configured session startup script on startup and the shutdown script on shutdown.
  • Method Details

    • findViewConfig

      public CompletableFuture<Optional<ViewConfig>> findViewConfig(String viewPath)
      Description copied from interface: Session
      Returns a CompletableFuture that completes to present an Optional<ViewConfig> for the specified path. The use of the future is to allow for the asynch collection of configs for views which are retrieved via asynchronous processes, as is the case when a view is being edited/altered in the designer.
      Parameters:
      viewPath - path to the view's project resource within the project being run.
    • getProject

      public @NonNull PerspectiveProject getProject()
      Description copied from interface: InternalSession
      Fetch the project associated with this session.
      Returns:
      the PerspectiveProject associated with this session
    • createViewModel

      public ViewModel createViewModel(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params)
    • getTagManager

      public TagManager getTagManager()
    • getTagHistoryManager

      public TagHistoryManager getTagHistoryManager()
    • getScriptManager

      public ScriptManager getScriptManager()
    • getNamedQueryManager

      public NamedQueryManager getNamedQueryManager()
    • getPageTimeout

      public long getPageTimeout()
    • getWebAuthStatus

      public @NonNull WebAuthStatus getWebAuthStatus()
      Returns:
      the WebAuthStatus for this Session
    • maybeScheduleReaper

      protected void maybeScheduleReaper()
      Description copied from class: AbstractSession
      Call this when it's possible the last page has been closed. The session will then schedule the reaper to close the session itself (runtime sessions only, designer sessions don't reap in this way)
      Specified by:
      maybeScheduleReaper in class AbstractSession<SecuredPerspectiveProjectSession>
    • onStartup

      protected void onStartup()
      Overrides:
      onStartup in class SessionKernelWrapper<SecuredPerspectiveProjectSession>
    • onShutdown

      protected void onShutdown()
      Overrides:
      onShutdown in class SessionKernelWrapper<SecuredPerspectiveProjectSession>
    • onSessionInit

      public void onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)
      Description copied from class: AbstractSession
      Called when handling the session-init message. Gives the project session a chance to add things to the response
      Specified by:
      onSessionInit in interface InternalSession
      Overrides:
      onSessionInit in class AbstractSession<SecuredPerspectiveProjectSession>
      Parameters:
      sessionInitResponse - the response JSON object to be passed back to the client in response to the session-init call
    • sendGatewayTime

      protected void sendGatewayTime()
    • logout

      public com.inductiveautomation.ignition.gateway.auth.idp.WebAuthSessionContext logout(@Nullable String message)
      Description copied from interface: InternalSession
      Logout this session. The user will no longer be authenticated against the session's IdP.

      Read the IdP to send the logout to from the returned context, not from Session.getWebAuthStatus() before calling this: a logout waits for any sign-in in progress, so the user it signs out may have just signed in through a different IdP.

      Parameters:
      message - the message to display to the user after they are logged out of this session
      Returns:
      the context this logout replaced, naming the IdP the user was signed in through and carrying that IdP's logout hint, if any. never null.
    • onLoginResponse

      public void onLoginResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) throws com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException
      Description copied from interface: InternalSession
      Called when the session receives a login response from the IdP.

      The response is not always applied - the responding IdP may not be one this session permits, the user may have cancelled, or the IdP may no longer exist or its response may not parse. The reason is thrown rather than logged and dropped so the caller can audit the outcome it actually got instead of assuming success.

      Parameters:
      webAuthResponseContext - the login response object
      Throws:
      com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException - if the response was not applied for any other reason
    • onLogoutResponse

      public void onLogoutResponse(com.inductiveautomation.ignition.gateway.auth.web.response.WebAuthResponseContext webAuthResponseContext) throws com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException
      Description copied from interface: InternalSession
      Called when this session received a logout response from the IdP.

      The session was already signed out when the logout request leg ran, before the redirect to the IdP, so a throw from here means only that the IdP's confirmation could not be validated. The sign-out itself stands either way; the reason is thrown so the caller can audit what actually happened instead of assuming the round trip completed cleanly.

      Parameters:
      webAuthResponseContext - the logout response object
      Throws:
      com.inductiveautomation.ignition.gateway.auth.idp.IdentityProviderException - if the response could not be validated for any other reason
    • createPropertyReference

      public @NonNull PropertyReference createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins)
      Description copied from interface: PerspectiveElement
      Create a PropertyReference with this PerspectiveElement as the target.
      Parameters:
      referencePath - the path to the property
      subscriber - the subscriber - a Consumer of PropertyTreeChangeEvents
      acceptableOrigins - the Set of Origins in which the subscriber is interested
      Returns:
      the PropertyReference
    • getLastActiveTime

      public long getLastActiveTime()
    • closePage

      public void closePage(String pageId)
      Description copied from interface: InternalSession
      Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).
      Specified by:
      closePage in interface InternalSession
      Overrides:
      closePage in class AbstractSession<SecuredPerspectiveProjectSession>
      Parameters:
      pageId - the page ID associated with the target page
    • newPage

      protected @NonNull PageModel newPage(@NonNull String pageId)
      Overrides:
      newPage in class AbstractSession<SecuredPerspectiveProjectSession>
    • destroySession

      public void destroySession()
      Description copied from interface: InternalSession
      Destroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels).
    • close

      public void close(@Nullable String message)
      Description copied from interface: Session
      Destroys this session and moves clients to a terminal state of closed
      Parameters:
      message - the message displayed to the client on the terminal state page