com.prosysopc.ua.server.io
Class IoManagerListenerChainImpl

java.lang.Object
  extended by com.prosysopc.ua.server.io.IoManagerListenerChainImpl
All Implemented Interfaces:
IoManagerListener, IoManagerListenerChain

public class IoManagerListenerChainImpl
extends Object
implements IoManagerListenerChain

Straightforward implementation of IoManagerListenerChain. Keeps an ordered list of IoManagerListeners. When a method is called, the call is delegated to the listeners sequentially until it is handled by a listener.


Constructor Summary
IoManagerListenerChainImpl()
           
 
Method Summary
 void addListeners(IoManagerListener... listeners)
          Add given listeners to the front of the chain.
 EnumSet<org.opcfoundation.ua.core.AccessLevel> onGetUserAccessLevel(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaVariable node)
          Notification of a read request for user access level attribute of a node.
 Boolean onGetUserExecutable(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaMethod node)
          Notification of a read request for user executable attribute of a node.
 EnumSet<WriteAccess> onGetUserWriteMask(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaNode node)
          Notification of a read request for user write mask attribute of a node.
 boolean onReadNonValue(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaNode node, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.builtintypes.DataValue dataValue)
          Notification of a read request for a node attribute, except for the Value attribute of a variable node (which goes to onReadValue).
 boolean onReadValue(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaValueNode node, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime minTimestamp, org.opcfoundation.ua.builtintypes.DataValue dataValue)
          Notification of a read request for the Value attribute of a Variable node.
 boolean onWriteNonValue(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaNode node, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.builtintypes.DataValue dataValue)
          Notification of a write request for the value of a single node attribute, except for the Value of a variable node.
 boolean onWriteValue(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaValueNode node, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.builtintypes.DataValue dataValue)
          Notification of a write request for the Value attribute of a Variable node.
 void removeListeners(IoManagerListener... listeners)
          Remove given listeners from the chain.
 void setListeners(IoManagerListener... listeners)
          Set all the listeners in the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoManagerListenerChainImpl

public IoManagerListenerChainImpl()
Method Detail

addListeners

public void addListeners(IoManagerListener... listeners)
Description copied from interface: IoManagerListenerChain
Add given listeners to the front of the chain.

Specified by:
addListeners in interface IoManagerListenerChain

onGetUserAccessLevel

public EnumSet<org.opcfoundation.ua.core.AccessLevel> onGetUserAccessLevel(ServiceContext serviceContext,
                                                                           org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                           UaVariable node)
Description copied from interface: IoManagerListener
Notification of a read request for user access level attribute of a node.

You can use the notification to provide the value.

Specified by:
onGetUserAccessLevel in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to read.
node - The node object to read. If the node is not available this may be null.
Returns:
the user access level of the node, or null if the event is not handled by the listener.

onGetUserExecutable

public Boolean onGetUserExecutable(ServiceContext serviceContext,
                                   org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                   UaMethod node)
Description copied from interface: IoManagerListener
Notification of a read request for user executable attribute of a node.

You can use the notification to provide the value.

Specified by:
onGetUserExecutable in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to read.
node - The node object to read. If the node is not available this may be null.
Returns:
the user executable attribute of the node, or null if the event is not handled by the listener.

onGetUserWriteMask

public EnumSet<WriteAccess> onGetUserWriteMask(ServiceContext serviceContext,
                                               org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                               UaNode node)
Description copied from interface: IoManagerListener
Notification of a read request for user write mask attribute of a node.

You can use the notification to provide the value.

Specified by:
onGetUserWriteMask in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to read.
node - The node object to read. If the node is not available this may be null.
Returns:
the user write mask of the node, or null if the event is not handled by the listener.

onReadNonValue

public boolean onReadNonValue(ServiceContext serviceContext,
                              org.opcfoundation.ua.builtintypes.NodeId nodeId,
                              UaNode node,
                              org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                              org.opcfoundation.ua.builtintypes.DataValue dataValue)
                       throws StatusException
Description copied from interface: IoManagerListener
Notification of a read request for a node attribute, except for the Value attribute of a variable node (which goes to onReadValue).

The notification is sent after the value is read from the node or other data source, depending on the actual IoManager.

You can use the notification to provide the value, modify the value being returned or even cancel the request.

Specified by:
onReadNonValue in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to read.
node - The node object to read. If the node is not available this may be null.
attributeId - The attribute to read.
dataValue - The data value being returned.
Returns:
true if the request was handled by the listener.
Throws:
StatusException - Throw the exception to cancel the request, for example due to insufficient user rights. Possible result codes: Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_NotReadable, Bad_UserAccessDenied

onReadValue

public boolean onReadValue(ServiceContext serviceContext,
                           org.opcfoundation.ua.builtintypes.NodeId nodeId,
                           UaValueNode node,
                           org.opcfoundation.ua.utils.NumericRange indexRange,
                           org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                           org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
                           org.opcfoundation.ua.builtintypes.DataValue dataValue)
                    throws StatusException
Description copied from interface: IoManagerListener
Notification of a read request for the Value attribute of a Variable node.

Specified by:
onReadValue in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to read.
node - The node object to read. If the node is not available this may be null.
indexRange - The requested index range for an array value. May be null.
timestampsToReturn - Which timestamps were requested by the client.
minTimestamp - Minimum value of the ServerTimestamp of the value to be read. If there is no value available that is new enough already available (in the server cache), the server should attempt to read a new value from the actual data source, instead of using the cached value. If a new value cannot be read, the best value available is returned. If minTimestamp == DateTime.MAX_VALUE a new value should be read from the source.
dataValue - The data value to return. Set Value, and for Value attribute also StatusCode and the Timestamps.
Returns:
true if the request was handled by the listener.
Throws:
StatusException - Throw the exception to cancel the request, for example due to insufficient user rights. Possible result codes: Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_NotReadable, Bad_UserAccessDenied

onWriteNonValue

public boolean onWriteNonValue(ServiceContext serviceContext,
                               org.opcfoundation.ua.builtintypes.NodeId nodeId,
                               UaNode node,
                               org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                               org.opcfoundation.ua.builtintypes.DataValue dataValue)
                        throws StatusException
Description copied from interface: IoManagerListener
Notification of a write request for the value of a single node attribute, except for the Value of a variable node.

The method is called before write actually takes place. So you can cancel the write, for example, if the user is not allowed to write to the attribute.

NOTE! Setting a bad StatusCode to the DataValue is not returned to the client, you must throw instead the StatusException.

Specified by:
onWriteNonValue in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to write.
node - The node object to write. If the node is not available this may be null.
attributeId - The attribute to write.
dataValue - The data value to write.
Returns:
true if the value was written to the source and you do not want any other operations to continue writing it - including it being written to the node (if you are using an IoManagerUaNode). If you return false, other listeners and the IoManager will get called with the write request.
Throws:
StatusException - If the write fails. Expected result codes: Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_DataEncodingInvalid, Bad_DataEncodingUnsupported, Bad_NotWriteable, Bad_UserAccessDenied, Bad_TypeMismatch

onWriteValue

public boolean onWriteValue(ServiceContext serviceContext,
                            org.opcfoundation.ua.builtintypes.NodeId nodeId,
                            UaValueNode node,
                            org.opcfoundation.ua.utils.NumericRange indexRange,
                            org.opcfoundation.ua.builtintypes.DataValue dataValue)
                     throws StatusException
Description copied from interface: IoManagerListener
Notification of a write request for the Value attribute of a Variable node.

The method is called before write actually takes place. So you can cancel the write, for example, if the user is not allowed to write to the value.

NOTE! Setting a bad StatusCode to the DataValue is not returned to the client, you must throw instead the StatusException.

Specified by:
onWriteValue in interface IoManagerListener
Parameters:
serviceContext - The serviceContext of the client connection used to call this service.
nodeId - The node to write.
node - The node object to write. If the node is not available this may be null.
indexRange - The index range to set for an array value. May be null.
dataValue - The data value to write.
Returns:
true if the value was written to the source and you do not want any other operations to continue writing it - including it being written to the node (if you are using an IoManagerUaNode). If you return false, other listeners and the IoManager will get called with the write request.
Throws:
StatusException - If the write fails. Expected result codes: Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_DataEncodingInvalid, Bad_DataEncodingUnsupported, Bad_NotWriteable, Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch, Bad_WriteNotSupported

removeListeners

public void removeListeners(IoManagerListener... listeners)
Description copied from interface: IoManagerListenerChain
Remove given listeners from the chain.

Specified by:
removeListeners in interface IoManagerListenerChain

setListeners

public void setListeners(IoManagerListener... listeners)
Description copied from interface: IoManagerListenerChain
Set all the listeners in the chain.

Specified by:
setListeners in interface IoManagerListenerChain


Copyright © 2018. All rights reserved.