Package com.tccc.kos.core.service.spawn
Class Adapter
java.lang.Object
com.tccc.kos.core.service.spawn.SpawnProcess
com.tccc.kos.core.service.spawn.Adapter
Specialized
SpawnProcess
designed around starting adapters.
Adapters are typically used to interface to hardware but some
adapters can be native software components that need to interface
with java.
This class is merely a convenience subclass that allows the base directory of the executable to be specified separately from the executable name, and that base path will also be used as the working directory of the executable. This allows adapters to be defined and packaged in kabs which have a variable mount point.
- Since:
- 1.0
- Version:
- 2023-09-19
-
Field Summary
Fields inherited from class com.tccc.kos.core.service.spawn.SpawnProcess
MAX_ARG_LEN, MAX_ARGS, MAX_PATH_LEN, MAX_PRIORITY, MAX_USER_GROUP_LEN, MIN_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
setBasePath
(File file) Set the base path to the executable.void
setBasePath
(String path) Set the base path to the executable.Set the path to the executable.Set the path to the executable.setWorkingDir
(File dir) Set the working directory.setWorkingDir
(String path) Set the working directory.Methods inherited from class com.tccc.kos.core.service.spawn.SpawnProcess
addArg, getArgs, getGroup, getLogFile, getNodeId, getPath, getPid, getPriority, getUser, getWorkingDir, setGroup, setLogFile, setPriority, setUser, toString, waitForStart
-
Constructor Details
-
Adapter
Create a new adapter that is backed by the specified program name. This is the executable file name only, without any path information. UsesetBasePath()
to define the directory the executable is located in.- Parameters:
programName
- the executable program name
-
-
Method Details
-
setBasePath
Set the base path to the executable. This will be used to set the working directory and the path to the executable. This should be used instead of callingsetPath()
orsetWorkingDir()
. -
setBasePath
Set the base path to the executable. This will be used to set the working directory and the path to the executable. This should be used instead of callingsetPath()
orsetWorkingDir()
.- Parameters:
file
- the file that represents the base path
-
setPath
Description copied from class:SpawnProcess
Set the path to the executable.- Overrides:
setPath
in classSpawnProcess
- Parameters:
path
- path to the executable
-
setPath
Description copied from class:SpawnProcess
Set the path to the executable.- Overrides:
setPath
in classSpawnProcess
- Parameters:
path
- the path to the executable
-
setWorkingDir
Description copied from class:SpawnProcess
Set the working directory.- Overrides:
setWorkingDir
in classSpawnProcess
- Parameters:
dir
- the working directory
-
setWorkingDir
Description copied from class:SpawnProcess
Set the working directory.- Overrides:
setWorkingDir
in classSpawnProcess
- Parameters:
path
- path to the working directory
-