public abstract class InstanceVariable extends ServerNode implements UaVariable
The variable will fetch most of the attribute values from the InstanceDeclaration, and only keeps the current value in an internal field. This helps to reduce memory consumption over 90% compared to the "heavy-weight" variables, such as CacheVariable.
The InstanceVariables are used in the complex type nodes, such as the Condition nodes and Data Access nodes, which are implementing the structures of OPC UA standard types.
InstanceVariable is an abstract base class: see the subclasses, CallbackInstanceVariable
and PlainInstanceVariable for actual implementations.
UaNode.ParameterseventListeners, INITIALIZATION_TIME, nodeManager, supportedAttributesMap| Constructor and Description |
|---|
InstanceVariable(NodeManagerUaNode nodeManager,
NodeId nodeId,
NodeId instanceDeclarationId)
Create a new node, referring to an instance declaration node.
|
InstanceVariable(NodeManagerUaNode nodeManager,
NodeId nodeId,
UaVariable instanceDeclaration)
Create a new node, referring to an instance declaration node.
|
| Modifier and Type | Method and Description |
|---|---|
UaReference |
addReference(UaNode targetNode,
NodeId referenceTypeId,
boolean isInverse)
Add a reference to the node.
|
protected boolean |
beforeAddReference(UaReference reference) |
UaReference |
deleteReference(ExpandedNodeId targetNodeId,
NodeId referenceTypeId,
boolean isInverse)
Delete a reference from the node.
|
protected abstract void |
doSetValue(DataValue value)
Perform the actual value set.
|
AccessLevelType |
getAccessLevel()
Defines the global read/write access of the Value attribute for all users.
|
UnsignedInteger[] |
getArrayDimensions()
This Attribute specifies the length of each dimension for an array value.
|
NodeAttributes |
getAttributes()
Returns the current attribute values of the node in a NodeAttributes structure.
|
Map<UnsignedInteger,Object> |
getAttributesMap()
Returns an unmodifiable
Map containing the Attributes of the node. |
QualifiedName |
getBrowseName()
Nodes have a BrowseName Attribute that is used as a non-localised human-readable name when
browsing the AddressSpace to create paths out of BrowseNames.
|
UaNode |
getComponent(QualifiedName componentName)
Get the component, which has the specified name.
|
UaNode[] |
getComponents()
Get a list of components of this node, i.e.
|
UaDataType |
getDataType() |
NodeId |
getDataTypeId() |
LocalizedText |
getDescription()
The optional Description Attribute shall explain the meaning of the Node in a localized text
using the same mechanisms for localization as described for the DisplayName.
|
LocalizedText |
getDisplayName()
The DisplayName Attribute contains the localised name of the Node.
|
Boolean |
getHistorizing() |
UaMethod |
getMethod(QualifiedName methodName)
Get the method, which has the specified name.
|
Double |
getMinimumSamplingInterval() |
NodeClass |
getNodeClass()
The NodeClass Attribute identifies the NodeClass of a Node.
|
UaProperty |
getNodeVersionNode()
Returns the NodeVersion property.
|
UaProperty[] |
getProperties()
Returns all properties of the node or null if none defined.
|
UaProperty |
getProperty(QualifiedName name)
Find the property with the specified name.
|
protected UaType |
getPropertyTypeNode() |
UaReference |
getReference(NodeId referenceTypeId,
boolean isInverse)
Finds the first reference of the specified reference type.
|
protected List<UaReference> |
getReferencesAsList(Boolean isInverse,
NodeId... referenceTypeIds) |
StatusCode |
getStatus() |
UaType |
getTypeDefinition()
The UaType object corresponding to TypeDefinitionId.
|
ExpandedNodeId |
getTypeDefinitionId()
Reference to the NodeId of the object's type definition.
|
protected UaServerReference |
getTypeDefinitionReference() |
AccessLevelType |
getUserAccessLevel()
Defines the user specific read/write access of the Value attribute.
|
AttributeWriteMask |
getUserWriteMask()
The optional UserWriteMask Attribute exposes the possibilities of a client to write the
Attributes of the Node taking user access rights into account.
|
Integer |
getValueRank()
This Attribute indicates whether the Value Attribute of the Variable is an array and how many
dimensions the array has.
|
AttributeWriteMask |
getWriteMask()
The optional WriteMask Attribute exposes the possibilities of a client to write the Attributes
of the Node.
|
boolean |
hasUserWriteAccess(UnsignedInteger attributeId)
Checks additional user access rights to the node.
|
boolean |
hasWriteAccess(UnsignedInteger attributeId)
Check the common access rights of a node attribute.
|
DataValue |
readAttribute(UnsignedInteger attributeId)
Read the current value of an attribute.
|
void |
readAttribute(UnsignedInteger attributeId,
DataValue dataValue,
Locale locale) |
UaNode |
removeComponent(UaNode component)
Remove a component reference from the node.
|
UaProperty |
removeProperty(QualifiedName name)
Remove the property with the specified name.
|
void |
setAccessLevel(AccessLevelType accessLevel) |
void |
setArrayDimensions(UnsignedInteger[] arrayDimensions)
This Attribute specifies the length of each dimension for an array value.
|
void |
setAttribute(UnsignedInteger attributeId,
DataValue dataValue)
Unconditionally, set the value of the specified attribute.
|
void |
setAttributes(NodeAttributes nodeAttributes)
Sets the attributes of the node.
|
void |
setBrowseName(QualifiedName browseName)
Sets the BrowseName Attribute of the node.
|
void |
setDataType(UaDataType dataType)
Set the Data Type node.
|
void |
setDataTypeId(NodeId dataTypeId)
Set the Data Type.
|
void |
setDescription(LocalizedText description)
Sets the Description Attribute of the node.
|
void |
setDisplayName(LocalizedText displayName)
Sets the DisplayName Attribute of the node.
|
void |
setHistorizing(Boolean historizing) |
void |
setMinimumSamplingInterval(Double minimumSamplingInterval) |
void |
setReferences(UaReference[] references)
Set all references of the node at one call.
|
void |
setStatus(StatusCode status)
Set the status of the variable.
|
void |
setTypeDefinition(UaType type)
Sets the type definition of the node using an UaType node.
|
void |
setTypeDefinitionId(ExpandedNodeId typeDefinitionId)
Sets the type definition to an ExpandedNodeId.
|
void |
setTypeDefinitionId(NodeId typeDefinitionId)
Sets the type definition to a local NodeId.
|
void |
setUserAccessLevel(AccessLevelType userAccessLevel) |
void |
setUserWriteMask(AttributeWriteMask userWriteMask)
Sets the UserWriteMask Attribute of the node.
|
void |
setValue(DataValue value)
The default Value for instances of this type.
|
void |
setValue(Object value)
Set value.
|
void |
setValueRank(int valueRank)
This Attribute indicates whether the Value Attribute of the VariableType is an array and how
many dimensions the array has.
|
void |
setWriteMask(AttributeWriteMask writeMask)
Sets the WriteMask Attribute of the node.
|
boolean |
writeAttribute(UnsignedInteger attributeId,
DataValue dataValue)
Write the attribute value in a node.
|
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, getNodeSetExtensions, getReferenceList, getReferences, getSupportedAttributes, getTargetNodes, getUaNodeId, hashCode, hasReference, initSupportedAttributes, isAddNotifierReferencesToServerObject, isFalseOrNull, isMandatory, isMonitoredForEvents, isTrueOrNull, isType, referenceTypeInherits, removeDataChangeListener, removeEventListener, setAddNotifierReferencesToServerObject, setNodeSetExtensions, supportsAttribute, toString, translateBrowsePathToNodeIds, validateHasEventSourceChain, validateHasEventSourceChain, writeAttributeValuegetForwardReferences, getInverseReferences, getReferences, getReferences, getUserData, referenceTypeInherits, setUserDataclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddDataChangeListener, removeDataChangeListenergetValueaddComponent, addOrganizes, addProperty, addReference, addReference, addReference, addReference, addReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getBrowsePaths, getForwardReferences, getInverseReferences, getNodeId, getOrganizedNode, getOrganizedNodes, getReferences, getReferences, getSupportedAttributes, getUaBrowsePaths, getUaNodeId, getUserData, setUserData, supportsAttributepublic InstanceVariable(NodeManagerUaNode nodeManager, NodeId nodeId, NodeId instanceDeclarationId) throws StatusException
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.StatusException - if instanceDeclarationId cannot be converted to a variable nodepublic InstanceVariable(NodeManagerUaNode nodeManager, NodeId nodeId, UaVariable instanceDeclaration)
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.public UaReference addReference(UaNode targetNode, NodeId referenceTypeId, boolean isInverse)
UaNodeaddReference in interface UaNodeaddReference in class ServerNodetargetNode - The target node where the reference points to.referenceTypeId - The type of reference.isInverse - Whether the reference is an inverse reference.public UaReference deleteReference(ExpandedNodeId targetNodeId, NodeId referenceTypeId, boolean isInverse)
UaNodedeleteReference in interface UaNodedeleteReference in class ServerNodetargetNodeId - The target node of the reference.referenceTypeId - The exact type of reference.isInverse - Whether to remove a forward reference. If false, deletes an inverse reference
only.public AccessLevelType getAccessLevel()
UaVariableIn contrast to the WriteAccess this attribute only applies to the Value attribute.
getAccessLevel in interface UaVariableUaVariable.getUserAccessLevel()public UnsignedInteger[] getArrayDimensions()
UaValueNodeThe number of elements shall be equal to the value of the ValueRank Attribute. Shall be null if ValueRank <= 0.
A value of 0 for an individual dimension indicates that the dimension has a variable length.
For example, if a Variable is defined by the following C array: Int32 myArray[346];
then this Variable's DataType would point to an Int32, the Variable's ValueRank has the value 1 and the ArrayDimensions is an array with one entry having the value 346.
getArrayDimensions in interface UaValueNodeUaValueNode.setArrayDimensions(com.prosysopc.ua.stack.builtintypes.UnsignedInteger[])public NodeAttributes getAttributes()
UaNodegetAttributes in interface UaNodepublic Map<UnsignedInteger,Object> getAttributesMap()
UaNodeMap containing the Attributes of the node. The key is the
AttributeId (listed in Attributes) and the value is the Attribute value. NOTE! For
mutable Attribute value types (e.g. Value, ArrayDimensions) the value is a clone of the
original.getAttributesMap in interface UaNodepublic QualifiedName getBrowseName()
UaNodeA BrowseName should never be used to display the name of a Node. The DisplayName should be used instead for this purpose.
Unlike NodeIds, the BrowseName cannot be used to unambiguously identify a Node. Different Nodes may have the same BrowseName.
getBrowseName in interface UaNodepublic UaNode getComponent(QualifiedName componentName)
UaNodegetComponent in interface UaNodecomponentName - the BrowseName of the component to getpublic UaNode[] getComponents()
UaNodegetComponents in interface UaNodepublic UaDataType getDataType()
getDataType in interface UaValueNodeUaValueNode.getDataTypeId()public NodeId getDataTypeId()
getDataTypeId in interface UaValueNodepublic LocalizedText getDescription()
UaNodegetDescription in interface UaNodepublic LocalizedText getDisplayName()
UaNodeThe string part of the DisplayName is restricted to 512 characters.
getDisplayName in interface UaNodepublic Boolean getHistorizing()
getHistorizing in interface UaVariablepublic UaMethod getMethod(QualifiedName methodName) throws ClassCastException
UaNodegetMethod in interface UaNodemethodName - the BrowseName (in namespace 0) of the method to getClassCastException - if the node is not a method nodepublic Double getMinimumSamplingInterval()
getMinimumSamplingInterval in interface UaVariablepublic NodeClass getNodeClass()
UaNodegetNodeClass in interface UaNodepublic UaProperty getNodeVersionNode()
UaNodegetNodeVersionNode in interface UaNodepublic UaProperty[] getProperties()
UaNodegetProperties in interface UaNodepublic UaProperty getProperty(QualifiedName name)
UaNodegetProperty in interface UaNodename - the name of the propertypublic UaReference getReference(NodeId referenceTypeId, boolean isInverse)
ServerNodegetReference in interface UaNodegetReference in class ServerNodereferenceTypeId - the reference type to search (or null to accept any)isInverse - To search for inverse reference, instead of non-inverse (applied also if null
referenceType is defined)public StatusCode getStatus()
public UaType getTypeDefinition()
UaInstancegetTypeDefinition in interface UaInstanceUaInstance.getTypeDefinitionId(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId),
UaInstance.setTypeDefinitionId(ExpandedNodeId)public ExpandedNodeId getTypeDefinitionId()
UaInstancegetTypeDefinitionId in interface UaInstanceUaInstance.getTypeDefinition(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId),
UaInstance.setTypeDefinitionId(ExpandedNodeId)public AccessLevelType getUserAccessLevel()
UaVariableIn contrast to the UserWriteAccess this attribute only applies to the Value attribute.
getUserAccessLevel in interface UaVariableUaVariable.getAccessLevel()public AttributeWriteMask getUserWriteMask()
UaNodeThe UserWriteMask Attribute can only further restrict the WriteMask Attribute, when it is set to not writable in the general case that applies for every user.
getUserWriteMask in interface UaNodepublic Integer getValueRank()
UaValueNodeIt may have the following values:
getValueRank in interface UaValueNodeUaValueNode.setValueRank(int)public AttributeWriteMask getWriteMask()
UaNodegetWriteMask in interface UaNodepublic boolean hasUserWriteAccess(UnsignedInteger attributeId)
UaNodeThe access rights are checked by default in writeAttribute.
hasUserWriteAccess in interface UaNodeattributeId - the attribute to checkpublic boolean hasWriteAccess(UnsignedInteger attributeId)
UaNodeThe access rights are checked by default in writeAttribute.
hasWriteAccess in interface UaNodeattributeId - the attribute to checkpublic DataValue readAttribute(UnsignedInteger attributeId)
UaNodereadAttribute in interface UaNodeattributeId - the attribute to read - the valid values are defined in
Attributes. Also check
UaNode.supportsAttribute(UnsignedInteger) whether the node actually supports this
attribute type.UaNode.supportsAttribute(UnsignedInteger)public void readAttribute(UnsignedInteger attributeId, DataValue dataValue, Locale locale)
readAttribute in interface UaNodepublic UaNode removeComponent(UaNode component)
UaNodeThis is a shortcut for
deleteReference(component, Identifiers.HasComponent, false);
Note that the method does not remove the component - it only removes the reference to it.
removeComponent in interface UaNoderemoveComponent in class ServerNodecomponent - the component node to removeUaNode.deleteReference(UaNode, NodeId, boolean)public UaProperty removeProperty(QualifiedName name)
UaNoderemoveProperty in interface UaNodename - the name of the propertypublic void setAccessLevel(AccessLevelType accessLevel)
setAccessLevel in interface UaVariableaccessLevel - the access level to setUaVariable.getAccessLevel()public void setArrayDimensions(UnsignedInteger[] arrayDimensions)
UaValueNodeThe number of elements shall be equal to the value of the ValueRank Attribute. Shall be null if ValueRank <= 0.
A value of 0 for an individual dimension indicates that the dimension has a variable length.
For example, if a VariableType is defined by the following array:
Integer[] myArray = new Integer[346];
then this VariableType's DataType would point to the Int32 data type node, the VariableType's ValueRank has the value 1 and the ArrayDimensions is an array with one entry having the value 346.
setArrayDimensions in interface UaValueNodepublic void setAttribute(UnsignedInteger attributeId, DataValue dataValue) throws StatusException
UaNodeTo check the access rights and that the attribute is supported by the node, use writeAttribute.
The method calls the internal, overridable, writeAttributeValue.
setAttribute in interface UaNodeStatusExceptionpublic void setAttributes(NodeAttributes nodeAttributes)
UaNodesetAttributes in interface UaNodepublic void setBrowseName(QualifiedName browseName)
UaNodesetBrowseName in interface UaNodepublic void setDataType(UaDataType dataType)
UaValueNodesetDataType in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setDataTypeId(NodeId dataTypeId)
UaValueNodesetDataTypeId in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setDescription(LocalizedText description)
UaNodesetDescription in interface UaNodepublic void setDisplayName(LocalizedText displayName)
UaNodesetDisplayName in interface UaNodepublic void setHistorizing(Boolean historizing)
setHistorizing in interface UaVariablehistorizing - define that the variable has history - or notpublic void setMinimumSamplingInterval(Double minimumSamplingInterval)
setMinimumSamplingInterval in interface UaVariableminimumSamplingInterval - define the minimum sampling intervalpublic void setReferences(UaReference[] references)
UaNode
Use UaNode.addReference(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId, com.prosysopc.ua.stack.builtintypes.NodeId) to add new references to the node.
setReferences in interface UaNodesetReferences in class ServerNodereferences - the references to setUaNode.getReferences(),
UaNode.getReference(NodeId, boolean)public void setStatus(StatusCode status)
The sourceTimestamp is set to null, and serverTimestamp is set to the current time.
status - the status to setpublic void setTypeDefinition(UaType type)
UaInstancesetTypeDefinition in interface UaInstancetype - The type to setUaInstance.getTypeDefinitionId(),
UaInstance.getTypeDefinition(),
UaInstance.setTypeDefinitionId(ExpandedNodeId),
UaInstance.setTypeDefinitionId(NodeId)public void setTypeDefinitionId(ExpandedNodeId typeDefinitionId)
UaInstancesetTypeDefinitionId in interface UaInstancetypeDefinitionId - the type definition Id to setUaInstance.getTypeDefinitionId(),
UaInstance.getTypeDefinition(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId)public void setTypeDefinitionId(NodeId typeDefinitionId)
UaInstanceIf
setTypeDefinitionId in interface UaInstancetypeDefinitionId - the type definition Id to setUaInstance.getTypeDefinitionId(),
UaInstance.getTypeDefinition(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(ExpandedNodeId)public void setUserAccessLevel(AccessLevelType userAccessLevel)
setUserAccessLevel in interface UaVariableuserAccessLevel - the user access level to setUaVariable.getUserAccessLevel()public void setUserWriteMask(AttributeWriteMask userWriteMask)
UaNodesetUserWriteMask in interface UaNodepublic void setValue(DataValue value) throws StatusException
UaValueNodesetValue in interface UaValueNodevalue - the default value to setStatusExceptionpublic void setValue(Object value) throws StatusException
UaValueNodesetValue in interface UaValueNodevalue - a new valueStatusException - if the value is invalid for the Value attributepublic void setValueRank(int valueRank)
UaValueNodeIt may have the following values:
setValueRank in interface UaValueNodevalueRank - the value rank to setpublic void setWriteMask(AttributeWriteMask writeMask)
UaNodesetWriteMask in interface UaNodepublic boolean writeAttribute(UnsignedInteger attributeId, DataValue dataValue) throws StatusException
UaNodewriteAttribute in interface UaNodeattributeId - the attribute to write - the valid values are defined in
AttributesdataValue - the new value, if this is null, the status of the attribute is set to
StatusCode.BAD, otherwise the status and value are used from itStatusException - if the write is not accepted (for above mentioned reasons)UaNode.supportsAttribute(UnsignedInteger)protected boolean beforeAddReference(UaReference reference)
beforeAddReference in class ServerNodeprotected abstract void doSetValue(DataValue value) throws StatusException
value - StatusExceptionprotected UaType getPropertyTypeNode()
StatusExceptionprotected List<UaReference> getReferencesAsList(Boolean isInverse, NodeId... referenceTypeIds)
getReferencesAsList in class AbstractUaNodeprotected UaServerReference getTypeDefinitionReference()
Copyright © 2026. All rights reserved.