org.opcfoundation.ua.transport.endpoint
Class AbstractServerSecureChannel

java.lang.Object
  extended by org.opcfoundation.ua.utils.AbstractState<CloseableObjectState,ServiceResultException>
      extended by org.opcfoundation.ua.transport.endpoint.AbstractServerSecureChannel
All Implemented Interfaces:
ServerSecureChannel, IStatefulObject<CloseableObjectState,ServiceResultException>
Direct Known Subclasses:
HttpsServerSecureChannel, OpcTcpServerSecureChannel

public abstract class AbstractServerSecureChannel
extends AbstractState<CloseableObjectState,ServiceResultException>
implements ServerSecureChannel

Super class for endpoint secure channels. Common mechanism: - Secure channel id - Security tokens - State and Error State


Field Summary
protected  SecurityToken activeToken
          The active token, This token is used in write operations
protected  Map<Integer,SecurityToken> tokens
          Collection of all Security Tokens
 
Constructor Summary
protected AbstractServerSecureChannel(int secureChannelId)
          Constructor for AbstractServerSecureChannel.
 
Method Summary
 void close()
          Close the secure channel.
 AsyncResult<ServerSecureChannel> closeAsync()
          Close the secure channel.
 SecurityToken getActiveSecurityToken()
          getActiveSecurityToken.
 SecurityToken getLatestNonExpiredToken()
          getLatestNonExpiredToken.
 MessageSecurityMode getMessageSecurityMode()
          getMessageSecurityMode.
protected  String getRemoteAddress()
          getRemoteAddress.
 int getSecureChannelId()
          Getter for the field secureChannelId.
 SecurityPolicy getSecurityPolicy()
          getSecurityPolicy.
 SecurityToken getSecurityToken(int tokenId)
          getSecurityToken.
 boolean isOpen()
          Is the secure channel open.
protected  void onListenerException(RuntimeException rte)
          Override this.
 void setActiveSecurityToken(SecurityToken token)
          setActiveSecurityToken.
 void setError(ServiceResultException e)
          setError.
 String toString()
          
 
Methods inherited from class org.opcfoundation.ua.utils.AbstractState
addStateListener, addStateNotifiable, assertNoError, attemptSetState, clearError, getError, getState, hasError, isStateTransitionAllowed, onStateTransition, removeStateListener, removeStateNotifiable, setState, setState, waitForState, waitForState, waitForStateUninterruptibly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opcfoundation.ua.transport.ServerSecureChannel
dispose, getConnection, getConnectURL, getEndpoint, getLocalCertificate, getPendingServiceRequests, getRemoteCertificate, getServer, needsCertificate
 

Field Detail

tokens

protected Map<Integer,SecurityToken> tokens
Collection of all Security Tokens


activeToken

protected SecurityToken activeToken
The active token, This token is used in write operations

Constructor Detail

AbstractServerSecureChannel

protected AbstractServerSecureChannel(int secureChannelId)

Constructor for AbstractServerSecureChannel.

Parameters:
secureChannelId - a int.
Method Detail

getSecureChannelId

public int getSecureChannelId()

Getter for the field secureChannelId.

Specified by:
getSecureChannelId in interface ServerSecureChannel
Returns:
a int.

getActiveSecurityToken

public SecurityToken getActiveSecurityToken()

getActiveSecurityToken.

Returns:
a SecurityToken object.

setActiveSecurityToken

public void setActiveSecurityToken(SecurityToken token)

setActiveSecurityToken.

Parameters:
token - a SecurityToken object.

getSecurityToken

public SecurityToken getSecurityToken(int tokenId)

getSecurityToken.

Parameters:
tokenId - a int.
Returns:
a SecurityToken object.

getMessageSecurityMode

public MessageSecurityMode getMessageSecurityMode()

getMessageSecurityMode.

Specified by:
getMessageSecurityMode in interface ServerSecureChannel
Returns:
a MessageSecurityMode object.

getSecurityPolicy

public SecurityPolicy getSecurityPolicy()

getSecurityPolicy.

Specified by:
getSecurityPolicy in interface ServerSecureChannel
Returns:
a SecurityPolicy object.

getLatestNonExpiredToken

public SecurityToken getLatestNonExpiredToken()

getLatestNonExpiredToken.

Returns:
a SecurityToken object.

setError

public void setError(ServiceResultException e)

setError.

Overrides:
setError in class AbstractState<CloseableObjectState,ServiceResultException>
Parameters:
e - a ServiceResultException object.

onListenerException

protected void onListenerException(RuntimeException rte)
Override this.

Overrides:
onListenerException in class AbstractState<CloseableObjectState,ServiceResultException>
Parameters:
rte - a RuntimeException object.

toString

public String toString()

Overrides:
toString in class Object

getRemoteAddress

protected String getRemoteAddress()

getRemoteAddress.

Returns:
a String object.

isOpen

public boolean isOpen()
Is the secure channel open.

Specified by:
isOpen in interface ServerSecureChannel
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, instead the secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed

Specified by:
close in interface ServerSecureChannel

closeAsync

public AsyncResult<ServerSecureChannel> 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, instead the secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed

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


Copyright © 2018. All rights reserved.