Class AbstractRunnablesService
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractService
-
- de.iip_ecosphere.platform.services.environment.AbstractRunnablesService
-
- All Implemented Interfaces:
ParameterConfigurerProvider,Service,ServiceBase
- Direct Known Subclasses:
AbstractProcessService,AbstractPythonProcessService
public abstract class AbstractRunnablesService extends AbstractService
A basic service that holds and stops runnables.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AbstractProcessService.RunnableWithStop>runnables-
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID
-
-
Constructor Summary
Constructors Constructor Description AbstractRunnablesService(YamlService yaml)Creates a service from YAML information.AbstractRunnablesService(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a service from a service id and a YAML artifact.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidregister(AbstractProcessService.RunnableWithStop runnable)Registers a runnable that shall be stopped instop().protected ServiceStatestop()Stops the service and the background process.-
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
getParameterConfigurer, getParameterNames, migrate, switchTo, update
-
-
-
-
Field Detail
-
runnables
private java.util.List<AbstractProcessService.RunnableWithStop> runnables
-
-
Constructor Detail
-
AbstractRunnablesService
public AbstractRunnablesService(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a service from a service id and a YAML artifact.- Parameters:
serviceId- the service idymlFile- the YML file containing the YAML artifact with the service descriptor
-
AbstractRunnablesService
public AbstractRunnablesService(YamlService yaml)
Creates a service from YAML information.- Parameters:
yaml- the service information as read from YAML. By default, the Python executable is "ServiceEnvironment.py", which can be overridden byYamlProcess.getExecutable().YamlProcess.getHomePath()is set to the home path where the executable was extracted to. Further,YamlProcess.getCmdArg()are taken over if given.
-
-
Method Detail
-
register
protected void register(AbstractProcessService.RunnableWithStop runnable)
Registers a runnable that shall be stopped instop().- Parameters:
runnable- the runnable, ignored if null
-
stop
protected ServiceState stop()
Description copied from class:AbstractServiceStops the service and the background process.- Overrides:
stopin classAbstractService- Returns:
- the state to transition to, may be null for none
-
-