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.
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.PageVisitorNested 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 voidBroadcast 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.EventBusAnEventManagerfor events targeted to the running Perspective Project this session.com.inductiveautomation.ignition.common.gson.GsongetGson()longgetLastComm(TimeUnit timeUnit) Return the time in the given time unit when the last communication was received from the clientlongThe project that this session is running.longlongReturn 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 voidprotected voidqueue()Queue upon which all work for components and their properties should occur onvoidtouch()Updates the last message time to the current time in nanosecondsMethods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startupMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
auditMethods 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, visitPageMethods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrapMethods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
createPropertyReference, getAuditProfile, getQualifiedPathMethods inherited from interface com.inductiveautomation.perspective.gateway.api.PropertyTreeOwner
getPropertyTreeOfMethods 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, sendErrorToDesignerMethods inherited from interface com.inductiveautomation.perspective.gateway.session.SessionKernel
shutdown, startup
-
Method Details
-
getSessionCollection
- Specified by:
getSessionCollectionin interfaceInternalSession- Specified by:
getSessionCollectionin interfaceSessionKernel- Returns:
- the
PerspectiveSessionCollectionwhich contains the session
-
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
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
- 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
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
- 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
- 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:
-
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:
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
- Specified by:
getSessionInfoin interfaceInternalSession- Returns:
- a report about this session
-
getUptime
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
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
- Specified by:
getSessionClosedMessagein interfaceInternalSession- Returns:
- the default message sent to the client when the session is closed
-
getPageClosedMessage
- Specified by:
getPageClosedMessagein interfaceInternalSession- Returns:
- the default message sent to the client then a page is closed
-
getLogoutMessage
- Specified by:
getLogoutMessagein interfaceInternalSession- Returns:
- the default message sent to the client when the user logs out
-
getAuditSnapshot
- Specified by:
getAuditSnapshotin 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: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 Optional<com.inductiveautomation.ignition.common.gson.JsonElement> claimToken(String type, 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
-