Interface SessionKernel
-
- All Known Implementing Classes:
AbstractSession
,AbstractSessionKernel
,PerspectiveDesignSession
,PerspectiveProjectSession
,SecuredPerspectiveProjectSession
,SessionKernelWrapper
public interface SessionKernel
The nucleus of a Perspective Session. Instances are meant to be fixed and reused per-session. Useful for sharing between session proxies.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
claimAccessToken​(java.lang.String token)
Claim the given access token previously created by this session kernel.java.lang.String
createAccessToken()
Create a new access token for the this session kernel.com.google.common.eventbus.EventBus
getEventBus()
default com.inductiveautomation.ignition.common.gson.Gson
getGson()
long
getLastMessageTime()
LoggerEx
getLogger()
java.lang.String
getProjectName()
PerspectiveSessionCollection
getSessionCollection()
java.util.UUID
getSessionId()
long
getStartupTime()
ExecutionQueue
queue()
void
shutdown()
Shuts down the session kernelvoid
startup()
Starts up the session kernelvoid
touch()
Updates the last message time to the current time in nanoseconds
-
-
-
Method Detail
-
getSessionCollection
PerspectiveSessionCollection getSessionCollection()
- Returns:
- the
PerspectiveSessionCollection
which contains the session
-
getProjectName
java.lang.String getProjectName()
- Returns:
- the name of the project associated with the session
-
getGson
default com.inductiveautomation.ignition.common.gson.Gson getGson()
- Returns:
- a
Gson
instance for json serialization / de-serialization
-
queue
ExecutionQueue queue()
- Returns:
- the
ExecutionQueue
used to run session tasks in serial
-
getEventBus
com.google.common.eventbus.EventBus getEventBus()
- Returns:
- the
EventBus
associated with the session
-
getSessionId
java.util.UUID getSessionId()
- Returns:
- the session's unique identifier
-
startup
void startup()
Starts up the session kernel- Throws:
java.lang.IllegalStateException
- if the session kernel has already been started or shutdown
-
shutdown
void shutdown()
Shuts down the session kernel- Throws:
java.lang.IllegalStateException
- if the session has not been started or if it has already been shut down
-
getStartupTime
long getStartupTime()
- Returns:
- the time in nanoseconds when the session kernel started (or 0 if the session kernel has not yet been started)
-
getLastMessageTime
long getLastMessageTime()
- Returns:
- the time in nanoseconds when the last message was received by the session containing this kernel
-
touch
void touch()
Updates the last message time to the current time in nanoseconds- See Also:
System.nanoTime()
-
createAccessToken
java.lang.String createAccessToken()
Create a new access token for the this session kernel. The access token expires in 30 seconds.- Returns:
- the new short-lived access token used to establish a web socket connection
-
claimAccessToken
boolean claimAccessToken​(java.lang.String token)
Claim the given access token previously created by this session kernel.- Parameters:
token
- the access token to claim- Returns:
- true if the access token is valid (not expired). false otherwise
-
-