public class AddressSpace extends Object implements UaAddressSpace
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(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId), getType(com.prosysopc.ua.stack.builtintypes.NodeId) and
getMethod(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId) to get access to the cached nodes.
You can also access the View Services from the AddressSpace. This includes
translateBrowsePathsToNodeIds(com.prosysopc.ua.stack.core.BrowsePath...), translateBrowsePathToNodeId(com.prosysopc.ua.stack.builtintypes.NodeId, com.prosysopc.ua.stack.core.RelativePathElement...),
registerNodes(com.prosysopc.ua.stack.builtintypes.NodeId...) and unregisterNodes(com.prosysopc.ua.stack.builtintypes.NodeId...).
| Constructor and Description |
|---|
AddressSpace(UaClient client)
Create a new address space using the client connection.
|
| Modifier and Type | Method and Description |
|---|---|
NodeId |
addNode(AddNodesItem node)
Add a new node to the server.
|
NodeId |
addNode(NodeId parentNodeId,
NodeId referenceTypeId,
NodeId newNodeId,
QualifiedName browseName,
NodeClass nodeClass,
NodeAttributes nodeAttributes,
NodeId typeDefinition)
Add a new node to the server.
|
void |
addNode(UaNode node)
Add a
UaNode to the address space. |
AddNodesResult[] |
addNodes(AddNodesItem... nodes)
Add new nodes to the server via the AddNodes service call.
|
void |
addReference(AddReferencesItem reference)
Add a new reference to the server.
|
StatusCode[] |
addReferences(AddReferencesItem... references)
Add new references to the server via the AddReferences service call.
|
List<ReferenceDescription> |
browse(ExpandedNodeId nodeId)
Browse a single node using the browse settings defined in the class.
|
List<ReferenceDescription> |
browse(ExpandedNodeId nodeId,
BrowseDirection direction,
NodeId referenceType,
boolean includeSubTypes,
NodeClass... nodeClasses)
Browse references of the specified type from the specified node.
|
List<ReferenceDescription> |
browse(NodeId nodeId)
Browse a single node using the browse settings defined in the class.
|
protected List<ReferenceDescription> |
browse(NodeId nodeId,
BrowseDescription browseDescription)
Browses the given node.
|
List<ReferenceDescription> |
browse(NodeId nodeId,
BrowseDirection direction,
NodeId referenceType)
Browse references of the specified type from the specified node.
|
List<ReferenceDescription> |
browse(NodeId nodeId,
BrowseDirection direction,
NodeId referenceType,
boolean includeSubTypes,
EnumSet<BrowseResultMask> resultMaskSet,
NodeClass... nodeClasses)
Browse references of the specified type from the specified node.
|
List<ReferenceDescription> |
browse(NodeId nodeId,
BrowseDirection direction,
NodeId referenceType,
boolean includeSubTypes,
NodeClass... nodeClasses)
Browse references of the specified type from the specified node.
|
List<ReferenceDescription> |
browse(UaNodeId nodeId)
Browse a single node using the browse settings defined in the class.
|
List<ReferenceDescription> |
browse(UaNodeId nodeId,
BrowseDirection direction,
UaNodeId referenceType,
boolean includeSubTypes,
NodeClass... nodeClasses)
Browse references of the specified type from the specified node.
|
BrowseResult[] |
browse(ViewDescription view,
int maxRequestedReferencesPerNode,
BrowseDescription... nodesToBrowse)
Browses the server address space using several, different browse descriptions at the same time.
|
AsyncResult<BrowseResponse> |
browseAsync(ExpandedNodeId nodeId)
Browses the server address space using several, different browse descriptions at the same time.
|
AsyncResult<BrowseResponse> |
browseAsync(NodeId nodeId)
Browses the server address space using several, different browse descriptions at the same time.
|
AsyncResult<BrowseResponse> |
browseAsync(UaNodeId nodeId)
Browses the server address space using several, different browse descriptions at the same time.
|
AsyncResult<BrowseResponse> |
browseAsync(ViewDescription view,
int maxRequestedReferencesPerNode,
BrowseDescription... nodesToBrowse)
Browses the server address space using several, different browse descriptions at the same time.
|
List<ReferenceDescription> |
browseMethods(ExpandedNodeId nodeId)
Browse references to object methods.This performs a browse to HasComponent references ending to
Method node classes.
|
List<ReferenceDescription> |
browseMethods(NodeId nodeId)
Browse references to object methods.This performs a browse to HasComponent references ending to
Method node classes.
|
List<ReferenceDescription> |
browseMethods(UaNodeId nodeId)
Browse references to object methods.This performs a browse to HasComponent references ending to
Method node classes.
|
BrowseResult[] |
browseNext(boolean releaseContinuationPoints,
byte[]... continuationPoints)
Continue a browse operation that was to be continued.
|
BrowseResult[] |
browseNext(boolean releaseContinuationPoints,
ByteString... continuationPoints)
Continue a browse operation that was to be continued.
|
List<ReferenceDescription> |
browseUp(ExpandedNodeId nodeId)
Browse up in the address space hierarchy.
|
List<ReferenceDescription> |
browseUp(NodeId nodeId)
Browse up in the address space hierarchy.
|
List<ReferenceDescription> |
browseUp(UaNodeId nodeId)
Browse up in the address space hierarchy.
|
BrowseDescription |
defaultBrowseDescription(NodeId nodeId)
Get the default browse description, used by the browse calls.
|
void |
deleteNode(DeleteNodesItem node)
Delete a node from the server.
|
StatusCode[] |
deleteNodes(DeleteNodesItem... nodes)
Delete nodes from the server via the DeleteNodes service call.
|
void |
deleteReference(DeleteReferencesItem reference)
Delete a reference from the server.
|
StatusCode[] |
deleteReferences(DeleteReferencesItem... references)
Delete new references to the server via the DeleteReferences service call.
|
UaNode |
findNode(NodeId id)
Find a (@link UaNode) corresponding to the given
NodeId. |
BrowseDirection |
getBrowseDirection()
Returns the default BrowseDirection to use in normal browse calls if it is not specified.
|
NodeCache |
getCache()
The node Cache which is used to keep UaNode objects retrieved from the server in a client side
cache.
|
UaClient |
getClient()
Returns the
UaClient object this AddressSpace uses for service calls. |
UaDataType |
getDataType(NodeId dataTypeId)
Return
UaDataType matching the given id, throws if node is not found or is not of
correct type. |
DataTypeConverter |
getDataTypeConverter()
Get the DataTypeConverter.
|
EncoderContext |
getEncoderContext()
Returns the
EncoderContext. |
UnsignedInteger |
getMaxDataSetsPerQuery() |
UnsignedInteger |
getMaxReferencesPerNode()
Returns the default MaxReferencesPerNode value used if none defined for Browse calls.
|
UaMethod |
getMethod(ExpandedNodeId methodId)
Get an UA method definition from the server.
|
UaMethod |
getMethod(NodeId methodId)
Get an UA method definition from the server.
|
UaMethod |
getMethod(UaNodeId methodId)
Get an UA method definition from the server.
|
UaMethod |
getMethodByName(NodeId nodeId,
QualifiedName methodName)
Get a method with methodName of a node.
|
List<UaMethod> |
getMethods(NodeId nodeId)
Get all methods of an object node.
|
NamespaceTable |
getNamespaceTable()
Returns the
NamespaceTable of the server. |
UaNode |
getNode(ExpandedNodeId nodeId)
Finds the node object, corresponding to the NodeId.
|
<T extends UaNode> |
getNode(ExpandedNodeId nodeId,
Class<T> clazz)
Convenience method for
getNode(ExpandedNodeId) which automatically casts the result to
the requested class. |
UaNode |
getNode(NodeId nodeId)
Finds the node object, corresponding to the NodeId.
|
<T extends UaNode> |
getNode(NodeId nodeId,
Class<T> clazz)
Convenience method for
getNode(ExpandedNodeId) which automatically casts the result to
the requested class. |
UaNode |
getNode(UaNodeId nodeId)
Finds the node object, corresponding to the NodeId.
|
<T extends UaNode> |
getNode(UaNodeId nodeId,
Class<T> clazz)
Convenience method for
getNode(UaNodeId) which automatically casts the result to the
requested class. |
EnumSet<NodeClass> |
getNodeClassSet()
Filter by NodeClass.
|
UaNode[] |
getNodes(NodeId... nodeIds)
Like
getNode(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId), but optimized for multiple nodes at the same time. |
FolderTypeImpl |
getObjectsFolder()
Returns the UaNode for
UaObjectIds.ObjectsFolder. |
NodeId |
getReferenceTypeId()
Returns the default reference types to follow in normal Browse calls if none specified.
|
EnumSet<BrowseResultMask> |
getResultMaskSet()
Returns the default ResultMaskSet Filter for Browse calls if none specified.
|
FolderTypeImpl |
getRoot()
Returns the UaNode for
UaObjectIds.RootFolder. |
ServerTable |
getServerTable()
Returns the ServerTable of the server.
|
UaType |
getType(NodeId typeId)
Get a Type node.
|
ExpandedNodeId |
getTypeDefinition(NodeId nodeId)
Browse for a type definition of a node.
|
ViewDescription |
getView()
Filter by view.
|
Boolean |
isIncludeSubTypes()
Returns the default value for IncludeSubTypes parameter of Browse calls if not specified.
|
boolean |
isRead104Attributes()
True (default), if the new Attributes in 1.04 should be attempted to Read for getNode() and
related operations.
|
void |
loadModel(InputStream inputStream)
Deprecated.
This method doesn't work as intended, see
ModelParser deprecation notes. |
void |
loadModel(InputStream inputStream,
Collection<ExpandedNodeId> ignoredNodes,
boolean failOnFirstError)
Deprecated.
This method doesn't work as intended, see
ModelParser deprecation notes. |
void |
loadModel(URI path)
Deprecated.
This method doesn't work as intended, see
ModelParser deprecation notes. |
void |
loadModel(URI path,
Collection<ExpandedNodeId> ignoredNodes,
boolean failOnFirstError)
Deprecated.
This method doesn't work as intended, see
ModelParser deprecation notes. |
QueryDataSet[] |
query(NodeTypeDescription[] nodeTypes,
ContentFilter filter) |
QueryDataSet[] |
query(NodeTypeDescription[] nodeTypes,
ContentFilter filter,
UnsignedInteger maxDataSetsToReturn,
UnsignedInteger maxReferencesToReturn) |
protected QueryDataSet[] |
query(ViewDescription view,
NodeTypeDescription[] nodeTypes,
ContentFilter filter,
UnsignedInteger maxDataSetsToReturn,
UnsignedInteger maxReferencesToReturn)
Makes the Query for the parameters.
|
QueryFirstResponse |
queryFirst(NodeTypeDescription[] nodeTypes,
ContentFilter filter) |
QueryFirstResponse |
queryFirst(QueryFirstRequest request) |
QueryNextResponse |
queryNext(boolean releaseContinuationPoints,
byte[] continuationPoint) |
QueryNextResponse |
queryNext(boolean releaseContinuationPoints,
ByteString continuationPoint) |
StatusCode[] |
readAttributes(UaNode node,
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, except for NodeId, 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,
NodeId referenceTypeId,
BrowseDirection direction,
boolean includeSubTypes)
Read the references of a node.
|
NodeId[] |
registerNodes(NodeId... nodesToRegister)
Register often used nodes in the server for quick access.
|
void |
setBrowseDirection(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<NodeClass> nodeClassSet)
Set the default node classes to request in the browse operations.
|
void |
setRead104Attributes(boolean read104Attributes)
True (default), if the new Attributes in 1.04 should be attempted to Read for getNode() and
related operations.
|
void |
setReferenceTypeId(NodeId referenceTypeId)
Set the default reference types to request in the browse operations.
|
void |
setResultMaskSet(EnumSet<BrowseResultMask> resultMaskSet)
Set the default result types to request in the browse operations.
|
void |
setView(ViewDescription view)
Set the default view to use in the browse operations.
|
BrowsePathResult[] |
translateBrowsePathsToNodeIds(BrowsePath... browsePaths)
Request the NodeIds for the nodes that are references from the startingNode using paths.
|
BrowsePathResult[] |
translateBrowsePathsToNodeIds(NodeId startingNode,
RelativePath... paths)
Request the NodeIds for the nodes that are references from the startingNode using paths.
|
BrowsePathTarget[] |
translateBrowsePathToNodeId(NodeId startingNode,
RelativePathElement... elements)
Translate a single browse path to a NodeId.
|
BrowsePathTarget[] |
translateBrowsePathToNodeIds(NodeId startingNode,
RelativePath relativePath)
Request the NodeIds for the nodes that are references from the startingNode using the given
path.
|
NodeId[] |
unregisterAllNodes()
Unregister all previously registered Nodes.
|
void |
unregisterNodes(NodeId... nodesToUnregister)
This Service is used to unregister NodeIds that have been obtained via
registerNodes(com.prosysopc.ua.stack.builtintypes.NodeId...). |
public AddressSpace(UaClient client)
client - The UaClient this AddressSpace will use for operations.UaClient.getAddressSpace()public NodeId addNode(AddNodesItem node) throws ServiceException, StatusException
Note:Use addNodes(AddNodesItem...) to add several nodes at once. Use this
method only when you are adding single nodes.
node - the node to addServiceException - if the service call failsStatusException - if the operation fails, for example due to insufficient access rightsaddNodes(AddNodesItem...)public NodeId addNode(NodeId parentNodeId, NodeId referenceTypeId, NodeId newNodeId, QualifiedName browseName, NodeClass nodeClass, NodeAttributes nodeAttributes, NodeId typeDefinition) throws ServiceException, EncodingException, StatusException
parentNodeId - parent for the nodereferenceTypeId - reference type for the Reference between the new node and the parentnewNodeId - requested NodeId, check the result for actual NodeId assigned by the serverbrowseName - BrowseName for the new nodenodeClass - NodeClass of the new nodenodeAttributes - 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 nodeServiceException - if the call to server fails or the server does not support the serviceEncodingException - if NodeAttributes cannotStatusException - if the adding failed due to an operation level errorpublic void addNode(UaNode node)
UaNode to the address space. Note! this method only adds the node to the cache of
the AddressSpace.addNode in interface UaAddressSpacenode - that is addedaddNodes(com.prosysopc.ua.stack.core.AddNodesItem...),
addNode(AddNodesItem)public AddNodesResult[] addNodes(AddNodesItem... nodes) throws ServiceException
nodes - the nodes to addServiceException - if the service call failspublic void addReference(AddReferencesItem reference) throws ServiceException, StatusException
Note:Use addReferences(AddReferencesItem...) to add several references at once.
Use this method only when you are adding single references.
reference - the reference to addServiceException - if the service call failsStatusException - if the operation fails, for example due to insufficient access rightsaddReferences(AddReferencesItem...)public StatusCode[] addReferences(AddReferencesItem... references) throws ServiceException
references - the references to addServiceException - if the service call failspublic List<ReferenceDescription> browse(ExpandedNodeId nodeId) throws ServiceException, StatusException
nodeId - The Node to browse.ServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(ExpandedNodeId nodeId, BrowseDirection direction, NodeId referenceType, boolean includeSubTypes, NodeClass... nodeClasses) throws ServiceException, StatusException
nodeId - the Nodedirection - browse directionreferenceType - the types of reference to browseincludeSubTypes - should the possible sub reference types be includednodeClasses - node classes to includeServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(NodeId nodeId) throws ServiceException, StatusException
nodeId - The Node to browse. Use Identifiers.RootFolder to browse the root node.ServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(NodeId nodeId, BrowseDirection direction, NodeId referenceType) throws ServiceException, StatusException
nodeId - the Nodedirection - browse directionreferenceType - the types of reference to browseServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(NodeId nodeId, BrowseDirection direction, NodeId referenceType, boolean includeSubTypes, EnumSet<BrowseResultMask> resultMaskSet, NodeClass... nodeClasses) throws ServiceException, StatusException
nodeId - the Nodedirection - browse directionreferenceType - the types of reference to browseincludeSubTypes - should the possible sub reference types be includedresultMaskSet - the resultMaskSet used to filter the fields to returnnodeClasses - node classes to includeServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(NodeId nodeId, BrowseDirection direction, NodeId referenceType, boolean includeSubTypes, NodeClass... nodeClasses) throws ServiceException, StatusException
nodeId - the Nodedirection - browse directionreferenceType - the types of reference to browseincludeSubTypes - should the possible sub reference types be includednodeClasses - node classes to includeServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(UaNodeId nodeId) throws ServiceException, StatusException
nodeId - The Node to browse.ServiceException - if the service call failsStatusException - if the operation failspublic List<ReferenceDescription> browse(UaNodeId nodeId, BrowseDirection direction, UaNodeId referenceType, boolean includeSubTypes, NodeClass... nodeClasses) throws ServiceException, StatusException
nodeId - the Nodedirection - browse directionreferenceType - the types of reference to browseincludeSubTypes - should the possible sub reference types be includednodeClasses - node classes to includeServiceException - if the service call failsStatusException - if the operation failspublic BrowseResult[] browse(ViewDescription view, int maxRequestedReferencesPerNode, BrowseDescription... nodesToBrowse) throws ServiceException
Note that you may need to call browseNext, if the server results continuation points in the results for some of the requests.
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.ServiceException - When the server returns a bad ServiceResult code for the service call.
The following result codes are expected: Bad_ViewIdUnknown, Bad_NothingToDo,
Bad_TooManyOperationspublic AsyncResult<BrowseResponse> browseAsync(ExpandedNodeId nodeId) throws ServiceException
nodeId - The node to Browse.ServiceExceptionpublic AsyncResult<BrowseResponse> browseAsync(NodeId nodeId) throws ServiceException
nodeId - The node to Browse.ServiceExceptionpublic AsyncResult<BrowseResponse> browseAsync(UaNodeId nodeId) throws ServiceException
nodeId - The node to Browse.ServiceExceptionpublic AsyncResult<BrowseResponse> browseAsync(ViewDescription view, int maxRequestedReferencesPerNode, BrowseDescription... nodesToBrowse) throws ServiceException
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.ServiceException - if the asynchronous call failspublic List<ReferenceDescription> browseMethods(ExpandedNodeId nodeId) throws ServiceException, StatusException
nodeId - The object to browse fromServiceException - if the service call failsStatusException - if the browse result is badgetMethods(com.prosysopc.ua.stack.builtintypes.NodeId)public List<ReferenceDescription> browseMethods(NodeId nodeId) throws ServiceException, StatusException
nodeId - The object to browse fromServiceException - if the service call failsStatusException - if the browse result is badgetMethods(com.prosysopc.ua.stack.builtintypes.NodeId)public List<ReferenceDescription> browseMethods(UaNodeId nodeId) throws ServiceException, StatusException
nodeId - The object to browse fromServiceException - if the service call failsStatusException - if the browse result is badgetMethods(com.prosysopc.ua.stack.builtintypes.NodeId)public BrowseResult[] browseNext(boolean releaseContinuationPoints, byte[]... continuationPoints) throws ServiceException
releaseContinuationPoints - release the specified continuation points without retrieving
the next set of referencescontinuationPoints - the continuation points returned by the previous browse requestsServiceException - if the service call failspublic BrowseResult[] browseNext(boolean releaseContinuationPoints, ByteString... continuationPoints) throws ServiceException
releaseContinuationPoints - release the specified continuation points without retrieving
the next set of referencescontinuationPoints - the continuation points returned by the previous browse requestsServiceException - if the service call failspublic List<ReferenceDescription> browseUp(ExpandedNodeId nodeId) throws ServerConnectionException, ServiceException, ServiceResultException, StatusException
nodeId - the node to browse fromServiceException - if the browse service call to the server failsServerConnectionException - if the client is not connected to a serverStatusException - if the NamespaceTable is not availableServiceResultException - if the node cannot be converted to a NodeIdpublic List<ReferenceDescription> browseUp(NodeId nodeId) throws ServerConnectionException, ServiceException
nodeId - the node to browse fromServiceException - if the browse service call to the server failsServerConnectionException - if the client is not connected to a serverpublic List<ReferenceDescription> browseUp(UaNodeId nodeId) throws ServerConnectionException, ServiceException, ServiceResultException, StatusException
nodeId - the node to browse fromServiceException - if the browse service call to the server failsServerConnectionException - if the client is not connected to a serverStatusException - if the NamespaceTable is not availableServiceResultException - if the node cannot be converted to a NodeIdpublic BrowseDescription defaultBrowseDescription(NodeId nodeId)
nodeId - The Node to Browsepublic void deleteNode(DeleteNodesItem node) throws ServiceException, StatusException
Note:Use deleteNodes(DeleteNodesItem...) to delete several nodes at once. Use
this method only when you are deleting single nodes.
node - the node to deleteServiceException - if the service call failsStatusException - if the operation fails, for example due to insufficient access rightsdeleteNodes(DeleteNodesItem...)public StatusCode[] deleteNodes(DeleteNodesItem... nodes) throws ServiceException
nodes - the nodes to deleteServiceException - if the service call failspublic void deleteReference(DeleteReferencesItem reference) throws ServiceException, StatusException
Note:Use deleteReferences(DeleteReferencesItem...) to delete several references
at once. Use this method only when you are deleting single references.
reference - the reference to deleteServiceException - if the service call failsStatusException - if the operation fails, for example due to insufficient access rightsdeleteReferences(DeleteReferencesItem...)public StatusCode[] deleteReferences(DeleteReferencesItem... references) throws ServiceException
references - the references to deleteServiceException - if the service call failspublic UaNode findNode(NodeId id)
UaAddressSpaceNodeId. Effectively this is the same
as UaAddressSpace.getNode(NodeId), but returns null if it would have thrown.findNode in interface UaAddressSpacepublic BrowseDirection getBrowseDirection()
public NodeCache getCache()
You should use the methods of the AddressSpace (getNode(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId), getType(com.prosysopc.ua.stack.builtintypes.NodeId),
getMethod(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId)) to access the nodes in the cache. But you can define the cache parameters
directly to the cache.
public UaClient getClient()
UaClient object this AddressSpace uses for service calls.public UaDataType getDataType(NodeId dataTypeId) throws ServiceException, AddressSpaceException
UaDataType matching the given id, throws if node is not found or is not of
correct type.dataTypeId - id for nodeUaDataType for the given idServiceException - if service calls fails.AddressSpaceException - if the node is not a DataType node.public DataTypeConverter getDataTypeConverter()
getDataTypeConverter in interface UaAddressSpacepublic EncoderContext getEncoderContext()
UaAddressSpaceEncoderContext.getEncoderContext in interface UaAddressSpacepublic UnsignedInteger getMaxDataSetsPerQuery()
public UnsignedInteger getMaxReferencesPerNode()
setMaxReferencesPerNode(int)public UaMethod getMethod(ExpandedNodeId methodId) throws ServiceException, AddressSpaceException, StatusException, ServiceResultException
Will call getMethod(NodeId) with a methodId converted to NodeId using the
NamespaceTable.
methodId - the NodeId of the methodAddressSpaceException - if the nodeId does not refer to a valid method nodeServiceException - if service call failsStatusException - if operation failsServiceResultExceptionpublic UaMethod getMethod(NodeId methodId) throws ServiceException, AddressSpaceException, StatusException
methodId - the NodeId of the methodAddressSpaceException - if the nodeId does not refer to a valid method nodeServiceException - if service call failsStatusException - if operation failspublic UaMethod getMethod(UaNodeId methodId) throws ServiceException, AddressSpaceException, StatusException, ServiceResultException
Will call getMethod(NodeId) with a methodId converted to NodeId using the
NamespaceTable.
methodId - the NodeId of the methodAddressSpaceException - if the nodeId does not refer to a valid method nodeServiceException - if service call failsStatusException - if operation failsServiceResultExceptionpublic UaMethod getMethodByName(NodeId nodeId, QualifiedName methodName) throws ServiceException, AddressSpaceException, StatusException, ServiceResultException
nodeId - the ID of the node whose method we are searching.methodName - the name of the method to find.ServiceResultException - if the method exists, but it is an external node, on another
serverStatusException - if the browse call failsAddressSpaceException - if the node cannot be initializedServiceException - if the service call to the server failspublic List<UaMethod> getMethods(NodeId nodeId) throws ServiceException, StatusException, AddressSpaceException
nodeId - the ID of the object node.StatusException - if the browse result is badServiceException - if the browse call failsAddressSpaceException - if the nodes cannot be created. Use browseMethods in this case to
get a list of the references only.browseMethods(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId)public NamespaceTable getNamespaceTable()
NamespaceTable of the server. Convenience method for
getClient().getNamespaceTable().getNamespaceTable in interface UaAddressSpacepublic UaNode getNode(ExpandedNodeId nodeId) throws ServiceException, AddressSpaceException
getNode in interface UaAddressSpacenodeId - 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).AddressSpaceException - if the NodeClass of the node to read cannot be determined or is
invalid.ServiceException - if the service call failspublic <T extends UaNode> T getNode(ExpandedNodeId nodeId, Class<T> clazz) throws ServiceException, AddressSpaceException
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.getNode in interface UaAddressSpacenodeId - 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.NodeId.NULL).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 failspublic UaNode getNode(NodeId nodeId) throws ServiceException, AddressSpaceException
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 AbstractUaNodeFactory.createNode(com.prosysopc.ua.stack.core.NodeClass, com.prosysopc.ua.stack.builtintypes.NodeId, com.prosysopc.ua.stack.builtintypes.QualifiedName, com.prosysopc.ua.stack.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).
getNode in interface UaAddressSpacenodeId - The ID of the node to readNodeId.NULL).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.public <T extends UaNode> T getNode(NodeId nodeId, Class<T> clazz) throws ServiceException, AddressSpaceException
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.getNode in interface UaAddressSpacenodeId - 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.NodeId.NULL).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 failspublic UaNode getNode(UaNodeId nodeId) throws ServiceException, AddressSpaceException
getNode in interface UaAddressSpacenodeId - 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).AddressSpaceException - if the NodeClass of the node to read cannot be determined or is
invalid.ServiceException - if the service call failspublic <T extends UaNode> T getNode(UaNodeId nodeId, Class<T> clazz) throws ServiceException, AddressSpaceException
getNode(UaNodeId) 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.getNode in interface UaAddressSpacenodeId - 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.NodeId.NULL).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 failspublic EnumSet<NodeClass> getNodeClassSet()
public UaNode[] getNodes(NodeId... nodeIds) throws AddressSpaceException, ServiceException
getNode(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId), but optimized for multiple nodes at the same time.nodeIds - The NodeIds of the nodes to get.ServiceException - on failureAddressSpaceException - on failurepublic FolderTypeImpl getObjectsFolder() throws ServiceException, AddressSpaceException
UaAddressSpaceUaObjectIds.ObjectsFolder.getObjectsFolder in interface UaAddressSpaceServiceExceptionAddressSpaceExceptionpublic NodeId getReferenceTypeId()
public EnumSet<BrowseResultMask> getResultMaskSet()
public FolderTypeImpl getRoot() throws ServiceException, AddressSpaceException
UaAddressSpaceUaObjectIds.RootFolder.getRoot in interface UaAddressSpaceServiceExceptionAddressSpaceExceptionpublic ServerTable getServerTable()
public UaType getType(NodeId typeId) throws ServiceException, AddressSpaceException
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.
typeId - The NodeId of the type.AddressSpaceException - if the node cannot be constructed or it is not a type nodeServiceException - if the node information cannot be readpublic ExpandedNodeId getTypeDefinition(NodeId nodeId) throws ServerConnectionException
Follows a possible HasTypeDefinition reference from the node and returns the target NodeId.
nodeId - the node to browseServerConnectionException - if we are not connectedpublic ViewDescription getView()
public Boolean isIncludeSubTypes()
setIncludeSubTypes(Boolean)public boolean isRead104Attributes()
@Deprecated public void loadModel(InputStream inputStream) throws SAXException, IOException, ModelException, ServiceException
ModelParser deprecation notes.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
loadModel in interface UaAddressSpaceinputStream - The stream that contains the XML node set.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@Deprecated public void loadModel(InputStream inputStream, Collection<ExpandedNodeId> ignoredNodes, boolean failOnFirstError) throws IOException, SAXException, ModelException, ServiceException
ModelParser deprecation notes.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
inputStream - The stream for the XML file.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@Deprecated public void loadModel(URI path) throws SAXException, IOException, ModelException, ServiceException
ModelParser deprecation notes.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
loadModel in interface UaAddressSpacepath - The path to the XML file. You can create an URI from a File name with
File.toURI()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@Deprecated public void loadModel(URI path, Collection<ExpandedNodeId> ignoredNodes, boolean failOnFirstError) throws SAXException, IOException, ModelException, ServiceException
ModelParser deprecation notes.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
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.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 failspublic QueryDataSet[] query(NodeTypeDescription[] nodeTypes, ContentFilter filter) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public QueryDataSet[] query(NodeTypeDescription[] nodeTypes, ContentFilter filter, UnsignedInteger maxDataSetsToReturn, UnsignedInteger maxReferencesToReturn) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public QueryFirstResponse queryFirst(NodeTypeDescription[] nodeTypes, ContentFilter filter) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public QueryFirstResponse queryFirst(QueryFirstRequest request) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public QueryNextResponse queryNext(boolean releaseContinuationPoints, byte[] continuationPoint) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public QueryNextResponse queryNext(boolean releaseContinuationPoints, ByteString continuationPoint) throws ServiceFaultException, ServerConnectionException, ServiceResultException
public StatusCode[] readAttributes(UaNode node, UnsignedInteger... attributes) throws ServiceException
Note: Only use this function occasionally. Use UaClient.read(java.lang.Double, com.prosysopc.ua.stack.core.TimestampsToReturn, com.prosysopc.ua.stack.core.ReadValueId...) instead, when you need to
read several nodes or attributes.
node - The node to read.attributes - The attributes to read.ServiceException - If the server returns a bad ServiceResult code for the service call.UaClient.readAttribute(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId, com.prosysopc.ua.stack.builtintypes.UnsignedInteger),
UaClient.readValue(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId),
UaClient.read(java.lang.Double, com.prosysopc.ua.stack.core.TimestampsToReturn, com.prosysopc.ua.stack.core.ReadValueId...)public void readComponents(UaNode node) throws ServiceException
Read all nodes that are connected to the node with a forward HasComponent reference and adds the respective references to the node.
node - the node whose components are to be retrieved.ServiceException - if the service calls failpublic void readNode(UaNode node) throws ServiceException
The method is called automatically by getNode(NodeId), so normally you need to call
readNode only to refresh the attribute values.
node - The node to readServiceException - If the server returns a bad ServiceResult code for the service call.getNode(NodeId)public void readProperties(UaNode node) throws ServiceException
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.
node - the node to browse.ServiceException - if a service call to get the properties or their values failspublic void readReferences(UaNode node, NodeId referenceTypeId, BrowseDirection direction, boolean includeSubTypes) throws ServiceException
getNode(NodeId)
and readNode(UaNode).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 referenceTypeIdServiceException - if the browse call fails.public NodeId[] registerNodes(NodeId... nodesToRegister) throws ServiceException
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(com.prosysopc.ua.stack.builtintypes.NodeId...) to tell the server that you have finished with the nodes.
nodesToRegister - the node IDs to register in the serverServiceException - if the service call failspublic void setBrowseDirection(BrowseDirection browseDirection)
browseDirection - the browse direction to set (default is Forward only)public void setIncludeSubTypes(Boolean includeSubTypes)
includeSubTypes - whether to include sub types or referenceTypeId in the browse results
(default is true)public void setMaxDataSetsPerQuery(int value)
public void setMaxReferencesPerNode(int value)
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
value - the maxReferencesPerNode to setpublic void setNodeClassSet(EnumSet<NodeClass> nodeClassSet)
nodeClassSet - the nodeClassSet to setpublic void setRead104Attributes(boolean read104Attributes)
public void setReferenceTypeId(NodeId referenceTypeId)
referenceTypeId - the reference types to request. if includeSubTypes is defined, all sub
types of this reference are also requested. Default is to browse all
HierarchicalReferencespublic void setResultMaskSet(EnumSet<BrowseResultMask> resultMaskSet)
resultMaskSet - the resultMask to set. Use BrowseResultMask.ALL to request all results
(this is the default setting).public void setView(ViewDescription view)
view - the view to set. Use null to define that no view restrictions should apply (this is
the default setting).public BrowsePathResult[] translateBrowsePathsToNodeIds(BrowsePath... browsePaths) throws ServiceException
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.
browsePaths - the browse paths, i.e. combinations of StartingNode & RelativePathUnsignedInteger.MAX_VALUE.ServiceException - if the service call failstranslateBrowsePathToNodeId(com.prosysopc.ua.stack.builtintypes.NodeId, com.prosysopc.ua.stack.core.RelativePathElement...)public BrowsePathResult[] translateBrowsePathsToNodeIds(NodeId startingNode, RelativePath... paths) throws ServiceException
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.
startingNode - the node from which the paths are browsedpaths - the relative paths.UnsignedInteger.MAX_VALUE.ServiceException - if the service call failstranslateBrowsePathToNodeId(com.prosysopc.ua.stack.builtintypes.NodeId, com.prosysopc.ua.stack.core.RelativePathElement...)public BrowsePathTarget[] translateBrowsePathToNodeId(NodeId startingNode, RelativePathElement... elements) throws ServiceException, StatusException
translateBrowsePathsToNodeIds(com.prosysopc.ua.stack.core.BrowsePath...), instead.startingNode - the node from which the paths are browsedelements - 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.UnsignedInteger.MAX_VALUE.ServiceException - if the service call failsStatusException - 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.translateBrowsePathsToNodeIds(com.prosysopc.ua.stack.core.BrowsePath...)public BrowsePathTarget[] translateBrowsePathToNodeIds(NodeId startingNode, RelativePath relativePath) throws StatusException, ServiceException
UaAddressSpacetranslateBrowsePathToNodeIds in interface UaAddressSpacestartingNode - the node from where to start.relativePath - the path from the node to follow.UnsignedInteger.MAX_VALUE.StatusException - if call failedServiceException - if call failedpublic NodeId[] unregisterAllNodes() throws ServiceException
ServiceExceptionunregisterNodes(NodeId...),
registeredNodespublic void unregisterNodes(NodeId... nodesToUnregister) throws ServiceException
registerNodes(com.prosysopc.ua.stack.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.
nodesToUnregister - A list of NodeIds that have been obtained via the RegisterNodes
service.ServiceException - if the service call failsunregisterAllNodes(),
registerNodes(com.prosysopc.ua.stack.builtintypes.NodeId...)protected List<ReferenceDescription> browse(NodeId nodeId, BrowseDescription browseDescription) throws ServerConnectionException, ServiceException, StatusException
protected QueryDataSet[] query(ViewDescription view, NodeTypeDescription[] nodeTypes, ContentFilter filter, UnsignedInteger maxDataSetsToReturn, UnsignedInteger maxReferencesToReturn) throws ServiceFaultException, ServerConnectionException, ServiceResultException
Copyright © 2026. All rights reserved.