public class Statements extends Object
Constructor and Description |
---|
Statements() |
Modifier and Type | Method and Description |
---|---|
static Statement |
appendFile(String path,
Iterable<String> lines) |
static Statement |
appendFile(String path,
Iterable<String> lines,
String delimiter) |
static Statement |
appendFile(String path,
String line,
String delimiter) |
static Statement |
call(String function,
String... args) |
static Statement |
createOrOverwriteFile(String path,
Iterable<String> lines) |
static Statement |
createOrOverwriteFile(String path,
Iterable<String> lines,
String delimiter) |
static CreateRunScript |
createRunScript(String instanceName,
Iterable<String> exports,
String pwd,
Iterable<Statement> statements) |
static Statement |
exec(String portableStatement)
interprets and adds a newline to the statement
|
static Statement |
extractTargzAndFlattenIntoDirectory(URI tgz,
String dest)
like
extractTargzIntoDirectory(URI, String) except that it
flattens the first directory in the archive
For example, apache-maven-3.0.4-bin.tar.gz normally extracts
directories like ./apache-maven-3.0.4/bin . |
static Statement |
extractTargzIntoDirectory(String method,
URI endpoint,
com.google.common.collect.Multimap<String,String> headers,
String directory)
untar, ungzip the data received from the request parameters.
|
static Statement |
extractTargzIntoDirectory(URI targz,
String directory) |
static Statement |
extractZipIntoDirectory(String method,
URI endpoint,
com.google.common.collect.Multimap<String,String> headers,
String directory)
unzip the data received from the request parameters.
|
static Statement |
findPid(String args)
Stores the pid into the variable
FOUND_PID if successful. |
static Statement |
forget(String instanceName,
String script,
String logDir)
Runs the script in a way that it can be matched later with
findPid(java.lang.String) |
static Statement |
interpret(String... portableStatements)
statement can have multiple newlines, note you should use
lf to be
portable |
static Statement |
kill()
Kills the pid and subprocesses related to the variable
FOUND_PID
if set. |
static Statement |
literal(String literalStatement)
sends statement only appending a newline
|
static Statement |
newStatementList(Statement... statements) |
static Statement |
pipeHttpResponseToBash(String method,
URI endpoint,
com.google.common.collect.Multimap<String,String> headers)
exec the data received from the request parameters.
|
static Statement |
rm(String path) |
static Statement |
saveHttpResponseTo(URI source,
String dir,
String file) |
static Statement |
switchArg(int arg,
Map<String,Statement> valueToActions) |
public static Statement appendFile(String path, Iterable<String> lines, String delimiter)
public static Statement createOrOverwriteFile(String path, Iterable<String> lines)
public static Statement createOrOverwriteFile(String path, Iterable<String> lines, String delimiter)
public static CreateRunScript createRunScript(String instanceName, Iterable<String> exports, String pwd, Iterable<Statement> statements)
exports
- variable names to export in UPPER_UNDERSCORE case formatpublic static Statement findPid(String args)
FOUND_PID
if successful.args
- - what to search for in the process tree.public static Statement forget(String instanceName, String script, String logDir)
findPid(java.lang.String)
instanceName
- - what to match the process onscript
- - what to run in the backgroundlogDir
- - where to write the following logs:
public static Statement kill()
FOUND_PID
if set.findPid(java.lang.String)
public static Statement interpret(String... portableStatements)
lf
to be
portableShellToken
public static Statement literal(String literalStatement)
public static Statement exec(String portableStatement)
public static Statement extractTargzIntoDirectory(String method, URI endpoint, com.google.common.collect.Multimap<String,String> headers, String directory)
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to senddirectory
- public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest)
extractTargzIntoDirectory(URI, String)
except that it
flattens the first directory in the archive
For example, apache-maven-3.0.4-bin.tar.gz
normally extracts
directories like ./apache-maven-3.0.4/bin
. This command eliminates
the intermediate directory, in the example ./apache-maven-3.0.4/
tgz
- remote ref to downloaddest
- path where the files in the intermediate directory will endpublic static Statement extractTargzIntoDirectory(URI targz, String directory)
public static Statement extractZipIntoDirectory(String method, URI endpoint, com.google.common.collect.Multimap<String,String> headers, String directory)
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to senddirectory
- public static Statement pipeHttpResponseToBash(String method, URI endpoint, com.google.common.collect.Multimap<String,String> headers)
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to sendCopyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.