Class Adapter

java.lang.Object
com.tccc.kos.core.service.spawn.SpawnProcess
com.tccc.kos.core.service.spawn.Adapter

public class Adapter extends SpawnProcess
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
  • Constructor Details

    • Adapter

      public Adapter(String programName)
      Create a new adapter that is backed by the specified program name. This is the executable file name only, without any path information. Use setBasePath() to define the directory the executable is located in.
      Parameters:
      programName - the executable program name
  • Method Details

    • setBasePath

      public void setBasePath(String path)
      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 calling setPath() or setWorkingDir() .
    • setBasePath

      public void setBasePath(File file)
      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 calling setPath() or setWorkingDir() .
      Parameters:
      file - the file that represents the base path
    • setPath

      public SpawnProcess setPath(String path)
      Description copied from class: SpawnProcess
      Set the path to the executable.
      Overrides:
      setPath in class SpawnProcess
      Parameters:
      path - path to the executable
    • setPath

      public SpawnProcess setPath(File path)
      Description copied from class: SpawnProcess
      Set the path to the executable.
      Overrides:
      setPath in class SpawnProcess
      Parameters:
      path - the path to the executable
    • setWorkingDir

      public SpawnProcess setWorkingDir(File dir)
      Description copied from class: SpawnProcess
      Set the working directory.
      Overrides:
      setWorkingDir in class SpawnProcess
      Parameters:
      dir - the working directory
    • setWorkingDir

      public SpawnProcess setWorkingDir(String path)
      Description copied from class: SpawnProcess
      Set the working directory.
      Overrides:
      setWorkingDir in class SpawnProcess
      Parameters:
      path - path to the working directory