Class SessionKernelWrapper<T extends SessionKernel>

    • Method Detail

      • getProjectName

        public java.lang.String getProjectName()
        Description copied from interface: Session
        The project that this session is running.
        Specified by:
        getProjectName in interface Session
        Specified by:
        getProjectName in interface SessionKernel
        Returns:
        the name of the project associated with the session
      • getGson

        public com.inductiveautomation.ignition.common.gson.Gson getGson()
        Specified by:
        getGson in interface SessionKernel
        Returns:
        a Gson instance for json serialization / de-serialization
      • getEventBus

        public com.google.common.eventbus.EventBus getEventBus()
        Description copied from interface: Session
        An EventBus for events targeted to the running Perspective Project this session.
        Specified by:
        getEventBus in interface Session
        Specified by:
        getEventBus in interface SessionKernel
        Returns:
        the EventBus associated with the session
      • getStartupTime

        public long getStartupTime()
        Specified by:
        getStartupTime in interface SessionKernel
        Returns:
        the time in nanoseconds when the session kernel started (or 0 if the session kernel has not yet been started)
      • getLastMessageTime

        public long getLastMessageTime()
        Specified by:
        getLastMessageTime in interface SessionKernel
        Returns:
        the time in nanoseconds when the last message was received by the session containing this kernel
      • touch

        public void touch()
        Description copied from interface: SessionKernel
        Updates the last message time to the current time in nanoseconds
        Specified by:
        touch in interface SessionKernel
        See Also:
        System.nanoTime()
      • broadcast

        protected abstract void broadcast​(java.lang.String protocol,
                                          java.lang.String payload)
        Broadcast a message to all pages associated with this session
        Parameters:
        protocol - the protocol of the message to broadcast
        payload - the payload of the message to broadcast
      • onHello

        public void onHello()
        Description copied from interface: InternalSession
        Called every time the hello API is invoked on this session.
        Specified by:
        onHello in interface InternalSession
      • getUptime

        public long getUptime​(java.util.concurrent.TimeUnit timeUnit)
        Description copied from interface: InternalSession
        Return the amount of time elapsed in the given time unit since the session started up.
        Specified by:
        getUptime in interface InternalSession
        Parameters:
        timeUnit - the TimeUnit to which the internal startup time should be converted
        Returns:
        the up time in the given unit
      • getLastComm

        public long getLastComm​(java.util.concurrent.TimeUnit timeUnit)
        Description copied from interface: InternalSession
        Return the time in the given time unit when the last communication was received from the client
        Specified by:
        getLastComm in interface InternalSession
        Parameters:
        timeUnit - the TimeUnit to which the last communication time should be converted
        Returns:
        the last communication time in the given unit
      • getSessionClosedMessage

        public java.lang.String getSessionClosedMessage()
        Specified by:
        getSessionClosedMessage in interface InternalSession
        Returns:
        the default message sent to the client when the session is closed
      • getPageClosedMessage

        public java.lang.String getPageClosedMessage()
        Specified by:
        getPageClosedMessage in interface InternalSession
        Returns:
        the default message sent to the client then a page is closed
      • getLogoutMessage

        public java.lang.String getLogoutMessage()
        Specified by:
        getLogoutMessage in interface InternalSession
        Returns:
        the default message sent to the client when the user logs out
      • createToken

        public java.lang.String createToken​(java.lang.String type,
                                            com.inductiveautomation.ignition.common.gson.JsonElement data)
        Description copied from interface: SessionKernel
        Create a new token associated with the given type and data for the this session kernel. The token expires in 30 seconds.
        Specified by:
        createToken in interface InternalSession
        Specified by:
        createToken in interface SessionKernel
        Returns:
        the new short-lived token
      • claimToken

        public java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken​(java.lang.String type,
                                                                                                       java.lang.String token)
        Description copied from interface: SessionKernel
        Claim the given token associated with the given data type previously created by this session kernel.
        Specified by:
        claimToken in interface InternalSession
        Specified by:
        claimToken in interface SessionKernel
        token - the token to claim
        Returns:
        an Optional containing the JsonElement data associated with the given data type and token, or an empty Optional if no data exists for the given data type and token pair