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.SecurityLevelsChangeEvent
-
-
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 sessionbooleanclaimAccessToken(java.lang.String token)Claim the given access token previously created by this session kernel.java.lang.StringcreateAccessToken()Create a new access token for the this session kernel.AuditContext.BuildergetAuditSnapshot()com.google.common.eventbus.EventBusgetEventBus()AnEventBusfor 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.StringgetPageClosedMessage()java.lang.StringgetProjectName()The project that this session is running.java.lang.StringgetSessionClosedMessage()PerspectiveSessionCollectiongetSessionCollection()java.util.UUIDgetSessionId()PerspectiveSessionInfogetSessionInfo()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, getLocale, getOrCreatePage, getPages, getPerspectiveContext, getProject, getTimeZone, getTimeZoneId, 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()
Description copied from interface:SessionAnEventBusfor events targeted to the running Perspective Project this session.- Specified by:
getEventBusin interfaceSession- Specified by:
getEventBusin interfaceSessionKernel- Returns:
- the
EventBusassociated 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
-
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
-
getAuditSnapshot
@Nonnull public AuditContext.Builder getAuditSnapshot()
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-
createAccessToken
public java.lang.String createAccessToken()
Description copied from interface:SessionKernelCreate a new access token for the this session kernel. The access token expires in 30 seconds.- Specified by:
createAccessTokenin interfaceInternalSession- Specified by:
createAccessTokenin interfaceSessionKernel- Returns:
- the new short-lived access token used to establish a web socket connection
-
claimAccessToken
public boolean claimAccessToken(java.lang.String token)
Description copied from interface:SessionKernelClaim the given access token previously created by this session kernel.- Specified by:
claimAccessTokenin interfaceInternalSession- Specified by:
claimAccessTokenin interfaceSessionKernel- Parameters:
token- the access token to claim- Returns:
- true if the access token is valid (not expired). false otherwise
-
-