com.prosysopc.ua.server
Class SessionManagerAdapter

java.lang.Object
  extended by com.prosysopc.ua.server.SessionManagerAdapter
All Implemented Interfaces:
SessionManagerListener

public class SessionManagerAdapter
extends Object
implements SessionManagerListener

Adapter class for SessionManagerListener


Constructor Summary
SessionManagerAdapter()
           
 
Method Summary
 boolean onActivateSession(Session session, ServerUserIdentity userIdentity)
          Notification of session activation.
 void onActivateSessionError(Session session, org.opcfoundation.ua.core.UserIdentityToken userToken, Exception e)
          Notification of an activation error.
 void onAfterActivateSession(Session session)
          Notification of a successful session activation.
 void onCancelSession(Session session)
          Notification of session cancel.
 void onCloseSession(Session session, boolean deleteSubscriptions)
          Notification of session close.
 void onCreateSession(Session session)
          Notification of session creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionManagerAdapter

public SessionManagerAdapter()
Method Detail

onActivateSession

public boolean onActivateSession(Session session,
                                 ServerUserIdentity userIdentity)
                          throws StatusException
Description copied from interface: SessionManagerListener
Notification of session activation. Used to validate the userIdentity. The event is called whenever a client application activates the session, which occurs, at initial connection, and also if the user identity is changed.

Note that raising an exception will also lead to a call to SessionManagerListener.onActivateSessionError(com.prosysopc.ua.server.Session, org.opcfoundation.ua.core.UserIdentityToken, java.lang.Exception)

The UaServer listens to the event as well, and delegates the certificate check to its userValidator.

Specified by:
onActivateSession in interface SessionManagerListener
Parameters:
session - The session which the user is logging in. The old user identity is still assigned to the session (it will be null in the first time).
userIdentity - the new user identity that is being used to activate the session.
Returns:
true, if the user is allowed access.
Throws:
StatusException - if there is a problem with the activation. For example, if the session is active, and you do not want to enable the user identity to be changed, throw the exception with StatusCodes.Bad_IdentityChangeNotSupported.

onActivateSessionError

public void onActivateSessionError(Session session,
                                   org.opcfoundation.ua.core.UserIdentityToken userToken,
                                   Exception e)
Description copied from interface: SessionManagerListener
Notification of an activation error. Read the exception to get more details on the error. userToken is the invalid token that was used for activation.

Specified by:
onActivateSessionError in interface SessionManagerListener
Parameters:
session - The session which the user was logging in.
userToken - The user token that was used
e - The error that was raised.

onAfterActivateSession

public void onAfterActivateSession(Session session)
Description copied from interface: SessionManagerListener
Notification of a successful session activation. The event will only be called after a successful activation.

Specified by:
onAfterActivateSession in interface SessionManagerListener
Parameters:
session - The session which the user logged in. You can read the new UserIdentity from the session.

onCancelSession

public void onCancelSession(Session session)
Description copied from interface: SessionManagerListener
Notification of session cancel. The event is used to notify the server that all currently pending operations for the session should be cancelled.

Specified by:
onCancelSession in interface SessionManagerListener
Parameters:
session - the session being canceled.

onCloseSession

public void onCloseSession(Session session,
                           boolean deleteSubscriptions)
Description copied from interface: SessionManagerListener
Notification of session close.

Specified by:
onCloseSession in interface SessionManagerListener
Parameters:
session - the session being closed.
deleteSubscriptions - whether the client is requesting that all subscriptions related to the session are to be deleted as well.

onCreateSession

public void onCreateSession(Session session)
                     throws StatusException
Description copied from interface: SessionManagerListener
Notification of session creation. The session is initialized with the data received from the client request, including the clientIdentity. The application certificate is typically checked in this event.

The UaServer listens to the event as well, and delegates the certificate check to its certificateValidator.

Specified by:
onCreateSession in interface SessionManagerListener
Parameters:
session - the session to be created.
Throws:
StatusException


Copyright © 2018. All rights reserved.