com.prosysopc.ua.server.nodes
Class UaInstanceNode

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
All Implemented Interfaces:
UaInstance, UaNode
Direct Known Subclasses:
UaObjectNode, UaVariableNode

public abstract class UaInstanceNode
extends BaseNode
implements UaInstance

Straight forward implementation of UaInstance.

It keeps all attributes in memory.

Note that the OPC UA Specification does not define or represent such a common "base class" for all instance nodes. However, all instance nodes support TypeDefinition reference. In principle UaInstance separates the instance nodes from type nodes, which implement UaType.


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
UaInstanceNode(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName)
           
UaInstanceNode(NodeManagerUaNode nodeManager, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale)
           
 
Method Summary
 UaReference addModellingRule(ModellingRule modellingRule)
          Adds a ModellingRule reference to the node.
protected  boolean beforeAddReference(UaReference reference)
           
protected abstract  org.opcfoundation.ua.builtintypes.ExpandedNodeId getDefaultTypeDefinition()
           
 UaType getTypeDefinition()
          The UaType object corresponding to TypeDefinitionId.
 org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeDefinitionId()
          Reference to the NodeId of the object's type definition.
 boolean hasTypeDefinition()
           
protected  UaMethod registerOverridePlainMethod(String name)
           
 void setTypeDefinition(UaType type)
          Sets the type of the 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.
protected  boolean supportsTypeDefinitionNode()
          Defines that the instance supports the TypeDefinition reference to a node, i.e. setting TypeDefinitionId (which is done by default in init()), also sets the TypeDefinition which creates a UA reference.
 String toString()
           
 
Methods inherited from class com.prosysopc.ua.server.nodes.BaseNode
addPlainProperty, addPlainVariable, assertTypeSupport, assertTypeSupport, createNodeId, createNodeId, createReflectiveInstanceProperty, createReflectiveInstanceProperty, deleteReference, deleteReference, doAddProperty, getAttributes, getAttributes, getBrowseName, getComponent, getComponents, getDescription, getDescription, getDisplayName, getDisplayName, getMethod, getNodeClass, getNodeVersion, getNodeVersionValue, getProperties, getProperty, getPropertyValue, getReferencesAsList, getStandardBrowseName, getStandardDisplayText, getUserWriteMask, getWriteMask, hasProperty, hasReference, hasUserWriteAccess, hasWriteAccess, incNodeVersion, initNodeVersion, isChildOfType, readAttribute, readAttribute, readAttributeValue, registerCallbackProperty, registerPlainInstanceProperty, registerPlainInstanceProperty, registerPlainProperty, registerPlainProperty, registerPlainVariable, registerPlainVariable, registerReflectiveInstanceProperty, registerReflectiveInstanceVariable, registerReflectiveProperty, registerReflectiveVariable, removeProperty, setAccessLevelRecursively, setAccessLevelRecursively, setAttribute, setAttributes, setBrowseName, setDescription, setDisplayName, setNodeVersionValue, setPropertyValue, setUserWriteMask, setWriteMask, writeAttribute, writeAttributeValue
 
Methods inherited from class com.prosysopc.ua.server.nodes.ServerNode
addComponent, addDataChangeListener, addEventListener, addNewReference, addNewReference, addOrganizes, addProperties, addProperty, 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, initSupportedAttributes, 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.UaNode
addComponent, addProperty, addReference, addReference, addReference, deleteReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getAttributes, getBrowseName, getComponent, getComponents, getDescription, getDisplayName, getForwardReferences, getInverseReferences, getMethod, getNodeClass, getNodeId, getNodeVersion, getProperties, getProperty, getReference, getReferences, getReferences, getSupportedAttributes, getUserWriteMask, getWriteMask, hasUserWriteAccess, hasWriteAccess, readAttribute, readAttribute, removeComponent, removeProperty, setAttribute, setAttributes, setBrowseName, setDescription, setDisplayName, setReferences, setUserWriteMask, setWriteMask, supportsAttribute, writeAttribute
 

Constructor Detail

UaInstanceNode

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

UaInstanceNode

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

addModellingRule

public UaReference addModellingRule(ModellingRule modellingRule)
Adds a ModellingRule reference to the node. ModellingRules are used in InstanceDeclarations (components and properties of type definitions) to define which of the nodes are mandatory, optional, etc.

Parameters:
modellingRule -
Returns:
the new reference.

getTypeDefinition

public UaType getTypeDefinition()
Description copied from interface: UaInstance
The UaType object corresponding to TypeDefinitionId. Note that the TypeDefinition may be null at certain circumstances although TypeDefinitionId is defined (although it should be implemented generally such that the node is retrieved automatically using TypeDefinitionId).

Specified by:
getTypeDefinition in interface UaInstance
Returns:
the type of the node, if it has such, or null
See Also:
UaInstance.getTypeDefinitionId(), UaInstance.setTypeDefinition(UaType), UaInstance.setTypeDefinitionId(NodeId), UaInstance.setTypeDefinitionId(ExpandedNodeId)

getTypeDefinitionId

public org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeDefinitionId()
Reference to the NodeId of the object's type definition. Type definitions are only available for the NodeClasses Object and Variable. For all other NodeClasses a null NodeId shall be returned.

Specified by:
getTypeDefinitionId in interface UaInstance
Returns:
See Also:
UaInstance.getTypeDefinition(), UaInstance.setTypeDefinition(UaType), UaInstance.setTypeDefinitionId(NodeId), UaInstance.setTypeDefinitionId(ExpandedNodeId)

hasTypeDefinition

public boolean hasTypeDefinition()
Overrides:
hasTypeDefinition in class BaseNode
Returns:

setTypeDefinition

public void setTypeDefinition(UaType type)
Sets the type of the node. Also sets typeDefinition, if type is not null. Type definitions are only available for the NodeClasses Object and Variable.

Specified by:
setTypeDefinition in interface UaInstance
Parameters:
type -
See Also:
UaInstance.getTypeDefinitionId(), UaInstance.getTypeDefinition(), UaInstance.setTypeDefinitionId(ExpandedNodeId), UaInstance.setTypeDefinitionId(NodeId)

setTypeDefinitionId

public void setTypeDefinitionId(org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
Description copied from interface: UaInstance
Sets the type definition to an ExpandedNodeId.

Specified by:
setTypeDefinitionId in interface UaInstance
Parameters:
typeDefinitionId - the type definition Id to set
See Also:
UaInstance.getTypeDefinitionId(), UaInstance.getTypeDefinition(), UaInstance.setTypeDefinition(UaType), UaInstance.setTypeDefinitionId(NodeId)

setTypeDefinitionId

public final void setTypeDefinitionId(org.opcfoundation.ua.builtintypes.NodeId typeDefinitionId)
Description copied from interface: UaInstance
Sets the type definition to a local NodeId.

If

Specified by:
setTypeDefinitionId in interface UaInstance
Parameters:
typeDefinitionId - the type definition Id to set
See Also:
UaInstance.getTypeDefinitionId(), UaInstance.getTypeDefinition(), UaInstance.setTypeDefinition(UaType), UaInstance.setTypeDefinitionId(ExpandedNodeId)

toString

public String toString()
Overrides:
toString in class BaseNode

beforeAddReference

protected boolean beforeAddReference(UaReference reference)
Overrides:
beforeAddReference in class ServerNode
Returns:

getDefaultTypeDefinition

protected abstract org.opcfoundation.ua.builtintypes.ExpandedNodeId getDefaultTypeDefinition()
Returns:

registerOverridePlainMethod

protected UaMethod registerOverridePlainMethod(String name)
Parameters:
name -
Returns:

supportsTypeDefinitionNode

protected boolean supportsTypeDefinitionNode()
Defines that the instance supports the TypeDefinition reference to a node, i.e. setting TypeDefinitionId (which is done by default in init()), also sets the TypeDefinition which creates a UA reference. The problem with the reference is that it inhibits the node from being garbage-collected since there is the reference to the type node.

The events will need to disable this, for instance.

Returns:


Copyright © 2018. All rights reserved.