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.model.AbstractModelAccess.NotificationChangedListener

@MachineConnector
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
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  OpcUaConnector.Descriptor
    The descriptor of this connector (see META-INF/services).
    protected class  OpcUaConnector.OpcUaModelAccess
    Implements the model access for OPC UA.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private org.eclipse.milo.opcua.sdk.client.OpcUaClient client  
    private static DataItem DUMMY  
    private static String FIELD_BINARY_ENCODING_ID  
    private static org.slf4j.Logger LOGGER  
    static String NAME  
    private de.iip_ecosphere.platform.connectors.ConnectorParameter params  
  • Constructor Summary

    Constructors 
    Constructor Description
    OpcUaConnector​(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,​Object,​CO,​CI> adapter)
    Creates an instance and installs the protocol adapter.
  • 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)  
    protected void disconnectImpl()  
    void dispose()  
    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)  
    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.
    String getName()  
    protected DataItem read()  
    protected void writeImpl​(Object data)  

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

    connect, disconnect, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getProtocolInputType, getProtocolOutputType, initializeModelAccess, installPollTask, isPolling, notificationsChanged, received, setReceptionCallback, uninstallPollTask, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OpcUaConnector

      public OpcUaConnector​(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,​Object,​CO,​CI> adapter)
      Creates an instance and installs the protocol adapter.
      Parameters:
      adapter - the protocol adapter
  • Method Details

    • 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
    • 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()
    • 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
    • error

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