Class 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.AbstractModelAccess
    Implements the model access for OPC UA.
    Author:
    Holger Eichelberger, SSE
    • Nested Class Summary

      • Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.model.AbstractModelAccess

        de.iip_ecosphere.platform.connectors.model.AbstractModelAccess.NotificationChangedListener
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void browseNode​(java.lang.String indent, org.eclipse.milo.opcua.stack.core.types.builtin.NodeId browseRoot)
      Just for testing, see Identifiers.RootFolder.
      java.lang.Object call​(java.lang.String qName, java.lang.Object... args)  
      java.lang.Object get​(java.lang.String qName)  
      java.lang.Object get​(java.lang.String qName, int lifetime)  
      protected de.iip_ecosphere.platform.connectors.ConnectorParameter getConnectorParameter()  
      private org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeId getEncodingId​(java.lang.Class<?> cls)
      Returns the encodingId of a custom type.
      de.iip_ecosphere.platform.connectors.model.ModelInputConverter getInputConverter()
      Returns the input converter instance.
      de.iip_ecosphere.platform.connectors.model.ModelOutputConverter getOutputConverter()
      Returns the output converter instance.
      java.lang.String getQSeparator()  
      <T> T getStruct​(java.lang.String qName, java.lang.Class<T> type)  
      void monitor​(int notificationInterval, java.lang.String... qName)  
      void monitorModelChanges​(int notificationInterval)  
      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.
      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.
      void registerCustomType​(java.lang.Class<?> cls)  
      private OpcUaConnector.NodeCacheEntry retrieveCacheEntry​(java.lang.String qName)
      Retrieves a node starting at the root of the OPC UA model based on the node's qualified name qName.
      private org.eclipse.milo.opcua.sdk.client.nodes.UaNode retrieveNode​(org.eclipse.milo.opcua.sdk.client.nodes.UaNode current, java.lang.String qName)
      Retrieves a node starting at current recursively following the path given by qName.
      private org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode retrieveVariableNode​(java.lang.String qName, OpcUaConnector.NodeCacheEntry entry)
      Retrieves an OPC UA variable node from a cache node entry.
      void set​(java.lang.String qName, java.lang.Object value)  
      void setStruct​(java.lang.String qName, java.lang.Object value)  
      OpcUaConnector.OpcUaModelAccess stepInto​(java.lang.String name)  
      OpcUaConnector.OpcUaModelAccess stepOut()  
      java.lang.String topInstancesQName()  
      • Methods inherited from class de.iip_ecosphere.platform.connectors.model.AbstractModelAccess

        iqName, isDetailNotifiedItemEnabled, monitor, monitorModelChanges, qName, setDetailNotifiedItem, useNotifications, useNotifications
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 on
        basePath - the base path this context represente
        parent - the parent to return to in stepOut()
        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 indent
        browseRoot - 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.IOException
        Retrieves 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 for qName or if the found node is not a variable node
        org.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 name qName. Takes into account the nodes cache.
        Parameters:
        qName - the qualified node name
        Returns:
        the node
        Throws:
        java.io.IOException - if no node can be found for qName
        org.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.UaException
        Retrieves a node starting at current recursively following the path given by qName.
        Parameters:
        current - the current node to start searching for, may be null for top-level
        qName - 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.IOException
        Returns 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:
        getConnectorParameter in class de.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 item
        value - 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 item
        var - the changed values/variants