org.opcfoundation.ua.transport
Class ServiceChannel

java.lang.Object
  extended by org.opcfoundation.ua.transport.ChannelService
      extended by org.opcfoundation.ua.transport.ServiceChannel
All Implemented Interfaces:
RequestChannel, SecureChannel

public class ServiceChannel
extends ChannelService
implements SecureChannel

This utility class envelopes Securechannel with client service methods. See ChannelService.


Constructor Summary
ServiceChannel(SecureChannel channel)
          Constructor for ServiceChannel.
 
Method Summary
 void close()
          Close the secure channel.
 AsyncResult<SecureChannel> closeAsync()
          Close the secure channel.
 void dispose()
          Close and dispose.
 ServerConnection getConnection()
          Get current socket connection if applicable for the binding type.
 String getConnectURL()
          Return the URL of the connection.
 EndpointConfiguration getEndpointConfiguration()
          getEndpointConfiguration.
 EndpointDescription getEndpointDescription()
          getEndpointDescription.
 EncoderContext getMessageContext()
          getMessageContext.
 MessageSecurityMode getMessageSecurityMode()
          Get message security mode.
 int getOperationTimeout()
          Get operation timeout
 int getSecureChannelId()
          Get secure channel ID
 SecurityPolicy getSecurityPolicy()
          Get security policy
 void initialize(String url, TransportChannelSettings settings, EncoderContext ctx)
          Initialize a secure channel with endpoint identified by the URL.
 void initialize(TransportChannelSettings settings, EncoderContext ctx)
          Initialize a secure channel with endpoint identified by the URL.
 boolean isOpen()
          Is the secure channel open.
 void open()
          Open the secure channel with the endpoint identified by the URL.
 AsyncResult<SecureChannel> openAsync()
          Open the secure channel asynchronously.
 ServiceResponse serviceRequest(ServiceRequest request)
          Sends a request over the secure channel.
 AsyncResult<ServiceResponse> serviceRequestAsync(ServiceRequest request)
          Asynchronous operation to send a request over the secure channel.
 void setOperationTimeout(int timeout)
          Set operation timeout
 
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

ServiceChannel

public ServiceChannel(SecureChannel channel)

Constructor for ServiceChannel.

Parameters:
channel - a SecureChannel object.
Method Detail

close

public void close()
Close the secure channel. This method does nothing if the channel is already closed or has never been opened.

This method sends CloseSecureChannelRequest to the server and closes the socket connection. If sending of the message fails and thus the servers never receives notification about closed secure channel, then there is no resend attempt. The secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed

Specified by:
close in interface SecureChannel

closeAsync

public AsyncResult<SecureChannel> closeAsync()
Close the secure channel. This method does nothing if the channel is already closed or has never been opened.

This method sends CloseSecureChannelRequest to the server and closes the socket connection. If sending of the message fails and thus the servers never receives notification about closed secure channel, then there is no resend attempt. The secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed

Specified by:
closeAsync in interface SecureChannel
Returns:
asynchronous monitor object

dispose

public void dispose()
Close and dispose. The object becomes unusuable.

Specified by:
dispose in interface SecureChannel

getConnectURL

public String getConnectURL()
Return the URL of the connection. This value is only available when the channel is in Open or Closing state, if not the return value is null.

Specified by:
getConnectURL in interface SecureChannel
Returns:
connect URL or null

getConnection

public ServerConnection getConnection()
Get current socket connection if applicable for the binding type.

Specified by:
getConnection in interface SecureChannel
Returns:
connection or null

getEndpointConfiguration

public EndpointConfiguration getEndpointConfiguration()

getEndpointConfiguration.

Specified by:
getEndpointConfiguration in interface SecureChannel
Returns:
a EndpointConfiguration object.

getEndpointDescription

public EndpointDescription getEndpointDescription()

getEndpointDescription.

Specified by:
getEndpointDescription in interface SecureChannel
Returns:
a EndpointDescription object.

getMessageContext

public EncoderContext getMessageContext()

getMessageContext.

Specified by:
getMessageContext in interface SecureChannel
Returns:
a EncoderContext object.

getMessageSecurityMode

public MessageSecurityMode getMessageSecurityMode()
Get message security mode.

Specified by:
getMessageSecurityMode in interface SecureChannel
Returns:
security mode or null

getOperationTimeout

public int getOperationTimeout()
Get operation timeout

Specified by:
getOperationTimeout in interface SecureChannel
Returns:
timeout in milliseconds

getSecureChannelId

public int getSecureChannelId()
Get secure channel ID

Specified by:
getSecureChannelId in interface SecureChannel
Returns:
secure channel id

getSecurityPolicy

public SecurityPolicy getSecurityPolicy()
Get security policy

Specified by:
getSecurityPolicy in interface SecureChannel
Returns:
security policy or null if channel has not been initialized

initialize

public void initialize(String url,
                       TransportChannelSettings settings,
                       EncoderContext ctx)
                throws ServiceResultException
Initialize a secure channel with endpoint identified by the URL.

Specified by:
initialize in interface SecureChannel
Parameters:
url - connect url
settings - a TransportChannelSettings object.
ctx - a EncoderContext object.
Throws:
ServiceResultException - if any.

isOpen

public boolean isOpen()
Is the secure channel open.

Specified by:
isOpen in interface SecureChannel
Returns:
true if the channel is open

open

public void open()
          throws ServiceResultException
Open the secure channel with the endpoint identified by the URL. Once the channel is open if will be assigned a secure channel id. The channel must be initialzied before hand. If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout.

Specified by:
open in interface SecureChannel
Throws:
ServiceResultException - if any.

openAsync

public AsyncResult<SecureChannel> openAsync()
Open the secure channel asynchronously.

Specified by:
openAsync in interface SecureChannel
Returns:
async result

serviceRequest

public ServiceResponse serviceRequest(ServiceRequest request)
                               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.

Sends a request over the secure channel.

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

Specified by:
serviceRequest in interface RequestChannel
Specified by:
serviceRequest in interface SecureChannel
Parameters:
request - 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.

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

setOperationTimeout

public void setOperationTimeout(int timeout)
Set operation timeout

Specified by:
setOperationTimeout in interface SecureChannel
Parameters:
timeout - in milliseconds

initialize

public void initialize(TransportChannelSettings settings,
                       EncoderContext ctx)
                throws ServiceResultException
Initialize a secure channel with endpoint identified by the URL.

Specified by:
initialize in interface SecureChannel
Parameters:
settings - a TransportChannelSettings object.
ctx - a EncoderContext object.
Throws:
ServiceResultException - if any.


Copyright © 2018. All rights reserved.