Class YamlProcess
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.YamlProcess
-
- All Implemented Interfaces:
ProcessSpec
- Direct Known Subclasses:
YamlServer
public class YamlProcess extends java.lang.Object implements ProcessSpec
If the service is not completely implemented rather than delegates functionality to an additional process that must be started and managed along with the service.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>artifactsprivate java.util.List<java.lang.String>cmdArgprivate java.lang.Stringexecutableprivate java.lang.StringexecutablePathprivate java.lang.StringhomePathprivate java.lang.StringlocationKeyprivate booleanstarted
-
Constructor Summary
Constructors Constructor Description YamlProcess()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>getArtifacts()Returns the process implementing artifacts within the containing artifact to be extracted into theprocess home directory.java.util.List<java.lang.String>getCmdArg()Returns the command line arguments to start the process.java.lang.StringgetExecutable()Returns the system command or relative path within the artifact to be executed.java.io.FilegetExecutablePath()Returns an optional path to be prefixed before the executable.java.io.FilegetHomePath()Returns the home directory of the process to be executed.java.lang.StringgetLocationKey()Returns the location key for lookup inInstalledDependenciesSetup.java.util.List<java.lang.String>getSubstCmdArg()ReturnsgetCmdArg()with substitutions fromtoSubstFileName(String)for all arguments.booleanisStarted()Returns whether the underlying process is already started when firing up the service or it will be started through the service implementation.voidsetArtifacts(java.util.List<java.lang.String> artifacts)Defines the process implementing artifacts within the containing artifact to be extracted.voidsetCmdArg(java.util.List<java.lang.String> cmdArg)Defines the command line arguments.voidsetExecutable(java.lang.String executable)Defines the system command or relative path to be executed.voidsetExecutablePath(java.io.File executablePath)Changes the optional path to be prefixed before the executable.voidsetExecutablePath(java.lang.String executablePath)Changes the optional path to be prefixed before the executable.voidsetHomePath(java.io.File home)Changes the home directory of the process to be executed.voidsetHomePath(java.lang.String homePath)Changes the home directory of the process to be executed.voidsetLocationKey(java.lang.String locationKey)Changes the location key for lookup inInstalledDependenciesSetup.voidsetStarted(boolean started)Changes whether the underlying process is already started when firing up the service.protected static java.lang.StringtoSubstFileName(java.lang.String path)Substitutes "${tmp}" and "${user}" and returns a name forpath.protected static java.io.FiletoSubstFilePath(java.lang.String path)Substitutes "${tmp}" and "${user}" and returns a file forpath.
-
-
-
Field Detail
-
executable
private java.lang.String executable
-
executablePath
private java.lang.String executablePath
-
homePath
private java.lang.String homePath
-
locationKey
private java.lang.String locationKey
-
cmdArg
private java.util.List<java.lang.String> cmdArg
-
artifacts
private java.util.List<java.lang.String> artifacts
-
started
private boolean started
-
-
Method Detail
-
getArtifacts
public java.util.List<java.lang.String> getArtifacts()
Description copied from interface:ProcessSpecReturns the process implementing artifacts within the containing artifact to be extracted into theprocess home directory.- Specified by:
getArtifactsin interfaceProcessSpec- Returns:
- the relative paths to the artifacts, shall start with "/" as part of ZIP/JAR
-
isStarted
public boolean isStarted()
Description copied from interface:ProcessSpecReturns whether the underlying process is already started when firing up the service or it will be started through the service implementation. If specified,artifactswill be extracted anyway into theprocess home directory, assuming that a pre-installed executable will not specify artifacts to be extracted.- Specified by:
isStartedin interfaceProcessSpec- Returns:
truefor started,falseelse (default)
-
setArtifacts
public void setArtifacts(java.util.List<java.lang.String> artifacts)
Defines the process implementing artifacts within the containing artifact to be extracted.- Parameters:
artifacts- the relative paths to the artifacts
-
setStarted
public void setStarted(boolean started)
Changes whether the underlying process is already started when firing up the service. [required by SnakeYaml]- Parameters:
started-truefor started (default),falseelse
-
getExecutable
public java.lang.String getExecutable()
Description copied from interface:ProcessSpecReturns the system command or relative path within the artifact to be executed.- Specified by:
getExecutablein interfaceProcessSpec- Returns:
- the command or relative path
-
getLocationKey
public java.lang.String getLocationKey()
Returns the location key for lookup inInstalledDependenciesSetup.- Returns:
- the location key, may be null
-
getExecutablePath
public java.io.File getExecutablePath()
Description copied from interface:ProcessSpecReturns an optional path to be prefixed before the executable. Relevance depends on the execution environment.- Specified by:
getExecutablePathin interfaceProcessSpec- Returns:
- the optional executable path, may be null for none
-
getHomePath
public java.io.File getHomePath()
Description copied from interface:ProcessSpecReturns the home directory of the process to be executed.- Specified by:
getHomePathin interfaceProcessSpec- Returns:
- the home directory, may be null to rely on extracted paths, may be given to explicitly define a home path
-
toSubstFileName
protected static java.lang.String toSubstFileName(java.lang.String path)
Substitutes "${tmp}" and "${user}" and returns a name forpath.- Parameters:
path- the path- Returns:
- the name, may be null if
pathis null or empty
-
toSubstFilePath
protected static java.io.File toSubstFilePath(java.lang.String path)
Substitutes "${tmp}" and "${user}" and returns a file forpath.- Parameters:
path- the path- Returns:
- the file, may be null if
pathis null or empty
-
getCmdArg
public java.util.List<java.lang.String> getCmdArg()
Description copied from interface:ProcessSpecReturns the command line arguments to start the process. The shell will be executed within the folder where the files fromProcessSpec.getHomePath()are extracted.- Specified by:
getCmdArgin interfaceProcessSpec- Returns:
- the command line arguments (may be empty for none)
-
getSubstCmdArg
public java.util.List<java.lang.String> getSubstCmdArg()
ReturnsgetCmdArg()with substitutions fromtoSubstFileName(String)for all arguments.- Returns:
- the substitutions
-
setExecutable
public void setExecutable(java.lang.String executable)
Defines the system command or relative path to be executed. [required by SnakeYaml]- Parameters:
executable- the name/path
-
setLocationKey
public void setLocationKey(java.lang.String locationKey)
Changes the location key for lookup inInstalledDependenciesSetup.- Parameters:
locationKey- the location key, may be null
-
setExecutablePath
public void setExecutablePath(java.lang.String executablePath)
Changes the optional path to be prefixed before the executable. Relevance depends on the execution environment. May contain "${tmp}" for the system temporary directory path and "${user}" for the user directory path. [required by SnakeYaml]- Parameters:
executablePath- the optional executable path, may be null for none
-
setExecutablePath
public void setExecutablePath(java.io.File executablePath)
Changes the optional path to be prefixed before the executable. Relevance depends on the execution environment. May contain "${tmp}" for the system temporary directory path and "${user}" for the user directory path. [required by SnakeYaml]- Parameters:
executablePath- the optional executable path, may be null for none
-
setHomePath
public void setHomePath(java.lang.String homePath)
Changes the home directory of the process to be executed. [required by SnakeYaml] May contain "${tmp}" for the system temporary directory path and "${user}" for the user directory path.- Parameters:
homePath- the home directory, may be null to rely on extracted paths, may be given to explicitly define a home path
-
setHomePath
public void setHomePath(java.io.File home)
Changes the home directory of the process to be executed. [required by SnakeYaml] May contain "${tmp}" for the system temporary directory path and "${user}" for the user directory path.- Parameters:
home- the home directory, may be null to rely on extracted paths, may be given to explicitly define a home path
-
setCmdArg
public void setCmdArg(java.util.List<java.lang.String> cmdArg)
Defines the command line arguments. [required by SnakeYaml]- Parameters:
cmdArg- the command line arguments (may be empty for none)
-
-