Class AbstractSessionKernel
- java.lang.Object
-
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
-
- com.inductiveautomation.perspective.gateway.session.AbstractSessionKernel
-
- All Implemented Interfaces:
SessionKernel
public abstract class AbstractSessionKernel extends AbstractLifecycle implements SessionKernel
Base class forSessionKernel
implementations. Encapsulates the basic properties and lifecycle of a session kernel.
-
-
Method Summary
All Methods Instance Methods Concrete 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()
long
getLastMessageTime()
LoggerEx
getLogger()
java.lang.String
getProjectName()
PerspectiveSessionCollection
getSessionCollection()
java.util.UUID
getSessionId()
long
getStartupTime()
protected void
onShutdown()
protected void
onStartup()
ExecutionQueue
queue()
void
touch()
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.session.SessionKernel
getGson, shutdown, startup
-
-
-
-
Method Detail
-
getSessionCollection
public PerspectiveSessionCollection getSessionCollection()
- Specified by:
getSessionCollection
in interfaceSessionKernel
- Returns:
- the
PerspectiveSessionCollection
which contains the session
-
getProjectName
public java.lang.String getProjectName()
- Specified by:
getProjectName
in interfaceSessionKernel
- Returns:
- the name of the project associated with the session
-
queue
public ExecutionQueue queue()
- Specified by:
queue
in interfaceSessionKernel
- Returns:
- the
ExecutionQueue
used to run session tasks in serial
-
getLogger
public LoggerEx getLogger()
- Specified by:
getLogger
in interfaceSessionKernel
- Returns:
- the
LoggerEx
associated with the session
-
getEventBus
public com.google.common.eventbus.EventBus getEventBus()
- Specified by:
getEventBus
in interfaceSessionKernel
- Returns:
- the
EventBus
associated with the session
-
getSessionId
public java.util.UUID getSessionId()
- Specified by:
getSessionId
in interfaceSessionKernel
- Returns:
- the session's unique identifier
-
getStartupTime
public long getStartupTime()
- Specified by:
getStartupTime
in 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:
getLastMessageTime
in 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:SessionKernel
Updates the last message time to the current time in nanoseconds- Specified by:
touch
in interfaceSessionKernel
- See Also:
System.nanoTime()
-
onStartup
protected void onStartup()
- Specified by:
onStartup
in classAbstractLifecycle
-
onShutdown
protected void onShutdown()
- Specified by:
onShutdown
in classAbstractLifecycle
-
createAccessToken
public java.lang.String createAccessToken()
Description copied from interface:SessionKernel
Create a new access token for the this session kernel. The access token expires in 30 seconds.- Specified by:
createAccessToken
in 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:SessionKernel
Claim the given access token previously created by this session kernel.- Specified by:
claimAccessToken
in interfaceSessionKernel
- Parameters:
token
- the access token to claim- Returns:
- true if the access token is valid (not expired). false otherwise
-
-