com.prosysopc.ua.client
Class AddressSpace

java.lang.Object
  extended by com.prosysopc.ua.client.AddressSpace
All Implemented Interfaces:
UaAddressSpace

public class AddressSpace
extends Object
implements UaAddressSpace

OPC UA Address Space. The address space is used to browse the server address space from a client. You create the address space with a reference to the server. You can define the browsing parameters and call browse with a NodeId to node data and references for that node.

You should normally use the default object, available from UaClient.getAddressSpace().

Alternatively, you can call browse with custom BrowseDescription(s).

The AddressSpace also contains a NodeCache, which you can access to get better support for server nodes, especially the type information. Use, for example, getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId), getType(org.opcfoundation.ua.builtintypes.NodeId) and getMethod(org.opcfoundation.ua.builtintypes.ExpandedNodeId) to get access to the cached nodes.

You can also access the View Services from the AddressSpace. This includes translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath...), translateBrowsePathToNodeId(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.core.RelativePathElement...), registerNodes(org.opcfoundation.ua.builtintypes.NodeId...) and unregisterNodes(org.opcfoundation.ua.builtintypes.NodeId...).


Constructor Summary
AddressSpace(UaClient client)
          Create a new address space using the client connection.
 
Method Summary
 org.opcfoundation.ua.builtintypes.NodeId addNode(org.opcfoundation.ua.core.AddNodesItem node)
          Add a new node to the server.
 org.opcfoundation.ua.builtintypes.NodeId addNode(org.opcfoundation.ua.builtintypes.NodeId parentNodeId, org.opcfoundation.ua.builtintypes.NodeId referenceTypeId, org.opcfoundation.ua.builtintypes.NodeId newNodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.core.NodeAttributes nodeAttributes, org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
          Add a new node to the server.
 void addNode(UaNode node)
          Add a UaNode to the address space.
 org.opcfoundation.ua.core.AddNodesResult[] addNodes(org.opcfoundation.ua.core.AddNodesItem... nodes)
          Add new nodes to the server via the AddNodes service call.
 void addReference(org.opcfoundation.ua.core.AddReferencesItem reference)
          Add a new reference to the server.
 org.opcfoundation.ua.builtintypes.StatusCode[] addReferences(org.opcfoundation.ua.core.AddReferencesItem... references)
          Add new references to the server via the AddReferences service call.
 List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Browse a single node using the browse settings defined in the class.
 List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.core.BrowseDirection direction, org.opcfoundation.ua.builtintypes.NodeId referenceType, boolean includeSubTypes, org.opcfoundation.ua.core.NodeClass... nodeClasses)
          Browse all references of the specified type from the specified node.
 List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Browse a single node using the browse settings defined in the class.
protected  List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.BrowseDescription browseDescription)
           
 List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.BrowseDirection direction, org.opcfoundation.ua.builtintypes.NodeId referenceType)
          Browse all references of the specified type from the specified node.
 List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.BrowseDirection direction, org.opcfoundation.ua.builtintypes.NodeId referenceType, boolean includeSubTypes, org.opcfoundation.ua.core.NodeClass... nodeClasses)
          Browse all references of the specified type from the specified node.
 org.opcfoundation.ua.core.BrowseResult[] browse(org.opcfoundation.ua.core.ViewDescription view, int maxRequestedReferencesPerNode, org.opcfoundation.ua.core.BrowseDescription... nodesToBrowse)
          Browses the server address space using several, different browse descriptions at the same time.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Browses the server address space using several, different browse descriptions at the same time.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Browses the server address space using several, different browse descriptions at the same time.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.core.ViewDescription view, int maxRequestedReferencesPerNode, org.opcfoundation.ua.core.BrowseDescription... nodesToBrowse)
          Browses the server address space using several, different browse descriptions at the same time.
 List<org.opcfoundation.ua.core.ReferenceDescription> browseMethods(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Browse references to object methods.This performs a browse to HasComponent references ending to Method node classes.
 List<org.opcfoundation.ua.core.ReferenceDescription> browseMethods(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Browse references to object methods.This performs a browse to HasComponent references ending to Method node classes.
 org.opcfoundation.ua.core.BrowseResult[] browseNext(boolean releaseContinuationPoints, byte[]... continuationPoints)
          Continue a browse operation that was to be continued.
 org.opcfoundation.ua.core.BrowseResult[] browseNext(boolean releaseContinuationPoints, org.opcfoundation.ua.builtintypes.ByteString... continuationPoints)
          Continue a browse operation that was to be continued.
 List<org.opcfoundation.ua.core.ReferenceDescription> browseUp(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Browse up in the address space hierarchy.
 List<org.opcfoundation.ua.core.ReferenceDescription> browseUp(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Browse up in the address space hierarchy.
 org.opcfoundation.ua.core.BrowseDescription defaultBrowseDescription(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Get the default browse description, used by the browse calls.
 void deleteNode(org.opcfoundation.ua.core.DeleteNodesItem node)
          Delete a node from the server.
 org.opcfoundation.ua.builtintypes.StatusCode[] deleteNodes(org.opcfoundation.ua.core.DeleteNodesItem... nodes)
          Delete nodes from the server via the DeleteNodes service call.
 void deleteReference(org.opcfoundation.ua.core.DeleteReferencesItem reference)
          Delete a reference from the server.
 org.opcfoundation.ua.builtintypes.StatusCode[] deleteReferences(org.opcfoundation.ua.core.DeleteReferencesItem... references)
          Delete new references to the server via the DeleteReferences service call.
 UaNode findNode(org.opcfoundation.ua.builtintypes.NodeId id)
          Find a (@link UaNode) corresponding to the given (@link NodeId).
 org.opcfoundation.ua.core.BrowseDirection getBrowseDirection()
           
 NodeCache getCache()
          The node Cache which is used to keep UaNode objects retrieved from the server in a client side cache.
 UaClient getClient()
           
 DataTypeConverter getDataTypeConverter()
          Get the DataTypeConverter.
 org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
           
 org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxDataSetsPerQuery()
           
 org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxReferencesPerNode()
           
 UaMethod getMethod(org.opcfoundation.ua.builtintypes.ExpandedNodeId methodId)
          Get an UA method definition from the server.
 UaMethod getMethod(org.opcfoundation.ua.builtintypes.NodeId methodId)
          Get an UA method definition from the server.
 UaMethod getMethodByName(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName methodName)
          Get a method with methodName of a node.
 List<UaMethod> getMethods(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Get all methods of an object node.
 org.opcfoundation.ua.common.NamespaceTable getNamespaceTable()
          Return the (@link NamespaceTable) associated with the (@link UaAddressSpace).
 UaNode getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Finds the node object, corresponding to the NodeId. the method simply converts nodeId to NodeId and calls getNode(NodeId).
<T extends UaNode>
T
getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, Class<T> clazz)
          Convenience method for getNode(ExpandedNodeId) which automatically casts the result to the requested class.
 UaNode getNode(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Finds the node object, corresponding to the NodeId.
<T extends UaNode>
T
getNode(org.opcfoundation.ua.builtintypes.NodeId nodeId, Class<T> clazz)
          Convenience method for getNode(ExpandedNodeId) which automatically casts the result to the requested class.
 EnumSet<org.opcfoundation.ua.core.NodeClass> getNodeClassSet()
          Filter by NodeClass.
 UaNode[] getNodes(org.opcfoundation.ua.builtintypes.NodeId... nodeIds)
           
 org.opcfoundation.ua.builtintypes.NodeId getReferenceTypeId()
           
 EnumSet<org.opcfoundation.ua.core.BrowseResultMask> getResultMaskSet()
          Filter by browse results.
 org.opcfoundation.ua.common.ServerTable getServerTable()
           
 UaType getType(org.opcfoundation.ua.builtintypes.NodeId typeId)
          Get a Type node.
 org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeDefinition(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Browse for a type definition of a node.
 org.opcfoundation.ua.core.ViewDescription getView()
          Filter by view.
 Boolean isIncludeSubTypes()
           
 void loadModel(InputStream inputStream)
          Load an Information Model into the client.
 void loadModel(InputStream inputStream, Collection<org.opcfoundation.ua.builtintypes.ExpandedNodeId> ignoredNodes, boolean failOnFirstError)
          Load an Information Model into the client.
 void loadModel(URI path)
          Load an Information Model into the client.
 void loadModel(URI path, Collection<org.opcfoundation.ua.builtintypes.ExpandedNodeId> ignoredNodes, boolean failOnFirstError)
          Load an Information Model into the server.
 org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes, org.opcfoundation.ua.core.ContentFilter filter)
           
 org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes, org.opcfoundation.ua.core.ContentFilter filter, org.opcfoundation.ua.builtintypes.UnsignedInteger maxDataSetsToReturn, org.opcfoundation.ua.builtintypes.UnsignedInteger maxReferencesToReturn)
           
protected  org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.ViewDescription view, org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes, org.opcfoundation.ua.core.ContentFilter filter, org.opcfoundation.ua.builtintypes.UnsignedInteger maxDataSetsToReturn, org.opcfoundation.ua.builtintypes.UnsignedInteger maxReferencesToReturn)
           
 org.opcfoundation.ua.core.QueryFirstResponse queryFirst(org.opcfoundation.ua.core.NodeTypeDescription[] NodeTypes, org.opcfoundation.ua.core.ContentFilter Filter)
           
 org.opcfoundation.ua.core.QueryFirstResponse queryFirst(org.opcfoundation.ua.core.QueryFirstRequest request)
           
 org.opcfoundation.ua.core.QueryNextResponse queryNext(boolean releaseContinuationPoints, byte[] continuationPoint)
           
 org.opcfoundation.ua.core.QueryNextResponse queryNext(boolean releaseContinuationPoints, org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
           
 org.opcfoundation.ua.builtintypes.StatusCode[] readAttributes(UaNode node, org.opcfoundation.ua.builtintypes.UnsignedInteger... attributes)
          Reads the values for the specified node attributes and sets the respective values in the node object.
 void readComponents(UaNode node)
          Read all components of a node from the server to the cache.
 void readNode(UaNode node)
          Reads the values for all node attributes and sets the respective values in the node object.
 void readProperties(UaNode node)
          Read values of all properties of a node.
 void readReferences(UaNode node, org.opcfoundation.ua.builtintypes.NodeId referenceTypeId, org.opcfoundation.ua.core.BrowseDirection direction, boolean includeSubTypes)
          Read the references of a node.
 org.opcfoundation.ua.builtintypes.NodeId[] registerNodes(org.opcfoundation.ua.builtintypes.NodeId... nodesToRegister)
          Register often used nodes in the server for quick access.
 void setBrowseDirection(org.opcfoundation.ua.core.BrowseDirection browseDirection)
          Set the default browse direction to use in the normal browse operations.
 void setIncludeSubTypes(Boolean includeSubTypes)
          Set the default setting for includeSubTypes in the normal browse operations.
 void setMaxDataSetsPerQuery(int value)
          Set the default maximum number of datasets to request per one internal query call to the server
 void setMaxReferencesPerNode(int value)
          Set the default maximum number of references to request per one internal browse/query call to the server.
 void setNodeClassSet(EnumSet<org.opcfoundation.ua.core.NodeClass> nodeClassSet)
          Set the default node classes to request in the browse operations.
 void setReferenceTypeId(org.opcfoundation.ua.builtintypes.NodeId referenceTypeId)
          Set the default reference types to request in the browse operations.
 void setResultMaskSet(EnumSet<org.opcfoundation.ua.core.BrowseResultMask> resultMaskSet)
          Set the default result types to request in the browse operations.
 void setView(org.opcfoundation.ua.core.ViewDescription view)
          Set the default view to use in the browse operations.
 org.opcfoundation.ua.core.BrowsePathResult[] translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath... browsePaths)
          Request the NodeIds for the nodes that are references from the startingNode using paths.
 org.opcfoundation.ua.core.BrowsePathResult[] translateBrowsePathsToNodeIds(org.opcfoundation.ua.builtintypes.NodeId startingNode, org.opcfoundation.ua.core.RelativePath... paths)
          Request the NodeIds for the nodes that are references from the startingNode using paths.
 org.opcfoundation.ua.core.BrowsePathTarget[] translateBrowsePathToNodeId(org.opcfoundation.ua.builtintypes.NodeId startingNode, org.opcfoundation.ua.core.RelativePathElement... elements)
          Translate a single browse path to a NodeId.
 org.opcfoundation.ua.builtintypes.NodeId[] unregisterAllNodes()
          Unregister all previously registered Nodes.
 void unregisterNodes(org.opcfoundation.ua.builtintypes.NodeId... nodesToUnregister)
          This Service is used to unregister NodeIds that have been obtained via registerNodes(org.opcfoundation.ua.builtintypes.NodeId...).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressSpace

public AddressSpace(UaClient client)
Create a new address space using the client connection. Note that the client already defines a default address space, which you should normally use.

Parameters:
client -
See Also:
UaClient.getAddressSpace()
Method Detail

addNode

public org.opcfoundation.ua.builtintypes.NodeId addNode(org.opcfoundation.ua.core.AddNodesItem node)
                                                 throws ServiceException,
                                                        StatusException
Add a new node to the server.

Note:Use addNodes(AddNodesItem...) to add several nodes at once. Use this method only when you are adding single nodes.

Parameters:
node - the node to add
Returns:
the NodeId of the added node
Throws:
ServiceException - if the service call fails
StatusException - if the operation fails, for example due to insufficient access rights
See Also:
addNodes(AddNodesItem...)

addNode

public org.opcfoundation.ua.builtintypes.NodeId addNode(org.opcfoundation.ua.builtintypes.NodeId parentNodeId,
                                                        org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
                                                        org.opcfoundation.ua.builtintypes.NodeId newNodeId,
                                                        org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                                                        org.opcfoundation.ua.core.NodeClass nodeClass,
                                                        org.opcfoundation.ua.core.NodeAttributes nodeAttributes,
                                                        org.opcfoundation.ua.builtintypes.NodeId typeDefinition)
                                                 throws ServiceException,
                                                        org.opcfoundation.ua.encoding.EncodingException,
                                                        StatusException
Add a new node to the server.

Parameters:
parentNodeId - parent for the node
referenceTypeId - reference type for the Reference between the new node and the parent
newNodeId - requested NodeId, check the result for actual NodeId assigned by the server
browseName - BrowseName for the new node
nodeClass - NodeClass of the new node
nodeAttributes - Attributes for the node, this object should be instance of XXXAttributes where XXX is the NodeClass of the node (e.g. for a Variable node, it should be VariableAttributes)
typeDefinition - TypeDefinition of the new node
Returns:
NodeId for the node assigned by the server
Throws:
ServiceException - if the call to server fails or the server does not support the service
org.opcfoundation.ua.encoding.EncodingException - if NodeAttributes cannot
StatusException - if the adding failed due to an operation level error

addNode

public void addNode(UaNode node)
Add a UaNode to the address space.

Specified by:
addNode in interface UaAddressSpace
Parameters:
node - that is added
See Also:
addNodes(org.opcfoundation.ua.core.AddNodesItem...), addNode(AddNodesItem)

addNodes

public org.opcfoundation.ua.core.AddNodesResult[] addNodes(org.opcfoundation.ua.core.AddNodesItem... nodes)
                                                    throws ServiceException
Add new nodes to the server via the AddNodes service call.

Parameters:
nodes - the nodes to add
Returns:
the results of the addition
Throws:
ServiceException - if the service call fails

addReference

public void addReference(org.opcfoundation.ua.core.AddReferencesItem reference)
                  throws ServiceException,
                         StatusException
Add a new reference to the server.

Note:Use addReferences(AddReferencesItem...) to add several references at once. Use this method only when you are adding single references.

Parameters:
reference - the reference to add
Throws:
ServiceException - if the service call fails
StatusException - if the operation fails, for example due to insufficient access rights
See Also:
addReferences(AddReferencesItem...)

addReferences

public org.opcfoundation.ua.builtintypes.StatusCode[] addReferences(org.opcfoundation.ua.core.AddReferencesItem... references)
                                                             throws ServiceException
Add new references to the server via the AddReferences service call.

Parameters:
references - the references to add
Returns:
the results of the addition
Throws:
ServiceException - if the service call fails
ServiceException

browse

public List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
                                                            throws ServiceException,
                                                                   StatusException
Browse a single node using the browse settings defined in the class.

Parameters:
nodeId - The Node to browse.
Returns:
All references of the browse node.
Throws:
ServiceException
StatusException

browse

public List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                                   org.opcfoundation.ua.core.BrowseDirection direction,
                                                                   org.opcfoundation.ua.builtintypes.NodeId referenceType,
                                                                   boolean includeSubTypes,
                                                                   org.opcfoundation.ua.core.NodeClass... nodeClasses)
                                                            throws ServiceException,
                                                                   StatusException
Browse all references of the specified type from the specified node. The property ResultMaskSet is used to filter the fields to return.

Parameters:
nodeId - the Node
direction - browse direction
referenceType - the types of reference to browse
includeSubTypes - should the possible sub reference types be included
nodeClasses - node classes to include
Returns:
list of reference descriptions
Throws:
ServiceException
StatusException

browse

public List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                            throws ServiceException,
                                                                   StatusException
Browse a single node using the browse settings defined in the class.

Parameters:
nodeId - The Node to browse. Use Identifiers.RootFolder to browse the root node.
Returns:
All references of the browse node.
Throws:
ServiceException
StatusException

browse

public List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                   org.opcfoundation.ua.core.BrowseDirection direction,
                                                                   org.opcfoundation.ua.builtintypes.NodeId referenceType)
                                                            throws ServiceException,
                                                                   StatusException
Browse all references of the specified type from the specified node. The property ResultMaskSet is used to filter the fields to return.

Parameters:
nodeId - the Node
direction - browse direction
referenceType - the types of reference to browse
Returns:
list of reference descriptions
Throws:
ServiceException
StatusException

browse

public List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                   org.opcfoundation.ua.core.BrowseDirection direction,
                                                                   org.opcfoundation.ua.builtintypes.NodeId referenceType,
                                                                   boolean includeSubTypes,
                                                                   org.opcfoundation.ua.core.NodeClass... nodeClasses)
                                                            throws ServiceException,
                                                                   StatusException
Browse all references of the specified type from the specified node. The property ResultMaskSet is used to filter the fields to return.

Parameters:
nodeId - the Node
direction - browse direction
referenceType - the types of reference to browse
includeSubTypes - should the possible sub reference types be included
nodeClasses - node classes to include
Returns:
list of reference descriptions
Throws:
ServiceException
StatusException

browse

public org.opcfoundation.ua.core.BrowseResult[] browse(org.opcfoundation.ua.core.ViewDescription view,
                                                       int maxRequestedReferencesPerNode,
                                                       org.opcfoundation.ua.core.BrowseDescription... nodesToBrowse)
                                                throws ServiceException
Browses the server address space using several, different browse descriptions at the same time. Note that you may need to call browseNext, if the server results continuation points in the results for some of the requests.

Parameters:
view - Description of the View to browse (see Clause 7.37 for ViewDescription definition). An empty ViewDescription value indicates the entire AddressSpace. Use of the empty ViewDescription value causes all References of the nodeToBrowse to be returned. Use of any other View causes only the References of the nodeToBrowse that are defined for that View to be returned.
maxRequestedReferencesPerNode - Indicates the maximum number of references to return for each starting Node specified in the request. The value 0 indicates that the Client is imposing no limitation.
nodesToBrowse - A list of nodes to Browse and settings for each.
Returns:
results of the browse operations
Throws:
ServiceException - When the server returns a bad ServiceResult code for the service call. The following result codes are expected: Bad_ViewIdUnknown, Bad_NothingToDo, Bad_TooManyOperations

browseAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
                                                                                                          throws ServiceException
Browses the server address space using several, different browse descriptions at the same time. The method returns immediately and lets the browse call to terminate asynchronously.

Parameters:
nodeId - The node to Browse.
Returns:
The asynchronous monitor, which will provide the response, when available. You can poll it, set a listener or wait for the result (or error).
Throws:
ServiceException

browseAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                                                                          throws ServiceException
Browses the server address space using several, different browse descriptions at the same time. The method returns immediately and lets the browse call to terminate asynchronously.

Parameters:
nodeId - The node to Browse.
Returns:
The asynchronous monitor, which will provide the response, when available. You can poll it, set a listener or wait for the result (or error).
Throws:
ServiceException

browseAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> browseAsync(org.opcfoundation.ua.core.ViewDescription view,
                                                                                                                 int maxRequestedReferencesPerNode,
                                                                                                                 org.opcfoundation.ua.core.BrowseDescription... nodesToBrowse)
                                                                                                          throws ServiceException
Browses the server address space using several, different browse descriptions at the same time. The method returns immediately and lets the browse call to terminate asynchronously.

Parameters:
view - Description of the View to browse (see Clause 7.37 for ViewDescription definition). An empty ViewDescription value indicates the entire AddressSpace. Use of the empty ViewDescription value causes all References of the nodeToBrowse to be returned. Use of any other View causes only the References of the nodeToBrowse that are defined for that View to be returned.
maxRequestedReferencesPerNode - Indicates the maximum number of references to return for each starting Node specified in the request. The value 0 indicates that the Client is imposing no limitation.
nodesToBrowse - A list of nodes to Browse and settings for each.
Returns:
A service request handle which you can monitor to check that status of the call
Throws:
ServiceException - if the asynchronous call fails

browseMethods

public List<org.opcfoundation.ua.core.ReferenceDescription> browseMethods(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
                                                                   throws ServiceException,
                                                                          StatusException
Browse references to object methods.This performs a browse to HasComponent references ending to Method node classes.

Parameters:
nodeId - The object to browse from
Returns:
list of reference descriptions received from the server
Throws:
ServiceException - if the service call fails
StatusException - if the browse result is bad
See Also:
getMethods(org.opcfoundation.ua.builtintypes.NodeId)

browseMethods

public List<org.opcfoundation.ua.core.ReferenceDescription> browseMethods(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                                   throws ServiceException,
                                                                          StatusException
Browse references to object methods.This performs a browse to HasComponent references ending to Method node classes.

Parameters:
nodeId - The object to browse from
Returns:
list of reference descriptions received from the server
Throws:
ServiceException - if the service call fails
StatusException - if the browse result is bad
See Also:
getMethods(org.opcfoundation.ua.builtintypes.NodeId)

browseNext

public org.opcfoundation.ua.core.BrowseResult[] browseNext(boolean releaseContinuationPoints,
                                                           byte[]... continuationPoints)
                                                    throws ServiceException
Continue a browse operation that was to be continued.

Parameters:
releaseContinuationPoints - release the specified continuation points without retrieving the next set of references
continuationPoints - the continuation points returned by the previous browse requests
Returns:
results of the browse operations, if releaseContinuationPoint is defined, the results will not contain any references. Check the StatusCode of each BrowseResult to see the result for each continuationPoint
Throws:
ServiceException - if the service call fails

browseNext

public org.opcfoundation.ua.core.BrowseResult[] browseNext(boolean releaseContinuationPoints,
                                                           org.opcfoundation.ua.builtintypes.ByteString... continuationPoints)
                                                    throws ServiceException
Continue a browse operation that was to be continued.

Parameters:
releaseContinuationPoints - release the specified continuation points without retrieving the next set of references
continuationPoints - the continuation points returned by the previous browse requests
Returns:
results of the browse operations, if releaseContinuationPoint is defined, the results will not contain any references. Check the StatusCode of each BrowseResult to see the result for each continuationPoint
Throws:
ServiceException - if the service call fails

browseUp

public List<org.opcfoundation.ua.core.ReferenceDescription> browseUp(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
                                                              throws ServerConnectionException,
                                                                     ServiceException,
                                                                     org.opcfoundation.ua.common.ServiceResultException,
                                                                     StatusException
Browse up in the address space hierarchy.

Parameters:
nodeId - the node to browse from
Returns:
list of inverse hierarchical references from nodeId, i.e. the parent(s). The list may contain 0 to any number of references - typically just one, considering that the address space is a simple tree structure.
Throws:
ServiceException - if the browse service call to the server fails
ServerConnectionException - if the client is not connected to a server
StatusException - if the NamespaceTable is not available
org.opcfoundation.ua.common.ServiceResultException - if the node cannot be converted to a NodeId

browseUp

public List<org.opcfoundation.ua.core.ReferenceDescription> browseUp(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                              throws ServerConnectionException,
                                                                     ServiceException
Browse up in the address space hierarchy.

Parameters:
nodeId - the node to browse from
Returns:
list of inverse hierarchical references from nodeId, i.e. the parent(s). The list may contain 0 to any number of references - typically just one, considering that the address space is a simple tree structure.
Throws:
ServiceException - if the browse service call to the server fails
ServerConnectionException - if the client is not connected to a server

defaultBrowseDescription

public org.opcfoundation.ua.core.BrowseDescription defaultBrowseDescription(org.opcfoundation.ua.builtintypes.NodeId nodeId)
Get the default browse description, used by the browse calls.

Parameters:
nodeId -
Returns:
the default BrowseDescription, defined by the properties BrowseDirection, referenceTypeId, IncludeSubTypes, NodeClassMask and ResultMask.

deleteNode

public void deleteNode(org.opcfoundation.ua.core.DeleteNodesItem node)
                throws ServiceException,
                       StatusException
Delete a node from the server.

Note:Use deleteNodes(DeleteNodesItem...) to delete several nodes at once. Use this method only when you are deleting single nodes.

Parameters:
node - the node to delete
Throws:
ServiceException - if the service call fails
StatusException - if the operation fails, for example due to insufficient access rights
See Also:
deleteNodes(DeleteNodesItem...)

deleteNodes

public org.opcfoundation.ua.builtintypes.StatusCode[] deleteNodes(org.opcfoundation.ua.core.DeleteNodesItem... nodes)
                                                           throws ServiceException
Delete nodes from the server via the DeleteNodes service call.

Parameters:
nodes - the nodes to delete
Returns:
the results of the deletion
Throws:
ServiceException - if the service call fails

deleteReference

public void deleteReference(org.opcfoundation.ua.core.DeleteReferencesItem reference)
                     throws ServiceException,
                            StatusException
Delete a reference from the server.

Note:Use deleteReferences(DeleteReferencesItem...) to delete several references at once. Use this method only when you are deleting single references.

Parameters:
reference - the reference to delete
Throws:
ServiceException - if the service call fails
StatusException - if the operation fails, for example due to insufficient access rights
See Also:
deleteReferences(DeleteReferencesItem...)

deleteReferences

public org.opcfoundation.ua.builtintypes.StatusCode[] deleteReferences(org.opcfoundation.ua.core.DeleteReferencesItem... references)
                                                                throws ServiceException
Delete new references to the server via the DeleteReferences service call.

Parameters:
references - the references to delete
Returns:
the results of the deletion
Throws:
ServiceException - if the service call fails
ServiceException

findNode

public UaNode findNode(org.opcfoundation.ua.builtintypes.NodeId id)
Find a (@link UaNode) corresponding to the given (@link NodeId).

Specified by:
findNode in interface UaAddressSpace
Parameters:
id - of the (@link UaNode) that is searched for
Returns:
the found (@link UaNode) or null if not found

getBrowseDirection

public org.opcfoundation.ua.core.BrowseDirection getBrowseDirection()
Returns:
the BrowseDirection to use in normal browse calls.

getCache

public NodeCache getCache()
The node Cache which is used to keep UaNode objects retrieved from the server in a client side cache. You should use the methods of the AddressSpace (getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId), getType(org.opcfoundation.ua.builtintypes.NodeId), getMethod(org.opcfoundation.ua.builtintypes.ExpandedNodeId)) to access the nodes in the cache. But you can define the cache parameters directly to the cache.

Returns:
the node cache

getClient

public UaClient getClient()
Returns:
the client connection to use for browsing.

getDataTypeConverter

public DataTypeConverter getDataTypeConverter()
Get the DataTypeConverter. Note that calling this before the client has connected returns null.

Specified by:
getDataTypeConverter in interface UaAddressSpace
Returns:
The converter or null if the client is not connected

getEncoderContext

public org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
Specified by:
getEncoderContext in interface UaAddressSpace
Returns:
the encoder context, which is used for mapping namespaces and nodeIds in the stack layer.

getMaxDataSetsPerQuery

public org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxDataSetsPerQuery()

getMaxReferencesPerNode

public org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxReferencesPerNode()
Returns:
maximum number of references per node to request in normal browse calls.
See Also:
setMaxReferencesPerNode(int)

getMethod

public UaMethod getMethod(org.opcfoundation.ua.builtintypes.ExpandedNodeId methodId)
                   throws ServiceException,
                          AddressSpaceException,
                          StatusException,
                          org.opcfoundation.ua.common.ServiceResultException
Get an UA method definition from the server. If the method has already been retrieved and is available from the NodeCache, that is returned directly.

Will call getMethod(NodeId) with a methodId converted to NodeId using the NamespaceTable.

Parameters:
methodId - the NodeId of the method
Returns:
the method object, if the NodeId refers to a method
Throws:
AddressSpaceException - if the nodeId does not refer to a valid method node
ServiceException
StatusException
org.opcfoundation.ua.common.ServiceResultException

getMethod

public UaMethod getMethod(org.opcfoundation.ua.builtintypes.NodeId methodId)
                   throws ServiceException,
                          AddressSpaceException,
                          StatusException
Get an UA method definition from the server. If the method has already been retrieved and is available from the NodeCache, that is returned directly.

Parameters:
methodId - the NodeId of the method
Returns:
the method object, if the NodeId refers to a method
Throws:
AddressSpaceException - if the nodeId does not refer to a valid method node
ServiceException
StatusException

getMethodByName

public UaMethod getMethodByName(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                org.opcfoundation.ua.builtintypes.QualifiedName methodName)
                         throws ServiceException,
                                AddressSpaceException,
                                StatusException,
                                org.opcfoundation.ua.common.ServiceResultException
Get a method with methodName of a node.

Parameters:
nodeId - the ID of the node whose method we are searching.
methodName - the name of the method to find.
Returns:
the method node or null, if such cannot be found
Throws:
org.opcfoundation.ua.common.ServiceResultException - if the method exists, but it is an external node, on another server
StatusException - if the browse call fails
AddressSpaceException - if the node cannot be initialized
ServiceException - if the service call to the server fails

getMethods

public List<UaMethod> getMethods(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                          throws ServiceException,
                                 StatusException,
                                 AddressSpaceException
Get all methods of an object node. Browses the server for references to method nodes and returns the respective UaMethod nodes (from the node cache, if they have already been retrieved).

Parameters:
nodeId - the ID of the object node.
Returns:
list of methods referred by the node with forward HasComponent references.
Throws:
StatusException - if the browse result is bad
ServiceException - if the browse call fails
AddressSpaceException - if the nodes cannot be created. Use browseMethods in this case to get a list of the references only.
See Also:
browseMethods(org.opcfoundation.ua.builtintypes.ExpandedNodeId)

getNamespaceTable

public org.opcfoundation.ua.common.NamespaceTable getNamespaceTable()
Description copied from interface: UaAddressSpace
Return the (@link NamespaceTable) associated with the (@link UaAddressSpace).

Specified by:
getNamespaceTable in interface UaAddressSpace
Returns:
the NamespaceTable of the server - equals to getClient().getNamespaceTable().

getNode

public UaNode getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
               throws ServiceException,
                      AddressSpaceException
Finds the node object, corresponding to the NodeId. the method simply converts nodeId to NodeId and calls getNode(NodeId).

Specified by:
getNode in interface UaAddressSpace
Parameters:
nodeId - the nodeId - this must be a local node as it is requested from the server using getNode(NodeId). Or null, if nodeId is null (or NodeId.NULL).
Returns:
the Node object. The object is fetched from the node cache or created, if not found from there.
Throws:
AddressSpaceException - if the NodeClass of the node to read cannot be determined or is invalid.
ServiceException - if the service call fails

getNode

public <T extends UaNode> T getNode(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                    Class<T> clazz)
                         throws ServiceException,
                                AddressSpaceException
Convenience method for getNode(ExpandedNodeId) which automatically casts the result to the requested class. A ClassCastException is wrapped to a AddressSpaceException if the node is not of the requested type. Make sure that you have registered the classes (or InformationModels) to the UaClient to ensure that the correct node classes are used.

Specified by:
getNode in interface UaAddressSpace
Parameters:
nodeId - the nodeId - this must be a local node as it is requested from the server using getNode(NodeId).
clazz - the type of the node to request.
Returns:
the Node object. The object is fetched from the node cache or created, if not found from there. Returns null, if nodeId is null (or NodeId.NULL).
Throws:
AddressSpaceException - if the NodeClass of the node to read cannot be determined or is invalid or cannot be cast to the requested type.
ServiceException - if the service call fails

getNode

public UaNode getNode(org.opcfoundation.ua.builtintypes.NodeId nodeId)
               throws ServiceException,
                      AddressSpaceException
Finds the node object, corresponding to the NodeId.

Uses an internal node cache to look for the node. If the cache does not contain the node, reads the node information from the server and creates a new node of the correct type.

The node is created using UaClientNodeFactory.createNode(org.opcfoundation.ua.core.NodeClass, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.QualifiedName, org.opcfoundation.ua.builtintypes.LocalizedText) with the value of the NodeClass attribute. Once that is done, all other attributes that are supported by the node class are read and set to the object.

Also browses the properties of the node and initializes the Properties into the node object using readProperties(com.prosysopc.ua.nodes.UaNode).

Specified by:
getNode in interface UaAddressSpace
Parameters:
nodeId - The ID of the node to read
Returns:
A new Node object. The exact class of the object depends on the value of the NodeClass attribute and typeDefinition. Returns null, if nodeId is null (or NodeId.NULL).
Throws:
ServiceException - If the server returns a bad ServiceResult code for a service call.
AddressSpaceException - if the NodeClass of the node to read cannot be determined or is invalid.

getNode

public <T extends UaNode> T getNode(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                    Class<T> clazz)
                         throws ServiceException,
                                AddressSpaceException
Convenience method for getNode(ExpandedNodeId) which automatically casts the result to the requested class. A ClassCastException is wrapped to a AddressSpaceException if the node is not of the requested type. Make sure that you have registered the classes (or InformationModels) to the UaClient to ensure that the correct node classes are used.

Specified by:
getNode in interface UaAddressSpace
Parameters:
nodeId - the nodeId - this must be a local node as it is requested from the server using getNode(NodeId).
clazz - the type of the node to request.
Returns:
the Node object. The object is fetched from the node cache or created, if not found from there. Returns null, if nodeId is null (or NodeId.NULL).
Throws:
AddressSpaceException - if the NodeClass of the node to read cannot be determined or is invalid or cannot be cast to the requested type.
ServiceException - if the service call fails

getNodeClassSet

public EnumSet<org.opcfoundation.ua.core.NodeClass> getNodeClassSet()
Filter by NodeClass.

Returns:
the node classes to request in normal browse calls.

getNodes

public UaNode[] getNodes(org.opcfoundation.ua.builtintypes.NodeId... nodeIds)
                  throws AddressSpaceException,
                         ServiceException
Throws:
AddressSpaceException
ServiceException

getReferenceTypeId

public org.opcfoundation.ua.builtintypes.NodeId getReferenceTypeId()
Returns:
the reference types to follow in normal browse calls.

getResultMaskSet

public EnumSet<org.opcfoundation.ua.core.BrowseResultMask> getResultMaskSet()
Filter by browse results.

Returns:
the results to request in normal browse calls.

getServerTable

public org.opcfoundation.ua.common.ServerTable getServerTable()
Returns:
the NamespaceTable of the server - equals to getClient().getNamespaceTable().

getType

public UaType getType(org.opcfoundation.ua.builtintypes.NodeId typeId)
               throws ServiceException,
                      AddressSpaceException
Get a Type node.

The node is fetched from an internal node cache, or from the server, if it is not yet in the cache. Note that the given NodeId must be of a type.

Parameters:
typeId - The NodeId of the type.
Returns:
The type node object.
Throws:
AddressSpaceException - if the node cannot be constructed or it is not a type node
ServiceException - if the node information cannot be read

getTypeDefinition

public org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeDefinition(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                                   throws ServerConnectionException
Browse for a type definition of a node.

Follows a possible HasTypeDefinition reference from the node and returns the target NodeId.

Parameters:
nodeId - the node to browse
Returns:
the target NodeId. If the reference is not found, returns ExpandedNodeId.NULL
Throws:
ServerConnectionException

getView

public org.opcfoundation.ua.core.ViewDescription getView()
Filter by view.

Returns:
the view to use in normal browse calls.

isIncludeSubTypes

public Boolean isIncludeSubTypes()
Returns:
whether to request sub types in normal browse calls.

loadModel

public void loadModel(InputStream inputStream)
               throws SAXException,
                      IOException,
                      ModelException,
                      ServiceException
Load an Information Model into the client. Load nodes and references from an UA NodeSet file. The file must conform to the UANodeSet schema, http://opcfoundation.org/UA/2011/03/UANodeSet.xsd

Specified by:
loadModel in interface UaAddressSpace
Parameters:
inputStream - The stream that contains the XML node set.
Throws:
ModelException - if there is a problem with the model and it cannot be fully created. The exception is thrown with and errorList of all errors found in the stream.
SAXException - if the required XMLReaded cannot be created.
IOException - if the model file cannot be read.
ServiceException - if the AddNodes service call to the server fails

loadModel

public void loadModel(InputStream inputStream,
                      Collection<org.opcfoundation.ua.builtintypes.ExpandedNodeId> ignoredNodes,
                      boolean failOnFirstError)
               throws IOException,
                      SAXException,
                      ModelException,
                      ServiceException
Load an Information Model into the client. Load nodes and references from an UA NodeSet file. The file must conform to the UANodeSet schema, http://opcfoundation.org/UA/2011/03/UANodeSet.xsd

Parameters:
inputStream - The stream for the XML file.
Throws:
ModelException - if there is a problem with the model and it cannot be fully created. The exception is thrown with and errorList of all errors found in the stream.
SAXException - if the required XMLReaded cannot be created.
IOException - if the model file cannot be read.
ServiceException - if the AddNodes service call to the server fails

loadModel

public void loadModel(URI path)
               throws SAXException,
                      IOException,
                      ModelException,
                      ServiceException
Load an Information Model into the client. Load nodes and references from an UA NodeSet file. The file must conform to the UANodeSet schema, http://opcfoundation.org/UA/2011/03/UANodeSet.xsd

Specified by:
loadModel in interface UaAddressSpace
Parameters:
path - The path to the XML file. You can create an URI from a File name with File.toURI()
Throws:
ModelException - if there is a problem with the model and it cannot be fully created. The exception is thrown with and errorList of all errors found in the file.
SAXException - if the required XMLReaded cannot be created.
IOException - if the model file cannot be read.
ServiceException - if the AddNodes service call to the server fails

loadModel

public void loadModel(URI path,
                      Collection<org.opcfoundation.ua.builtintypes.ExpandedNodeId> ignoredNodes,
                      boolean failOnFirstError)
               throws SAXException,
                      IOException,
                      ModelException,
                      ServiceException
Load an Information Model into the server. Load nodes and references from an UA NodeSet file. The file must conform to the UANodeSet schema, http://opcfoundation.org/UA/2011/03/UANodeSet.xsd

Parameters:
path - The path to the XML file. You can create an URI from a File name with File.toURI()
ignoredNodes - Nodes to leave out of import. Use this if you are creating the nodes explicitly in the server and do not want them to be imported from the XML. The related references will be imported though.
failOnFirstError - make the model creation fail for the first error encountered. If false, the model is parsed fully and possible errors are raised only at the end.
Throws:
ModelException - if there is a problem with the model and it cannot be fully created. The exception is thrown for individual nodes only if ModelParserBase.isFailOnFirstError() is true. Otherwise, it will be filled with and errorList.
SAXException - if the required XMLReaded cannot be created.
IOException - if the model file cannot be read.
ServiceException - if the AddNodes service call to the server fails

query

public org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes,
                                                      org.opcfoundation.ua.core.ContentFilter filter)
                                               throws org.opcfoundation.ua.common.ServiceFaultException,
                                                      ServerConnectionException,
                                                      org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

query

public org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes,
                                                      org.opcfoundation.ua.core.ContentFilter filter,
                                                      org.opcfoundation.ua.builtintypes.UnsignedInteger maxDataSetsToReturn,
                                                      org.opcfoundation.ua.builtintypes.UnsignedInteger maxReferencesToReturn)
                                               throws org.opcfoundation.ua.common.ServiceFaultException,
                                                      ServerConnectionException,
                                                      org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

queryFirst

public org.opcfoundation.ua.core.QueryFirstResponse queryFirst(org.opcfoundation.ua.core.NodeTypeDescription[] NodeTypes,
                                                               org.opcfoundation.ua.core.ContentFilter Filter)
                                                        throws org.opcfoundation.ua.common.ServiceFaultException,
                                                               ServerConnectionException,
                                                               org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

queryFirst

public org.opcfoundation.ua.core.QueryFirstResponse queryFirst(org.opcfoundation.ua.core.QueryFirstRequest request)
                                                        throws org.opcfoundation.ua.common.ServiceFaultException,
                                                               ServerConnectionException,
                                                               org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

queryNext

public org.opcfoundation.ua.core.QueryNextResponse queryNext(boolean releaseContinuationPoints,
                                                             byte[] continuationPoint)
                                                      throws org.opcfoundation.ua.common.ServiceFaultException,
                                                             ServerConnectionException,
                                                             org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

queryNext

public org.opcfoundation.ua.core.QueryNextResponse queryNext(boolean releaseContinuationPoints,
                                                             org.opcfoundation.ua.builtintypes.ByteString continuationPoint)
                                                      throws org.opcfoundation.ua.common.ServiceFaultException,
                                                             ServerConnectionException,
                                                             org.opcfoundation.ua.common.ServiceResultException
Throws:
org.opcfoundation.ua.common.ServiceFaultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceResultException

readAttributes

public org.opcfoundation.ua.builtintypes.StatusCode[] readAttributes(UaNode node,
                                                                     org.opcfoundation.ua.builtintypes.UnsignedInteger... attributes)
                                                              throws ServiceException
Reads the values for the specified node attributes and sets the respective values in the node object. Note: Only use this function occasionally. Use UaClient.read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
node - The node to read.
attributes - The attributes to read.
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
See Also:
UaClient.readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), UaClient.readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), UaClient.read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readComponents

public void readComponents(UaNode node)
                    throws ServiceException
Read all components of a node from the server to the cache.

Read all nodes that are connected to the node with a forward HasComponent reference and adds the respective references to the node.

Parameters:
node - the node whose components are to be retrieved.
Throws:
ServiceException - if the service calls fail

readNode

public void readNode(UaNode node)
              throws ServiceException
Reads the values for all node attributes and sets the respective values in the node object.

The method is called automatically by getNode(NodeId), so normally you need to call readNode only to refresh the attribute values.

Parameters:
node - The node to read
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
See Also:
getNode(NodeId)

readProperties

public void readProperties(UaNode node)
                    throws ServiceException
Read values of all properties of a node.

It expects that the properties are already fetched to the node, which is true by default for nodes retrieved with getNode(NodeId).

Note that readProperties is also automatically called by getNode.

Parameters:
node - the node to browse.
Throws:
ServiceException - if a service call to get the properties or their values fails

readReferences

public void readReferences(UaNode node,
                           org.opcfoundation.ua.builtintypes.NodeId referenceTypeId,
                           org.opcfoundation.ua.core.BrowseDirection direction,
                           boolean includeSubTypes)
                    throws ServiceException
Read the references of a node. All references are read by default in getNode(NodeId) and readNode(UaNode).

Parameters:
node - The node to read.
referenceTypeId - The reference types to read - use Identifiers.References to read all types.
direction - Forward, inverse or both references?
includeSubTypes - Use true to accept all subtypes of referenceTypeId
Throws:
ServiceException - if the browse call fails.

registerNodes

public org.opcfoundation.ua.builtintypes.NodeId[] registerNodes(org.opcfoundation.ua.builtintypes.NodeId... nodesToRegister)
                                                         throws ServiceException
Register often used nodes in the server for quick access.

A Server often has no direct access to the information that it manages. Variables or services might be in underlying systems and additional effort is required to establish a connection to these systems. The RegisterNodes Service can be used by Clients to register the Nodes that they know they will access repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so that the access operations will be more efficient. Clients can expect performance improvements when using registered NodeIds, but the optimization measures are vendor-specific. For Variable Nodes Servers shall concentrate their optimization efforts on the Value Attribute.

Registered NodeIds are only guaranteed to be valid within the current Session. Clients shall unregister unneeded Ids immediately to free up resources.

RegisterNodes does not validate the NodeIds from the request. Servers will simply copy unknown NodeIds in the response. Structural NodeId errors (size violations, invalid id types) will cause the complete Service to fail.

For the purpose of Auditing, Servers shall not use the registered NodeIds but only the canonical NodeIds which is the value of the NodeId Attribute.

Use unregisterNodes(org.opcfoundation.ua.builtintypes.NodeId...) to tell the server that you have finished with the nodes.

Parameters:
nodesToRegister - the node IDs to register in the server
Returns:
the new "quick" node IDs
Throws:
ServiceException - if the service call fails

setBrowseDirection

public void setBrowseDirection(org.opcfoundation.ua.core.BrowseDirection browseDirection)
Set the default browse direction to use in the normal browse operations.

Parameters:
browseDirection - the browse direction to set (default is Forward only)

setIncludeSubTypes

public void setIncludeSubTypes(Boolean includeSubTypes)
Set the default setting for includeSubTypes in the normal browse operations. IncludeSubTypes refers to the requested reference types to follow. If this is true, then all references of all sub types of the defined ReferenceTypeId are also browsed.

Parameters:
includeSubTypes - whether to include sub types or referenceTypeId in the browse results (default is true)

setMaxDataSetsPerQuery

public void setMaxDataSetsPerQuery(int value)
Set the default maximum number of datasets to request per one internal query call to the server

Parameters:
value -

setMaxReferencesPerNode

public void setMaxReferencesPerNode(int value)
Set the default maximum number of references to request per one internal browse/query call to the server.

The parameter enables the browse/query calls to be broken to smaller parts, which enables huge address spaces to be browsed without a problem. The AddressSpace object will use browse/browseNext/queryFirst/queryNext automatically to retrieve all references to a node in any case. This parameter just defines what is the maximum number of references the server should return for one internal request.

If you use 0, the results are not limited. In that case, you may hit the message size limits of the endpoint, if the server tries to send too many references as response.

Default: 1000

Parameters:
value - the maxReferencesPerNode to set

setNodeClassSet

public void setNodeClassSet(EnumSet<org.opcfoundation.ua.core.NodeClass> nodeClassSet)
Set the default node classes to request in the browse operations.

Parameters:
nodeClassSet - the nodeClassSet to set

setReferenceTypeId

public void setReferenceTypeId(org.opcfoundation.ua.builtintypes.NodeId referenceTypeId)
Set the default reference types to request in the browse operations.

Parameters:
referenceTypeId - the reference types to request. if includeSubTypes is defined, all sub types of this reference are also requested. Default is to browse all HierarchicalReferences

setResultMaskSet

public void setResultMaskSet(EnumSet<org.opcfoundation.ua.core.BrowseResultMask> resultMaskSet)
Set the default result types to request in the browse operations.

Parameters:
resultMaskSet - the resultMask to set. Use BrowseResultMask.ALL to request all results (this is the default setting).

setView

public void setView(org.opcfoundation.ua.core.ViewDescription view)
Set the default view to use in the browse operations.

Parameters:
view - the view to set. Use null to define that no view restrictions should apply (this is the default setting).

translateBrowsePathsToNodeIds

public org.opcfoundation.ua.core.BrowsePathResult[] translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath... browsePaths)
                                                                           throws ServiceException
Request the NodeIds for the nodes that are references from the startingNode using paths.

This Service is used to request that the Server translates one or more browse paths to NodeIds. Each browse path is constructed of a starting Node and a RelativePath. The specified starting Node identifies the Node from which the RelativePath is based. The RelativePath contains a sequence of ReferenceTypes and BrowseNames.

Parameters:
browsePaths - the browse paths, i.e. combinations of StartingNode & RelativePath
Returns:
the results of the browse. Each result contains a list of targets for the relativePath from the startingNode. The result is a list, since it is possible that there are several nodes that have the same path. Normally, there should be only one result, though. Read the TargetId of the result(s) to find the NodeId requested.

A Server may also encounter a Reference to a Node in another Server which it can not follow while it is processing the RelativePath. If this happens the Server returns the NodeId of the external Node as TargetId, and sets the remainingPathIndex parameter to indicate which RelativePath elements still need to be processed. To complete the operation the Client shall connect to the other Server and call this service again using the target as the startingNode and the unprocessed elements as the relativePath. If all elements are processed, i.e. there is no reference to an external server, remainingPathIndex will be set to UnsignedInteger.MAX_VALUE.

Throws:
ServiceException - if the service call fails
See Also:
translateBrowsePathToNodeId(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.core.RelativePathElement...)

translateBrowsePathsToNodeIds

public org.opcfoundation.ua.core.BrowsePathResult[] translateBrowsePathsToNodeIds(org.opcfoundation.ua.builtintypes.NodeId startingNode,
                                                                                  org.opcfoundation.ua.core.RelativePath... paths)
                                                                           throws ServiceException
Request the NodeIds for the nodes that are references from the startingNode using paths.

This Service is used to request that the Server translates one or more browse paths to NodeIds. Each browse path is constructed of a starting Node and a RelativePath. The specified starting Node identifies the Node from which the RelativePath is based. The RelativePath contains a sequence of ReferenceTypes and BrowseNames.

Parameters:
startingNode - the node from which the paths are browsed
paths - the relative paths.
Returns:
the results of the browse. Each result contains a list of targets for the relativePath from the startingNode. The result is a list, since it is possible that there are several nodes that have the same path. Normally, there should be only one result, though. Read the TargetId of the result(s) to find the NodeId requested.

A Server may also encounter a Reference to a Node in another Server which it can not follow while it is processing the RelativePath. If this happens the Server returns the NodeId of the external Node as TargetId, and sets the remainingPathIndex parameter to indicate which RelativePath elements still need to be processed. To complete the operation the Client shall connect to the other Server and call this service again using the target as the startingNode and the unprocessed elements as the relativePath. If all elements are processed, i.e. there is no reference to an external server, remainingPathIndex will be set to UnsignedInteger.MAX_VALUE.

Throws:
ServiceException
ServiceException - if the service call fails
See Also:
translateBrowsePathToNodeId(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.core.RelativePathElement...)

translateBrowsePathToNodeId

public org.opcfoundation.ua.core.BrowsePathTarget[] translateBrowsePathToNodeId(org.opcfoundation.ua.builtintypes.NodeId startingNode,
                                                                                org.opcfoundation.ua.core.RelativePathElement... elements)
                                                                         throws ServiceException,
                                                                                StatusException
Translate a single browse path to a NodeId. Use this only for occasional calls. If you have several paths that you wish to translate, use translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath...), instead.

Parameters:
startingNode - the node from which the paths are browsed
elements - the elements of RelativePath to browse from the starting node. The last element in the RelativePath shall always have a targetName specified. This further restricts the definition of the RelativePath type. The Server shall return Bad_BrowseNameInvalid if the targetName is missing.
Returns:
List of targets for the relativePath from the startingNode. The result is a list, since it is possible that there are several nodes that have the same path. Normally, there should be only one result, though. Read the TargetId of the result(s) to find the NodeId requested.

A Server may also encounter a Reference to a Node in another Server which it can not follow while it is processing the RelativePath. If this happens the Server returns the NodeId of the external Node as TargetId, and sets the remainingPathIndex parameter to indicate which RelativePath elements still need to be processed. To complete the operation the Client shall connect to the other Server and call this service again using the target as the startingNode and the unprocessed elements as the relativePath. If all elements are processed, i.e. there is no reference to an external server, remainingPathIndex will be set to UnsignedInteger.MAX_VALUE.

Throws:
ServiceException - if the service call fails
StatusException - if the server returns a bad status code for the request. Note that you will not get any of the results back: if there is a Bad_NoMatch, you could use translateBrowsePathsToNodeIds(NodeId, RelativePath...) instead to find out the remainingPathIndex for the failing targets.
See Also:
translateBrowsePathsToNodeIds(org.opcfoundation.ua.core.BrowsePath...)

unregisterAllNodes

public org.opcfoundation.ua.builtintypes.NodeId[] unregisterAllNodes()
                                                              throws ServiceException
Unregister all previously registered Nodes.

Returns:
the nodes that were unregistered
Throws:
ServiceException
See Also:
unregisterNodes(NodeId...), registeredNodes

unregisterNodes

public void unregisterNodes(org.opcfoundation.ua.builtintypes.NodeId... nodesToUnregister)
                     throws ServiceException
This Service is used to unregister NodeIds that have been obtained via registerNodes(org.opcfoundation.ua.builtintypes.NodeId...).

UnregisterNodes does not validate the NodeIds from the request. Servers shall simply unregister NodeIds that are known as registered NodeIds. Any NodeIds that are in the list, but are not registered NodeIds are simply ignored.

Note: You can also use unregisterAllNodes() to unregister all previously registered nodes.

Parameters:
nodesToUnregister - A list of NodeIds that have been obtained via the RegisterNodes service.
Throws:
ServiceException - if the service call fails
See Also:
unregisterAllNodes(), registerNodes(org.opcfoundation.ua.builtintypes.NodeId...)

browse

protected List<org.opcfoundation.ua.core.ReferenceDescription> browse(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                      org.opcfoundation.ua.core.BrowseDescription browseDescription)
                                                               throws ServerConnectionException,
                                                                      ServiceException,
                                                                      StatusException
Parameters:
nodeId -
browseDescription -
Returns:
Throws:
ServerConnectionException
ServiceException
StatusException

query

protected org.opcfoundation.ua.core.QueryDataSet[] query(org.opcfoundation.ua.core.ViewDescription view,
                                                         org.opcfoundation.ua.core.NodeTypeDescription[] nodeTypes,
                                                         org.opcfoundation.ua.core.ContentFilter filter,
                                                         org.opcfoundation.ua.builtintypes.UnsignedInteger maxDataSetsToReturn,
                                                         org.opcfoundation.ua.builtintypes.UnsignedInteger maxReferencesToReturn)
                                                  throws org.opcfoundation.ua.common.ServiceFaultException,
                                                         ServerConnectionException,
                                                         org.opcfoundation.ua.common.ServiceResultException
Parameters:
request -
view -
NodeTypes -
Filter -
MaxDataSetsToReturn -
MaxReferencesToReturn -
b -
Returns:
Throws:
org.opcfoundation.ua.common.ServiceResultException
ServerConnectionException
org.opcfoundation.ua.common.ServiceFaultException


Copyright © 2018. All rights reserved.