com.prosysopc.ua.server.nodes
Class UaServerNodeFactory

java.lang.Object
  extended by com.prosysopc.ua.server.nodes.UaServerNodeFactory
All Implemented Interfaces:
UaNodeFactory

public class UaServerNodeFactory
extends Object
implements UaNodeFactory

Default implementation of the UaNodeFactory for the server side. The factory is initialized with server side node classes.

The server side factories are available from NodeManagerUaNode.getNodeFactory().


Field Summary
protected  org.slf4j.Logger logger
           
 
Constructor Summary
UaServerNodeFactory(NodeManagerUaNode nodeManager)
           
 
Method Summary
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName)
          Create a new Node object based on the nodeClass (or typeDefinition).
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName, org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinition)
          Create a new Node object based on the nodeClass (or typeDefinition).
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName, org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
          Create a new Node object based on the nodeClass (or typeDefinition).
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale)
          Create a new Node object based on the nodeClass (or typeDefinition).
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale, org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
          Create a new Node object based on the nodeClass (or typeDefinition).
 UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale, org.opcfoundation.ua.builtintypes.NodeId typeDefinitionId)
           
 Class<? extends UaNode> getClassType(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinition)
          Return the object class corresponding to the NodeClass or Type.
 Class<? extends UaNode> getClassType(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
          Return the object class corresponding to the NodeClass or Type.
protected  Constructor<? extends UaNode> getConstructor(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
           
protected  Constructor<? extends UaNode> getConstructor(org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.NodeId typeId)
           
 void registerNodeClass(org.opcfoundation.ua.core.NodeClass nodeClass, Class<? extends UaNode> clazz)
          Register an actual UaNode class to use when using UaNodeFactory.createNode(org.opcfoundation.ua.core.NodeClass, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.QualifiedName, org.opcfoundation.ua.builtintypes.LocalizedText) to create new nodes for a OPC UA NodeClass.
 void registerTypeDefinition(org.opcfoundation.ua.builtintypes.NodeId typeDefinition, Class<? extends UaNode> clazz)
          Register an actual UaNode class to use when using UaNodeFactory.createNode(org.opcfoundation.ua.core.NodeClass, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.QualifiedName, org.opcfoundation.ua.builtintypes.LocalizedText) to create new nodes for a OPC UA typeDefinition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Constructor Detail

UaServerNodeFactory

public UaServerNodeFactory(NodeManagerUaNode nodeManager)
Method Detail

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                         org.opcfoundation.ua.builtintypes.LocalizedText displayName)
                  throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Create a new Node object based on the nodeClass (or typeDefinition).

The method creates a new UaNode object. The class of the Node is selected depending on the nodeClass - or if typeDefinition is provided, also on that.

You can register new Node classes per nodeClass or typeDefinition using UaNodeFactory.registerNodeClass(org.opcfoundation.ua.core.NodeClass, java.lang.Class).

Specified by:
createNode in interface UaNodeFactory
Parameters:
nodeClass - The UA NodeClass
nodeId - The ID of the new node.
browseName - The BrowseName of the new node.
displayName - The DisplayName of the new node.
Returns:
a new UaNode of a concrete class type (UaNode is abstract itself).
Throws:
UaNodeFactoryException - if the class cannot be created.

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                         org.opcfoundation.ua.builtintypes.LocalizedText displayName,
                         org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinition)
                  throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Create a new Node object based on the nodeClass (or typeDefinition).

The method creates a new UaNode object. The class of the Node is selected depending on the nodeClass - or if typeDefinition is provided, also on that.

You can register new Node classes per nodeClass or typeDefinition using UaNodeFactory.registerNodeClass(org.opcfoundation.ua.core.NodeClass, java.lang.Class).

Specified by:
createNode in interface UaNodeFactory
Parameters:
nodeClass - The UA NodeClass
nodeId - The ID of the new node.
browseName - The BrowseName of the new node.
displayName - The DisplayName of the new node.
typeDefinition - Optional type definition to use for the class selection.
Returns:
a new UaNode of a concrete class type (UaNode is abstract itself).
Throws:
UaNodeFactoryException - if the class cannot be created.

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                         org.opcfoundation.ua.builtintypes.LocalizedText displayName,
                         org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
                  throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Create a new Node object based on the nodeClass (or typeDefinition).

The method creates a new UaNode object. The class of the Node is selected depending on the nodeClass - or if typeDefinition is provided, also on that.

You can register new Node classes per nodeClass or typeDefinition using UaNodeFactory.registerNodeClass(org.opcfoundation.ua.core.NodeClass, java.lang.Class).

Specified by:
createNode in interface UaNodeFactory
Parameters:
nodeClass - The UA NodeClass
nodeId - The ID of the new node.
browseName - The BrowseName of the new node.
displayName - The DisplayName of the new node.
typeDefinition - Optional type definition to use for the class selection.
Returns:
a new UaNode of a concrete class type (UaNode is abstract itself).
Throws:
UaNodeFactoryException - if the class cannot be created.

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         String name,
                         Locale locale)
                  throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Create a new Node object based on the nodeClass (or typeDefinition).

The method creates a new UaNode object. The class of the Node is selected depending on the nodeClass - or if typeDefinition is provided, also on that.

You can register new Node classes per nodeClass or typeDefinition using UaNodeFactory.registerNodeClass(org.opcfoundation.ua.core.NodeClass, java.lang.Class).

Specified by:
createNode in interface UaNodeFactory
Parameters:
nodeClass - The UA NodeClass
nodeId - The ID of the new node.
name - The name of the new node. The BrowseName and DisplayName are initialized to this.
locale - The locale to use for the DisplayName.
Returns:
a new UaNode of a concrete class type (UaNode is abstract itself).
Throws:
UaNodeFactoryException - if the class cannot be created.

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         String name,
                         Locale locale,
                         org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)
                  throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Create a new Node object based on the nodeClass (or typeDefinition).

The method creates a new UaNode object. The class of the Node is selected depending on the nodeClass - or if typeDefinition is provided, also on that.

You can register new Node classes per nodeClass or typeDefinition using UaNodeFactory.registerNodeClass(org.opcfoundation.ua.core.NodeClass, java.lang.Class).

Specified by:
createNode in interface UaNodeFactory
Parameters:
nodeClass - The UA NodeClass
nodeId - The ID of the new node.
name - The name of the new node. The BrowseName and DisplayName are initialized to this.
locale - The locale to use for the DisplayName.
typeDefinitionId - The type definition of the node to create. If there is a specific class registered with the type, a node object of that type is created.
Returns:
a new UaNode of a concrete class type (UaNode is abstract itself).
Throws:
UaNodeFactoryException - if the class cannot be created.

createNode

public UaNode createNode(org.opcfoundation.ua.core.NodeClass nodeClass,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         String name,
                         Locale locale,
                         org.opcfoundation.ua.builtintypes.NodeId typeDefinitionId)
                  throws UaNodeFactoryException
Specified by:
createNode in interface UaNodeFactory
Returns:
Throws:
UaNodeFactoryException

getClassType

public Class<? extends UaNode> getClassType(org.opcfoundation.ua.core.NodeClass nodeClass,
                                            org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinition)
Description copied from interface: UaNodeFactory
Return the object class corresponding to the NodeClass or Type. Type has precedence, if there is a class registered for it.

You can create objects of this type with newInstance.

Use registerNodeClass to register custom classes.

Specified by:
getClassType in interface UaNodeFactory
Parameters:
nodeClass - UA NodeClass
typeDefinition - UA Type
Returns:
UaNode class matching the nodeClass or typeDefinition

getClassType

public Class<? extends UaNode> getClassType(org.opcfoundation.ua.core.NodeClass nodeClass,
                                            org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
Description copied from interface: UaNodeFactory
Return the object class corresponding to the NodeClass or Type. Type has precedence, if there is a class registered for it.

You can create objects of this type with newInstance.

Use registerNodeClass to register custom classes.

Specified by:
getClassType in interface UaNodeFactory
Parameters:
nodeClass - UA NodeClass
typeDefinition - UA Type
Returns:
UaNode class matching the nodeClass or typeDefinition

registerNodeClass

public void registerNodeClass(org.opcfoundation.ua.core.NodeClass nodeClass,
                              Class<? extends UaNode> clazz)
                       throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Register an actual UaNode class to use when using UaNodeFactory.createNode(org.opcfoundation.ua.core.NodeClass, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.QualifiedName, org.opcfoundation.ua.builtintypes.LocalizedText) to create new nodes for a OPC UA NodeClass.

These are registered by default

 registerNodeClass(NodeClass.Object, UaObject.class);
 registerNodeClass(NodeClass.Variable, UaVariable.class);
 registerNodeClass(NodeClass.Method, UaMethod.class);
 registerNodeClass(NodeClass.ObjectType, UaObjectType.class);
 registerNodeClass(NodeClass.VariableType, UaVariableType.class);
 registerNodeClass(NodeClass.ReferenceType, UaReferenceType.class);
 registerNodeClass(NodeClass.DataType, UaDataType.class);
 registerNodeClass(NodeClass.View, UaView.class);
 registerNodeClass(Identifiers.PropertyType, UaProperty.class);
 registerNodeClass(Identifiers.FolderType, UaFolder.class);
 

Specified by:
registerNodeClass in interface UaNodeFactory
Parameters:
nodeClass - the UA NodeClass
clazz - the UaNode class to use for the nodeClass. The class must define a public constructor with the parameters (NodeId, QualifiedName, LocalizedText).
Throws:
UaNodeFactoryException - if the clazz does not contain the valid public constructor

registerTypeDefinition

public void registerTypeDefinition(org.opcfoundation.ua.builtintypes.NodeId typeDefinition,
                                   Class<? extends UaNode> clazz)
                            throws UaNodeFactoryException
Description copied from interface: UaNodeFactory
Register an actual UaNode class to use when using UaNodeFactory.createNode(org.opcfoundation.ua.core.NodeClass, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.QualifiedName, org.opcfoundation.ua.builtintypes.LocalizedText) to create new nodes for a OPC UA typeDefinition.

Specified by:
registerTypeDefinition in interface UaNodeFactory
Parameters:
typeDefinition - the UA type definition, e.g. Identifiers.FolderType
clazz - the UaNode class to use for the nodeClass. The class must define a public constructor with the parameters (NodeId, QualifiedName, LocalizedText).
Throws:
UaNodeFactoryException - if the clazz does not contain the valid public constructor

getConstructor

protected Constructor<? extends UaNode> getConstructor(org.opcfoundation.ua.core.NodeClass nodeClass,
                                                       org.opcfoundation.ua.builtintypes.ExpandedNodeId typeDefinitionId)

getConstructor

protected Constructor<? extends UaNode> getConstructor(org.opcfoundation.ua.core.NodeClass nodeClass,
                                                       org.opcfoundation.ua.builtintypes.NodeId typeId)


Copyright © 2018. All rights reserved.