Class OpcUaConnector<CO,CI>

java.lang.Object
de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
de.iip_ecosphere.platform.connectors.opcuav1.OpcUaConnector<CO,CI>
Type Parameters:
CO - the output type to the IIP-Ecosphere platform
CI - the input type from the IIP-Ecosphere platform
All Implemented Interfaces:
de.iip_ecosphere.platform.connectors.Connector<DataItem,Object,CO,CI>, de.iip_ecosphere.platform.connectors.events.EventHandlingConnector, de.iip_ecosphere.platform.connectors.model.AbstractModelAccess.NotificationChangedListener

@MachineConnector(specificSettings={}) public class OpcUaConnector<CO,CI> extends de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
Implements the generic OPC UA connector. Do not rename, this class is referenced in META-INF/services. For custom types such as structs, the following must apply:
  • A class implements the datatype and its fields.
  • The class declares an accessible static field named BINARY_ENCODING_ID of type ExpandedNodeId.
  • The class declares a top-level inner class called "Codec" of type GenericDataTypeCodec having an accessible no-arg constructor.
  • Value constructor parameters and accessors shall be based on Java types rather than OPC/Milo types
  • Such custom types must be registered through ModelAccess.registerCustomType(Class) in ConnectorOutputTypeTranslator.initializeModelAccess().
Author:
Holger Eichelberger, SSE, Jan Cepok, SSE
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The descriptor of this connector (see META-INF/services).
    private class 
    A fallback identity provider.
    private static class 
    Realizes a node cache entry with value lifetime.
    private static class 
    Specialized model input converter.
    private static class 
    Specialized model output converter.
    protected class 
    Implements the model access for OPC UA.

    Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    de.iip_ecosphere.platform.connectors.AbstractConnector.BasicAdapterProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.eclipse.milo.opcua.sdk.client.OpcUaClient
     
    private static final DataItem
     
    private static final String
     
    private static final de.iip_ecosphere.platform.support.logging.Logger
     
    static final String
    The name of this connector.
    private de.iip_ecosphere.platform.connectors.ConnectorParameter
     
    static final char
    Denotes the path separator for qualified model names.
    static final String
    Denotes the path separator for qualified model names (as String).
    static final String
    Denotes the top-level folder "Objects".
    static final String
    Denotes the top-level folder "Types".
    static final String
    Denotes the top-level folder "Views".

    Fields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    DEFAULT_CHANNEL
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpcUaConnector(de.iip_ecosphere.platform.connectors.AdapterSelector<DataItem,Object,CO,CI> selector, de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI>... adapter)
    Creates an instance and installs the protocol adapter(s).
    OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI>... adapter)
    Creates an instance and installs the protocol adapter(s).
  • Method Summary

    Modifier and Type
    Method
    Description
    private org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder
    configure(org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configBuilder)
    Does the basic configuration of the OPC UA client.
    protected void
    connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
     
    private org.eclipse.milo.opcua.stack.core.types.builtin.DataValue
    createWriteDataValue(org.eclipse.milo.opcua.stack.core.types.builtin.Variant value)
    Creates a data value for write accesses.
    protected void
     
    void
     
     
    protected Predicate<org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription>
    endpointFilter(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
    Provides a filter for OPC UA endpoints in case that multiple are present.
    protected void
    error(String message, Throwable th)
     
    private String
    getEndpointUrl(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
    Construct the endpoint URL.
    protected org.eclipse.milo.opcua.sdk.client.api.identity.IdentityProvider
    getIdentityProvider(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
    Returns the identity provider by translating the token information in params to Milo specific token information.
    private de.iip_ecosphere.platform.support.identities.IdentityToken
    getIdToken(String endpointUrl)
    Returns the id token for an endpoint URL considering ConnectorParameter.ANY_ENDPOINT.
     
    protected DataItem
     
     
    void
    trigger(de.iip_ecosphere.platform.connectors.events.ConnectorTriggerQuery query)
     
    protected void
     

    Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    checkCache, configureAdapter, configureModelAccess, connect, createTlsContext, disconnect, doPolling, enableNotifications, enablePolling, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getSelector, getStorageValue, initializeModelAccess, initSelector, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, received, received, request, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, uninstallPollTask, useTls, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface de.iip_ecosphere.platform.connectors.Connector

    createSharedSpace, disconnectSafe, enableSharedSpace, setReceptionCallbackSafe
  • Field Details

    • NAME

      public static final String NAME
      The name of this connector.
      See Also:
    • TOP_OBJECTS

      public static final String TOP_OBJECTS
      Denotes the top-level folder "Objects".
      See Also:
    • TOP_TYPES

      public static final String TOP_TYPES
      Denotes the top-level folder "Types".
      See Also:
    • TOP_VIEWS

      public static final String TOP_VIEWS
      Denotes the top-level folder "Views".
      See Also:
    • SEPARATOR_CHAR

      public static final char SEPARATOR_CHAR
      Denotes the path separator for qualified model names.
      See Also:
    • SEPARATOR_STRING

      public static final String SEPARATOR_STRING
      Denotes the path separator for qualified model names (as String).
      See Also:
    • LOGGER

      private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER
    • DUMMY

      private static final DataItem DUMMY
    • FIELD_BINARY_ENCODING_ID

      private static final String FIELD_BINARY_ENCODING_ID
      See Also:
    • client

      private org.eclipse.milo.opcua.sdk.client.OpcUaClient client
    • params

      private de.iip_ecosphere.platform.connectors.ConnectorParameter params
  • Constructor Details

    • OpcUaConnector

      @SafeVarargs public OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI>... adapter)
      Creates an instance and installs the protocol adapter(s).
      Parameters:
      adapter - the protocol adapter(s)
      Throws:
      IllegalArgumentException - if adapter is null or empty or adapters are null
    • OpcUaConnector

      @SafeVarargs public OpcUaConnector(de.iip_ecosphere.platform.connectors.AdapterSelector<DataItem,Object,CO,CI> selector, de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI>... adapter)
      Creates an instance and installs the protocol adapter(s).
      Parameters:
      selector - the adapter selector (null leads to a default selector for the first adapter)
      adapter - the protocol adapter(s)
      Throws:
      IllegalArgumentException - if adapter is null or empty or adapters are null
  • Method Details

    • createWriteDataValue

      private org.eclipse.milo.opcua.stack.core.types.builtin.DataValue createWriteDataValue(org.eclipse.milo.opcua.stack.core.types.builtin.Variant value)
      Creates a data value for write accesses.
      Parameters:
      value - the actual value
      Returns:
      the data value
    • getEndpointUrl

      private String getEndpointUrl(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
      Construct the endpoint URL.
      Parameters:
      params - the connector parameters
      Returns:
      the endpoint URL
    • connectImpl

      protected void connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) throws IOException
      Specified by:
      connectImpl in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
      Throws:
      IOException
    • endpointFilter

      protected Predicate<org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription> endpointFilter(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
      Provides a filter for OPC UA endpoints in case that multiple are present.
      Parameters:
      params - the connector parameters
      Returns:
      the endpoint filter
    • configure

      private org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configure(org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configBuilder)
      Does the basic configuration of the OPC UA client.
      Parameters:
      configBuilder - the configuration builder
      Returns:
      configBuilder
    • getIdToken

      private de.iip_ecosphere.platform.support.identities.IdentityToken getIdToken(String endpointUrl)
      Returns the id token for an endpoint URL considering ConnectorParameter.ANY_ENDPOINT.
      Parameters:
      endpointUrl - the endpoint URL
      Returns:
      the identity token
    • getIdentityProvider

      protected org.eclipse.milo.opcua.sdk.client.api.identity.IdentityProvider getIdentityProvider(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
      Returns the identity provider by translating the token information in params to Milo specific token information.
      Parameters:
      params - the connector params
      Returns:
      the identity provider
    • disconnectImpl

      protected void disconnectImpl() throws IOException
      Specified by:
      disconnectImpl in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
      Throws:
      IOException
    • getName

      public String getName()
    • dispose

      public void dispose()
      Specified by:
      dispose in interface de.iip_ecosphere.platform.connectors.Connector<DataItem,Object,CO,CI>
      Overrides:
      dispose in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
    • writeImpl

      protected void writeImpl(Object data) throws IOException
      Specified by:
      writeImpl in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
      Throws:
      IOException
    • read

      protected DataItem read() throws IOException
      Specified by:
      read in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
      Throws:
      IOException
    • trigger

      public void trigger(de.iip_ecosphere.platform.connectors.events.ConnectorTriggerQuery query)
      Specified by:
      trigger in interface de.iip_ecosphere.platform.connectors.events.EventHandlingConnector
      Overrides:
      trigger in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
    • error

      protected void error(String message, Throwable th)
      Specified by:
      error in class de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
    • supportedEncryption

      public String supportedEncryption()
    • enabledEncryption

      public String enabledEncryption()