|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.nodes.AbstractUaNode
com.prosysopc.ua.server.nodes.ServerNode
com.prosysopc.ua.server.nodes.InstanceVariable
public abstract class InstanceVariable
An instance variable is a light-weight implementation of an UaVariable, which actually refers to an InstanceDeclaration of a type node.
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.
| Field Summary |
|---|
| Fields inherited from class com.prosysopc.ua.server.nodes.ServerNode |
|---|
eventListeners, INITIALIZATION_TIME, nodeManager, supportedAttributesMap |
| Constructor Summary | |
|---|---|
InstanceVariable(NodeManagerUaNode nodeManager,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.NodeId instanceDeclarationId)
Create a new node, referring to an instance declaration node. |
|
InstanceVariable(NodeManagerUaNode nodeManager,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
UaVariable instanceDeclaration)
Create a new node, referring to an instance declaration node. |
|
| Method Summary | |
|---|---|
UaReference |
addReference(UaNode targetNode,
org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
Add a reference to the node. |
protected boolean |
beforeAddReference(UaReference reference)
|
UaReference |
deleteReference(org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId,
org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
Delete a reference from the node. |
protected abstract void |
doSetValue(org.opcfoundation.ua.builtintypes.DataValue value)
Perform the actual value set. |
EnumSet<org.opcfoundation.ua.core.AccessLevel> |
getAccessLevel()
Defines the global read/write access of the Value attribute for all users. |
org.opcfoundation.ua.builtintypes.UnsignedInteger[] |
getArrayDimensions()
This Attribute specifies the length of each dimension for an array value. |
org.opcfoundation.ua.core.NodeAttributes |
getAttributes()
|
org.opcfoundation.ua.builtintypes.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(org.opcfoundation.ua.builtintypes.QualifiedName componentName)
Get the component, which has the specified name. |
UaNode[] |
getComponents()
Get a list of components of this node, i.e. target nodes of all forward HasComponent references. |
UaType |
getDataType()
|
org.opcfoundation.ua.builtintypes.NodeId |
getDataTypeId()
|
org.opcfoundation.ua.builtintypes.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. |
org.opcfoundation.ua.builtintypes.LocalizedText |
getDisplayName()
The DisplayName Attribute contains the localised name of the Node. |
Boolean |
getHistorizing()
|
UaMethod |
getMethod(org.opcfoundation.ua.builtintypes.QualifiedName methodName)
Get the method, which has the specified name. |
Double |
getMinimumSamplingInterval()
|
org.opcfoundation.ua.core.NodeClass |
getNodeClass()
The NodeClass Attribute identifies the NodeClass of a Node. |
UaProperty |
getNodeVersion()
|
UaProperty[] |
getProperties()
|
UaProperty |
getProperty(org.opcfoundation.ua.builtintypes.QualifiedName name)
Find the property with the specified name. |
protected UaType |
getPropertyTypeNode()
|
UaReference |
getReference(org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
Finds the first reference of the specified reference type. |
protected List<UaReference> |
getReferencesAsList(Boolean isInverse,
org.opcfoundation.ua.builtintypes.NodeId... referenceTypeIds)
|
org.opcfoundation.ua.builtintypes.StatusCode |
getStatus()
|
UaType |
getTypeDefinition()
The UaType object corresponding to TypeDefinitionId. |
org.opcfoundation.ua.builtintypes.ExpandedNodeId |
getTypeDefinitionId()
Reference to the NodeId of the object's type definition. |
protected UaServerReference |
getTypeDefinitionReference()
|
EnumSet<org.opcfoundation.ua.core.AccessLevel> |
getUserAccessLevel()
Defines the user specific read/write access of the Value attribute. |
EnumSet<WriteAccess> |
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. |
EnumSet<WriteAccess> |
getWriteMask()
The optional WriteMask Attribute exposes the possibilities of a client to write the Attributes of the Node. |
boolean |
hasUserWriteAccess(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
Checks additional user access rights to the node. |
boolean |
hasWriteAccess(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
Check the common access rights of a node attribute. |
org.opcfoundation.ua.builtintypes.DataValue |
readAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
Read the current value of an attribute. |
void |
readAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue,
Locale locale)
|
UaNode |
removeComponent(UaNode component)
Remove a component reference from the node. |
UaProperty |
removeProperty(org.opcfoundation.ua.builtintypes.QualifiedName name)
Remove the property with the specified name. |
void |
setAccessLevel(EnumSet<org.opcfoundation.ua.core.AccessLevel> accessLevel)
|
void |
setArrayDimensions(org.opcfoundation.ua.builtintypes.UnsignedInteger[] arrayDimensions)
This Attribute specifies the length of each dimension for an array value. |
void |
setAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Unconditionally, set the value of the specified attribute. |
void |
setAttributes(org.opcfoundation.ua.core.NodeAttributes nodeAttributes)
|
void |
setBrowseName(org.opcfoundation.ua.builtintypes.QualifiedName browseName)
|
void |
setDataType(UaType dataType)
Set the Data Type node. |
void |
setDataTypeId(org.opcfoundation.ua.builtintypes.NodeId dataTypeId)
Set the Data Type. |
void |
setDescription(org.opcfoundation.ua.builtintypes.LocalizedText description)
|
void |
setDisplayName(org.opcfoundation.ua.builtintypes.LocalizedText displayName)
|
void |
setHistorizing(Boolean historizing)
|
void |
setMinimumSamplingInterval(Double minimumSamplingInterval)
|
void |
setReferences(UaReference[] references)
Set all references of the node at one call. |
void |
setStatus(org.opcfoundation.ua.builtintypes.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(org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
Sets the type definition to an ExpandedNodeId. |
void |
setTypeDefinitionId(org.opcfoundation.ua.builtintypes.NodeId typeDefinitionId)
Sets the type definition to a local NodeId. |
void |
setUserAccessLevel(EnumSet<org.opcfoundation.ua.core.AccessLevel> userAccessLevel)
|
void |
setUserWriteMask(EnumSet<WriteAccess> userWriteMask)
|
void |
setValue(org.opcfoundation.ua.builtintypes.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(EnumSet<WriteAccess> writeMask)
|
boolean |
writeAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
Write the attribute value in a node. |
| 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.UaValueNode |
|---|
getValue |
| 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 |
|---|
public InstanceVariable(NodeManagerUaNode nodeManager,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.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 node
public InstanceVariable(NodeManagerUaNode nodeManager,
org.opcfoundation.ua.builtintypes.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.| Method Detail |
|---|
public UaReference addReference(UaNode targetNode,
org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
UaNode
addReference 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(org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId,
org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
UaNode
deleteReference 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 EnumSet<org.opcfoundation.ua.core.AccessLevel> getAccessLevel()
UaVariableIn contrast to the WriteAccess this attribute only applies to the Value attribute.
getAccessLevel in interface UaVariableUaVariable.getUserAccessLevel()public org.opcfoundation.ua.builtintypes.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(org.opcfoundation.ua.builtintypes.UnsignedInteger[])public org.opcfoundation.ua.core.NodeAttributes getAttributes()
getAttributes in interface UaNodepublic org.opcfoundation.ua.builtintypes.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 UaNodeAddressSpace.translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath...)public UaNode getComponent(org.opcfoundation.ua.builtintypes.QualifiedName componentName)
UaNode
getComponent in interface UaNodecomponentName - the BrowseName of the component to get
public UaNode[] getComponents()
UaNode
getComponents in interface UaNodepublic UaType getDataType()
getDataType in interface UaValueNodeUaValueNode.getDataTypeId()public org.opcfoundation.ua.builtintypes.NodeId getDataTypeId()
getDataTypeId in interface UaValueNodepublic org.opcfoundation.ua.builtintypes.LocalizedText getDescription()
UaNode
getDescription in interface UaNodepublic org.opcfoundation.ua.builtintypes.LocalizedText getDisplayName()
UaNodeThe string part of the DisplayName is restricted to 512 characters.
getDisplayName in interface UaNodepublic Boolean getHistorizing()
getHistorizing in interface UaVariable
public UaMethod getMethod(org.opcfoundation.ua.builtintypes.QualifiedName methodName)
throws ClassCastException
UaNode
getMethod in interface UaNodemethodName - the BrowseName (in namespace 0) of the method to get
ClassCastException - if the node is not a method nodepublic Double getMinimumSamplingInterval()
getMinimumSamplingInterval in interface UaVariablepublic org.opcfoundation.ua.core.NodeClass getNodeClass()
UaNode
getNodeClass in interface UaNodepublic UaProperty getNodeVersion()
getNodeVersion in interface UaNodepublic UaProperty[] getProperties()
getProperties in interface UaNodepublic UaProperty getProperty(org.opcfoundation.ua.builtintypes.QualifiedName name)
UaNode
getProperty in interface UaNodename - the name of the property
public UaReference getReference(org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
boolean isInverse)
ServerNode
getReference 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 org.opcfoundation.ua.builtintypes.StatusCode getStatus()
public UaType getTypeDefinition()
UaInstance
getTypeDefinition in interface UaInstanceUaInstance.getTypeDefinitionId(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId),
UaInstance.setTypeDefinitionId(ExpandedNodeId)public org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeDefinitionId()
UaInstance
getTypeDefinitionId in interface UaInstanceUaInstance.getTypeDefinition(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId),
UaInstance.setTypeDefinitionId(ExpandedNodeId)public EnumSet<org.opcfoundation.ua.core.AccessLevel> getUserAccessLevel()
UaVariableIn contrast to the UserWriteAccess this attribute only applies to the Value attribute.
getUserAccessLevel in interface UaVariableUaVariable.getAccessLevel()public EnumSet<WriteAccess> 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 EnumSet<WriteAccess> getWriteMask()
UaNode
getWriteMask in interface UaNodepublic boolean hasUserWriteAccess(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
UaNode
hasUserWriteAccess in interface UaNodeattributeId - the attribute to check
public boolean hasWriteAccess(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
UaNode
hasWriteAccess in interface UaNodeattributeId - the attribute to check
public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
UaNode
readAttribute 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(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.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(org.opcfoundation.ua.builtintypes.QualifiedName name)
UaNode
removeProperty in interface UaNodename - the name of the property
public void setAccessLevel(EnumSet<org.opcfoundation.ua.core.AccessLevel> accessLevel)
setAccessLevel in interface UaVariableaccessLevel - the access level to setUaVariable.getAccessLevel()public void setArrayDimensions(org.opcfoundation.ua.builtintypes.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 UaValueNode
public void setAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
UaNode
setAttribute in interface UaNodeStatusExceptionpublic void setAttributes(org.opcfoundation.ua.core.NodeAttributes nodeAttributes)
setAttributes in interface UaNodepublic void setBrowseName(org.opcfoundation.ua.builtintypes.QualifiedName browseName)
setBrowseName in interface UaNodebrowseName - the new BrowseName to setUaNode.getBrowseName()public void setDataType(UaType dataType)
UaValueNode
setDataType in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setDataTypeId(org.opcfoundation.ua.builtintypes.NodeId dataTypeId)
UaValueNode
setDataTypeId in interface UaValueNodeUaValueNode.setDataTypeId(NodeId)public void setDescription(org.opcfoundation.ua.builtintypes.LocalizedText description)
setDescription in interface UaNodedescription - the new description to setUaNode.getDescription()public void setDisplayName(org.opcfoundation.ua.builtintypes.LocalizedText displayName)
setDisplayName in interface UaNodedisplayName - the new DisplayName to setUaNode.getDisplayName()public 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(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.NodeId, boolean) 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(org.opcfoundation.ua.builtintypes.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)
UaInstance
setTypeDefinition in interface UaInstancetype - The type to setUaInstance.getTypeDefinitionId(),
UaInstance.getTypeDefinition(),
UaInstance.setTypeDefinitionId(ExpandedNodeId),
UaInstance.setTypeDefinitionId(NodeId)public void setTypeDefinitionId(org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
UaInstance
setTypeDefinitionId in interface UaInstancetypeDefinitionId - the type definition Id to setUaInstance.getTypeDefinitionId(),
UaInstance.getTypeDefinition(),
UaInstance.setTypeDefinition(UaType),
UaInstance.setTypeDefinitionId(NodeId)public void setTypeDefinitionId(org.opcfoundation.ua.builtintypes.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(EnumSet<org.opcfoundation.ua.core.AccessLevel> userAccessLevel)
setUserAccessLevel in interface UaVariableuserAccessLevel - the user access level to setUaVariable.getUserAccessLevel()public void setUserWriteMask(EnumSet<WriteAccess> userWriteMask)
setUserWriteMask in interface UaNodeuserWriteMask - the new UserWriteMask to setUaNode.getUserWriteMask()
public void setValue(org.opcfoundation.ua.builtintypes.DataValue value)
throws StatusException
UaValueNode
setValue in interface UaValueNodevalue - the default value to set
StatusException
public void setValue(Object value)
throws StatusException
UaValueNode
setValue in interface UaValueNodevalue - a new value
StatusException - 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(EnumSet<WriteAccess> writeMask)
setWriteMask in interface UaNodewriteMask - the new WriteMask to setUaNode.getWriteMask()
public boolean writeAttribute(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
org.opcfoundation.ua.builtintypes.DataValue dataValue)
throws StatusException
UaNode
writeAttribute 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 it
StatusException - if the write is not accepted (for above mentioned reasons)UaNode.supportsAttribute(UnsignedInteger)protected boolean beforeAddReference(UaReference reference)
beforeAddReference in class ServerNode
protected abstract void doSetValue(org.opcfoundation.ua.builtintypes.DataValue value)
throws StatusException
value -
StatusExceptionprotected UaType getPropertyTypeNode()
StatusException
protected List<UaReference> getReferencesAsList(Boolean isInverse,
org.opcfoundation.ua.builtintypes.NodeId... referenceTypeIds)
getReferencesAsList in class AbstractUaNodeprotected UaServerReference getTypeDefinitionReference()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||