Class SessionKernelWrapper<T extends SessionKernel>
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.session.SessionKernelWrapper<T>
- Type Parameters:
T
- the type ofSessionKernel
to be encapsulated by this wrapper
- All Implemented Interfaces:
AuditingContext
,LoggingContext
,PerspectiveElement
,PropertyTreeOwner
,Session
,InternalSession
,SessionKernel
- Direct Known Subclasses:
AbstractSession
,SecuredPerspectiveProjectSession
public abstract class SessionKernelWrapper<T extends SessionKernel>
extends AbstractLifecycle
implements SessionKernel, InternalSession
Base class for Perspective Sessions which wrap a session kernel.
All
SessionKernel
methods in this class will proxy calls to the delegate session kernel.-
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 interface com.inductiveautomation.perspective.gateway.session.InternalSession
SESSION
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Broadcast a message to all pages associated with this sessionOptional<com.inductiveautomation.ignition.common.gson.JsonElement>
claimToken
(String type, String token) Claim the given token associated with the given data type previously created by this session kernel.createToken
(String type, com.inductiveautomation.ignition.common.gson.JsonElement data) Create a new token associated with the given type and data for the this session kernel.com.google.common.eventbus.EventBus
AnEventManager
for events targeted to the running Perspective Project this session.com.inductiveautomation.ignition.common.gson.Gson
getGson()
long
getLastComm
(TimeUnit timeUnit) Return the time in the given time unit when the last communication was received from the clientlong
The project that this session is running.long
long
Return the amount of time elapsed in the given time unit since the session started up.void
onHello()
Called every time the hello API is invoked on this session.protected void
protected void
queue()
Queue upon which all work for components and their properties should occur onvoid
touch()
Updates the last message time to the current time in nanosecondsMethods 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
close, closePage, closePage, destroySession, findPage, getBindingCount, getComponentCount, getLocale, getOrCreatePage, getPageCount, getPages, getPerspectiveContext, getProject, getTimeZone, getTimeZoneId, getViewCount, isRunning, logout, notifyConnected, notifyDisconnected, onKeepaliveReceived, onLoginResponse, onLogoutResponse, onSessionInit, receive, scope, shutdown, startup, updateSessionProps, visitPage
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
createPropertyReference, getAuditProfile, getQualifiedPath
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PropertyTreeOwner
getPropertyTreeOf
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.Session
createViewModel, findViewConfig, getGatewayContext, getMdcParent, getName, getNamedQueryManager, getPage, getPageTimeout, getScriptManager, getSession, getTagHistoryManager, getTagManager, getView, getWebAuthStatus, mdcSetup, mdcTeardown, refreshBinding, sendErrorToDesigner
Methods inherited from interface com.inductiveautomation.perspective.gateway.session.SessionKernel
shutdown, startup
-
Method Details
-
getSessionCollection
- Specified by:
getSessionCollection
in interfaceInternalSession
- Specified by:
getSessionCollection
in interfaceSessionKernel
- Returns:
- the
PerspectiveSessionCollection
which contains the session
-
getProjectName
Description copied from interface:Session
The project that this session is running.- Specified by:
getProjectName
in interfaceSession
- Specified by:
getProjectName
in interfaceSessionKernel
- Returns:
- the name of the project associated with the session
-
getGson
public com.inductiveautomation.ignition.common.gson.Gson getGson()- Specified by:
getGson
in interfaceSessionKernel
- Returns:
- a
Gson
instance for json serialization / de-serialization
-
queue
Description copied from interface:Session
Queue upon which all work for components and their properties should occur on- Specified by:
queue
in interfaceSession
- Specified by:
queue
in interfaceSessionKernel
- Returns:
- the
ExecutionQueue
used to run session tasks in serial
-
getLogger
- Specified by:
getLogger
in interfaceLoggingContext
- Specified by:
getLogger
in interfaceSessionKernel
- Returns:
- the
LoggerEx
associated with the session
-
getEventBus
public com.google.common.eventbus.EventBus getEventBus()- Specified by:
getEventBus
in interfaceSession
- Specified by:
getEventBus
in interfaceSessionKernel
-
getEventManager
Description copied from interface:Session
AnEventManager
for events targeted to the running Perspective Project this session.- Specified by:
getEventManager
in interfaceSession
- Specified by:
getEventManager
in interfaceSessionKernel
- Returns:
- the
EventManager
associated with the session
-
getSessionId
- Specified by:
getSessionId
in interfaceSession
- Specified by:
getSessionId
in interfaceSessionKernel
- Returns:
- the session's unique identifier
-
getStartupTime
public long getStartupTime()- Specified by:
getStartupTime
in interfaceSessionKernel
- 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 interfaceSessionKernel
- Returns:
- the time in nanoseconds when the last message was received by the session containing this kernel
-
getSessionStats
- Specified by:
getSessionStats
in interfaceSession
- Specified by:
getSessionStats
in interfaceSessionKernel
- Returns:
- An object containing various statistics that pertain to this session. Also useful for registering metrics that will automatically get removed when this session is shut down.
-
touch
public void touch()Description copied from interface:SessionKernel
Updates the last message time to the current time in nanoseconds- Specified by:
touch
in interfaceSessionKernel
- See Also:
-
broadcast
Broadcast a message to all pages associated with this session- Parameters:
protocol
- the protocol of the message to broadcastpayload
- the payload of the message to broadcast
-
onStartup
protected void onStartup()- Specified by:
onStartup
in classAbstractLifecycle
-
onShutdown
protected void onShutdown()- Specified by:
onShutdown
in classAbstractLifecycle
-
onHello
public void onHello()Description copied from interface:InternalSession
Called every time the hello API is invoked on this session.- Specified by:
onHello
in interfaceInternalSession
-
getSessionInfo
- Specified by:
getSessionInfo
in interfaceInternalSession
- Returns:
- a report about this session
-
getUptime
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 interfaceInternalSession
- Parameters:
timeUnit
- theTimeUnit
to which the internal startup time should be converted- Returns:
- the up time in the given unit
-
getLastComm
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 interfaceInternalSession
- Parameters:
timeUnit
- theTimeUnit
to which the last communication time should be converted- Returns:
- the last communication time in the given unit
-
getSessionClosedMessage
- Specified by:
getSessionClosedMessage
in interfaceInternalSession
- Returns:
- the default message sent to the client when the session is closed
-
getPageClosedMessage
- Specified by:
getPageClosedMessage
in interfaceInternalSession
- Returns:
- the default message sent to the client then a page is closed
-
getLogoutMessage
- Specified by:
getLogoutMessage
in interfaceInternalSession
- Returns:
- the default message sent to the client when the user logs out
-
getAuditSnapshot
- Specified by:
getAuditSnapshot
in interfaceAuditingContext
- Returns:
- A new, or extended,
AuditContext.Builder
, with qualified information about the current scope.
-
createToken
public String createToken(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 interfaceInternalSession
- Specified by:
createToken
in interfaceSessionKernel
- Returns:
- the new short-lived token
-
claimToken
public Optional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken(String type, 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 interfaceInternalSession
- Specified by:
claimToken
in interfaceSessionKernel
token
- the token to claim- Returns:
- an
Optional
containing theJsonElement
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
-