Interface GenericMultiTypeService

All Superinterfaces:
ParameterConfigurerProvider, Service, ServiceBase
All Known Implementing Classes:
AbstractDelegatingMultiService, AbstractPythonProcessService, PythonAsyncProcessService, PythonSyncProcessService, PythonWsProcessService

public interface GenericMultiTypeService extends Service
Basic interface for a generic service that handles multiple any types of data. We use symbolic type names to distinguish the data types used. Symbolic names can be names from the configuration model, the class name or also some unique optimized short names shared between Java and Python (through generation). Registration methods also require the class of the type in order to have the type available for internal type casts.
Author:
Holger Eichelberger, SSE
  • Method Details

    • registerInputTypeTranslator

      <I> void registerInputTypeTranslator(Class<I> inCls, String inTypeName, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,String> inTrans)
      Adds an input type translator.
      Type Parameters:
      I - the input data type
      Parameters:
      inCls - the class representing the input type
      inTypeName - symbolic name of inCls, e.g. from configuration model
      inTrans - the input data type translator
      See Also:
    • registerOutputTypeTranslator

      <O> void registerOutputTypeTranslator(Class<O> outCls, String outTypeName, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<String,O> outTrans)
      Adds an output type translator.
      Type Parameters:
      O - the output data type
      Parameters:
      outCls - the class representing the input type
      outTypeName - symbolic name of outCls, e.g. from configuration model
      outTrans - the output data type translator
      See Also:
    • attachIngestor

      <O> void attachIngestor(Class<O> outCls, String outTypeName, DataIngestor<O> ingestor)
      Attaches an asynchronous result data ingestor.
      Type Parameters:
      O - the output data type
      Parameters:
      outCls - the class representing the type
      outTypeName - symbolic name of outCls, e.g. from configuration model
      ingestor - the ingestor instance
    • process

      <I> void process(String inTypeName, I data) throws ExecutionException
      Requests asynchronous processing a data item.
      Type Parameters:
      I - the input data type
      Parameters:
      inTypeName - the name of inType in the configuration model
      data - the data item to be processed
      Throws:
      ExecutionException - if the execution fails for some reason, e.g., because type translators are not registered (@link #registerInputTypeTranslator(Class, Class, TypeTranslator, TypeTranslator)}
    • processSync

      <I, O> O processSync(String inTypeName, I data, String outTypeName) throws ExecutionException
      Requests synchronous processing a data item.
      Type Parameters:
      I - the input data type
      O - the output data type
      Parameters:
      inTypeName - the name of inType in the configuration model
      data - the data item to be processed
      outTypeName - the name of outType in the configuration model
      Returns:
      the output, always null in case of asynchronous processing as the result is passed to a registered ingestor
      Throws:
      ExecutionException - if the execution fails for some reason, e.g., because type translators are not registered (@link #registerInputTypeTranslator(Class, Class, TypeTranslator, TypeTranslator)}
    • processQuiet

      default <I> void processQuiet(String inTypeName, I data)
      Requests asynchronous processing a data item. Shall call process(String, Object) but handle potential exceptions.
      Type Parameters:
      I - the input data type
      Parameters:
      inTypeName - the name of inType in the configuration model
      data - the data item to be processed
    • processSyncQuiet

      default <I, O> O processSyncQuiet(String inTypeName, I data, String outTypeName)
      Requests asynchronous processing a data item. Shall call process(String, Object) but handle potential exceptions.
      Type Parameters:
      I - the input data type
      O - the output data type
      Parameters:
      inTypeName - the name of inType in the configuration model
      data - the data item to be processed
      outTypeName - the name of outType in the configuration model
      Returns:
      the output, always null in case of asynchronous processing as the result is passed to a registered ingestor