Interface ConnectorFactory<O,I,CO,CI,A extends ProtocolAdapter<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
A - the protocol adapter type

public interface ConnectorFactory<O,I,CO,CI,A extends ProtocolAdapter<O,I,CO,CI>>
Creates a single connector instance or allows to dynamically choose among multiple connector types of the same kind. Implementations must have a publicly accessible no-arg constructor.
Author:
Holger Eichelberger, SSE
  • Method Details

    • createConnector

      Connector<O,I,CO,CI> createConnector(ConnectorParameter params, A... adapter)
      Creates a connector based on the given connector parameters.
      Parameters:
      params - the parameters
      adapter - the protocol adapters to create the connector for
      Returns:
      the connector
    • hasService

      static boolean hasService(ConnectorParameter params)
      Returns whether connector parameter is given and has a service.
      Parameters:
      params - the parameters
      Returns:
      true for service, false else
    • hasVersion

      static boolean hasVersion(ConnectorParameter params)
      Returns whether connector parameter is given and has service containing a version with version number.
      Parameters:
      params - the parameters
      Returns:
      true for version, false else
    • createConnector

      @SafeVarargs static <O, I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> Connector<O,I,CO,CI> createConnector(String cls, ConnectorParameter params, A... adapter)
      Creates a connector instance.
      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
      A - the adapter type
      Parameters:
      cls - the class or plugin id of the connector or of the connector factory indirectly creating the connector. Connectors must have at least a one-arg public constructor taking adapters
      params - the connector parameters supplier
      adapter - the protocol adapters to create the connector for
      Returns:
      the connector instance or null if none can be created
      See Also:
    • createConnector

      @SafeVarargs static <O, I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> Connector<O,I,CO,CI> createConnector(String cls, Supplier<ConnectorParameter> params, A... adapter)
      Creates a connector instance.
      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
      A - the adapter type
      Parameters:
      cls - the class or plugin id of the connector or of the connector factory indirectly creating the connector. Connectors must have at least a one-arg public constructor taking adapters
      params - the connector parameters supplier
      adapter - the protocol adapters to create the connector for
      Returns:
      the connector instance or null if none can be created
    • createConnectorByPlugin

      static <O, I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> Connector<O,I,CO,CI> createConnectorByPlugin(String pluginId, Supplier<ConnectorParameter> params, A... adapter)
      Creates a connector instance from a plugin of type ConnectorDescriptor, see also AbstractPluginConnectorDescriptor. Logs errors.
      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
      A - the adapter type
      Parameters:
      pluginId - the plugin id
      params - the connector parameters supplier
      adapter - the protocol adapters to create the connector for
      Returns:
      the connector instance or null if none can be created
    • createConnectorByPlugin

      static <O, I, CO, CI, S extends AdapterSelector<O, I, CO, CI>, A extends ProtocolAdapter<O, I, CO, CI>> Connector<O,I,CO,CI> createConnectorByPlugin(String pluginId, boolean log, Supplier<ConnectorParameter> params, S selector, A... adapter)
      Creates a connector instance from a plugin of type ConnectorDescriptor, see also AbstractPluginConnectorDescriptor.
      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
      S - the selector type
      A - the adapter type
      Parameters:
      pluginId - the plugin id
      log - shall plugin errors be logged
      params - the connector parameters supplier
      selector - the adapter selector, may be null for none
      adapter - the protocol adapters to create the connector for
      Returns:
      the connector instance or null if none can be created
    • createConnectorParameter

      static ConnectorParameter createConnectorParameter(String serviceId)
      Creates the default connector parameter for a given serviceId.
      Returns:
      the connector parameter instance or null if no instance can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, ConnectorParameter params, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      params - connector params to use, may be null for implicitly obtaining the default connector params
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, ConnectorParameter params, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      params - connector params to use, may be null for implicitly obtaining the default connector params
      inPathSupplier - function returning the actual input base path to use for data accesses, may be null
      outPathSupplier - function returning the actual output base path to use for data accesses, may be null
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      inPathSupplier - function returning the actual input base path to use for data accesses, may be null
      outPathSupplier - function returning the actual output base path to use for data accesses, may be null
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!) becomes active if metrics is not null
      metrics - the metrics provider to use, null for no metric measurements
      log - the log file to use to record individual measurements in experiments, null for no logging. Only
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, ConnectorParameter params, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      params - connector params to use, may be null for implicitly obtaining the default connector params becomes active if metrics is not null
      metrics - the metrics provider to use, null for no metric measurements
      log - the log file to use to record individual measurements in experiments, null for no logging. Only
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createConnector

      static <O, I, CO, CI> Connector<O,I,CO,CI> createConnector(String serviceId, ConnectorParameter params, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass)
      Creates a connector for a given serviceId. Connector instances may only be available after the app build process has been completed once.
      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
      Parameters:
      serviceId - the id of the service to create the connector for (not the plugin id!)
      params - connector params to use, may be null for implicitly obtaining the default connector params
      metrics - the metrics provider to use, null for no metric measurements
      log - the log file to use to record individual measurements in experiments, null for no logging. Only becomes active if metrics is not null
      inPathSupplier - function returning the actual input base path to use for data accesses, may be null
      outPathSupplier - function returning the actual output base path to use for data accesses, may be null
      oClass - the actual type of O
      iClass - the actual type of I
      coClass - the actual type of CO
      ciClass - the actual type of CI
      Returns:
      the connector or null if no connector can be created
    • createChanneledSerializer

      static <T> ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T> createChanneledSerializer(String serviceId, boolean input, Class<T> cls)
      Creates a channeled input/output serializer for the given serviceId and the given type cls. If serializers are registered, they shall be available already in early app build stages so that service unit test can rely on the instances.
      Type Parameters:
      T - the data type
      Parameters:
      serviceId - the service id
      input - input (parser) or output formatter
      cls - the data type
      Returns:
      the serializer or null if unknown