Class ProcessSupport.ScriptOwner

  • Enclosing class:
    ProcessSupport

    public static class ProcessSupport.ScriptOwner
    extends java.lang.Object
    Holds the script context.
    Author:
    Holger Eichelberger, SSE
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptOwner​(java.lang.String tmpFolderName, java.lang.String testFallbackPath, java.lang.String zipFileName)
      Creates an instance.
      ScriptOwner​(java.lang.String tmpFolderName, java.lang.String testFallbackPath, java.lang.String zipFileName, java.lang.String resultFile)
      Creates an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.function.Consumer<java.lang.ProcessBuilder> getProcessCustomizer()
      Returns the optional process customizer.
      java.io.File getPythonFolder()
      Returns the folder where the extracted script is located in.
      java.lang.String getResultFile()
      Returns the result file.
      java.lang.String getTestFallbackPath()
      Returns the fallback path to read the script during tests from the project folders.
      java.lang.String getTmpFolderName()
      Returns the temporary folder name to extract the scripts into.
      java.lang.String getZipFileName()
      Returns the ZIP file name containing the script.
      boolean isInitialized()
      Returns whether the holder/folder is initialized.
      (package private) void setInitialized​(boolean initialized)
      Defines whether the holder/folder is initialized.
      (package private) void setPythonFolder​(java.io.File pythonFolder)
      Changes the folder where the extracted script is located in.
      ProcessSupport.ScriptOwner withProcessCustomizer​(java.util.function.Consumer<java.lang.ProcessBuilder> customizer)
      Adds an optional process customizer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • initialized

        private boolean initialized
      • pythonFolder

        private java.io.File pythonFolder
      • tmpFolderName

        private java.lang.String tmpFolderName
      • testFallbackPath

        private java.lang.String testFallbackPath
      • zipFileName

        private java.lang.String zipFileName
      • resultFile

        private java.lang.String resultFile
      • processCustomizer

        private java.util.function.Consumer<java.lang.ProcessBuilder> processCustomizer
    • Constructor Detail

      • ScriptOwner

        public ScriptOwner​(java.lang.String tmpFolderName,
                           java.lang.String testFallbackPath,
                           java.lang.String zipFileName)
        Creates an instance.
        Parameters:
        tmpFolderName - the temp folder name where to copy the script/extract the ZIP to.
        testFallbackPath - the test fallback path in the local project taking precedence during testing
        zipFileName - the ZIP file name to read from classpath
      • ScriptOwner

        public ScriptOwner​(java.lang.String tmpFolderName,
                           java.lang.String testFallbackPath,
                           java.lang.String zipFileName,
                           java.lang.String resultFile)
        Creates an instance.
        Parameters:
        tmpFolderName - the temp folder name where to copy the script/extract the ZIP to.
        testFallbackPath - the test fallback path in the local project taking precedence during testing
        zipFileName - the ZIP file name to read from classpath
        resultFile - file to read result from, e.g., short lived processes, if null use standard in
    • Method Detail

      • isInitialized

        public boolean isInitialized()
        Returns whether the holder/folder is initialized.
        Returns:
        whether it is initialized
      • setInitialized

        void setInitialized​(boolean initialized)
        Defines whether the holder/folder is initialized.
        Parameters:
        initialized - whether it is initialized
      • getPythonFolder

        public java.io.File getPythonFolder()
        Returns the folder where the extracted script is located in.
        Returns:
        the folder
      • setPythonFolder

        void setPythonFolder​(java.io.File pythonFolder)
        Changes the folder where the extracted script is located in.
        Parameters:
        pythonFolder - the folder
      • getTmpFolderName

        public java.lang.String getTmpFolderName()
        Returns the temporary folder name to extract the scripts into.
        Returns:
        the temporary folder name
      • getTestFallbackPath

        public java.lang.String getTestFallbackPath()
        Returns the fallback path to read the script during tests from the project folders.
        Returns:
        the fallback path
      • getZipFileName

        public java.lang.String getZipFileName()
        Returns the ZIP file name containing the script.
        Returns:
        the ZIP file name as to be read as resource
      • getResultFile

        public java.lang.String getResultFile()
        Returns the result file.
        Returns:
        the result file
      • withProcessCustomizer

        public ProcessSupport.ScriptOwner withProcessCustomizer​(java.util.function.Consumer<java.lang.ProcessBuilder> customizer)
        Adds an optional process customizer.
        Parameters:
        customizer - the customizer
        Returns:
        thi
      • getProcessCustomizer

        public java.util.function.Consumer<java.lang.ProcessBuilder> getProcessCustomizer()
        Returns the optional process customizer.
        Returns:
        the customizer, may be null