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 ofSessionKernelto 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. AllSessionKernelmethods 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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidbroadcast(java.lang.String protocol, java.lang.String payload)Broadcast a message to all pages associated with this sessionjava.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 kernel.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 kernel.AuditContext.BuildergetAuditSnapshot()com.google.common.eventbus.EventBusgetEventBus()EventManagergetEventManager()AnEventManagerfor events targeted to the running Perspective Project this session.com.inductiveautomation.ignition.common.gson.GsongetGson()longgetLastComm(java.util.concurrent.TimeUnit timeUnit)Return the time in the given time unit when the last communication was received from the clientlonggetLastMessageTime()LoggerExgetLogger()java.lang.StringgetLogoutMessage()java.lang.StringgetPageClosedMessage()java.lang.StringgetProjectName()The project that this session is running.java.lang.StringgetSessionClosedMessage()PerspectiveSessionCollectiongetSessionCollection()java.util.UUIDgetSessionId()PerspectiveSessionInfogetSessionInfo()SessionStatsgetSessionStats()longgetStartupTime()longgetUptime(java.util.concurrent.TimeUnit timeUnit)Return the amount of time elapsed in the given time unit since the session started up.voidonHello()Called every time the hello API is invoked on this session.protected voidonShutdown()protected voidonStartup()ExecutionQueuequeue()Queue upon which all work for components and their properties should occur onvoidtouch()Updates the last message time to the current time in nanoseconds-
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
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 Detail
-
getSessionCollection
public PerspectiveSessionCollection getSessionCollection()
- Specified by:
getSessionCollectionin interfaceInternalSession- Specified by:
getSessionCollectionin interfaceSessionKernel- Returns:
- the
PerspectiveSessionCollectionwhich contains the session
-
getProjectName
public java.lang.String getProjectName()
Description copied from interface:SessionThe project that this session is running.- Specified by:
getProjectNamein interfaceSession- Specified by:
getProjectNamein interfaceSessionKernel- Returns:
- the name of the project associated with the session
-
getGson
public com.inductiveautomation.ignition.common.gson.Gson getGson()
- Specified by:
getGsonin interfaceSessionKernel- Returns:
- a
Gsoninstance for json serialization / de-serialization
-
queue
public ExecutionQueue queue()
Description copied from interface:SessionQueue upon which all work for components and their properties should occur on- Specified by:
queuein interfaceSession- Specified by:
queuein interfaceSessionKernel- Returns:
- the
ExecutionQueueused to run session tasks in serial
-
getLogger
public LoggerEx getLogger()
- Specified by:
getLoggerin interfaceLoggingContext- Specified by:
getLoggerin interfaceSessionKernel- Returns:
- the
LoggerExassociated with the session
-
getEventBus
public com.google.common.eventbus.EventBus getEventBus()
- Specified by:
getEventBusin interfaceSession- Specified by:
getEventBusin interfaceSessionKernel
-
getEventManager
public EventManager getEventManager()
Description copied from interface:SessionAnEventManagerfor events targeted to the running Perspective Project this session.- Specified by:
getEventManagerin interfaceSession- Specified by:
getEventManagerin interfaceSessionKernel- Returns:
- the
EventManagerassociated with the session
-
getSessionId
public java.util.UUID getSessionId()
- Specified by:
getSessionIdin interfaceSession- Specified by:
getSessionIdin interfaceSessionKernel- Returns:
- the session's unique identifier
-
getStartupTime
public long getStartupTime()
- Specified by:
getStartupTimein 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:
getLastMessageTimein interfaceSessionKernel- Returns:
- the time in nanoseconds when the last message was received by the session containing this kernel
-
getSessionStats
public SessionStats getSessionStats()
- Specified by:
getSessionStatsin interfaceSession- Specified by:
getSessionStatsin 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:SessionKernelUpdates the last message time to the current time in nanoseconds- Specified by:
touchin interfaceSessionKernel- 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 broadcastpayload- the payload of the message to broadcast
-
onStartup
protected void onStartup()
- Specified by:
onStartupin classAbstractLifecycle
-
onShutdown
protected void onShutdown()
- Specified by:
onShutdownin classAbstractLifecycle
-
onHello
public void onHello()
Description copied from interface:InternalSessionCalled every time the hello API is invoked on this session.- Specified by:
onHelloin interfaceInternalSession
-
getSessionInfo
public PerspectiveSessionInfo getSessionInfo()
- Specified by:
getSessionInfoin interfaceInternalSession- Returns:
- a report about this session
-
getUptime
public long getUptime(java.util.concurrent.TimeUnit timeUnit)
Description copied from interface:InternalSessionReturn the amount of time elapsed in the given time unit since the session started up.- Specified by:
getUptimein interfaceInternalSession- Parameters:
timeUnit- theTimeUnitto 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:InternalSessionReturn the time in the given time unit when the last communication was received from the client- Specified by:
getLastCommin interfaceInternalSession- Parameters:
timeUnit- theTimeUnitto 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:
getSessionClosedMessagein interfaceInternalSession- Returns:
- the default message sent to the client when the session is closed
-
getPageClosedMessage
public java.lang.String getPageClosedMessage()
- Specified by:
getPageClosedMessagein interfaceInternalSession- Returns:
- the default message sent to the client then a page is closed
-
getLogoutMessage
public java.lang.String getLogoutMessage()
- Specified by:
getLogoutMessagein interfaceInternalSession- Returns:
- the default message sent to the client when the user logs out
-
getAuditSnapshot
@Nonnull public AuditContext.Builder getAuditSnapshot()
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-
createToken
public java.lang.String createToken(java.lang.String type, com.inductiveautomation.ignition.common.gson.JsonElement data)Description copied from interface:SessionKernelCreate a new token associated with the given type and data for the this session kernel. The token expires in 30 seconds.- Specified by:
createTokenin interfaceInternalSession- Specified by:
createTokenin interfaceSessionKernel- 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:SessionKernelClaim the given token associated with the given data type previously created by this session kernel.- Specified by:
claimTokenin interfaceInternalSession- Specified by:
claimTokenin interfaceSessionKerneltoken- 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
-
-