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
-
-
Field Summary
-
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <O> voidattachIngestor(java.lang.Class<O> outCls, java.lang.String outTypeName, DataIngestor<O> ingestor)Attaches an asynchronous result data ingestor.<I> voidprocess(java.lang.String inTypeName, I data)Requests asynchronous processing a data item.default <I> voidprocessQuiet(java.lang.String inTypeName, I data)Requests asynchronous processing a data item.<I,O>
OprocessSync(java.lang.String inTypeName, I data, java.lang.String outTypeName)Requests synchronous processing a data item.default <I,O>
OprocessSyncQuiet(java.lang.String inTypeName, I data, java.lang.String outTypeName)Requests asynchronous processing a data item.<I> voidregisterInputTypeTranslator(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.<O> voidregisterOutputTypeTranslator(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.-
Methods inherited from interface de.iip_ecosphere.platform.services.environment.Service
activate, getDescription, getKind, getName, getNetMgtKeyAddress, getParameterConfigurer, getParameterNames, getVersion, isDeployable, isTopLevel, migrate, passivate, reconfigure, switchTo, update
-
Methods inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
getId, getState, setState
-
-
-
-
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 typeinTypeName- symbolic name ofinCls, e.g. from configuration modelinTrans- 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 typeoutTypeName- symbolic name ofoutCls, e.g. from configuration modeloutTrans- 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 typeoutTypeName- symbolic name ofoutCls, e.g. from configuration modelingestor- the ingestor instance
-
process
<I> void process(java.lang.String inTypeName, I data) throws java.util.concurrent.ExecutionExceptionRequests asynchronous processing a data item.- Type Parameters:
I- the input data type- Parameters:
inTypeName- the name ofinTypein the configuration modeldata- 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.ExecutionExceptionRequests synchronous processing a data item.- Type Parameters:
I- the input data typeO- the output data type- Parameters:
inTypeName- the name ofinTypein the configuration modeldata- the data item to be processedoutTypeName- the name ofoutTypein 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 callprocess(String, Object)but handle potential exceptions.- Type Parameters:
I- the input data type- Parameters:
inTypeName- the name ofinTypein the configuration modeldata- 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 callprocess(String, Object)but handle potential exceptions.- Type Parameters:
I- the input data typeO- the output data type- Parameters:
inTypeName- the name ofinTypein the configuration modeldata- the data item to be processedoutTypeName- the name ofoutTypein the configuration model- Returns:
- the output, always null in case of asynchronous processing as the result is passed to a registered ingestor
-
-