Class AbstractStringProcessService<I,​O>

  • Type Parameters:
    I - the input data type
    O - 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
    • 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 translator
        outTrans - the output translator
        callback - called when data from the service is available
        yaml - the service description
    • Method Detail

      • process

        public void process​(I data)
                     throws java.io.IOException
        Description copied from class: AbstractProcessService
        Requests to process the given data item.
        Specified by:
        process in class AbstractProcessService<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: AbstractProcessService
        Handles the input stream upon process creation.
        Specified by:
        handleInputStream in class AbstractProcessService<I,​java.lang.String,​java.lang.String,​O>
        Parameters:
        in - the process input stream