Class AbstractSessionKernel
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.session.AbstractSessionKernel
- All Implemented Interfaces:
Lifecycle, SessionKernel
Base class for
SessionKernel implementations. Encapsulates the basic properties and
lifecycle of a session kernel.-
Method Summary
Modifier and TypeMethodDescriptionOptional<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 jsonElement) Create a new token associated with the given type and data for the this session kernel.com.google.common.eventbus.EventBuslonglongprotected voidprotected voidqueue()voidtouch()Updates the last message time to the current time in nanosecondsMethods inherited from class AbstractLifecycle
isRunning, shutdown, startupMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SessionKernel
getGson, shutdown, startup
-
Method Details
-
getSessionCollection
- Specified by:
getSessionCollectionin interfaceSessionKernel- Returns:
- the
PerspectiveSessionCollectionwhich contains the session
-
getProjectName
- Specified by:
getProjectNamein interfaceSessionKernel- Returns:
- the name of the project associated with the session
-
queue
- Specified by:
queuein interfaceSessionKernel- Returns:
- the
ExecutionQueueused to run session tasks in serial
-
getLogger
- Specified by:
getLoggerin interfaceSessionKernel- Returns:
- the
LoggerExassociated with the session
-
getEventBus
public com.google.common.eventbus.EventBus getEventBus()- Specified by:
getEventBusin interfaceSessionKernel
-
getEventManager
- Specified by:
getEventManagerin interfaceSessionKernel- Returns:
- the
EventManagerassociated with the session
-
getSessionId
- 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 interfaceSessionKernel
-
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:
-
onStartup
protected void onStartup()- Specified by:
onStartupin classAbstractLifecycle
-
onShutdown
protected void onShutdown()- Specified by:
onShutdownin classAbstractLifecycle
-
createToken
public String createToken(String type, com.inductiveautomation.ignition.common.gson.JsonElement jsonElement) 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 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 interfaceSessionKernel- Parameters:
token- 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
-