org.opcfoundation.ua.application
Class SessionChannel

java.lang.Object
  extended by org.opcfoundation.ua.transport.ChannelService
      extended by org.opcfoundation.ua.application.SessionChannel
All Implemented Interfaces:
RequestChannel

public class SessionChannel
extends ChannelService
implements RequestChannel

Session channel is a request channel of an active session.

It is fully safe to use session channel from different thread simultaneosly.

Session channel adds authentication token and time stamp to all requests. TODO Keep-Alive


Constructor Summary
SessionChannel(Client client, Session session, SecureChannel channel)
          Constructor for SessionChannel.
 
Method Summary
 ActivateSessionResponse activate()
          Activate session using anonymous access.
 ActivateSessionResponse activate(byte[] issuedIdentityToken)
          Activate session using identity token.
 ActivateSessionResponse activate(String username, String password)
          Activate session using user name and password.
 ActivateSessionResponse activate(UserIdentityToken identity, SignatureData identitySignature)
          Activate session.
 void close()
          Close the session and the secure channel.
 AsyncResult<SecureChannel> closeAsync()
          Close the session and the secure channel asynchronously.
 void closeSecureChannel()
          Close the underlying secure channel.
 void closeUnsafe()
          Close the session and the secure channel.
 void dispose()
          dispose.
 SecureChannel getSecureChannel()
          Get secure channel.
 Session getSession()
          Get the session.
 IEncodeable serviceRequest(ServiceRequest serviceRequest)
          Sends a request over the secure channel.
 AsyncResult<ServiceResponse> serviceRequestAsync(ServiceRequest request)
          Asynchronous operation to send a request over the secure channel.
 
Methods inherited from class org.opcfoundation.ua.transport.ChannelService
ActivateSession, ActivateSession, ActivateSessionAsync, ActivateSessionAsync, AddNodes, AddNodes, AddNodesAsync, AddNodesAsync, AddReferences, AddReferences, AddReferencesAsync, AddReferencesAsync, Browse, Browse, BrowseAsync, BrowseAsync, BrowseNext, BrowseNext, BrowseNextAsync, BrowseNextAsync, Call, Call, CallAsync, CallAsync, Cancel, Cancel, CancelAsync, CancelAsync, CloseSecureChannel, CloseSecureChannel, CloseSecureChannelAsync, CloseSecureChannelAsync, CloseSession, CloseSession, CloseSessionAsync, CloseSessionAsync, CreateMonitoredItems, CreateMonitoredItems, CreateMonitoredItemsAsync, CreateMonitoredItemsAsync, CreateSession, CreateSession, CreateSessionAsync, CreateSessionAsync, CreateSubscription, CreateSubscription, CreateSubscriptionAsync, CreateSubscriptionAsync, DeleteMonitoredItems, DeleteMonitoredItems, DeleteMonitoredItemsAsync, DeleteMonitoredItemsAsync, DeleteNodes, DeleteNodes, DeleteNodesAsync, DeleteNodesAsync, DeleteReferences, DeleteReferences, DeleteReferencesAsync, DeleteReferencesAsync, DeleteSubscriptions, DeleteSubscriptions, DeleteSubscriptionsAsync, DeleteSubscriptionsAsync, FindServers, FindServers, FindServersAsync, FindServersAsync, FindServersOnNetwork, FindServersOnNetwork, FindServersOnNetworkAsync, FindServersOnNetworkAsync, GetEndpoints, GetEndpoints, GetEndpointsAsync, GetEndpointsAsync, HistoryRead, HistoryRead, HistoryReadAsync, HistoryReadAsync, HistoryUpdate, HistoryUpdate, HistoryUpdateAsync, HistoryUpdateAsync, ModifyMonitoredItems, ModifyMonitoredItems, ModifyMonitoredItemsAsync, ModifyMonitoredItemsAsync, ModifySubscription, ModifySubscription, ModifySubscriptionAsync, ModifySubscriptionAsync, OpenSecureChannel, OpenSecureChannel, OpenSecureChannelAsync, OpenSecureChannelAsync, Publish, Publish, PublishAsync, PublishAsync, QueryFirst, QueryFirst, QueryFirstAsync, QueryFirstAsync, QueryNext, QueryNext, QueryNextAsync, QueryNextAsync, Read, Read, ReadAsync, ReadAsync, RegisterNodes, RegisterNodes, RegisterNodesAsync, RegisterNodesAsync, RegisterServer, RegisterServer, RegisterServer2, RegisterServer2, RegisterServer2Async, RegisterServer2Async, RegisterServerAsync, RegisterServerAsync, Republish, Republish, RepublishAsync, RepublishAsync, SetMonitoringMode, SetMonitoringMode, SetMonitoringModeAsync, SetMonitoringModeAsync, SetPublishingMode, SetPublishingMode, SetPublishingModeAsync, SetPublishingModeAsync, setRequestChannel, SetTriggering, SetTriggering, SetTriggeringAsync, SetTriggeringAsync, TransferSubscriptions, TransferSubscriptions, TransferSubscriptionsAsync, TransferSubscriptionsAsync, TranslateBrowsePathsToNodeIds, TranslateBrowsePathsToNodeIds, TranslateBrowsePathsToNodeIdsAsync, TranslateBrowsePathsToNodeIdsAsync, UnregisterNodes, UnregisterNodes, UnregisterNodesAsync, UnregisterNodesAsync, Write, Write, WriteAsync, WriteAsync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionChannel

public SessionChannel(Client client,
                      Session session,
                      SecureChannel channel)

Constructor for SessionChannel.

Parameters:
client - a Client object.
session - a Session object.
channel - a SecureChannel object.
Method Detail

activate

public ActivateSessionResponse activate()
                                 throws ServiceResultException
Activate session using anonymous access.

Returns:
response
Throws:
ServiceResultException - if error

activate

public ActivateSessionResponse activate(String username,
                                        String password)
                                 throws ServiceResultException
Activate session using user name and password.

Parameters:
username - user name
password - user password
Returns:
response
Throws:
ServiceResultException - if error

activate

public ActivateSessionResponse activate(byte[] issuedIdentityToken)
                                 throws ServiceResultException
Activate session using identity token.

Parameters:
issuedIdentityToken - token
Returns:
response
Throws:
ServiceResultException - if error

activate

public ActivateSessionResponse activate(UserIdentityToken identity,
                                        SignatureData identitySignature)
                                 throws ServiceResultException
Activate session.

Parameters:
identity - user identity, see EndpointUtil.createIssuedIdentityToken(EndpointDescription, byte[], byte[])
identitySignature - used with X509IdentityToken and IssuedIdentityToken ?
identitySignature - used with X509IdentityToken and IssuedIdentityToken ?
Returns:
response
Throws:
ServiceResultException - if error

getSession

public Session getSession()
Get the session.

Returns:
session

getSecureChannel

public SecureChannel getSecureChannel()
Get secure channel.

Returns:
secure channel

close

public void close()
           throws ServiceFaultException,
                  ServiceResultException
Close the session and the secure channel. Subscriptions are deleted. This convenience method logs the errors to default Logger but doesn't throw exceptions. Rationale is that in typical case, the client cannot handle close errors. To capture errors use ChannelService.CloseSession(RequestHeader, Boolean) and closeSecureChannel().

Throws:
ServiceResultException - if error
ServiceFaultException - if error

closeUnsafe

public void closeUnsafe()
Close the session and the secure channel. Subscriptions are deleted. This convenience method logs the errors to default Logger but doesn't throw exceptions. Rationale is that in typical case, the client cannot handle close errors. To capture errors use close().


closeSecureChannel

public void closeSecureChannel()
Close the underlying secure channel.


closeAsync

public AsyncResult<SecureChannel> closeAsync()
Close the session and the secure channel asynchronously.

Use close() to close the session before closing the session.

Returns:
async result of the operation

dispose

public void dispose()

dispose.


serviceRequest

public IEncodeable serviceRequest(ServiceRequest serviceRequest)
                           throws ServiceResultException
Sends a request over the secure channel.

If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout.

Invoke session service request.

AuthenticationToken and Timestamp is added to RequestHeader.

If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout

Specified by:
serviceRequest in interface RequestChannel
Parameters:
serviceRequest - the request
Returns:
the response
Throws:
ServiceResultException - if error

serviceRequestAsync

public AsyncResult<ServiceResponse> serviceRequestAsync(ServiceRequest request)
Asynchronous operation to send a request over the secure channel. Asynchronous operation to send a request over the secure channel. Invoke session service request.

AuthenticationToken and Timestamp is added to RequestHeader.

Specified by:
serviceRequestAsync in interface RequestChannel
Parameters:
request - the request
Returns:
the result


Copyright © 2018. All rights reserved.