Class TranslatingProtocolAdapter<O,I,CO,CI>

java.lang.Object
de.iip_ecosphere.platform.connectors.types.AbstractProtocolAdapter<O,I,CO,CI>
de.iip_ecosphere.platform.connectors.types.TranslatingProtocolAdapter<O,I,CO,CI>
Type Parameters:
O - the output type from the underlying machine/platform
I - the input type to the underlying machine/platform
CO - the output type of the connector
CI - the input type of the connector
All Implemented Interfaces:
ProtocolAdapter<O,I,CO,CI>
Direct Known Subclasses:
ChannelTranslatingProtocolAdapter

public class TranslatingProtocolAdapter<O,I,CO,CI> extends AbstractProtocolAdapter<O,I,CO,CI>
Uses two TypeTranslator instances for the protocol adaptation, optionally passing on the reception channel to a given ChanneledConnectorOutputTypeTranslator.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

  • Method Details

    • adaptInput

      public I adaptInput(CI data) throws IOException
      Description copied from interface: ProtocolAdapter
      Adapts the input from the IIP-Ecosphere platform to the underlying machine/platform.
      Parameters:
      data - the data to be adapted
      Returns:
      the adapted data
      Throws:
      IOException - in case that the adaptation fails
    • adaptOutput

      public CO adaptOutput(String channel, O data) throws IOException
      Description copied from interface: ProtocolAdapter
      Adapts the output from the underlying machine/platform to the IIP-Ecosphere platform.
      Parameters:
      channel - the channel the data was received
      data - the data to be adapted
      Returns:
      the adapted data
      Throws:
      IOException - in case that the adaptation fails
    • setModelAccess

      public void setModelAccess(ModelAccess modelAccess)
      Description copied from class: AbstractProtocolAdapter
      Defines the model access. Handle with care, shall be called by connector only.
      Specified by:
      setModelAccess in interface ProtocolAdapter<O,I,CO,CI>
      Overrides:
      setModelAccess in class AbstractProtocolAdapter<O,I,CO,CI>
      Parameters:
      modelAccess - the model access
    • initializeModelAccess

      public void initializeModelAccess() throws IOException
      Description copied from interface: ProtocolAdapter
      Called to initialize the model access, e.g., to setup notifications. Called only, when the connector is connected.
      Throws:
      IOException - in case the initialization fails, e.g., monitors cannot be set up
    • getProtocolInputType

      public Class<? extends I> getProtocolInputType()
      Description copied from interface: ProtocolAdapter
      Returns the input type to the protocol.
      Returns:
      the input type (may be null in case of generic types, but shall not be null)
    • getConnectorInputType

      public Class<? extends CI> getConnectorInputType()
      Description copied from interface: ProtocolAdapter
      Returns the input type from the IIP-Ecosphere platform.
      Returns:
      the input type (may be null in case of generic types, but shall not be null)
    • getProtocolOutputType

      public Class<? extends O> getProtocolOutputType()
      Description copied from interface: ProtocolAdapter
      Returns the output type of the protocol.
      Returns:
      the output type (may be null in case of generic types, but shall not be null)
    • getConnectorOutputType

      public Class<? extends CO> getConnectorOutputType()
      Description copied from interface: ProtocolAdapter
      Returns the output type to the IIP-Ecosphere platform.
      Returns:
      the output type (may be null in case of generic types, but shall not be null)