com.prosysopc.ua.server.nodes
Class PlainInstanceVariable<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.InstanceVariable
              extended by com.prosysopc.ua.server.nodes.PlainInstanceVariable<T>
All Implemented Interfaces:
UaInstance, UaNode, UaValueNode, UaVariable
Direct Known Subclasses:
PlainInstanceProperty

public class PlainInstanceVariable<T>
extends InstanceVariable

A very plain, type specific implementation of InstanceVariable.

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.ServerNode
eventListeners, INITIALIZATION_TIME, nodeManager, supportedAttributesMap
 
Constructor Summary
PlainInstanceVariable(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.NodeId instanceDeclarationId)
          Create a new node, referring to an instance declaration node.
PlainInstanceVariable(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, UaVariable instanceDeclaration)
          Create a new node, referring to an instance declaration node.
 
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.
 
Methods inherited from class com.prosysopc.ua.server.nodes.InstanceVariable
addReference, beforeAddReference, deleteReference, getAccessLevel, getArrayDimensions, getAttributes, getBrowseName, getComponent, getComponents, getDataType, getDataTypeId, getDescription, getDisplayName, getHistorizing, getMethod, getMinimumSamplingInterval, getNodeClass, getNodeVersion, getProperties, getProperty, getPropertyTypeNode, getReference, getReferencesAsList, getTypeDefinition, getTypeDefinitionId, getTypeDefinitionReference, getUserAccessLevel, getUserWriteMask, getValueRank, getWriteMask, hasUserWriteAccess, hasWriteAccess, readAttribute, readAttribute, removeComponent, removeProperty, setAccessLevel, setArrayDimensions, setAttribute, setAttributes, setBrowseName, setDataType, setDataTypeId, setDescription, setDisplayName, setHistorizing, setMinimumSamplingInterval, setReferences, setTypeDefinition, setTypeDefinitionId, setTypeDefinitionId, setUserAccessLevel, setUserWriteMask, setValue, setValue, setValueRank, setWriteMask, writeAttribute
 
Methods inherited from class com.prosysopc.ua.server.nodes.ServerNode
addComponent, addDataChangeListener, addEventListener, addNewReference, addNewReference, addOrganizes, addProperties, addProperty, addReference, addReference, addReference, addReference, addReference, afterAddReference, afterDeleteReference, dataChange, deleteReference, deleteReference, deleteReference, deleteReferences, doAddProperty, doDeleteReference, equals, findPlaceholders, fireDataChange, fireEvent, fireEventInParents, getAddressSpace, getDefaultBrowseName, getNodeId, getNodeManager, getReferenceList, getReferences, getSupportedAttributes, getTargetNodes, hashCode, hasReference, initSupportedAttributes, isAddNotifierReferencesToServerObject, isFalseOrNull, isMandatory, isMonitoredForEvents, isTrueOrNull, isType, referenceTypeInherits, removeDataChangeListener, removeEventListener, setAddNotifierReferencesToServerObject, supportsAttribute, toString, translateBrowsePathToNodeIds, validateHasEventSourceChain, validateHasEventSourceChain, writeAttributeValue
 
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.UaNode
addComponent, addProperty, addReference, addReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getForwardReferences, getInverseReferences, getNodeId, getReferences, getReferences, getSupportedAttributes, supportsAttribute
 

Constructor Detail

PlainInstanceVariable

public PlainInstanceVariable(NodeManagerUaNode nodeManager,
                             org.opcfoundation.ua.builtintypes.NodeId nodeId,
                             org.opcfoundation.ua.builtintypes.NodeId instanceDeclarationId)
                      throws StatusException
Create a new node, referring to an instance declaration node.

Parameters:
nodeManager - The node manager to which the node is created.
nodeId - The ID of the new node.
instanceDeclarationId - The ID of the instance declaration node, which this node is referring to. I.e. the same variable or property as this one, but under the type, instead of the instance.
Throws:
StatusException - if instanceDeclarationId cannot be converted to a variable node

PlainInstanceVariable

public PlainInstanceVariable(NodeManagerUaNode nodeManager,
                             org.opcfoundation.ua.builtintypes.NodeId nodeId,
                             UaVariable instanceDeclaration)
Create a new node, referring to an instance declaration node.

Parameters:
nodeManager - The node manager to which the node is created.
nodeId - The ID of the new node.
instanceDeclaration - The instance declaration node, which this node is referring to. I.e. the same variable or property as this one, but under the type, instead of the instance.
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 InstanceVariable
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:
class of current value or null if current value is null

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 time 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: InstanceVariable
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 InstanceVariable
Parameters:
status - the status to set

doSetValue

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

Specified by:
doSetValue in class InstanceVariable
Throws:
StatusException


Copyright © 2018. All rights reserved.