org.opcfoundation.ua.transport.tcp.nio
Class AbstractServerConnection

java.lang.Object
  extended by org.opcfoundation.ua.utils.AbstractState<CloseableObjectState,ServiceResultException>
      extended by org.opcfoundation.ua.transport.tcp.nio.AbstractServerConnection
All Implemented Interfaces:
CloseableObject, ServerConnection, IStatefulObject<CloseableObjectState,ServiceResultException>
Direct Known Subclasses:
OpcTcpServerConnection

public abstract class AbstractServerConnection
extends AbstractState<CloseableObjectState,ServiceResultException>
implements ServerConnection, CloseableObject

Abstract AbstractServerConnection class.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opcfoundation.ua.transport.ServerConnection
ServerConnection.SecureChannelListener
 
Constructor Summary
protected AbstractServerConnection()
          Constructor for AbstractServerConnection.
 
Method Summary
 void addChannelListener(Channel.ChannelListener listener)
          addChannelListener.
 void addConnectionListener(IConnectionListener listener)
          Add response listener
 void addSecureChannelListener(ServerConnection.SecureChannelListener l)
          addSecureChannelListener.
 CloseableObject close()
          close.
protected  void fireSecureChannelAttached(ServerSecureChannel c)
          Send a notification to listeners that a secure channel has been attached to (opened in) the connection.
protected  void fireSecureChannelDetached(ServerSecureChannel c)
          Send a notification the listeners that a secure channel has been detached from the connection.
 String getConnectURL()
          getConnectURL.
 Certificate getRemoteCertificate()
          getRemoteCertificate.
protected abstract  CertificateValidator getRemoteCertificateValidator()
          Remote Certificate Validator, invoked upon connect
 void getSecureChannels(Collection<ServerSecureChannel> list)
          Get all open and opening secure channels of this connection.
protected  void onListenerException(RuntimeException rte)
          Override this.
protected  void onStateTransition(CloseableObjectState oldState, CloseableObjectState newState)
          Override this.
 void removeChannelListener(Channel.ChannelListener listener)
          removeChannelListener.
 void removeConnectionListener(IConnectionListener listener)
          Add response listener
 void removeSecureChannelListener(ServerConnection.SecureChannelListener l)
          removeSecureChannelListener.
protected abstract  int sendAsymmSecureMessage(AsyncWrite msg, SecurityConfiguration securityConfiguration, int secureChannelId, int requestNumber, AtomicInteger sendSequenceNumber)
          sendAsymmSecureMessage.
protected abstract  void sendSecureMessage(AsyncWrite msg, SecurityToken token, int requestId, int messageType, AtomicInteger sendSequenceNumber)
          sendSecureMessage.
protected  void setError(ServiceResultException e)
          setError.
protected  void setError(StatusCode sc)
          setError.
protected  void setError(UnsignedInteger errorCode)
          setError.
 String toString()
          
 
Methods inherited from class org.opcfoundation.ua.utils.AbstractState
addStateListener, addStateNotifiable, assertNoError, attemptSetState, clearError, getError, getState, hasError, isStateTransitionAllowed, 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.ServerConnection
getLocalAddress, getRemoteAddress
 
Methods inherited from interface org.opcfoundation.ua.utils.IStatefulObject
addStateListener, addStateNotifiable, getError, getState, removeStateListener, removeStateNotifiable, waitForState, waitForState, waitForStateUninterruptibly
 

Constructor Detail

AbstractServerConnection

protected AbstractServerConnection()

Constructor for AbstractServerConnection.

Method Detail

getRemoteCertificateValidator

protected abstract CertificateValidator getRemoteCertificateValidator()
Remote Certificate Validator, invoked upon connect

Returns:
a CertificateValidator object.

sendAsymmSecureMessage

protected abstract int sendAsymmSecureMessage(AsyncWrite msg,
                                              SecurityConfiguration securityConfiguration,
                                              int secureChannelId,
                                              int requestNumber,
                                              AtomicInteger sendSequenceNumber)
                                       throws ServiceResultException

sendAsymmSecureMessage.

Parameters:
msg - a AsyncWrite object.
securityConfiguration - a SecurityConfiguration object.
secureChannelId - a int.
requestNumber - a int.
sendSequenceNumber - a AtomicInteger object.
Returns:
a int.
Throws:
ServiceResultException - if any.

sendSecureMessage

protected abstract void sendSecureMessage(AsyncWrite msg,
                                          SecurityToken token,
                                          int requestId,
                                          int messageType,
                                          AtomicInteger sendSequenceNumber)

sendSecureMessage.

Parameters:
msg - a AsyncWrite object.
token - a SecurityToken object.
requestId - a int.
messageType - a int.
sendSequenceNumber - a AtomicInteger object.

setError

protected void setError(UnsignedInteger errorCode)

setError.

Parameters:
errorCode - a UnsignedInteger object.

setError

protected void setError(StatusCode sc)

setError.

Parameters:
sc - a StatusCode object.

setError

protected void setError(ServiceResultException e)

setError.

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

onStateTransition

protected void onStateTransition(CloseableObjectState oldState,
                                 CloseableObjectState newState)
Override this.

Overrides:
onStateTransition in class AbstractState<CloseableObjectState,ServiceResultException>
Parameters:
oldState - a StateType object.
newState - a StateType object.

onListenerException

protected void onListenerException(RuntimeException rte)
Override this.

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

getSecureChannels

public void getSecureChannels(Collection<ServerSecureChannel> list)
Get all open and opening secure channels of this connection.

Specified by:
getSecureChannels in interface ServerConnection
Parameters:
list - list to be filled

addSecureChannelListener

public void addSecureChannelListener(ServerConnection.SecureChannelListener l)

addSecureChannelListener.

Specified by:
addSecureChannelListener in interface ServerConnection
Parameters:
l - a ServerConnection.SecureChannelListener object.

removeSecureChannelListener

public void removeSecureChannelListener(ServerConnection.SecureChannelListener l)

removeSecureChannelListener.

Specified by:
removeSecureChannelListener in interface ServerConnection
Parameters:
l - a ServerConnection.SecureChannelListener object.

fireSecureChannelAttached

protected void fireSecureChannelAttached(ServerSecureChannel c)
Send a notification to listeners that a secure channel has been attached to (opened in) the connection.

Parameters:
c - a ServerSecureChannel object.

fireSecureChannelDetached

protected void fireSecureChannelDetached(ServerSecureChannel c)
Send a notification the listeners that a secure channel has been detached from the connection.

Parameters:
c - a ServerSecureChannel object.

getConnectURL

public String getConnectURL()

getConnectURL.

Returns:
a String object.

getRemoteCertificate

public Certificate getRemoteCertificate()

getRemoteCertificate.

Returns:
a Certificate object.

addChannelListener

public void addChannelListener(Channel.ChannelListener listener)

addChannelListener.

Parameters:
listener - a Channel.ChannelListener object.

removeChannelListener

public void removeChannelListener(Channel.ChannelListener listener)

removeChannelListener.

Parameters:
listener - a Channel.ChannelListener object.

addConnectionListener

public void addConnectionListener(IConnectionListener listener)
Add response listener

Specified by:
addConnectionListener in interface ServerConnection
Parameters:
listener - a IConnectionListener object.

removeConnectionListener

public void removeConnectionListener(IConnectionListener listener)
Add response listener

Specified by:
removeConnectionListener in interface ServerConnection
Parameters:
listener - a IConnectionListener object.

toString

public String toString()

Overrides:
toString in class Object

close

public CloseableObject close()

close.

Specified by:
close in interface CloseableObject
Returns:
a CloseableObject object.


Copyright © 2018. All rights reserved.