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

java.lang.Object
  extended by org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder
All Implemented Interfaces:
InputMessage

public class SecureInputMessageBuilder
extends Object
implements InputMessage

SecureInputMessageBuilder deciphers and decodes chunks into messages.

Message is decoded and chunks are deciphered and validated in background threads. Deciphering is executed in StackUtils.getNonBlockerExecutor() which has one thread for each CPU core. Decoding is executed in StackUtils.getBlockerExecutor() which creates new threads as needed.


Nested Class Summary
static interface SecureInputMessageBuilder.MessageListener
           
 
Constructor Summary
SecureInputMessageBuilder(Object token, SecureInputMessageBuilder.MessageListener listener, TcpConnectionParameters ctx, EncoderContext encoderCtx, AtomicInteger expectedSequenceNumber)
          Create message builder.
 
Method Summary
 void addChunk(ByteBuffer chunk)
          addChunk.
 void close()
          close.
protected  void fireComplete()
          fireComplete.
 Exception getError()
          Getter for the field error.
 IEncodeable getMessage()
          getMessage.
 int getMessageType()
          Getter for the field messageType.
 byte[] getReceiverCertificateThumbprint()
          getReceiverCertificateThumbprint.
 int getRequestId()
          Getter for the field requestId.
 int getSecureChannelId()
          getSecureChannelId.
 String getSecurityPolicyUri()
          Getter for the field securityPolicyUri.
 byte[] getSenderCertificate()
          Getter for the field senderCertificate.
 List<Integer> getSequenceNumbers()
          Return sequence number of each chunk
 Object getToken()
          Get security token
protected  boolean hasError()
          hasError.
 boolean isDone()
          isDone.
 boolean moreChunksRequired()
          moreChunksRequired.
protected  void setError(Exception e)
          Setter for the field error.
protected  void setMessage(IEncodeable msg)
          setMessage.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecureInputMessageBuilder

public SecureInputMessageBuilder(Object token,
                                 SecureInputMessageBuilder.MessageListener listener,
                                 TcpConnectionParameters ctx,
                                 EncoderContext encoderCtx,
                                 AtomicInteger expectedSequenceNumber)
Create message builder. Message builder compiles inbound chunks into a message.

Parameters:
token - SecurityToken (symm) or SecurityConfiguration (asymm)
listener - a SecureInputMessageBuilder.MessageListener object.
ctx - a TcpConnectionParameters object.
expectedSequenceNumber - a AtomicInteger object.
encoderCtx - a EncoderContext object.
Method Detail

toString

public String toString()

Overrides:
toString in class Object

addChunk

public void addChunk(ByteBuffer chunk)
              throws ServiceResultException

addChunk.

Parameters:
chunk - a ByteBuffer object.
Throws:
ServiceResultException - if any.

fireComplete

protected void fireComplete()

fireComplete.


setError

protected void setError(Exception e)

Setter for the field error.

Parameters:
e - a Exception object.

setMessage

protected void setMessage(IEncodeable msg)

setMessage.

Parameters:
msg - a IEncodeable object.

getRequestId

public int getRequestId()

Getter for the field requestId.

Specified by:
getRequestId in interface InputMessage
Returns:
a int.

isDone

public boolean isDone()

isDone.

Returns:
a boolean.

moreChunksRequired

public boolean moreChunksRequired()

moreChunksRequired.

Returns:
a boolean.

close

public void close()

close.


getMessage

public IEncodeable getMessage()

getMessage.

Specified by:
getMessage in interface InputMessage
Returns:
a IEncodeable object.

getError

public Exception getError()

Getter for the field error.

Specified by:
getError in interface InputMessage
Returns:
a Exception object.

getMessageType

public int getMessageType()

Getter for the field messageType.

Specified by:
getMessageType in interface InputMessage
Returns:
a int.

getSecureChannelId

public int getSecureChannelId()

getSecureChannelId.

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

getSecurityPolicyUri

public String getSecurityPolicyUri()

Getter for the field securityPolicyUri.

Returns:
a String object.

getSenderCertificate

public byte[] getSenderCertificate()

Getter for the field senderCertificate.

Returns:
an array of byte.

getReceiverCertificateThumbprint

public byte[] getReceiverCertificateThumbprint()

getReceiverCertificateThumbprint.

Returns:
an array of byte.

getSequenceNumbers

public List<Integer> getSequenceNumbers()
Return sequence number of each chunk

Specified by:
getSequenceNumbers in interface InputMessage
Returns:
list of sequnce numbers

getToken

public Object getToken()
Get security token

Specified by:
getToken in interface InputMessage
Returns:
SecurityConfiguration if async message, SecurityToken is sync message

hasError

protected boolean hasError()

hasError.

Returns:
a boolean.


Copyright © 2018. All rights reserved.