Interface InternalSession
- 
- All Superinterfaces:
- AuditingContext,- LoggingContext,- PerspectiveElement,- PropertyTreeOwner,- Session
 - All Known Implementing Classes:
- AbstractSession,- PerspectiveDesignSession,- PerspectiveProjectSession,- SecuredPerspectiveProjectSession,- SessionKernelWrapper
 
 public interface InternalSession extends Session The internal interface to sessions used by the system to coordinate the lifecycle and inner workings of the session with the communications from clients and designers.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceInternalSession.PageVisitorA page visitor interface.- 
Nested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.api.SessionSession.WebAuthStatusChangeEvent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.ThreadLocal<InternalSession>SESSION
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonElement>claimToken(java.lang.String type, java.lang.String token)Claim the given token associated with the given data type previously created by this session.default voidclose(java.lang.String message)Destroys this session and moves clients to a terminal state of closedvoidclosePage(java.lang.String pageId)Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).voidclosePage(java.lang.String pageId, java.lang.String message)Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).java.lang.StringcreateToken(java.lang.String type, com.inductiveautomation.ignition.common.gson.JsonElement data)Create a new token associated with the given type and data for the this session.default voiddestroySession()Destroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels).java.util.Optional<PageModel>findPage(java.lang.String pageId)Find thePageassociated with the given page IDintgetBindingCount()intgetComponentCount()longgetLastComm(java.util.concurrent.TimeUnit timeUnit)Return the time in the given time unit when the last communication was received from the clientjava.util.LocalegetLocale()The current locale for this session, or a safe defaultLocale.getDefault()if not available.java.lang.StringgetLogoutMessage()PageModelgetOrCreatePage(java.lang.String pageId)Fetch thePageModelassociated with the given page ID.java.lang.StringgetPageClosedMessage()intgetPageCount()java.util.List<PageModel>getPages()default PerspectiveContextgetPerspectiveContext()default PerspectiveProjectgetProject()Fetch the project associated with this session.java.lang.StringgetSessionClosedMessage()PerspectiveSessionCollectiongetSessionCollection()PerspectiveSessionInfogetSessionInfo()default java.util.TimeZonegetTimeZone()The current timezone for this session, or a safe default if not available.java.lang.StringgetTimeZoneId()The current timezone id for this session, or a safe default if not available.longgetUptime(java.util.concurrent.TimeUnit timeUnit)Return the amount of time elapsed in the given time unit since the session started up.intgetViewCount()booleanisRunning()java.util.Optional<java.lang.String>logout(java.lang.String message)Logout of this session.voidnotifyConnected(MessageChannel channel)Let the session know that the page has connectedvoidnotifyDisconnected(MessageChannel channel)Let the session know that the page has disconnectedvoidonHello()Called every time the hello API is invoked on this session.voidonKeepaliveReceived(java.lang.String pageId, long timestamp)Called by the client to keep the session alive.voidonLoginResponse(WebAuthResponseContext webAuthResponseContext)Called when the session receives a login response from the IdPvoidonLogoutResponse(WebAuthResponseContext webAuthResponseContext)Called when this session received a logout response from the IdPvoidonSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)Called during the session-init lifecycle of the client.voidreceive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload)Called when this session has received a message from the message channel.default SessionScopescope()The scope in which this context represents -- Client or Designervoidshutdown()Shut down the session.voidstartup()Start up the session.voidupdateSessionProps(SessionPropsConfig config)Update the props and bindings associated with this sessionvoidvisitPage(java.lang.String pageId, InternalSession.PageVisitor visitor)Visit the page associated with the given ID.- 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextaudit, getAuditSnapshot
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContextgetLogger, mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElementcreatePropertyReference, getAuditProfile, getQualifiedPath
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PropertyTreeOwnergetPropertyTreeOf
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.SessioncreateViewModel, findViewConfig, getEventBus, getEventManager, getGatewayContext, getMdcParent, getName, getNamedQueryManager, getPage, getPageTimeout, getProjectName, getScriptManager, getSession, getSessionId, getSessionStats, getTagHistoryManager, getTagManager, getView, getWebAuthStatus, mdcSetup, mdcTeardown, queue, refreshBinding, sendErrorToDesigner
 
- 
 
- 
- 
- 
Field Detail- 
SESSIONstatic final java.lang.ThreadLocal<InternalSession> SESSION 
 
- 
 - 
Method Detail- 
startupvoid startup() Start up the session.- Throws:
- java.lang.IllegalStateException- if the session has already been started or shutdown
 
 - 
shutdownvoid shutdown() Shut down the session.- Throws:
- java.lang.IllegalStateException- if the session has not been started or if it has already been shut down
 
 - 
isRunningboolean isRunning() - Specified by:
- isRunningin interface- PerspectiveElement
- Returns:
- true if the session has started and has not yet been shut down
- See Also:
- AbstractLifecycle.isRunning()
 
 - 
notifyConnectedvoid notifyConnected(MessageChannel channel) Let the session know that the page has connected- Parameters:
- channel- the- MessageChannelused for communications between the client page and the gateway page
 
 - 
notifyDisconnectedvoid notifyDisconnected(MessageChannel channel) Let the session know that the page has disconnected- Parameters:
- channel- the- MessageChannelused for communications between the client page and the gateway page
 
 - 
destroySessiondefault void destroySession() Destroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels).
 - 
receivevoid receive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload) Called when this session has received a message from the message channel.- Parameters:
- channel- the- MessageChannelfrom which the message was received
- protocol- the protocol of the message
- payload- the payload of the message
 
 - 
getOrCreatePagePageModel getOrCreatePage(java.lang.String pageId) Fetch thePageModelassociated with the given page ID. If the page does not exist, it is created, associated with the given page ID, and returned.- Parameters:
- pageId- the page ID associated with the target page
- Returns:
- the page associated with the given page ID or a new page if it does not exist
 
 - 
findPagejava.util.Optional<PageModel> findPage(java.lang.String pageId) Description copied from interface:SessionFind thePageassociated with the given page ID
 - 
getPagesjava.util.List<PageModel> getPages() 
 - 
getPageCountint getPageCount() 
 - 
getViewCountint getViewCount() 
 - 
getComponentCountint getComponentCount() 
 - 
getBindingCountint getBindingCount() 
 - 
visitPagevoid visitPage(java.lang.String pageId, InternalSession.PageVisitor visitor)Visit the page associated with the given ID. If the page is found,InternalSession.PageVisitor.onPageFound(PageModel)is invoked with the target page. If the page is not found,InternalSession.PageVisitor.onPageMissing()is invoked. If the page is closed,InternalSession.PageVisitor.onPageClosed(String)is invoked with the closed message.- Parameters:
- pageId- the target page ID
- visitor- the page visitor
 
 - 
closePagevoid closePage(java.lang.String pageId) Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).- Parameters:
- pageId- the page ID associated with the target page
 
 - 
closePagevoid closePage(java.lang.String pageId, @Nullable java.lang.String message)Shuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected). Moves the client to a terminal state page of closed with the given message.- Parameters:
- pageId- the page ID associated with the target page
- message- the message displayed to the client on the terminal state page
 
 - 
onSessionInitvoid onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) Called during the session-init lifecycle of the client. Implementations may modify the given response JSON object to pass back to the client.- Parameters:
- sessionInitResponse- the response JSON object to be passed back to the client in response to the session-init call
 
 - 
logoutjava.util.Optional<java.lang.String> logout(@Nullable java.lang.String message)Logout of this session. The user will no longer be authenticated.- Parameters:
- message- the message to display to the user after they are logged out of this session
- Returns:
- a logout token or hint for the IdP if one is available
 
 - 
onLoginResponsevoid onLoginResponse(WebAuthResponseContext webAuthResponseContext) Called when the session receives a login response from the IdP- Parameters:
- webAuthResponseContext- the login response object
 
 - 
onLogoutResponsevoid onLogoutResponse(WebAuthResponseContext webAuthResponseContext) Called when this session received a logout response from the IdP- Parameters:
- webAuthResponseContext- the logout response object
 
 - 
getSessionCollectionPerspectiveSessionCollection getSessionCollection() - Returns:
- the PerspectiveSessionCollectionwhich contains this session
 
 - 
getPerspectiveContextdefault PerspectiveContext getPerspectiveContext() - Specified by:
- getPerspectiveContextin interface- Session
 
 - 
scopedefault SessionScope scope() Description copied from interface:SessionThe scope in which this context represents -- Client or Designer
 - 
getLocalejava.util.Locale getLocale() The current locale for this session, or a safe defaultLocale.getDefault()if not available.
 - 
getTimeZoneIdjava.lang.String getTimeZoneId() The current timezone id for this session, or a safe default if not available.
 - 
getTimeZonedefault java.util.TimeZone getTimeZone() The current timezone for this session, or a safe default if not available.
 - 
onKeepaliveReceivedvoid onKeepaliveReceived(java.lang.String pageId, long timestamp)Called by the client to keep the session alive.- Parameters:
- pageId- the page ID of the page which triggered the keep alive request
- timestamp- the timestamp associated with the keep alive request
 
 - 
updateSessionPropsvoid updateSessionProps(SessionPropsConfig config) Update the props and bindings associated with this session- Parameters:
- config- the session props config to apply
 
 - 
getProject@Nonnull default PerspectiveProject getProject() Fetch the project associated with this session.- Returns:
- the PerspectiveProjectassociated with this session
- Throws:
- java.lang.IllegalStateException- if the project associated with this session does not exist
 
 - 
onHellovoid onHello() Called every time the hello API is invoked on this session.
 - 
getSessionInfoPerspectiveSessionInfo getSessionInfo() - Returns:
- a report about this session
 
 - 
getUptimelong getUptime(java.util.concurrent.TimeUnit timeUnit) Return the amount of time elapsed in the given time unit since the session started up.- Parameters:
- timeUnit- the- TimeUnitto which the internal startup time should be converted
- Returns:
- the up time in the given unit
 
 - 
getLastCommlong getLastComm(java.util.concurrent.TimeUnit timeUnit) Return the time in the given time unit when the last communication was received from the client- Parameters:
- timeUnit- the- TimeUnitto which the last communication time should be converted
- Returns:
- the last communication time in the given unit
 
 - 
getSessionClosedMessagejava.lang.String getSessionClosedMessage() - Returns:
- the default message sent to the client when the session is closed
 
 - 
getPageClosedMessagejava.lang.String getPageClosedMessage() - Returns:
- the default message sent to the client then a page is closed
 
 - 
getLogoutMessagejava.lang.String getLogoutMessage() - Returns:
- the default message sent to the client when the user logs out
 
 - 
closedefault void close(@Nullable java.lang.String message)Description copied from interface:SessionDestroys this session and moves clients to a terminal state of closed
 - 
createTokenjava.lang.String createToken(java.lang.String type, com.inductiveautomation.ignition.common.gson.JsonElement data)Create a new token associated with the given type and data for the this session. The token expires in 30 seconds.- Returns:
- the new short-lived token
 
 - 
claimTokenjava.util.Optional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken(java.lang.String type, java.lang.String token)Claim the given token associated with the given data type previously created by this session.- Parameters:
- token- the token to claim
- Returns:
- an Optionalcontaining theJsonElementdata associated with the given data type and token, or an empty Optional if no data exists for the given data type and token pair
 
 
- 
 
-