com.prosysopc.ua.server
Class NodeManagerRoot

java.lang.Object
  extended by com.prosysopc.ua.server.ServiceManagerBase
      extended by com.prosysopc.ua.server.NodeManager
          extended by com.prosysopc.ua.server.NodeManagerUaNode
              extended by com.prosysopc.ua.server.NodeManagerRoot

public final class NodeManagerRoot
extends NodeManagerUaNode

NodeManager for the namespace 0, which is the default OPCUA namespace. The node manager handles the address space root, and the default folder structure. It also contains the default OPCUA types.

NodeManagerRoot is also used to trigger ModelChangeEvents (see beginModelChange() & endModelChange()).


Field Summary
 
Fields inherited from class com.prosysopc.ua.server.NodeManager
initialized, started
 
Constructor Summary
NodeManagerRoot(UaServer server)
           
 
Method Summary
 void addModelChange(org.opcfoundation.ua.builtintypes.NodeId nodeAffected, org.opcfoundation.ua.builtintypes.NodeId typeDefinition, ModelChangeType... changeTypes)
          Adds a change to the ModelChangeEvent, if one is active.
 void addModelChange(UaNode nodeAffected, ModelChangeType... changeTypes)
          Adds a change to the ModelChangeEvent, if one is active.
protected  org.opcfoundation.ua.builtintypes.NodeId addNode(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.NodeId parentNodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId, org.opcfoundation.ua.core.NodeAttributes attributes, org.opcfoundation.ua.builtintypes.NodeId referenceTypeId)
          Handle adding a new node.
protected  void addReference(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId sourceNodeId, org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId, org.opcfoundation.ua.builtintypes.NodeId referenceTypeId, boolean isForward, org.opcfoundation.ua.core.NodeClass targetNodeClass, String targetServerUri)
          Handle adding a reference.
 void addSemanticChange(UaNode nodeAffected)
           
 void beginModelChange()
          Begins a model change operation.
 void beginSemanticChange()
          Begins a semantic change operation.
protected  void deleteNode(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId nodeId, Boolean deleteTargetReferences)
           
protected  void deleteReference(ServiceContext serviceContext, org.opcfoundation.ua.builtintypes.NodeId sourceNodeId, org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId, org.opcfoundation.ua.builtintypes.NodeId referenceTypeId, Boolean isForward, Boolean deleteBidirectional)
           
 void endModelChange()
          Ends a model change started with beginModelChange() and triggers the ModelChangeEvent.
 org.opcfoundation.ua.builtintypes.ByteString endSemanticChange()
          Ends a semantic change started with beginSemanticChange().
protected  UaDataType getBaseDataType()
           
protected  UaVariableType getBaseDataVariableType()
           
protected  UaObjectType getBaseObjectType()
           
protected  UaReferenceType getBaseReferenceType()
           
protected  UaVariableType getBaseVariableType()
           
 DataTypeConverter getDataTypeConverter()
           
 FolderType getDataTypesFolder()
           
 FolderType getEventTypesFolder()
           
 GeneralModelChangeEvent getModelChangeEvent()
          Get access to the contents of the current modelChangeEvent.
 int getNamespaceIndex()
           
 FolderType getObjectsFolder()
          This is the root of the Objects folder, containing all object definitions.
 FolderType getObjectTypesFolder()
           
 FolderType getReferenceTypesFolder()
           
 FolderType getRoot()
          This is the ultimate root of the client address space.
 SemanticChangeEvent getSemanticChangeEvent()
          Get access to the contents of the current semanticChangeEvent.
 ServerTypeNode getServerData()
           
 FolderType getTypesFolder()
          This is the root of the Types folder, containing all type definitions.
 FolderType getVariableTypesFolder()
           
 FolderType getViewsFolder()
          This is the root of the Views folder, containing all view definitions.
protected  void init()
          Initialize the NodeManager.
protected  void shutdown(int secondsTillShutdown, org.opcfoundation.ua.builtintypes.LocalizedText shutdownReason)
           
protected  void start()
          Start the NodeManager, i.e. make it available
 
Methods inherited from class com.prosysopc.ua.server.NodeManagerUaNode
addComponent, addNode, addNodeAndReference, addReference, addReference, addReference, addType, addType, close, createEvent, createEvent, createEvent, createFolder, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createMonitoredDataItem, createNodeBuilder, createNodeBuilder, createNodeBuilder, createNodeBuilder, createNodeBuilder, createNodeBuilder, createNodeForAddNodesRequest, createNodeForNodeSet2, createNodeId, createNodeId, createNodeId, createNodeId, createNodeMap, deleteNode, deleteNode, deleteNode, deleteReference, deleteReference, deleteReference, findNode, getBrowseName, getDisplayName, getIoManager, getNode, getNode, getNodeBuilderConfiguration, getNodeClass, getNodeFactory, getNodeIdDelimiter, getNodeIdFormat, getNodeOrExternal, getNodes, getReferences, getType, getTypeDefinition, getVariableDataType, hasNode, replaceExternalNode, requireUaNode, setNodeBuilderConfiguration, setNodeFactory, setNodeIdDelimiter, supportsUaNode
 
Methods inherited from class com.prosysopc.ua.server.NodeManager
addListener, afterCreateMonitoredDataItem, afterCreateMonitoredEventItem, afterDeleteMonitoredItem, afterModifyMonitoredDataItem, afterModifyMonitoredEventItem, browseNode, callMethod, createMonitoredEventItem, createReferenceDescription, deleteMonitoredItem, findNode, findNodeClass, fireAddNode, fireAddReference, fireAfterAddNode, fireAfterAddReference, fireAfterCreateMonitoredDataItem, fireAfterDeleteMonitoredItem, fireAfterModifyMonitoredDataItem, fireBrowseNode, fireCreateMonitoredDataItem, fireDeleteMonitoredItem, fireDeleteNode, fireDeleteReference, fireModifyMonitoredDataItem, getDefaultLocale, getEventManager, getEventManager, getHistoryManager, getIsOfType, getMethodManager, getNamespaceTable, getNamespaceUri, getNode, getNodeClass, getNodeId, getQualifiedName, getReferences, getReferenceType, hasListener, isInitialized, isOfType, isStarted, modifyMonitoredDataItem, modifyMonitoredEventItem, queryFirst, queryNext, referenceMatchesRequest, registerNode, removeListener, setDefaultLocale, setEventManager, setHistoryManager, setIoManager, setMethodManager, toString, translateBrowsePath, unregisterNode
 
Methods inherited from class com.prosysopc.ua.server.ServiceManagerBase
arrayDimensionsMatch, checkIsMethod, checkIsValueNode, checkIsVariable, checkIsVariableOrVariableType, dataTypeEquals, getNode, getNode, getNode, getNodeManagerTable, getServer, getSubscriptionManager, isValueNode, isVariable, listenerError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeManagerRoot

public NodeManagerRoot(UaServer server)
Parameters:
server -
Method Detail

addModelChange

public void addModelChange(org.opcfoundation.ua.builtintypes.NodeId nodeAffected,
                           org.opcfoundation.ua.builtintypes.NodeId typeDefinition,
                           ModelChangeType... changeTypes)
Adds a change to the ModelChangeEvent, if one is active. You must activate the ModelChangeEvent by calling beginModelChange() before calling addModelChange.

Note: Adding and deleting nodes to NodeManagerUaNode objects and references to BaseNode:s will call #addModelChange(UaNode, ChangeType...) automatically.

Parameters:
nodeAffected - the affected node
typeDefinition - the type of node
changeTypes - the types of change

addModelChange

public void addModelChange(UaNode nodeAffected,
                           ModelChangeType... changeTypes)
Adds a change to the ModelChangeEvent, if one is active. You must activate the ModelChangeEvent by calling beginModelChange() before calling addModelChange.

Note: Adding and deleting nodes to NodeManagerUaNode objects and references to BaseNode:s will call this method automatically.

The NodeVersion property must also be enabled in the Node objects (by calling BaseNode.incNodeVersion() once), before the changes are accepted to the ModelChangeEvent - the version will be automatically incremented when endModelChange() is called and the event is sent to the clients.

Parameters:
nodeAffected - the affected node
changeTypes - the types of change

addSemanticChange

public void addSemanticChange(UaNode nodeAffected)
Parameters:
nodeAffected - the affected node

beginModelChange

public void beginModelChange()
Begins a model change operation.

All node and reference additions and deletions done using UaNode:s (or BaseNode:s specifically) will call #addModelChange(UaNode, ChangeType...) automatically, and these are recorded when a ModelChangeEvent is activated with this method.

The change is finally ended with endModelChange(), which triggers the event.

Note: The nodes must define the NodeVersion property before they are accepted to the ModelChangeEvent (you can define it with BaseNode.incNodeVersion()).


beginSemanticChange

public void beginSemanticChange()
Begins a semantic change operation.

All node modifications that result in a BaseNode#semanticChange being called

The change is finally ended with endSemanticChange(), which triggers the event.


endModelChange

public void endModelChange()
Ends a model change started with beginModelChange() and triggers the ModelChangeEvent. Also increases the NodeVersion of the affectedNodes (if they are BaseNodes).

If the list of changes to report is empty, will not send any events.


endSemanticChange

public org.opcfoundation.ua.builtintypes.ByteString endSemanticChange()
Ends a semantic change started with beginSemanticChange(). If several begin/end-calls are nested, the last endSemanticChange call will trigger the SemanticChangeEvent.

Returns:
the fullEventId of the SemanticChangeEvent that was sent - or null, if the event was not sent, yet.

getDataTypeConverter

public DataTypeConverter getDataTypeConverter()
Returns:
the dataTypeConverter to use for data type conversions. In practice, it provides the converter from ServiceManagerBase.getNodeManagerTable().

getDataTypesFolder

public FolderType getDataTypesFolder()

getEventTypesFolder

public FolderType getEventTypesFolder()
Returns:
the eventTypesFolder

getModelChangeEvent

public GeneralModelChangeEvent getModelChangeEvent()
Get access to the contents of the current modelChangeEvent. The model change event is used to notify clients of all model changes in the address space. Use beginModelChange() to start a model change and endModelChange() to end it. All node modifications done between them are recorded and sent to the clients that are listening to the event.

Alternatively, you can access and fill the event yourself.

Returns:
the current modelChangeEvent

getNamespaceIndex

public int getNamespaceIndex()
Overrides:
getNamespaceIndex in class NodeManager
Returns:
See Also:
NodeManager.getNamespaceUri()

getObjectsFolder

public FolderType getObjectsFolder()
This is the root of the Objects folder, containing all object definitions.

Returns:
the objectsFolder

getObjectTypesFolder

public FolderType getObjectTypesFolder()

getReferenceTypesFolder

public FolderType getReferenceTypesFolder()

getRoot

public FolderType getRoot()
This is the ultimate root of the client address space.

Returns:
the root

getSemanticChangeEvent

public SemanticChangeEvent getSemanticChangeEvent()
Get access to the contents of the current semanticChangeEvent. The semantic change event is used to notify clients of all model changes in the address space. Use beginModelChange() to start a model change and endModelChange() to end it. All node modifications done between them are recorded and sent to the clients that are listening to the event.

Alternatively, you can access and fill the event yourself.

Returns:
the current modelChangeEvent

getServerData

public ServerTypeNode getServerData()

getTypesFolder

public FolderType getTypesFolder()
This is the root of the Types folder, containing all type definitions.

Returns:
the typesFolder

getVariableTypesFolder

public FolderType getVariableTypesFolder()

getViewsFolder

public FolderType getViewsFolder()
This is the root of the Views folder, containing all view definitions.

Returns:
the viewsFolder

addNode

protected org.opcfoundation.ua.builtintypes.NodeId addNode(ServiceContext serviceContext,
                                                           org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                           org.opcfoundation.ua.builtintypes.NodeId parentNodeId,
                                                           org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                                                           org.opcfoundation.ua.core.NodeClass nodeClass,
                                                           org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId,
                                                           org.opcfoundation.ua.core.NodeAttributes attributes,
                                                           org.opcfoundation.ua.builtintypes.NodeId referenceTypeId)
                                                    throws StatusException
Description copied from class: NodeManager
Handle adding a new node. NOTE! you should call fireBeforeAddNode before adding the node to check permissions from added listeners and fireAfterAddNode after the node is added. Default implementation throws Bad_NotImplemented.

Overrides:
addNode in class NodeManagerUaNode
Throws:
StatusException

addReference

protected void addReference(ServiceContext serviceContext,
                            org.opcfoundation.ua.builtintypes.NodeId sourceNodeId,
                            org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId,
                            org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
                            boolean isForward,
                            org.opcfoundation.ua.core.NodeClass targetNodeClass,
                            String targetServerUri)
                     throws StatusException
Description copied from class: NodeManager
Handle adding a reference. NOTE! you should call fireBeforeAddReference before adding the reference to check permissions from added listeners and fireAfterAddReference after the reference is added. Default implementation throws Bad_NotImplemented.

Overrides:
addReference in class NodeManagerUaNode
Throws:
StatusException

deleteNode

protected void deleteNode(ServiceContext serviceContext,
                          org.opcfoundation.ua.builtintypes.NodeId nodeId,
                          Boolean deleteTargetReferences)
                   throws StatusException
Overrides:
deleteNode in class NodeManagerUaNode
Throws:
StatusException

deleteReference

protected void deleteReference(ServiceContext serviceContext,
                               org.opcfoundation.ua.builtintypes.NodeId sourceNodeId,
                               org.opcfoundation.ua.builtintypes.ExpandedNodeId targetNodeId,
                               org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
                               Boolean isForward,
                               Boolean deleteBidirectional)
                        throws StatusException
Overrides:
deleteReference in class NodeManagerUaNode
Throws:
StatusException

getBaseDataType

protected UaDataType getBaseDataType()
Returns:
the baseDataType

getBaseDataVariableType

protected UaVariableType getBaseDataVariableType()
Returns:
the baseDataVariableType

getBaseObjectType

protected UaObjectType getBaseObjectType()
Returns:
the baseObjectType

getBaseReferenceType

protected UaReferenceType getBaseReferenceType()
Returns:
the baseReferenceType

getBaseVariableType

protected UaVariableType getBaseVariableType()
Returns:
the baseVariableType

init

protected void init()
             throws RuntimeException
Description copied from class: NodeManager
Initialize the NodeManager.

Overrides:
init in class NodeManager
Throws:
RuntimeException
UaNodeFactoryException

shutdown

protected void shutdown(int secondsTillShutdown,
                        org.opcfoundation.ua.builtintypes.LocalizedText shutdownReason)
Parameters:
secondsTillShutdown -
shutdownReason -
Throws:
StatusException

start

protected void start()
              throws StatusException,
                     UaNodeFactoryException
Description copied from class: NodeManager
Start the NodeManager, i.e. make it available

Overrides:
start in class NodeManager
Throws:
StatusException
UaNodeFactoryException


Copyright © 2018. All rights reserved.