com.prosysopc.ua.server
Class Session

java.lang.Object
  extended by com.prosysopc.ua.server.Session

public class Session
extends Object

Client session information, managed by the OPC UA client. The session object is used to keep track of a client session, including diagnostic information.


Field Summary
static Session INTERNAL_SESSION
           
protected  List<SessionListener> listeners
           
 
Constructor Summary
protected Session(SessionManager sessionManager, ApplicationIdentity clientIdentity, String sessionName)
           
 
Method Summary
protected  void activate(ServerUserIdentity userIdentity)
          Activate the session.
protected  org.opcfoundation.ua.builtintypes.ByteString addBrowseContinuationPoint(BrowseContinuationPoint c)
           
protected  org.opcfoundation.ua.builtintypes.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.
 org.opcfoundation.ua.builtintypes.NodeId getAuthenticationToken()
          A unique identifier assigned by the Server to the Session.
protected  BrowseContinuationPoint getBrowseContinuationPoint(org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
          Find the BrowseContinuationPoint object indexed with the byte array.
 org.opcfoundation.ua.transport.ServerSecureChannel getChannel()
           
 ApplicationIdentity getClientIdentity()
          The identity of the client application.
 org.opcfoundation.ua.builtintypes.DateTime getClientLastContactTime()
          Last time we got a message from the client, telling us that it was alive.
protected  org.opcfoundation.ua.builtintypes.QualifiedName getDefaultEncoding()
          Default data encoding used in the session.
 Locale getDefaultLocale()
           
protected  HistoryContinuationPoint getHistoryContinuationPoint(org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
          Find the HistoryContinuationPoint object indexed with the byte array.
 Locale[] getLocales()
          The locales defined by the client, to use in the session.
 org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxResponseMessageSize()
          Maximum size of response messages sent over the stack, as defined by the client.
protected  org.opcfoundation.ua.builtintypes.ByteString getNewServerNonce(int minServerNonceLength)
          Create a new serverNonce using minServerNonceLength.
protected  org.opcfoundation.ua.builtintypes.ByteString getServerNonce()
           
 SessionDiagnostics getSessionDiagnostics()
          Diagnostic information of the session.
 org.opcfoundation.ua.builtintypes.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 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(org.opcfoundation.ua.transport.ServerSecureChannel serverSecureChannel)
           
protected  void setLocaleIds(String[] localeIds)
          The localeIDs defined by the client, to use in the session
protected  void setMaxResponseMessageSize(org.opcfoundation.ua.builtintypes.UnsignedInteger maxResponseMessageSize)
           
protected  void setSessionName(String name)
           
protected  void setSessionTimeout(double requestedSessionTimeout)
          Define the session timeout.
 String toString()
           
protected  void updateDiagnostics()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERNAL_SESSION

public static final Session INTERNAL_SESSION

listeners

protected List<SessionListener> listeners
Constructor Detail

Session

protected Session(SessionManager sessionManager,
                  ApplicationIdentity clientIdentity,
                  String sessionName)
Method Detail

getActivationTimeout

public static long getActivationTimeout()
Activation timeout: if a new session is not activated soon enough, it is disposed.

Default: 10 s

Returns:
the activationTimeout

setActivationTimeout

public static void setActivationTimeout(long activationTimeout)
/** Activation timeout: if a new session is not activated soon enough, it is disposed.

Default: 10 s

Parameters:
activationTimeout - the new timeout. the activationTimeout to set

addSessionListener

public void addSessionListener(SessionListener listener)
Add a Sessionlistener.

Parameters:
listener - listener to add.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getAuthenticationToken

public org.opcfoundation.ua.builtintypes.NodeId getAuthenticationToken()
A unique identifier assigned by the Server to the Session. This identifier shall be passed in the RequestHeader of each request and is used with the SecureChannelId to determine whether a Client has access to the Session. This identifier shall not be reused in a way that the Client or the Server has a chance of confusing them with a previous or existing Session.

Returns:
the authenticationToken

getChannel

public org.opcfoundation.ua.transport.ServerSecureChannel getChannel()
Returns:
the secure channel used by the session

getClientIdentity

public ApplicationIdentity getClientIdentity()
The identity of the client application.

Returns:
the clientIdentity

getClientLastContactTime

public org.opcfoundation.ua.builtintypes.DateTime getClientLastContactTime()
Last time we got a message from the client, telling us that it was alive.

Returns:
the clientLastContactTime

getDefaultLocale

public Locale getDefaultLocale()
Returns:
the default locale requested by the client application.

getLocales

public Locale[] getLocales()
The locales defined by the client, to use in the session. The respective LocaleID list is available from #getDiagnostics()

Returns:
array of Locale objects

getMaxResponseMessageSize

public org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxResponseMessageSize()
Maximum size of response messages sent over the stack, as defined by the client.

Returns:

getSessionDiagnostics

public SessionDiagnostics getSessionDiagnostics()
Diagnostic information of the session.

Returns:
the diagnostics

getSessionId

public org.opcfoundation.ua.builtintypes.NodeId getSessionId()

getSessionName

public String getSessionName()
Human readable string that identifies the Session. The Server makes this name and the sessionId visible in its AddressSpace for diagnostic purposes. The Client should provide a name that is unique for the instance of the Client. If this parameter is not specified the Server will assign a value.

Returns:
The name of the session.

getSessionSecurityDiagnostics

public SessionSecurityDiagnostics getSessionSecurityDiagnostics()
Security diagnostics of the session.

Returns:
the diagnostics

getSessionTimeout

public double getSessionTimeout()

getSubscriptionCount

public int getSubscriptionCount()
Current number of subscriptions in the session.

Returns:

getUserIdentity

public ServerUserIdentity getUserIdentity()
The user identity that was used to activate the session.

Returns:
the userIdentity

hashCode

public int hashCode()
Overrides:
hashCode in class Object

hasLocale

public boolean hasLocale(Locale locale)
Check if the session accepts a locale.

Parameters:
locale -
Returns:

hasSessionListener

public boolean hasSessionListener(SessionListener listener)
Check if a given listener is added

Parameters:
listener - listener to check
Returns:
true if it is added, false if not

isActive

public boolean isActive()
Returns:
the active

isTimeout

public boolean isTimeout()
Returns:
true if the session has timed out because of too little activity.

removeSessionListener

public void removeSessionListener(SessionListener listener)
Remove a SessionListener.

Parameters:
listener - listener to remove.

toString

public String toString()
Overrides:
toString in class Object

activate

protected void activate(ServerUserIdentity userIdentity)
                 throws StatusException
Activate the session.

Parameters:
userIdentity - the new user identity
Throws:
StatusException

addBrowseContinuationPoint

protected org.opcfoundation.ua.builtintypes.ByteString addBrowseContinuationPoint(BrowseContinuationPoint c)
                                                                           throws StatusException
Parameters:
r -
Returns:
Throws:
StatusException

addHistoryContinuationPoint

protected org.opcfoundation.ua.builtintypes.ByteString addHistoryContinuationPoint(HistoryContinuationPoint historyContinuationPoint)
                                                                            throws StatusException
Parameters:
resultUserContinuationPoint -
historyContinuationPoint -
Returns:
Throws:
StatusException

addSubscription

protected void addSubscription(Subscription s)

cancel

protected void cancel()
This Service is used to cancel outstanding Service requests. Successfully canceled service requests shall respond with Bad_RequestCancelledByClient.


close

protected void close(boolean deleteSubscriptions)
This Service is used to terminate a Session. The Server takes the following actions when it receives a CloseSession request: a) It stops accepting requests for the Session. All subsequent requests received for the Session are discarded. b) It returns negative responses with the StatusCode Bad_SessionClosed to all requests that are currently outstanding to provide for the timely return of the CloseSession response. Clients are urged to wait for all outstanding requests to complete before submitting the CloseSession request. c) It removes the entry for the Client in its SessionDiagnosticArray Variable.

Parameters:
deleteSubscriptions - Also remove all subscriptions, currently registered for the session.

deactivate

protected void deactivate()
Set active=false.


getBrowseContinuationPoint

protected BrowseContinuationPoint getBrowseContinuationPoint(org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
                                                      throws StatusException
Find the BrowseContinuationPoint object indexed with the byte array. The ContinuationPoint is also removed from the Session when retrieved.

Parameters:
continuationPoint - the bytearray "index"
Returns:
the continuation point or null if the point is not found
Throws:
StatusException - Bad_ContinuationPointInvalid

getDefaultEncoding

protected org.opcfoundation.ua.builtintypes.QualifiedName getDefaultEncoding()
Default data encoding used in the session. Used to encode ExtensionObjects that are sent to the client.

Returns:

getHistoryContinuationPoint

protected HistoryContinuationPoint getHistoryContinuationPoint(org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
                                                        throws StatusException
Find the HistoryContinuationPoint object indexed with the byte array. The ContinuationPoint is also removed from the Session when retrieved.

Parameters:
continuationPoint - the bytearray "index"
Returns:
the continuation point or null if the point is not found
Throws:
StatusException - Bad_ContinuationPointInvalid

getNewServerNonce

protected org.opcfoundation.ua.builtintypes.ByteString getNewServerNonce(int minServerNonceLength)
Create a new serverNonce using minServerNonceLength.

Parameters:
minServerNonceLength -
Returns:

getServerNonce

protected org.opcfoundation.ua.builtintypes.ByteString getServerNonce()
Returns:
the last server nonce used to encrypt the data package.

getSessionManager

protected SessionManager getSessionManager()
Returns:
the sessionManager

getTransferredSubscriptions

protected Queue<Subscription> getTransferredSubscriptions()
Returns:
the transferredSubscriptions

removeSubscription

protected void removeSubscription(Subscription s)

resetDiagnostics

protected void resetDiagnostics()
Resets the service diagnostics.


setChannel

protected void setChannel(org.opcfoundation.ua.transport.ServerSecureChannel serverSecureChannel)
Parameters:
serverSecureChannel - the channel to set

setLocaleIds

protected void setLocaleIds(String[] localeIds)
The localeIDs defined by the client, to use in the session

Parameters:
localeIds -

setMaxResponseMessageSize

protected void setMaxResponseMessageSize(org.opcfoundation.ua.builtintypes.UnsignedInteger maxResponseMessageSize)
Parameters:
maxResponseMessageSize -

setSessionName

protected void setSessionName(String name)
Parameters:
name - the name to set

setSessionTimeout

protected void setSessionTimeout(double requestedSessionTimeout)
Define the session timeout. The Server should attempt to honour the Client request for this parameter, but may negotiate this value up or down to meet its own constraints.

Parameters:
requestedSessionTimeout - The timeout requested by the Client. This may be revised to another value, which is then available from getSessionTimeout

updateDiagnostics

protected void updateDiagnostics()


Copyright © 2018. All rights reserved.