Class AbstractSession<T extends SessionKernel>
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper<T>
com.inductiveautomation.perspective.gateway.session.AbstractSession<T>
- All Implemented Interfaces:
- AuditingContext,- LoggingContext,- PerspectiveElement,- PropertyTreeOwner,- Session,- InternalSession,- SessionKernel
- Direct Known Subclasses:
- PerspectiveDesignSession,- PerspectiveProjectSession
Base class for perspective applications, whether that is a project running as a client, or a project being designed
 in the designer. Provides the context for Page objects to function in.
- 
Nested Class SummaryNested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSessionInternalSession.PageVisitorNested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.api.SessionSession.WebAuthStatusChangeEvent
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected BindingCollectionprotected PropertyChangeScriptCollectionprotected final MessageProtocolDispatcherCollection of active pages.protected Map<PropertyType,PropertyTree> Holds session.props and session.custom property trees.Fields inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSessionSESSION
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidBroadcast a message to all pages associated with this sessionvoidShuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).voidShuts down and removes the page associated with the given page ID which will disconnect the associated message channel (if one is connected).protected PropertyTreePermissionModelcreatePermissionModel(PropertyType scope, PropertyConfigCollection config) Find thePageassociated with the given page IDprotected Optional<SessionPropsConfig>intintlongThe current locale for this session, or a safe defaultLocale.getDefault()if not available.getOrCreatePage(String pageId) Returns a page for the given key, where the key itself is relevant to the session scope.intcom.inductiveautomation.ignition.common.gson.JsonArrayCollects the "brief report " json structure of each running page in this session.getPages()getPropertyTreeOf(PropertyType propertyType) Fetch thePropertyTreeassociated with the givenPropertyTypeThe current timezone id for this session, or a safe default if not available.intprotected Map<PropertyType,PropertyTree> initProperties(SessionPropsConfig config) protected abstract voidCall this when it's possible the last page has been closed.protected PageModelvoidnotifyConnected(MessageChannel channel) Should notifyPageModels which are associated with this channel that the websocket has connected.voidnotifyDisconnected(MessageChannel channel) Called when a message channel has disconnected.voidonKeepaliveReceived(String pageId, long timestamp) Called by the client to keep the session alive.voidonSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) Called when handling the session-init message.voidreceive(MessageChannel channel, String protocol, Reader payload) Called when this session has received a message from the message channel.voidrefreshBinding(PropertyKey property) Refresh the binding for the given propertyprotected voidvoidupdateSessionProps(SessionPropsConfig config) Update the props and bindings associated with this sessionvoidvisitPage(String pageId, InternalSession.PageVisitor visitor) Visit the page associated with the given ID.Methods inherited from class com.inductiveautomation.perspective.gateway.session.SessionKernelWrapperclaimToken, createToken, getAuditSnapshot, getEventBus, getEventManager, getGson, getLastComm, getLastMessageTime, getLogger, getLogoutMessage, getPageClosedMessage, getProjectName, getSessionClosedMessage, getSessionCollection, getSessionId, getSessionInfo, getSessionStats, getStartupTime, getUptime, onHello, onShutdown, onStartup, queue, touchMethods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startupMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextauditMethods inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSessionclose, destroySession, getPerspectiveContext, getProject, getTimeZone, isRunning, logout, onLoginResponse, onLogoutResponse, scope, shutdown, startupMethods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContextmdc, mdcSetupTree, mdcTeardownTree, mdcWrapMethods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElementcreatePropertyReference, getAuditProfile, getQualifiedPathMethods inherited from interface com.inductiveautomation.perspective.gateway.api.SessioncreateViewModel, findViewConfig, getGatewayContext, getMdcParent, getName, getNamedQueryManager, getPage, getPageTimeout, getScriptManager, getSession, getTagHistoryManager, getTagManager, getView, getWebAuthStatus, mdcSetup, mdcTeardown, sendErrorToDesignerMethods inherited from interface com.inductiveautomation.perspective.gateway.session.SessionKernelshutdown, startup
- 
Field Details- 
handlers
- 
pagesCollection of active pages. Key of this map is the "page id" (a string). In the non-designer session, a perspective application may be running across multiple browser tabs. Each tab is its own "page" and has its own page id
- 
propsHolds session.props and session.custom property trees.
- 
bindings
- 
changeScripts
 
- 
- 
Method Details- 
getPropertyTreeOfDescription copied from interface:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Parameters:
- propertyType- The- PropertyTypeof the- PropertyTreewe want to fetch
- Returns:
- The PropertyTree or null if this PropertyTreeOwner does not manage a PropertyTree for the given PropertyType or if a null PropertyType is given
 
- 
findPropConfig
- 
initProperties
- 
createPermissionModelprotected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) 
- 
sendSessionKeepaliveprotected void sendSessionKeepalive()
- 
updateSessionPropsDescription copied from interface:InternalSessionUpdate the props and bindings associated with this session- Parameters:
- config- the session props config to apply
 
- 
findPageDescription copied from interface:SessionFind thePageassociated with the given page ID- Parameters:
- pageId- the page ID associated with the target page
- Returns:
- the page associated with the given page ID if it exists
 
- 
getPages- Returns:
- A list of all open pages for this session
 
- 
getPageCountpublic int getPageCount()
- 
getViewCountpublic int getViewCount()
- 
getComponentCountpublic int getComponentCount()
- 
getBindingCountpublic int getBindingCount()
- 
getLocaleDescription copied from interface:InternalSessionThe current locale for this session, or a safe defaultLocale.getDefault()if not available.
- 
getTimeZoneIdDescription copied from interface:InternalSessionThe current timezone id for this session, or a safe default if not available.
- 
onKeepaliveReceivedDescription copied from interface:InternalSessionCalled 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
 
- 
getPageReportpublic com.inductiveautomation.ignition.common.gson.JsonArray getPageReport()Collects the "brief report " json structure of each running page in this session.
- 
getOrCreatePageReturns a page for the given key, where the key itself is relevant to the session scope. For instance, the key used to get a page from a client project session will be a tab id. In the designer, each view open for editing is its own "session", and the designer derives a pageid based on the project resource id- Parameters:
- pageId- the page ID associated with the target page
- Returns:
- an instantiated page with the matching key.
 
- 
newPage
- 
onSessionInitpublic void onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse) Called when handling the session-init message. Gives the project session a chance to add things to the response- Parameters:
- sessionInitResponse- the response JSON object to be passed back to the client in response to the session-init call
 
- 
receiveDescription copied from interface:InternalSessionCalled 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
 
- 
getKeepAliveIntervalSecspublic long getKeepAliveIntervalSecs()
- 
notifyConnectedShould notifyPageModels which are associated with this channel that the websocket has connected. May be used to determine that a client has established a first-time connection and requires the allocation and startup of view resources. This call may be re-entrant as socket connections are re-established.- Parameters:
- channel- the newly connected message channel that may provide any needed tab/session specific information
 
- 
notifyDisconnectedCalled when a message channel has disconnected.- Parameters:
- channel- the channel that was disconnected.
 
- 
maybeScheduleReaperprotected abstract void maybeScheduleReaper()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)
- 
closePageDescription copied from interface:InternalSessionShuts 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
 
- 
closePageDescription copied from interface:InternalSessionShuts 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
 
- 
visitPageDescription copied from interface:InternalSessionVisit 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
 
- 
broadcastDescription copied from class:SessionKernelWrapperBroadcast a message to all pages associated with this session- Specified by:
- broadcastin class- SessionKernelWrapper<T extends SessionKernel>
- Parameters:
- protocol- the protocol of the message to broadcast
- payload- the payload of the message to broadcast
 
- 
refreshBindingDescription copied from interface:SessionRefresh the binding for the given property- Parameters:
- property- the property which has the binding to refresh
 
 
-