public class Session extends Object
| Modifier and Type | Field and Description |
|---|---|
static Session |
INTERNAL_SESSION |
protected List<SessionListener> |
listeners |
| Modifier | Constructor and Description |
|---|---|
protected |
Session(SessionManager sessionManager,
ApplicationIdentity clientIdentity,
String sessionName,
SecurityMode securityMode) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(ServerUserIdentity userIdentity)
Activate the session.
|
protected ByteString |
addBrowseContinuationPoint(BrowseContinuationPoint c) |
protected ByteString |
addHistoryContinuationPoint(HistoryContinuationPoint historyContinuationPoint) |
void |
addSessionListener(SessionListener listener)
Add a Sessionlistener.
|
protected void |
addSubscription(Subscription s) |
protected void |
cancel()
This Service is used to cancel outstanding Service requests.
|
protected void |
close(boolean deleteSubscriptions)
This Service is used to terminate a Session.
|
protected void |
deactivate()
Set active=false.
|
boolean |
equals(Object obj) |
static long |
getActivationTimeout()
Activation timeout: if a new session is not activated soon enough, it is disposed.
|
NodeId |
getAuthenticationToken()
A unique identifier assigned by the Server to the Session.
|
protected BrowseContinuationPoint |
getBrowseContinuationPoint(ByteString continuationPoint)
Find the BrowseContinuationPoint object indexed with the byte array.
|
ServerSecureChannel |
getChannel() |
ApplicationIdentity |
getClientIdentity()
The identity of the client application.
|
DateTime |
getClientLastContactTime()
Last time we got a message from the client, telling us that it was alive.
|
protected QualifiedName |
getDefaultEncoding()
Default data encoding used in the session.
|
Locale |
getDefaultLocale() |
protected HistoryContinuationPoint |
getHistoryContinuationPoint(ByteString continuationPoint)
Find the HistoryContinuationPoint object indexed with the byte array.
|
List<Locale> |
getLocales()
Returns an unmodifiable List of the locales requested by the Client in ActivateSession.
|
UnsignedInteger |
getMaxResponseMessageSize()
Maximum size of response messages sent over the stack, as defined by the client.
|
protected ByteString |
getNewServerNonce(int minServerNonceLength)
Create a new serverNonce using minServerNonceLength.
|
SecurityMode |
getSecurityMode()
SecurityMode of this session. |
protected ByteString |
getServerNonce() |
SessionDiagnostics |
getSessionDiagnostics()
Diagnostic information of the session.
|
NodeId |
getSessionId() |
protected SessionManager |
getSessionManager() |
String |
getSessionName()
Human readable string that identifies the Session.
|
SessionSecurityDiagnostics |
getSessionSecurityDiagnostics()
Security diagnostics of the session.
|
double |
getSessionTimeout() |
int |
getSubscriptionCount()
Current number of subscriptions in the session.
|
protected Queue<Subscription> |
getTransferredSubscriptions() |
ServerUserIdentity |
getUserIdentity()
The user identity that was used to activate the session.
|
int |
hashCode() |
boolean |
hasLocale(Locale locale)
Check if the session accepts a locale.
|
boolean |
hasSessionListener(SessionListener listener)
Check if a given listener is added
|
boolean |
isActive() |
boolean |
isClosed()
Returns true if this
Session is closed, either by CloseSessionRequest from the client
or any other reason, such as timeout. |
boolean |
isTimeout() |
void |
removeSessionListener(SessionListener listener)
Remove a SessionListener.
|
protected void |
removeSubscription(Subscription s) |
protected void |
resetDiagnostics()
Resets the service diagnostics.
|
static void |
setActivationTimeout(long activationTimeout)
/** Activation timeout: if a new session is not activated soon enough, it is disposed.
|
protected void |
setChannel(ServerSecureChannel serverSecureChannel) |
protected void |
setLocaleIds(String[] localeIds)
The localeIDs defined by the client, to use in the session
|
protected void |
setMaxResponseMessageSize(UnsignedInteger maxResponseMessageSize) |
protected void |
setSessionName(String name) |
protected void |
setSessionTimeout(double requestedSessionTimeout)
Define the session timeout.
|
String |
toString() |
protected void |
updateDiagnostics() |
public static final Session INTERNAL_SESSION
protected List<SessionListener> listeners
protected Session(SessionManager sessionManager, ApplicationIdentity clientIdentity, String sessionName, SecurityMode securityMode)
public static long getActivationTimeout()
Default: 10 s
public static void setActivationTimeout(long activationTimeout)
Default: 10 s
activationTimeout - the new timeout. the activationTimeout to setpublic void addSessionListener(SessionListener listener)
listener - listener to add.public NodeId getAuthenticationToken()
public ServerSecureChannel getChannel()
public ApplicationIdentity getClientIdentity()
public DateTime getClientLastContactTime()
public Locale getDefaultLocale()
public List<Locale> getLocales()
public UnsignedInteger getMaxResponseMessageSize()
public SecurityMode getSecurityMode()
SecurityMode of this session. NOTE! Related to the CreateSession part, not taking
transport layer into account, e.g. even if this is SecurityMode.NONE, the transport
layer might be encrypted. However this affects application level authentication, if
SecurityMode.getMessageSecurityMode() is other than MessageSecurityMode.None,
then each side shall trust eachothers cert or CreateSession would fail.public SessionDiagnostics getSessionDiagnostics()
public NodeId getSessionId()
public String getSessionName()
public SessionSecurityDiagnostics getSessionSecurityDiagnostics()
public double getSessionTimeout()
public int getSubscriptionCount()
public ServerUserIdentity getUserIdentity()
public boolean hasLocale(Locale locale)
locale - public boolean hasSessionListener(SessionListener listener)
listener - listener to checkpublic boolean isActive()
public boolean isClosed()
Session is closed, either by CloseSessionRequest from the client
or any other reason, such as timeout. False otherwise.public boolean isTimeout()
public void removeSessionListener(SessionListener listener)
listener - listener to remove.protected void activate(ServerUserIdentity userIdentity)
userIdentity - the new user identityprotected ByteString addBrowseContinuationPoint(BrowseContinuationPoint c) throws StatusException
StatusExceptionprotected ByteString addHistoryContinuationPoint(HistoryContinuationPoint historyContinuationPoint) throws StatusException
StatusExceptionprotected void addSubscription(Subscription s)
protected void cancel()
protected void close(boolean deleteSubscriptions)
deleteSubscriptions - Also remove all subscriptions, currently registered for the session.protected void deactivate()
protected BrowseContinuationPoint getBrowseContinuationPoint(ByteString continuationPoint) throws StatusException
continuationPoint - the bytearray "index"StatusException - Bad_ContinuationPointInvalidprotected QualifiedName getDefaultEncoding()
protected HistoryContinuationPoint getHistoryContinuationPoint(ByteString continuationPoint) throws StatusException
continuationPoint - the bytearray "index"StatusException - Bad_ContinuationPointInvalidprotected ByteString getNewServerNonce(int minServerNonceLength)
minServerNonceLength - protected ByteString getServerNonce()
protected SessionManager getSessionManager()
protected Queue<Subscription> getTransferredSubscriptions()
protected void removeSubscription(Subscription s)
protected void resetDiagnostics()
protected void setChannel(ServerSecureChannel serverSecureChannel)
serverSecureChannel - the channel to set.protected void setLocaleIds(String[] localeIds)
localeIds - protected void setMaxResponseMessageSize(UnsignedInteger maxResponseMessageSize)
maxResponseMessageSize - protected void setSessionName(String name)
name - the name to setprotected void setSessionTimeout(double requestedSessionTimeout)
requestedSessionTimeout - The timeout requested by the Client. This may be revised to
another value, which is then available from getSessionTimeoutprotected void updateDiagnostics()
Copyright © 2026. All rights reserved.