com.prosysopc.ua.server.instantiation
Class NodeBuilder<T extends UaInstance>

java.lang.Object
  extended by com.prosysopc.ua.server.instantiation.NodeBuilder<T>

public final class NodeBuilder<T extends UaInstance>
extends Object

Builds UaNodes with given UaType. First, setXXX-methods are called for setting different parameters for the root node. Then, build-method is called to build the UaNode.

Minimum of supplied arguments are name and defaultNamespaceIndex. These are used to create the NodeId, browse name and display name of the root node. Node id, browse name and display name can also be given explicitly, in which case the name and defaultNamespaceIndex are overridden.

Currently, NodeBuilder creates the mandatory structure of the given UaType for the new instance. NodeIds for the new nodes are generated based on the NodeId of the root node of the structure and the browse path of the target node.


Constructor Summary
NodeBuilder(NodeManagerUaNode nodeManager, UaNodeBuilderConfiguration configuration, UaType type)
          Creates a new NodeBuilder, that creates instances of the given type and uses the factory to create the nodes.
 
Method Summary
 T build()
          Builds a new (@link UaInstance) with the structure of the UaType.
 void clear()
          Clears all settable fields
protected static boolean isTypeOnlyReference(ExternalReferenceDeclaration reference)
           
 NodeBuilder<T> setBrowseName(org.opcfoundation.ua.builtintypes.QualifiedName name)
          Sets the browse name of the root node of the created UaNode.
 NodeBuilder<T> setDefaultNameSpaceIndex(int defaultNameSpaceIndex)
          Sets the default namespace index.
 NodeBuilder<T> setDisplayName(org.opcfoundation.ua.builtintypes.LocalizedText name)
          Sets the display name of the root node of the created UaNode.
 NodeBuilder<T> setName(String name)
          Sets the name.
 NodeBuilder<T> setNodeId(org.opcfoundation.ua.builtintypes.NodeId id)
          Sets the node id of the root node of the created UaNode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeBuilder

public NodeBuilder(NodeManagerUaNode nodeManager,
                   UaNodeBuilderConfiguration configuration,
                   UaType type)
            throws InvalidTypeNodeException
Creates a new NodeBuilder, that creates instances of the given type and uses the factory to create the nodes.

Parameters:
nodeManager - the node manager to which the node(s) are built. Must not be null.
configuration - the configuration options for the builder. Must not be null.
type - the UA type of the node(s) to build. Must not be null.
Throws:
InvalidTypeNodeException - if the given type node cannot be used for instantiation.
Method Detail

isTypeOnlyReference

protected static boolean isTypeOnlyReference(ExternalReferenceDeclaration reference)
Parameters:
reference -
Returns:

build

public T build()
                           throws NodeBuilderException
Builds a new (@link UaInstance) with the structure of the UaType. Clears settable fields after building.

Throws:
NodeBuilderException - if node id, browse name or display name could not be deduced for the new root node.

clear

public void clear()
Clears all settable fields


setBrowseName

public NodeBuilder<T> setBrowseName(org.opcfoundation.ua.builtintypes.QualifiedName name)
Sets the browse name of the root node of the created UaNode.


setDefaultNameSpaceIndex

public NodeBuilder<T> setDefaultNameSpaceIndex(int defaultNameSpaceIndex)
Sets the default namespace index. The index is used for node id and browse name, if they are not supplied otherwise.


setDisplayName

public NodeBuilder<T> setDisplayName(org.opcfoundation.ua.builtintypes.LocalizedText name)
Sets the display name of the root node of the created UaNode.


setName

public NodeBuilder<T> setName(String name)
Sets the name. The name is used for the node id, browse name and display name, if they are not supplied otherwise.


setNodeId

public NodeBuilder<T> setNodeId(org.opcfoundation.ua.builtintypes.NodeId id)
Sets the node id of the root node of the created UaNode.



Copyright © 2018. All rights reserved.