Class AbstractStringProcessService<I,O>
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractService
-
- de.iip_ecosphere.platform.services.environment.AbstractRunnablesService
-
- de.iip_ecosphere.platform.services.environment.AbstractProcessService<I,java.lang.String,java.lang.String,O>
-
- de.iip_ecosphere.platform.services.environment.AbstractStringProcessService<I,O>
-
- Type Parameters:
I- the input data typeO- the output data type
- All Implemented Interfaces:
MonitoringService,ParameterConfigurerProvider,Service,ServiceBase
public abstract class AbstractStringProcessService<I,O> extends AbstractProcessService<I,java.lang.String,java.lang.String,O>
Implements an abstract asynchronous process-based service which require a String-based communication with the actual service process for a single pair of input-output types, e.g., via JSON.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.iip_ecosphere.platform.services.environment.AbstractProcessService
AbstractProcessService.RunnableWithStop
-
-
Field Summary
-
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStringProcessService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, YamlService yaml)Creates an instance of the service with the required type translators.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidhandleInputStream(java.io.InputStream in)Handles the input stream upon process creation.voidprocess(I data)Requests to process the given data item.voidredirectIO(java.io.InputStream in)Redirects an input stream to another stream (in parallel).-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractProcessService
addProcessSpecCmdArg, attachIngestor, attachMetricsProvider, configure, createAndConfigureProcess, createProcess, createProcess, getExecutableName, getExecutableName, getExecutablePrefix, getExecutablePrefix, getExecutableSuffix, getInputTranslator, getOsArch, getOutputTranslator, getPid, getProcessId, getProcessSpec, getServiceIn, getServiceSpec, getWaitTimeBeforeDestroy, handleErrorStream, handleOutputStream, notifyCallbacks, processQuiet, redirectIO, selectNotNull, selectNotNull, setInheritIo, stop, waitAndDestroy, waitAndDestroy
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractRunnablesService
register
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractService
activate, addConfigurer, addConfigurer, addConfigurer, createInstance, createInstance, createInstance, getDescription, getId, getKind, getName, getNetMgtKeyAddress, getResourceAsStream, getState, getVersion, initializeFrom, isDeployable, isTopLevel, notifyReconfigured, passivate, reconf, reconfigure, reconfigure, rollbackReconfigurationOnFailure, setLibJars, setState, start
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
-
-
-
Constructor Detail
-
AbstractStringProcessService
protected AbstractStringProcessService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, YamlService yaml)
Creates an instance of the service with the required type translators.- Parameters:
inTrans- the input translatoroutTrans- the output translatorcallback- called when data from the service is availableyaml- the service description
-
-
Method Detail
-
process
public void process(I data) throws java.io.IOException
Description copied from class:AbstractProcessServiceRequests to process the given data item.- Specified by:
processin classAbstractProcessService<I,java.lang.String,java.lang.String,O>- Parameters:
data- the data to process- Throws:
java.io.IOException- if processing/transferring to the service fails
-
redirectIO
public void redirectIO(java.io.InputStream in)
Redirects an input stream to another stream (in parallel).- Parameters:
in- the input stream of the spawned process (e.g., input/error)
-
handleInputStream
protected void handleInputStream(java.io.InputStream in)
Description copied from class:AbstractProcessServiceHandles the input stream upon process creation.- Specified by:
handleInputStreamin classAbstractProcessService<I,java.lang.String,java.lang.String,O>- Parameters:
in- the process input stream
-
-