|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.server.ServiceManagerBase
com.prosysopc.ua.server.IoManager
public class IoManager
A base class for IO Manager implementations. Use this as a base to your custom IO Manager, if you do not wish to use UaNodes. If you use UaNodes, you had normally better simply use the IoManagerUaNode or inherit from it.
The base implementation defines the default constructor which requires a NodeManager, which the IO Manager will use to find the nodes that the operations refer to.
By default the operations just call the respective methods in IoManagerListeners.
Node-specific listeners can be added with addNodeListener(org.opcfoundation.ua.builtintypes.NodeId, com.prosysopc.ua.server.io.UaNodeIoListener).
| Constructor Summary | |
|---|---|
IoManager(NodeManager nodeManager)
Default constructor. |
|
| Method Summary | |
|---|---|
void |
addListeners(IoManagerListener... listeners)
Add listeners to the IoManagerListenerChain. |
void |
addNodeListener(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNodeIoListener listener)
Add UaNodeIoListener to the NodeIoManagerListener. |
static void |
applyIndexRangeToReadValue(org.opcfoundation.ua.builtintypes.DataValue dataValue,
org.opcfoundation.ua.utils.NumericRange indexRange)
"Cuts" the specified indexRange out of the provided dataValue. |
protected static Object |
applyIndexRangeToReadValue(Object value,
org.opcfoundation.ua.utils.NumericRange indexRange,
int d)
|
static org.opcfoundation.ua.builtintypes.DataValue |
applyIndexRangeToWriteValue(org.opcfoundation.ua.builtintypes.DataValue currentValue,
org.opcfoundation.ua.builtintypes.DataValue newValue,
org.opcfoundation.ua.utils.NumericRange indexRange)
Writes the newValue to currentValue in the location specified by the indexRange. |
org.opcfoundation.ua.builtintypes.Variant |
autoConvert(org.opcfoundation.ua.builtintypes.Variant v,
org.opcfoundation.ua.builtintypes.NodeId dataTypeId)
Method for converting UA ByteString DataType to Java UnsignedByte[] type. |
protected Object |
beginRead(ServiceContext serviceContext,
org.opcfoundation.ua.core.ReadValueId[] nodesToRead,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
Called to notify that a Read is beginning. |
protected Object |
beginWrite(ServiceContext serviceContext,
org.opcfoundation.ua.core.WriteValue[] nodesToWrite,
org.opcfoundation.ua.builtintypes.StatusCode[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
Called to notify that a Write is beginning. |
protected void |
checkAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable variable,
org.opcfoundation.ua.core.AccessLevel accessLevel)
Validate that the node enables access for a certain accessLevel. |
protected void |
checkDataType(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
|
protected static void |
checkIndexRange(Object value,
org.opcfoundation.ua.utils.NumericRange indexRange,
int dimension)
|
protected void |
checkSupportsAttribute(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
|
protected void |
checkWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
|
protected void |
endRead(ServiceContext serviceContext,
Object object,
org.opcfoundation.ua.core.ReadValueId[] nodesToRead,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
Called to notify the end of a Read. |
protected void |
endWrite(ServiceContext serviceContext,
Object object,
org.opcfoundation.ua.core.WriteValue[] nodesToWrite,
org.opcfoundation.ua.builtintypes.StatusCode[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
Called to notify the end of a Write. |
protected EnumSet<org.opcfoundation.ua.core.AccessLevel> |
getAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable variable)
|
IoManagerListener |
getDefaultListener()
Get the default IoManagerListener. |
protected boolean |
getExecutable(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaMethod node)
|
IoManagerListener |
getNodeListener()
Get NodeIoManagerListener. |
NodeManager |
getNodeManager()
|
protected EnumSet<org.opcfoundation.ua.core.AccessLevel> |
getUserAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable node)
|
protected boolean |
getUserExecutable(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaMethod node)
|
protected EnumSet<WriteAccess> |
getUserWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node)
|
protected org.opcfoundation.ua.builtintypes.NodeId |
getVariableDataType(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode)
|
protected EnumSet<WriteAccess> |
getWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node)
|
protected void |
initializeMonitoredDataItem(ServiceContext serviceContext,
MonitoredDataItem monitoredItem,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Get the initial value for a new MonitoredDataItem. |
org.opcfoundation.ua.builtintypes.DataValue |
readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp)
Read attribute directly from this IoManager |
protected void |
readAttribute(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Read the value of a single node attribute. |
protected void |
readNonValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Read the value of a node attribute, except for the Value of a variable node. |
protected void |
readValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode variable,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Read the Value attribute of a Variable node. |
void |
removeListeners(IoManagerListener... listeners)
Remove given listeners from the IoManagerListenerChain. |
void |
setListeners(IoManagerListener... listeners)
Set the listeners of the IoManagerListenerChain. |
protected static void |
validateIndexRange(int dim,
int length,
org.opcfoundation.ua.utils.NumericRange indexRange)
|
void |
writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Write the value of a single node attribute. |
protected boolean |
writeAttribute(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Write the value of a single node attribute. |
protected boolean |
writeNonValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Write the value of a single node attribute, except for the Value of a variable node. |
protected boolean |
writeValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Write the Value attribute of a Variable node. |
| Methods inherited from class com.prosysopc.ua.server.ServiceManagerBase |
|---|
arrayDimensionsMatch, checkIsMethod, checkIsValueNode, checkIsVariable, checkIsVariableOrVariableType, dataTypeEquals, getNode, getNode, getNode, getNode, getNodeManagerTable, getServer, getSubscriptionManager, isValueNode, isVariable, listenerError, requireUaNode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IoManager(NodeManager nodeManager)
nodeManager - the NodeManager to which this IO Manager is attached to.| Method Detail |
|---|
public static void applyIndexRangeToReadValue(org.opcfoundation.ua.builtintypes.DataValue dataValue,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws StatusException
dataValue - the original value, which is modified by the method, unless the status is bad,
in which case the range is ignoredindexRange - the index range to cut out of the value: if null or empty, the method will
not modify the value
StatusException - Bad_IndexRangeNoData, if the index range cannot be applied to the value
public static org.opcfoundation.ua.builtintypes.DataValue applyIndexRangeToWriteValue(org.opcfoundation.ua.builtintypes.DataValue currentValue,
org.opcfoundation.ua.builtintypes.DataValue newValue,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws StatusException
currentValue - the current value to modify.newValue - the new value to write: if not a string or array, the method will return the
value unmodifiedindexRange - the range where to write the newValue: if null or empty, the method will
return the value unmodified
StatusException - Bad_IndexRangeNoData if the range cannot be applied to currentValue
protected static Object applyIndexRangeToReadValue(Object value,
org.opcfoundation.ua.utils.NumericRange indexRange,
int d)
throws StatusException
StatusException
protected static void checkIndexRange(Object value,
org.opcfoundation.ua.utils.NumericRange indexRange,
int dimension)
throws StatusException
StatusException
protected static void validateIndexRange(int dim,
int length,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws StatusException
StatusExceptionpublic void addListeners(IoManagerListener... listeners)
IoManagerListenerChain.
public void addNodeListener(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNodeIoListener listener)
UaNodeIoListener to the NodeIoManagerListener.
public final org.opcfoundation.ua.builtintypes.Variant autoConvert(org.opcfoundation.ua.builtintypes.Variant v,
org.opcfoundation.ua.builtintypes.NodeId dataTypeId)
dv - dataTypeId -
public IoManagerListener getDefaultListener()
IoManagerListener. This should be the last listener in the
IoManagerListenerChain to provide default return values.
public IoManagerListener getNodeListener()
NodeIoManagerListener.
public NodeManager getNodeManager()
public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp)
throws StatusException
nodeId - The node to read.attributeId - The attribute to read.indexRange - The requested index range for an array value. May be null.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.
StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_NotReadable, Bad_UserAccessDeniedpublic void removeListeners(IoManagerListener... listeners)
IoManagerListenerChain.
public void setListeners(IoManagerListener... listeners)
IoManagerListenerChain. Typically the last one is the default
getDefaultListener(). Node-specific listener getNodeListener() and
type-specific listener IoManagerUaNode.getTypeListener() can be used too.
public void writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
nodeId - The node to write.attributeId - The attribute to write.indexRange - The index range to set for an array value. May be null.dataValue - The data value to write.
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
protected Object beginRead(ServiceContext serviceContext,
org.opcfoundation.ua.core.ReadValueId[] nodesToRead,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
throws ServiceException
readValue(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.builtintypes.NodeId, com.prosysopc.ua.nodes.UaValueNode, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue) and
readNonValue(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.builtintypes.NodeId, com.prosysopc.ua.nodes.UaNode, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.builtintypes.DataValue) handlers. Alternatively, you may define all the results here.
If you return a result object, it will be provided in endRead(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.core.ReadValueId[], org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[]), where you can dispose
it.
serviceContext - the client service call contextnodesToRead - the nodes to be read. Note: The call may contain read requests for
several node managers, so if you handle the nodes here, check the namespace of the
requested items.timestampsToReturn - defines whether Server, Source or Both timestamps should be returned
with every value. Neither is not a valid value (checked already before calling the
method)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.results - the array of results, which you may fill here or later in the specific read
methodsdiagnosticInfos - possible error diagnostics
ServiceException - if you need to return a service call error
protected Object beginWrite(ServiceContext serviceContext,
org.opcfoundation.ua.core.WriteValue[] nodesToWrite,
org.opcfoundation.ua.builtintypes.StatusCode[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
throws ServiceException
writeValue(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.builtintypes.NodeId, com.prosysopc.ua.nodes.UaValueNode, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.builtintypes.DataValue) and
writeNonValue(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.builtintypes.NodeId, com.prosysopc.ua.nodes.UaNode, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.builtintypes.DataValue) handlers. Alternatively, you may define all the results here and ignore
them in the specific methods.
If you return a result object, it will be provided in endWrite(com.prosysopc.ua.server.ServiceContext, java.lang.Object, org.opcfoundation.ua.core.WriteValue[], org.opcfoundation.ua.builtintypes.StatusCode[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[]), where you can dispose
it.
serviceContext - the client service call contextnodesToWrite - the nodes to be read. Note: The call may contain read requests for
several node managers, so if you handle the nodes here, check the namespace of the
requested items.results - the array of results, which you may fill here or later in the specific write
methodsdiagnosticInfos - possible error diagnostics
ServiceException - if you need to return a service call error
protected void checkAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable variable,
org.opcfoundation.ua.core.AccessLevel accessLevel)
throws StatusException
serviceContext - nodeId - variable - accessLevel -
StatusException
protected void checkDataType(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
nodeId - valueNode - dataValue -
StatusException
protected void checkSupportsAttribute(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
throws StatusException
serviceContext - nodeId - node - attributeId -
StatusException
protected void checkWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
throws StatusException
serviceContext - operationContext - nodeId - node -
StatusException
protected void endRead(ServiceContext serviceContext,
Object object,
org.opcfoundation.ua.core.ReadValueId[] nodesToRead,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.builtintypes.DateTime minTimestamp,
org.opcfoundation.ua.builtintypes.DataValue[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
throws ServiceException
beginRead(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.ReadValueId[], org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])
here.
serviceContext - the client service call contextnodesToRead - the nodes to be readtimestampsToReturn - defines whether Server, Source or Both timestamps should be returned
with every value. Neither is not a valid value (checked already before calling the
method)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.results - the array of resultsdiagnosticInfos - possible error diagnostics
ServiceException - if you need to return a service call error
protected void endWrite(ServiceContext serviceContext,
Object object,
org.opcfoundation.ua.core.WriteValue[] nodesToWrite,
org.opcfoundation.ua.builtintypes.StatusCode[] results,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] diagnosticInfos)
throws ServiceException
beginWrite(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.WriteValue[], org.opcfoundation.ua.builtintypes.StatusCode[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[]) here.
serviceContext - the client service call contextnodesToWrite - the nodes to be writtenresults - the array of resultsdiagnosticInfos - possible error diagnostics
ServiceException - if you need to return a service call error
protected EnumSet<org.opcfoundation.ua.core.AccessLevel> getAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable variable)
throws StatusException
variable - nodeId - serviceContext - operationContext -
StatusException
protected boolean getExecutable(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaMethod node)
throws StatusException
serviceContext - operationContext - nodeId - node -
StatusException
protected EnumSet<org.opcfoundation.ua.core.AccessLevel> getUserAccessLevel(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable node)
serviceContext - operationContext - nodeId - node -
protected boolean getUserExecutable(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaMethod node)
serviceContext - operationContext - nodeId - node -
protected EnumSet<WriteAccess> getUserWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node)
serviceContext - operationContext - nodeId - node -
protected org.opcfoundation.ua.builtintypes.NodeId getVariableDataType(org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode)
throws StatusException
nodeId - valueNode - valueNode -
StatusException
protected EnumSet<WriteAccess> getWriteMask(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node)
throws StatusException
serviceContext - operationContext - nodeId - node -
StatusException
protected void initializeMonitoredDataItem(ServiceContext serviceContext,
MonitoredDataItem monitoredItem,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
The initial value is required for CreateMonitoredItem, ModifyMonitoredItem or TransferSubscription.
serviceContext - The serviceContext of the client connection used to call the
CreateMonitoredItem, ModifyMonitoredItem or TransferSubscription service that initiates
the call. Note that the RequestHeader part of the ServiceContext may be set to null in
the object.monitoredItem - The new monitoredItem that needs the initial valuedataValue - The value that should be initialized to the initial value of the item. The
value is by default Bad_WaitingForInitialData, unless changed here.
StatusException - If the value is not available or may not be read due to access level
restrictions, for example.
protected void readAttribute(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
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
If the Value attribute is to be read, the method uses
#checkAccessLevel(ServiceContext, NodeId, UaVariable, AccessLevel) to validate that the
user has read access to the value. If the read is acceptable, it will call
#readValue(ServiceContext, NodeId, UaVariable, NumericRange, TimestampsToReturn, DateTime, DataValue)
to do the read and finally, it will trigger the onRead event in the listener.
For other attributes,
#readNonValue(ServiceContext, NodeId, UaNode, UnsignedInteger, DataValue) is used to
read the attribute value, except for the User-attributes for which
#getUserAccessLevel(ServiceContext, NodeId, UaVariable),
#getUserExecutable(ServiceContext, NodeId, UaMethod) or
#getUserWriteMask(ServiceContext, NodeId, UaNode) are used, respectively, to define the
correct value. By default, these methods just ask the value from the listener.
Typically, you will just need to override readValue and readNonValue to create your custom
IoManager. If you use IoManagerUaNode, it will simply read the attributes from the node
objects, by default.
serviceContext - The serviceContext of the client connection used to call this service.operationContext - the possible operationContext prepared in beginRead(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.ReadValueId[], org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])nodeId - The node to read.attributeId - The attribute to read.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.
StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_NotReadable, Bad_UserAccessDenied
protected void readNonValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
serviceContext - The serviceContext of the client connection used to call this service.operationContext - the possible operationContext prepared in beginRead(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.ReadValueId[], org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])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 to return. You only need to set Value of the DataValue.
StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_NotReadable, Bad_UserAccessDenied
protected void readValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode variable,
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
serviceContext - The serviceContext of the client connection used to call this service.operationContext - the possible operationContext prepared in beginRead(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.ReadValueId[], org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DataValue[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])nodeId - The node to read.variable - 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.
StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_NotReadable,
Bad_UserAccessDenied
protected boolean writeAttribute(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
The method uses #checkAccessLevel(ServiceContext, NodeId, UaVariable, AccessLevel) ,
checkSupportsAttribute(ServiceContext, NodeId, UaNode, UnsignedInteger) and
#checkWriteMask(ServiceContext, NodeId, UaNode, UnsignedInteger) methods to validate if
write is accepted. Override these methods, instead of this method, to provide your custom
checks.
If write is acceptable, it will also notify the listener about the write. Unless the listener
cancels the write, it will finally call
#writeValue(ServiceContext, NodeId, UaVariable, NumericRange, DataValue) or
#writeNonValue(ServiceContext, NodeId, UaNode, UnsignedInteger, DataValue) to do the
actual write. The default implementation does nothing, so you must override that. Or if you are
actually using IoManagerUaNode, it will write the attribute value to a UaNode
object.
serviceContext - The serviceContext of the client connection used to call this service.operationContext - the possible operationContext prepared in beginWrite(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.WriteValue[], org.opcfoundation.ua.builtintypes.StatusCode[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])nodeId - The node to write.attributeId - The attribute to write.indexRange - The index range to set for an array value. May be null.dataValue - The data value to write.
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
protected boolean writeNonValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaNode node,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
serviceContext - The serviceContext of the client connection used to call this service.operationContext - 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.
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
protected boolean writeValue(ServiceContext serviceContext,
Object operationContext,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaValueNode valueNode,
org.opcfoundation.ua.utils.NumericRange indexRange,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
serviceContext - The serviceContext of the client connection used to call this service.operationContext - the possible operationContext prepared in beginWrite(com.prosysopc.ua.server.ServiceContext, org.opcfoundation.ua.core.WriteValue[], org.opcfoundation.ua.builtintypes.StatusCode[], org.opcfoundation.ua.builtintypes.DiagnosticInfo[])nodeId - The node to write.valueNode - 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.
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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||