com.prosysopc.ua.server.nodes
Class PlainVariable<T>

java.lang.Object
  extended by com.prosysopc.ua.nodes.AbstractUaNode
      extended by com.prosysopc.ua.server.nodes.ServerNode
          extended by com.prosysopc.ua.server.nodes.BaseNode
              extended by com.prosysopc.ua.server.nodes.UaInstanceNode
                  extended by com.prosysopc.ua.server.nodes.UaVariableNode
                      extended by com.prosysopc.ua.server.nodes.PlainVariable<T>
All Implemented Interfaces:
UaInstance, UaNode, UaValueNode, UaVariable
Direct Known Subclasses:
PlainProperty

public class PlainVariable<T>
extends UaVariableNode

A very plain, type specific implementation of the UA variable node.

This is a generic type, which adds a strongly typed field for the CurrentValue of the property. It also reserves separate fields for status, serverTimestamp and sourceTimestamp.


Field Summary
 
Fields inherited from class com.prosysopc.ua.server.nodes.BaseNode
NODE_VERSION_PROPERTY_NAME
 
Fields inherited from class com.prosysopc.ua.server.nodes.ServerNode
eventListeners, INITIALIZATION_TIME, nodeManager, supportedAttributesMap
 
Constructor Summary
PlainVariable(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName)
           
PlainVariable(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale)
           
 
Method Summary
protected  void doSetValue(org.opcfoundation.ua.builtintypes.DataValue value)
          Perform the actual value set.
 T getCurrentValue()
           
 org.opcfoundation.ua.builtintypes.DateTime getServerTimestamp()
           
 org.opcfoundation.ua.builtintypes.DateTime getSourceTimestamp()
           
 org.opcfoundation.ua.builtintypes.StatusCode getStatus()
           
 org.opcfoundation.ua.builtintypes.DataValue getValue()
           
 Class<?> getValueClass()
           
 boolean setCurrentValue(T currentValue)
          Set the current value with the current time as sourceTimestamp assuming a good status (unless null value is given).
 boolean setCurrentValue(T newValue, org.opcfoundation.ua.builtintypes.DateTime sourceTimestamp)
          Set the current value with a specific sourceTimestamp assuming a good status (unless null value is given).
 boolean setCurrentValue(T newValue, org.opcfoundation.ua.builtintypes.StatusCode status, org.opcfoundation.ua.builtintypes.DateTime sourceTimestamp, org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
          Set the currentValue together with a specific Status and sourceTimestamp.
 void setStatus(org.opcfoundation.ua.builtintypes.StatusCode status)
          Set the status of the variable.
protected  void updateValue(Object newValue, org.opcfoundation.ua.builtintypes.StatusCode status, org.opcfoundation.ua.builtintypes.DateTime sourceTime, org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
          Update the current value and status.
 
Methods inherited from class com.prosysopc.ua.server.nodes.UaVariableNode
addProperty, addReflectiveVariable, beforeAddReference, checkPropertyType, checkPropertyType, createDataValue, exposeStructureWithReflectiveVariables, getAccessLevel, getArrayDimensions, getAttributes, getAttributes, getDataType, getDataTypeId, getDefaultTypeDefinition, getHistorizing, getMinimumSamplingInterval, getNodeClass, getProperties, getUserAccessLevel, getValueRank, hasUserWriteAccess, hasWriteAccess, initSupportedAttributes, isPropertyType, notifyValueChanging, notifyValueChanging, readAttributeValue, semanticsChanged, setAccessLevel, setArrayDimensions, setAttributes, setDataType, setDataTypeId, setHistorizing, setMinimumSamplingInterval, setTypeDefinition, setTypeDefinitionId, setUserAccessLevel, setValue, setValue, setValueRank, structureChanged, toString, updateValue, writeAttributeValue
 
Methods inherited from class com.prosysopc.ua.server.nodes.UaInstanceNode
addModellingRule, getTypeDefinition, getTypeDefinitionId, hasTypeDefinition, registerOverridePlainMethod, setTypeDefinitionId, supportsTypeDefinitionNode
 
Methods inherited from class com.prosysopc.ua.server.nodes.BaseNode
addPlainProperty, addPlainVariable, assertTypeSupport, assertTypeSupport, createNodeId, createNodeId, createReflectiveInstanceProperty, createReflectiveInstanceProperty, deleteReference, deleteReference, doAddProperty, getAttributes, getBrowseName, getComponent, getComponents, getDescription, getDescription, getDisplayName, getDisplayName, getMethod, getNodeVersion, getNodeVersionValue, getProperty, getPropertyValue, getReferencesAsList, getStandardBrowseName, getStandardDisplayText, getUserWriteMask, getWriteMask, hasProperty, hasReference, incNodeVersion, initNodeVersion, isChildOfType, readAttribute, readAttribute, registerCallbackProperty, registerPlainInstanceProperty, registerPlainInstanceProperty, registerPlainProperty, registerPlainProperty, registerPlainVariable, registerPlainVariable, registerReflectiveInstanceProperty, registerReflectiveInstanceVariable, registerReflectiveProperty, registerReflectiveVariable, removeProperty, setAccessLevelRecursively, setAccessLevelRecursively, setAttribute, setBrowseName, setDescription, setDisplayName, setNodeVersionValue, setPropertyValue, setUserWriteMask, setWriteMask, writeAttribute
 
Methods inherited from class com.prosysopc.ua.server.nodes.ServerNode
addComponent, addDataChangeListener, addEventListener, addNewReference, addNewReference, addOrganizes, addProperties, addReference, addReference, addReference, addReference, addReference, addReference, afterAddReference, afterDeleteReference, dataChange, deleteReference, deleteReference, deleteReferences, doDeleteReference, equals, findPlaceholders, fireDataChange, fireEvent, fireEventInParents, getAddressSpace, getDefaultBrowseName, getNodeId, getNodeManager, getReference, getReferenceList, getReferences, getSupportedAttributes, getTargetNodes, hashCode, isAddNotifierReferencesToServerObject, isFalseOrNull, isMandatory, isMonitoredForEvents, isTrueOrNull, isType, referenceTypeInherits, removeComponent, removeDataChangeListener, removeEventListener, setAddNotifierReferencesToServerObject, setReferences, supportsAttribute, translateBrowsePathToNodeIds, validateHasEventSourceChain, validateHasEventSourceChain
 
Methods inherited from class com.prosysopc.ua.nodes.AbstractUaNode
getForwardReferences, getInverseReferences, getReferences, getReferences, referenceTypeInherits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.prosysopc.ua.nodes.UaVariable
addDataChangeListener, removeDataChangeListener
 
Methods inherited from interface com.prosysopc.ua.nodes.UaInstance
getTypeDefinition, getTypeDefinitionId, setTypeDefinitionId
 
Methods inherited from interface com.prosysopc.ua.nodes.UaNode
addComponent, addReference, addReference, addReference, deleteReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getBrowseName, getComponent, getComponents, getDescription, getDisplayName, getForwardReferences, getInverseReferences, getMethod, getNodeId, getNodeVersion, getProperty, getReference, getReferences, getReferences, getSupportedAttributes, getUserWriteMask, getWriteMask, readAttribute, readAttribute, removeComponent, removeProperty, setAttribute, setBrowseName, setDescription, setDisplayName, setReferences, setUserWriteMask, setWriteMask, supportsAttribute, writeAttribute
 

Constructor Detail

PlainVariable

public PlainVariable(NodeManagerUaNode nodeManager,
                     org.opcfoundation.ua.builtintypes.NodeId nodeId,
                     org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                     org.opcfoundation.ua.builtintypes.LocalizedText displayName)
Parameters:
nodeManager -
nodeId -
browseName -
displayName -

PlainVariable

public PlainVariable(NodeManagerUaNode nodeManager,
                     org.opcfoundation.ua.builtintypes.NodeId nodeId,
                     String name,
                     Locale locale)
Parameters:
nodeManager -
nodeId -
name -
locale -
Method Detail

getCurrentValue

public final T getCurrentValue()
Returns:
the currentValue

getServerTimestamp

public org.opcfoundation.ua.builtintypes.DateTime getServerTimestamp()
Returns:
the serverTimestamp

getSourceTimestamp

public org.opcfoundation.ua.builtintypes.DateTime getSourceTimestamp()
Returns:
the sourceTimestamp

getStatus

public org.opcfoundation.ua.builtintypes.StatusCode getStatus()
Overrides:
getStatus in class UaVariableNode
Returns:
the status

getValue

public org.opcfoundation.ua.builtintypes.DataValue getValue()
Returns:
The default Value for instances of this type.

getValueClass

public Class<?> getValueClass()
Returns:

setCurrentValue

public boolean setCurrentValue(T currentValue)
Set the current value with the current time as sourceTimestamp assuming a good status (unless null value is given). Also omit the picosecond accuracy of the timestamp.

Parameters:
currentValue - the currentValue to set
Returns:
true if the value is changing, false if the CurrentValue equals to newValue

setCurrentValue

public boolean setCurrentValue(T newValue,
                               org.opcfoundation.ua.builtintypes.DateTime sourceTimestamp)
Set the current value with a specific sourceTimestamp assuming a good status (unless null value is given). Also omit the picosecond accuracy of the timestamp.

Parameters:
newValue - the new value to set. If this is null, status will be set to BAD, otherwise it is set to GOOD.
sourceTimestamp - the tie when the value was measured in the actual source, if known. Leave to null if the time is not available.
Returns:
true if the value is changing, false if the CurrentValue equals to newValue

setCurrentValue

public boolean setCurrentValue(T newValue,
                               org.opcfoundation.ua.builtintypes.StatusCode status,
                               org.opcfoundation.ua.builtintypes.DateTime sourceTimestamp,
                               org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
Set the currentValue together with a specific Status and sourceTimestamp.

Parameters:
newValue - the currentValue to set
status - the status to set
sourceTimestamp - the time when the value was measured in the source
sourcePicoseconds - optional picosecond accuracy of the timestamp
Returns:
true if the value is changing, false if the CurrentValue equals to newValue

setStatus

public void setStatus(org.opcfoundation.ua.builtintypes.StatusCode status)
Description copied from class: UaVariableNode
Set the status of the variable. If Status is a Bad status, Value is set to null.

The sourceTimestamp is set to null, and serverTimestamp is set to the current time.

Overrides:
setStatus in class UaVariableNode
Parameters:
status - the status to set

doSetValue

protected void doSetValue(org.opcfoundation.ua.builtintypes.DataValue value)
                   throws StatusException
Description copied from class: UaVariableNode
Perform the actual value set.

Specified by:
doSetValue in class UaVariableNode
Throws:
StatusException

updateValue

protected void updateValue(Object newValue,
                           org.opcfoundation.ua.builtintypes.StatusCode status,
                           org.opcfoundation.ua.builtintypes.DateTime sourceTime,
                           org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
                    throws StatusException
Description copied from class: UaVariableNode
Update the current value and status. Server timestamp is set to the current time.

Overrides:
updateValue in class UaVariableNode
Parameters:
newValue - The new value for the variable. This should be of the correct DataType or a Variant. Or it can be a DataValue, in which case, it is copied to value with a new timestamp.
status - The new status for the variable.
Throws:
StatusException - if newValue is not valid for the variable


Copyright © 2018. All rights reserved.