Class PerspectiveProjectSession
- java.lang.Object
-
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
-
- com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper<T>
-
- com.inductiveautomation.perspective.gateway.session.AbstractSession<SecuredPerspectiveProjectSession>
-
- com.inductiveautomation.perspective.gateway.session.PerspectiveProjectSession
-
- All Implemented Interfaces:
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
InternalSession.PageVisitor
-
Nested classes/interfaces inherited from interface com.inductiveautomation.perspective.gateway.api.Session
Session.WebAuthStatusChangeEvent
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.perspective.gateway.session.AbstractSession
bindings, changeScripts, handlers, pages, props
-
Fields inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
SESSION
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(java.lang.String message)
Destroys this session and moves clients to a terminal state of closedvoid
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).PropertyReference
createPropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)
Create aPropertyReference
with thisPerspectiveElement
as the target.ViewModel
createViewModel(PageModel group, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject params)
void
destroySession()
Destroys the session by removing it from its containing session collection and shutting it down (which should close any connected message channels).java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>
findViewConfig(java.lang.String viewPath)
Returns aCompletableFuture
that completes to present anOptional
<ViewConfig
> for the specified path.long
getLastActiveTime()
NamedQueryManager
getNamedQueryManager()
long
getPageTimeout()
PerspectiveProject
getProject()
Fetch the project associated with this session.ScriptManager
getScriptManager()
TagHistoryManager
getTagHistoryManager()
TagManager
getTagManager()
WebAuthStatus
getWebAuthStatus()
java.util.Optional<java.lang.String>
logout(java.lang.String message)
Logout of this session.protected void
maybeScheduleReaper()
Call this when it's possible the last page has been closed.protected PageModel
newPage(java.lang.String pageId)
void
onLoginResponse(WebAuthResponseContext webAuthResponseContext)
Called when the session receives a login response from the IdPvoid
onLogoutResponse(WebAuthResponseContext webAuthResponseContext)
Called when this session received a logout response from the IdPvoid
onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)
Called when when handling the session-init message.protected void
onShutdown()
protected void
onStartup()
protected void
sendGatewayTime()
-
Methods inherited from class com.inductiveautomation.perspective.gateway.session.AbstractSession
broadcast, closePage, createPermissionModel, findPage, findPropConfig, getLocale, getOrCreatePage, getPageReport, getPages, getPropertyTreeOf, getTimeZoneId, initProperties, notifyConnected, notifyDisconnected, onKeepaliveReceived, receive, refreshBinding, sendSessionKeepalive, updateSessionProps, visitPage
-
Methods inherited from class com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper
claimToken, createToken, getAuditSnapshot, getEventBus, getGson, getLastComm, getLastMessageTime, getLogger, getLogoutMessage, getPageClosedMessage, getProjectName, getSessionClosedMessage, getSessionCollection, getSessionId, getSessionInfo, getStartupTime, getUptime, onHello, queue, touch
-
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
audit
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.session.InternalSession
getPerspectiveContext, getTimeZone, isRunning, scope, shutdown, startup
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
getAuditProfile, getQualifiedPath
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.Session
getGatewayContext, getMdcParent, getName, getPage, getSession, getView, mdcSetup, mdcTeardown, sendErrorToDesigner
-
Methods inherited from interface com.inductiveautomation.perspective.gateway.session.SessionKernel
shutdown, startup
-
-
-
-
Method Detail
-
findViewConfig
public java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>> findViewConfig(java.lang.String viewPath)
Description copied from interface:Session
Returns aCompletableFuture
that completes to present anOptional
<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
@Nonnull public 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
@Nonnull public WebAuthStatus getWebAuthStatus()
- Returns:
- the
WebAuthStatus
for thisSession
-
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 classAbstractSession<SecuredPerspectiveProjectSession>
-
onStartup
protected void onStartup()
- Overrides:
onStartup
in classSessionKernelWrapper<SecuredPerspectiveProjectSession>
-
onShutdown
protected void onShutdown()
- Overrides:
onShutdown
in classSessionKernelWrapper<SecuredPerspectiveProjectSession>
-
onSessionInit
public void onSessionInit(com.inductiveautomation.ignition.common.gson.JsonObject sessionInitResponse)
Description copied from class:AbstractSession
Called when when handling the session-init message. Gives the project session a chance to add things to the response- Specified by:
onSessionInit
in interfaceInternalSession
- Overrides:
onSessionInit
in classAbstractSession<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 java.util.Optional<java.lang.String> logout(@Nullable java.lang.String message)
Description copied from interface:InternalSession
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
-
onLoginResponse
public void onLoginResponse(WebAuthResponseContext webAuthResponseContext)
Description copied from interface:InternalSession
Called when the session receives a login response from the IdP- Parameters:
webAuthResponseContext
- the login response object
-
onLogoutResponse
public void onLogoutResponse(WebAuthResponseContext webAuthResponseContext)
Description copied from interface:InternalSession
Called when this session received a logout response from the IdP- Parameters:
webAuthResponseContext
- the logout response object
-
createPropertyReference
@Nonnull public PropertyReference createPropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)
Description copied from interface:PerspectiveElement
Create aPropertyReference
with thisPerspectiveElement
as the target.- Parameters:
referencePath
- the path to the propertysubscriber
- the subscriber - aConsumer
ofPropertyTreeChangeEvent
sacceptableOrigins
- theSet
ofOrigin
s in which the subscriber is interested- Returns:
- the
PropertyReference
-
getLastActiveTime
public long getLastActiveTime()
-
closePage
public void closePage(java.lang.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 interfaceInternalSession
- Overrides:
closePage
in classAbstractSession<SecuredPerspectiveProjectSession>
- Parameters:
pageId
- the page ID associated with the target page
-
newPage
@Nonnull protected PageModel newPage(@Nonnull java.lang.String pageId)
- Overrides:
newPage
in classAbstractSession<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 java.lang.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
-
-