Package org.jclouds.scriptbuilder.domain
Class Statements
java.lang.Object
org.jclouds.scriptbuilder.domain.Statements
Statements used in shell scripts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
interprets and adds a newline to the statementstatic Statement
extractTargzAndFlattenIntoDirectory
(URI tgz, String dest) likeextractTargzIntoDirectory(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
Stores the pid into the variableFOUND_PID
if successful.static Statement
Runs the script in a way that it can be matched later withfindPid(java.lang.String)
static Statement
statement can have multiple newlines, note you should uself
to be portablestatic Statement
kill()
Kills the pid and subprocesses related to the variableFOUND_PID
if set.static Statement
sends statement only appending a newlinestatic 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
static Statement
saveHttpResponseTo
(URI source, String dir, String file) static Statement
-
Constructor Details
-
Statements
public Statements()
-
-
Method Details
-
newStatementList
-
switchArg
-
rm
-
call
-
appendFile
-
appendFile
-
appendFile
-
createOrOverwriteFile
-
createOrOverwriteFile
-
createRunScript
public static CreateRunScript createRunScript(String instanceName, Iterable<String> exports, String pwd, Iterable<Statement> statements) - Parameters:
exports
- variable names to export in UPPER_UNDERSCORE case format
-
findPid
Stores the pid into the variableFOUND_PID
if successful.- Parameters:
args
- - what to search for in the process tree.
-
forget
Runs the script in a way that it can be matched later withfindPid(java.lang.String)
- Parameters:
instanceName
- - what to match the process onscript
- - what to run in the backgroundlogDir
- - where to write the following logs:- stdout.log
- stderr.log
-
kill
Kills the pid and subprocesses related to the variableFOUND_PID
if set.- See Also:
-
interpret
statement can have multiple newlines, note you should uself
to be portable- See Also:
-
literal
sends statement only appending a newline -
exec
interprets and adds a newline to the statement -
extractTargzIntoDirectory
public 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.- Parameters:
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to senddirectory
-
-
extractTargzAndFlattenIntoDirectory
likeextractTargzIntoDirectory(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/
- Parameters:
tgz
- remote ref to downloaddest
- path where the files in the intermediate directory will end
-
extractTargzIntoDirectory
-
extractZipIntoDirectory
public 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.- Parameters:
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to senddirectory
-
-
saveHttpResponseTo
-
pipeHttpResponseToBash
public static Statement pipeHttpResponseToBash(String method, URI endpoint, com.google.common.collect.Multimap<String, String> headers) exec the data received from the request parameters.- Parameters:
method
- http method: ex GETendpoint
- uri corresponding to the requestheaders
- request headers to send
-