org.opcfoundation.ua.common
Class NamespaceTable

java.lang.Object
  extended by org.opcfoundation.ua.common.UriTable
      extended by org.opcfoundation.ua.common.NamespaceTable

public class NamespaceTable
extends UriTable

The table of name space URIs for a server. The table enables mapping between name space indexes and URIs. Use UriTable.add(java.lang.String) to add entries to the table. Use UriTable.getIndex(java.lang.String) to find the index of an URI or UriTable.getUri(int) to find the Uri of an index.


Field Summary
static String OPCUA_NAMESPACE
          Constant OPCUA_NAMESPACE="http://opcfoundation.org/UA/"
 
Constructor Summary
NamespaceTable()
          Constructor for NamespaceTable.
 
Method Summary
static NamespaceTable createFromArray(String[] namespaceArray)
          createFromArray.
static NamespaceTable getDefaultInstance()
          Getter for the field defaultInstance.
 boolean namespaceEquals(ExpandedNodeId expandedNodeId1, ExpandedNodeId expandedNodeId2)
          Check if the node IDs refer to the same name space.
 boolean namespaceEquals(NodeId nodeId, ExpandedNodeId expandedNodeId)
          Check if the node IDs refer to the same name space.
 boolean namespaceEquals(NodeId nodeId1, NodeId nodeId2)
          Check if the node IDs refer to the same name space.
 boolean nodeIdEquals(ExpandedNodeId n1, ExpandedNodeId n2)
          Compare 2 ExpandedNodeId objects.
 boolean nodeIdEquals(NodeId n1, ExpandedNodeId n2)
          Compare 1 ExpandedNodeId and 1 NodeId.
 ExpandedNodeId toExpandedNodeId(NodeId nodeId)
          Convert the nodeId to an ExpandedNodeId using the namespaceUris of the table
 NodeId toNodeId(ExpandedNodeId expandedNodeId)
          Convert the expandedNodeId to a NodeId using the name space indexes of the table
 
Methods inherited from class org.opcfoundation.ua.common.UriTable
add, add, addAll, getIndex, getUri, remove, remove, size, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPCUA_NAMESPACE

public static String OPCUA_NAMESPACE
Constant OPCUA_NAMESPACE="http://opcfoundation.org/UA/"

Constructor Detail

NamespaceTable

public NamespaceTable()

Constructor for NamespaceTable.

Method Detail

createFromArray

public static NamespaceTable createFromArray(String[] namespaceArray)

createFromArray.

Parameters:
namespaceArray - an array of String objects.
Returns:
a NamespaceTable object.

nodeIdEquals

public boolean nodeIdEquals(ExpandedNodeId n1,
                            ExpandedNodeId n2)
Compare 2 ExpandedNodeId objects. This method is intended for cases where one ExpandedNodeId is defined with NamespaceUri and another is defined with NamespaceIndex.

Parameters:
n1 - first
n2 - second
Returns:
true if they are equal

nodeIdEquals

public boolean nodeIdEquals(NodeId n1,
                            ExpandedNodeId n2)
Compare 1 ExpandedNodeId and 1 NodeId. This method is intended for cases where the ExpandedNodeId is defined with NamespaceUri and a comparison to NodeId which has NamespaceIndex is wanted.

Parameters:
n1 - first
n2 - second
Returns:
true if they are equal

toExpandedNodeId

public ExpandedNodeId toExpandedNodeId(NodeId nodeId)
Convert the nodeId to an ExpandedNodeId using the namespaceUris of the table

Parameters:
nodeId - the node ID
Returns:
The respective ExpandedNodeId

toNodeId

public NodeId toNodeId(ExpandedNodeId expandedNodeId)
                throws ServiceResultException
Convert the expandedNodeId to a NodeId using the name space indexes of the table

Parameters:
expandedNodeId - the expanded node ID
Returns:
The respective NodeId
Throws:
ServiceResultException - if there is no entry for the namespaceUri used in the expandedNodeId

namespaceEquals

public boolean namespaceEquals(NodeId nodeId1,
                               NodeId nodeId2)
Check if the node IDs refer to the same name space. Compares the NamespaceIndex of the IDs.

Parameters:
nodeId1 - a NodeId object.
nodeId2 - a NodeId object.
Returns:
true if the nodes are in the same name space

namespaceEquals

public boolean namespaceEquals(NodeId nodeId,
                               ExpandedNodeId expandedNodeId)
Check if the node IDs refer to the same name space. The expandedNodeId is checked for the NamespaceUri or Index depending on which is used.

Parameters:
nodeId - a NodeId object.
expandedNodeId - a ExpandedNodeId object.
Returns:
true if the nodes are in the same name space

namespaceEquals

public boolean namespaceEquals(ExpandedNodeId expandedNodeId1,
                               ExpandedNodeId expandedNodeId2)
Check if the node IDs refer to the same name space. The expandedNodeIds are checked for the NamespaceUri or Index depending on which is used.

Parameters:
expandedNodeId1 - a ExpandedNodeId object.
expandedNodeId2 - a ExpandedNodeId object.
Returns:
true if the nodes are in the same name space

getDefaultInstance

public static NamespaceTable getDefaultInstance()

Getter for the field defaultInstance.

Returns:
a default instance which can be used when no other namespace table is available. DO NOT use, if you have a valid application context with an initialized namespace table available.


Copyright © 2018. All rights reserved.