Class MonitoredTranslatingProtocolAdapter<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:
    de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<O,​I,​CO,​CI>, de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<O,​I,​CO,​CI>

    public class MonitoredTranslatingProtocolAdapter<O,​I,​CO,​CI>
    extends de.iip_ecosphere.platform.connectors.types.ChannelTranslatingProtocolAdapter<O,​I,​CO,​CI>
    Implements a monitoring wrapper for TranslatingProtocolAdapter to be instrumented into by generation.
    Author:
    Holger Eichelberger, SSE
    • Constructor Summary

      Constructors 
      Constructor Description
      MonitoredTranslatingProtocolAdapter​(de.iip_ecosphere.platform.connectors.types.ConnectorOutputTypeTranslator<O,​CO> outputTranslator, de.iip_ecosphere.platform.connectors.types.ConnectorInputTypeTranslator<CI,​I> inputTranslator, MetricsProvider metrics, java.io.File log)
      Creates a monitored translating protocol adapter with empty channels.
      MonitoredTranslatingProtocolAdapter​(java.lang.String outputChannel, de.iip_ecosphere.platform.connectors.types.ConnectorOutputTypeTranslator<O,​CO> outputTranslator, java.lang.String inputChannel, de.iip_ecosphere.platform.connectors.types.ConnectorInputTypeTranslator<CI,​I> inputTranslator, MetricsProvider metrics, java.io.File log)
      Creates a monitored translating protocol adapter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      I adaptInput​(CI data)  
      CO adaptOutput​(O data)  
      private void log​(java.lang.String activity, long duration)
      Logs an activity if there is a logger.
      • Methods inherited from class de.iip_ecosphere.platform.connectors.types.ChannelTranslatingProtocolAdapter

        getInputChannel, getOutputChannel
      • Methods inherited from class de.iip_ecosphere.platform.connectors.types.TranslatingProtocolAdapter

        getConnectorInputType, getConnectorOutputType, getProtocolInputType, getProtocolOutputType, initializeModelAccess, setModelAccess
      • Methods inherited from class de.iip_ecosphere.platform.connectors.types.AbstractProtocolAdapter

        getModelAccess
      • 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.types.ProtocolAdapter

        getConnectorInputType, getConnectorOutputType, getModelAccess, getProtocolInputType, getProtocolOutputType, initializeModelAccess, setModelAccess
    • Constructor Detail

      • MonitoredTranslatingProtocolAdapter

        public MonitoredTranslatingProtocolAdapter​(de.iip_ecosphere.platform.connectors.types.ConnectorOutputTypeTranslator<O,​CO> outputTranslator,
                                                   de.iip_ecosphere.platform.connectors.types.ConnectorInputTypeTranslator<CI,​I> inputTranslator,
                                                   MetricsProvider metrics,
                                                   java.io.File log)
        Creates a monitored translating protocol adapter with empty channels.
        Parameters:
        outputTranslator - the output translator
        inputTranslator - the input translator
        metrics - the metrics provider used to measure
        log - optional file to log individual values to (may be null for none)
      • MonitoredTranslatingProtocolAdapter

        public MonitoredTranslatingProtocolAdapter​(java.lang.String outputChannel,
                                                   de.iip_ecosphere.platform.connectors.types.ConnectorOutputTypeTranslator<O,​CO> outputTranslator,
                                                   java.lang.String inputChannel,
                                                   de.iip_ecosphere.platform.connectors.types.ConnectorInputTypeTranslator<CI,​I> inputTranslator,
                                                   MetricsProvider metrics,
                                                   java.io.File log)
        Creates a monitored translating protocol adapter.
        Parameters:
        outputChannel - the name of the input channel. Further semantics is implied/restrictions are imposed by the underlying protocol.
        outputTranslator - the output translator
        inputChannel - the name of the input channel. Further semantics is implied/restrictions are imposed by the underlying protocol.
        inputTranslator - the input translator
        metrics - the metrics provider used to measure
        log - optional file to log individual values to (may be null for none)
    • Method Detail

      • log

        private void log​(java.lang.String activity,
                         long duration)
        Logs an activity if there is a logger.
        Parameters:
        activity - the activity name
        duration - the duration
      • adaptInput

        public I adaptInput​(CI data)
                     throws java.io.IOException
        Specified by:
        adaptInput in interface de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<O,​I,​CO,​CI>
        Overrides:
        adaptInput in class de.iip_ecosphere.platform.connectors.types.TranslatingProtocolAdapter<O,​I,​CO,​CI>
        Throws:
        java.io.IOException
      • adaptOutput

        public CO adaptOutput​(O data)
                       throws java.io.IOException
        Specified by:
        adaptOutput in interface de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<O,​I,​CO,​CI>
        Overrides:
        adaptOutput in class de.iip_ecosphere.platform.connectors.types.TranslatingProtocolAdapter<O,​I,​CO,​CI>
        Throws:
        java.io.IOException