Class OpcUaConnector.OpcUaModelAccess
- java.lang.Object
-
- de.iip_ecosphere.platform.connectors.model.AbstractModelAccess
-
- de.iip_ecosphere.platform.connectors.opcuav1.OpcUaConnector.OpcUaModelAccess
-
- All Implemented Interfaces:
de.iip_ecosphere.platform.connectors.model.ModelAccess
- Enclosing class:
- OpcUaConnector<CO,CI>
protected class OpcUaConnector.OpcUaModelAccess extends de.iip_ecosphere.platform.connectors.model.AbstractModelAccessImplements the model access for OPC UA.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private OpcUaConnector.NodeCacheEntrybaseprivate java.lang.StringbasePathprivate OpcUaConnector.OpcInputConverterinputConverterprivate java.util.Map<java.lang.String,OpcUaConnector.NodeCacheEntry>nodesprivate OpcUaConnector.OpcOutputConverteroutputConverterprivate OpcUaConnector.OpcUaModelAccessparent
-
Constructor Summary
Constructors Modifier Constructor Description protectedOpcUaModelAccess()Creates the instance and binds the listener to the creating connector instance.protectedOpcUaModelAccess(OpcUaConnector.NodeCacheEntry base, java.lang.String basePath, OpcUaConnector.OpcUaModelAccess parent, java.util.Map<java.lang.String,OpcUaConnector.NodeCacheEntry> nodes)Creates the instance and binds the listener to the creating connector instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbrowseNode(java.lang.String indent, org.eclipse.milo.opcua.stack.core.types.builtin.NodeId browseRoot)Just for testing, see Identifiers.RootFolder.java.lang.Objectcall(java.lang.String qName, java.lang.Object... args)java.lang.Objectget(java.lang.String qName)java.lang.Objectget(java.lang.String qName, int lifetime)protected de.iip_ecosphere.platform.connectors.ConnectorParametergetConnectorParameter()private org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeIdgetEncodingId(java.lang.Class<?> cls)Returns the encodingId of a custom type.de.iip_ecosphere.platform.connectors.model.ModelInputConvertergetInputConverter()Returns the input converter instance.de.iip_ecosphere.platform.connectors.model.ModelOutputConvertergetOutputConverter()Returns the output converter instance.java.lang.StringgetQSeparator()<T> TgetStruct(java.lang.String qName, java.lang.Class<T> type)voidmonitor(int notificationInterval, java.lang.String... qName)voidmonitorModelChanges(int notificationInterval)private voidonEvent(org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem item, org.eclipse.milo.opcua.stack.core.types.builtin.Variant[] var)Is called when a monitoring event occurs.private voidonSubscriptionValue(org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem item, org.eclipse.milo.opcua.stack.core.types.builtin.DataValue value)Is called on changing a monitored item.voidregisterCustomType(java.lang.Class<?> cls)private OpcUaConnector.NodeCacheEntryretrieveCacheEntry(java.lang.String qName)Retrieves a node starting at the root of the OPC UA model based on the node's qualified nameqName.private org.eclipse.milo.opcua.sdk.client.nodes.UaNoderetrieveNode(org.eclipse.milo.opcua.sdk.client.nodes.UaNode current, java.lang.String qName)Retrieves a node starting atcurrentrecursively following the path given byqName.private org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNoderetrieveVariableNode(java.lang.String qName, OpcUaConnector.NodeCacheEntry entry)Retrieves an OPC UA variable node from a cache node entry.voidset(java.lang.String qName, java.lang.Object value)voidsetStruct(java.lang.String qName, java.lang.Object value)OpcUaConnector.OpcUaModelAccessstepInto(java.lang.String name)OpcUaConnector.OpcUaModelAccessstepOut()java.lang.StringtopInstancesQName()-
Methods inherited from class de.iip_ecosphere.platform.connectors.model.AbstractModelAccess
iqName, isDetailNotifiedItemEnabled, monitor, monitorModelChanges, qName, setDetailNotifiedItem, useNotifications, useNotifications
-
-
-
-
Field Detail
-
nodes
private java.util.Map<java.lang.String,OpcUaConnector.NodeCacheEntry> nodes
-
base
private OpcUaConnector.NodeCacheEntry base
-
basePath
private java.lang.String basePath
-
parent
private OpcUaConnector.OpcUaModelAccess parent
-
inputConverter
private OpcUaConnector.OpcInputConverter inputConverter
-
outputConverter
private OpcUaConnector.OpcOutputConverter outputConverter
-
-
Constructor Detail
-
OpcUaModelAccess
protected OpcUaModelAccess()
Creates the instance and binds the listener to the creating connector instance.
-
OpcUaModelAccess
protected OpcUaModelAccess(OpcUaConnector.NodeCacheEntry base, java.lang.String basePath, OpcUaConnector.OpcUaModelAccess parent, java.util.Map<java.lang.String,OpcUaConnector.NodeCacheEntry> nodes)
Creates the instance and binds the listener to the creating connector instance.- Parameters:
base- the context node to resolve non-nested names onbasePath- the base path this context representeparent- the parent to return to instepOut()nodes- the (parent) nodes cache to use
-
-
Method Detail
-
topInstancesQName
public java.lang.String topInstancesQName()
-
getQSeparator
public java.lang.String getQSeparator()
-
getInputConverter
public de.iip_ecosphere.platform.connectors.model.ModelInputConverter getInputConverter()
Returns the input converter instance.- Returns:
- the input converter
-
getOutputConverter
public de.iip_ecosphere.platform.connectors.model.ModelOutputConverter getOutputConverter()
Returns the output converter instance.- Returns:
- the output converter
-
call
public java.lang.Object call(java.lang.String qName, java.lang.Object... args) throws java.io.IOException- Throws:
java.io.IOException
-
browseNode
private void browseNode(java.lang.String indent, org.eclipse.milo.opcua.stack.core.types.builtin.NodeId browseRoot)Just for testing, see Identifiers.RootFolder.- Parameters:
indent- output indentbrowseRoot- the node id to start browsing at
-
retrieveVariableNode
private org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode retrieveVariableNode(java.lang.String qName, OpcUaConnector.NodeCacheEntry entry) throws org.eclipse.milo.opcua.stack.core.UaException, java.io.IOExceptionRetrieves an OPC UA variable node from a cache node entry.- Parameters:
qName- the qualified node name (for exception message)entry- the cache entry to read the variable node from- Returns:
- the variable node
- Throws:
java.io.IOException- if no node can be found forqNameor if the found node is not a variable nodeorg.eclipse.milo.opcua.stack.core.UaException- if accessing/browsing the OPC UA model fails
-
retrieveCacheEntry
private OpcUaConnector.NodeCacheEntry retrieveCacheEntry(java.lang.String qName) throws org.eclipse.milo.opcua.stack.core.UaException, java.io.IOException
Retrieves a node starting at the root of the OPC UA model based on the node's qualified nameqName. Takes into accountthe nodes cache.- Parameters:
qName- the qualified node name- Returns:
- the node
- Throws:
java.io.IOException- if no node can be found forqNameorg.eclipse.milo.opcua.stack.core.UaException- if accessing/browsing the OPC UA model fails
-
retrieveNode
private org.eclipse.milo.opcua.sdk.client.nodes.UaNode retrieveNode(org.eclipse.milo.opcua.sdk.client.nodes.UaNode current, java.lang.String qName) throws org.eclipse.milo.opcua.stack.core.UaExceptionRetrieves a node starting atcurrentrecursively following the path given byqName.- Parameters:
current- the current node to start searching for, may be null for top-levelqName- the qualified node name- Returns:
- the node or null for none found
- Throws:
org.eclipse.milo.opcua.stack.core.UaException- if accessing/browsing the OPC UA model fails
-
get
public java.lang.Object get(java.lang.String qName) throws java.io.IOException- Throws:
java.io.IOException
-
get
public java.lang.Object get(java.lang.String qName, int lifetime) throws java.io.IOException- Throws:
java.io.IOException
-
set
public void set(java.lang.String qName, java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
getStruct
public <T> T getStruct(java.lang.String qName, java.lang.Class<T> type) throws java.io.IOException- Throws:
java.io.IOException
-
setStruct
public void setStruct(java.lang.String qName, java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
getEncodingId
private org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeId getEncodingId(java.lang.Class<?> cls) throws java.io.IOExceptionReturns the encodingId of a custom type.- Parameters:
cls- the type class- Returns:
- the encodingId
- Throws:
java.io.IOException- if the encodingID cannot be found
-
registerCustomType
public void registerCustomType(java.lang.Class<?> cls) throws java.io.IOException- Throws:
java.io.IOException
-
getConnectorParameter
protected de.iip_ecosphere.platform.connectors.ConnectorParameter getConnectorParameter()
- Specified by:
getConnectorParameterin classde.iip_ecosphere.platform.connectors.model.AbstractModelAccess
-
monitor
public void monitor(int notificationInterval, java.lang.String... qName) throws java.io.IOException- Throws:
java.io.IOException
-
monitorModelChanges
public void monitorModelChanges(int notificationInterval) throws java.io.IOException- Throws:
java.io.IOException
-
onSubscriptionValue
private void onSubscriptionValue(org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem item, org.eclipse.milo.opcua.stack.core.types.builtin.DataValue value)Is called on changing a monitored item.- Parameters:
item- the monitored itemvalue- the new data value
-
onEvent
private void onEvent(org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem item, org.eclipse.milo.opcua.stack.core.types.builtin.Variant[] var)Is called when a monitoring event occurs.- Parameters:
item- the monitored itemvar- the changed values/variants
-
stepInto
public OpcUaConnector.OpcUaModelAccess stepInto(java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
stepOut
public OpcUaConnector.OpcUaModelAccess stepOut()
-
-