Interface GenericMultiTypeService
- All Superinterfaces:
ParameterConfigurerProvider,Service,ServiceBase
- All Known Implementing Classes:
AbstractDelegatingMultiService,AbstractPythonProcessService,PythonAsyncProcessService,PythonSyncProcessService,PythonWsProcessService
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
Modifier and TypeMethodDescription<O> voidattachIngestor(Class<O> outCls, String outTypeName, DataIngestor<O> ingestor) Attaches an asynchronous result data ingestor.getOutTypeName(String inTypeName) Returns a registered output type name for a given input type name.<I> voidRequests asynchronous processing a data item.default <I> voidprocessQuiet(String inTypeName, I data) Requests asynchronous processing a data item.<I,O> O processSync(String inTypeName, I data, String outTypeName) Requests synchronous processing a data item.default <I,O> O processSyncQuiet(String inTypeName, I data, String outTypeName) Requests asynchronous processing a data item.voidregisterInOutRelation(String inTypeName, String outTypeName) Explicitly registers the relation between two type names.<I> voidregisterInputTypeTranslator(Class<I> inCls, String inTypeName, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I, String> inTrans) Adds an input type translator.<O> voidregisterOutputTypeTranslator(Class<O> outCls, String outTypeName, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<String, O> outTrans) Adds an output type translator.Methods inherited from interface de.iip_ecosphere.platform.services.environment.Service
activate, addTypeSubstitution, createType, createType, getDescription, getKind, getName, getNetMgtKeyAddress, getParameterConfigurer, getParameterNames, getSubstitutedType, getTypeCreator, getTypeSubstitutions, getVersion, isDeployable, isTopLevel, migrate, passivate, reconfigure, switchTo, updateMethods inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
getId, getState, setState
-
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 typeinTypeName- symbolic name ofinCls, e.g. from configuration modelinTrans- 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 typeoutTypeName- symbolic name ofoutCls, e.g. from configuration modeloutTrans- the output data type translator- See Also:
-
registerInOutRelation
Explicitly registers the relation between two type names.- Parameters:
inTypeName- symbolic name of an input type, e.g. from configuration modeloutTypeName- symbolic name of an output type, e.g. from configuration model- See Also:
-
getOutTypeName
Returns a registered output type name for a given input type name.- Parameters:
inTypeName- the symbolic input type name- Returns:
- the related symbolic output type name, may be null if there is none
- See Also:
-
attachIngestor
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
Requests 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:
ExecutionException- if the execution fails for some reason, e.g., because type translators are not registered (@link #registerInputTypeTranslator(Class, Class, TypeTranslator, TypeTranslator)}
-
processSync
Requests 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:
ExecutionException- if the execution fails for some reason, e.g., because type translators are not registered (@link #registerInputTypeTranslator(Class, Class, TypeTranslator, TypeTranslator)}
-
processQuiet
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
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
-