org.opcfoundation.ua.transport.https
Class HttpsClientSecureChannel

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

public class HttpsClientSecureChannel
extends Object
implements SecureChannel

HttpsClientSecureChannel class.


Constructor Summary
HttpsClientSecureChannel(HttpsClient client)
          Constructor for HttpsClientSecureChannel.
 
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 tcs, EncoderContext ctx)
          Initialize a secure channel with endpoint identified by the URL.
 void initialize(TransportChannelSettings tcs, 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpsClientSecureChannel

public HttpsClientSecureChannel(HttpsClient client)

Constructor for HttpsClientSecureChannel.

Parameters:
client - a HttpsClient object.
Method Detail

initialize

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

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

initialize

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

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

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

getSecureChannelId

public int getSecureChannelId()
Get secure channel ID

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

getConnection

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

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

getMessageSecurityMode

public MessageSecurityMode getMessageSecurityMode()
Get message security mode.

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

getSecurityPolicy

public SecurityPolicy getSecurityPolicy()
Get security policy

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

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

isOpen

public boolean isOpen()
Is the secure channel open.

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

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

getEndpointDescription

public EndpointDescription getEndpointDescription()

getEndpointDescription.

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

getEndpointConfiguration

public EndpointConfiguration getEndpointConfiguration()

getEndpointConfiguration.

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

getMessageContext

public EncoderContext getMessageContext()

getMessageContext.

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

setOperationTimeout

public void setOperationTimeout(int timeout)
Set operation timeout

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

getOperationTimeout

public int getOperationTimeout()
Get operation timeout

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


Copyright © 2018. All rights reserved.