Interface GenericMultiTypeService

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

    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 Detail

      • registerInputTypeTranslator

        <I> void registerInputTypeTranslator​(java.lang.Class<I> inCls,
                                             java.lang.String inTypeName,
                                             de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,​java.lang.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(Class, String, TypeTranslator)
      • registerOutputTypeTranslator

        <O> void registerOutputTypeTranslator​(java.lang.Class<O> outCls,
                                              java.lang.String outTypeName,
                                              de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.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:
        registerInputTypeTranslator(Class, String, TypeTranslator)
      • attachIngestor

        <O> void attachIngestor​(java.lang.Class<O> outCls,
                                java.lang.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​(java.lang.String inTypeName,
                         I data)
                  throws java.util.concurrent.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:
        java.util.concurrent.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​(java.lang.String inTypeName,
                                  I data,
                                  java.lang.String outTypeName)
                           throws java.util.concurrent.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:
        java.util.concurrent.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​(java.lang.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​(java.lang.String inTypeName,
                                               I data,
                                               java.lang.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