public class Processor extends Object
ScriptModules that generate scripts will submit a main script to the OS for execution as a
Processor.| Modifier and Type | Class and Description |
|---|---|
class |
Processor.Subprocess
Class used to submit processes on their own Thread.
|
| Constructor and Description |
|---|
Processor()
Empty constructor to facilitate subprocess creation
|
| Modifier and Type | Method and Description |
|---|---|
static void |
deregisterThread(Thread thread)
De-register a thread, so it is not considered when shutting down the application.
|
static String |
getBashVar(String bashVar)
Return the value of the bash variable from the runtime shell.
|
protected String |
runJob(String[] args,
String label) |
protected String |
runJob(String[] args,
String label,
File workDir) |
protected String |
runJob(String[] args,
String label,
File workDir,
String[] envP)
Execute the command args and log output with label.
|
static void |
runModuleMainScript(ScriptModule module)
This method is called by script generating
ScriptModules to update the script
file-permissions to ensure they are executable by the program. |
static Thread |
runSubprocess(String[] args,
String label)
Instantiates a new
Processor.String[] array used to control spacing between command/params. As if executing on terminal args[0] args[1]... |
static void |
setFilePermissions(String path,
String permissions)
Set file permissions by executing chmod "script.permissions" on generated bash scripts.
|
static void |
submitJob(String[] args,
String label)
Instantiates a new
Processor.String[] array used to control spacing between command/params. As if executing on terminal args[0] args[1]... |
static String |
submitQuery(String cmd,
String label)
Run script that expects a single result
|
static boolean |
subProcAlive(Long id)
Check if a specific process is alive
|
static boolean |
subProcsAlive()
Check if any Subprocess threads are still running.
|
protected String runJob(String[] args, String label, File workDir, String[] envP) throws IOException, InterruptedException
args - Command argslabel - Log labelIOException - if errors occur reading the InputStreamInterruptedException - if the thread process is interruptedprotected String runJob(String[] args, String label) throws IOException, InterruptedException, ConfigNotFoundException
protected String runJob(String[] args, String label, File workDir) throws IOException, InterruptedException, ConfigNotFoundException
public static void deregisterThread(Thread thread)
thread - Subprocess threadpublic static String getBashVar(String bashVar)
bashVar - Bash variable namepublic static Thread runSubprocess(String[] args, String label)
Processor.args - Terminal command created from args (adds 1 space between each array element)label - to associate with the processpublic static void setFilePermissions(String path, String permissions) throws Exception
path - Target directory pathpermissions - Set the chmod security bits (ex 764)Exception - if chmod command command failspublic static void runModuleMainScript(ScriptModule module) throws Exception
ScriptModules to update the script
file-permissions to ensure they are executable by the program. Once file permissions are set, the main script
(passed in the args param) is executed. Calls setFilePermissions(String, String) and
runModuleMainScript(ScriptModule)module - ScriptModule that is submitting its main script as a ProcessorExceptionpublic static void submitJob(String[] args, String label) throws IOException, InterruptedException, ConfigNotFoundException
Processor.args - Terminal command created from args (adds 1 space between each array element)label - - Process labelIOException - if errors occur reading the InputStreamInterruptedException - if the thread process is interruptedConfigNotFoundExceptionpublic static String submitQuery(String cmd, String label) throws IOException, InterruptedException, ConfigNotFoundException
cmd - Commandlabel - Process LabelIOException - if errors occur reading the InputStreamInterruptedException - if the thread process is interruptedConfigNotFoundExceptionpublic static boolean subProcAlive(Long id)
id - - Registered thread IDpublic static boolean subProcsAlive()