ServerSideScriptingCaller
- public class ServerSideScriptingCaller
Calls server-side scripting scripts.
The script are started in a unique directory, they are provided with an authentication token and a special shared directory where they may temporarily store files for download by the user.
Fields
STARTED
UPLOAD_FILES_DIR
Constructors
ServerSideScriptingCaller
ServerSideScriptingCaller
ServerSideScriptingCaller
- public ServerSideScriptingCaller(String[] commandLine, Integer timeoutMs, List<FileProperties> files, Object authToken, Map<String, String> env, ScriptingUtils utils)
ServerSideScriptingCaller
Methods
callScript
- int callScript(String absoluteScriptPath, String[] commandLine, Object authToken, Map<String, String> env)
Call the script.
The absoluteScriptPath is called with all remaining parameters from the commandLine arrays, an optional additional authToken and environment variables.
- Parameters:
absoluteScriptPath –
commandLine –
authToken –
env –
environment variables
- Throws:
- Returns:
the exit code of the script call
cleanup
- void cleanup()
createTmpHomeDir
- void createTmpHomeDir()
Create a writable “home like” directory, needed for some Python libs, e.g. caosdb-pylib.
The temporary working directory must exist when this method is called.
createWorkingDir
- void createWorkingDir()
deleteWorkingDir
getAbsoluteScriptPath
getCode
getCommandLine
getStdErr
getStdErrFile
getStdOut
getStdOutFile
getTimeoutMs
- int getTimeoutMs()
getTmpHomeDir
getTmpWorkingDir
getUploadFilesDir
injectAuthToken
invoke
- public int invoke()
Does some final preparation, then calls the script and cleans up.
putFilesInWorkingDir
- void putFilesInWorkingDir(Collection<FileProperties> files)
updateEnvironment
- void updateEnvironment()
Sets environment variables for the script, according to the current state of the caller.