Package org.jclouds.scriptbuilder
Class ScriptBuilder
- java.lang.Object
 - 
- org.jclouds.scriptbuilder.ScriptBuilder
 
 
- 
- All Implemented Interfaces:
 AcceptsStatementVisitor,Statement
public class ScriptBuilder extends Object implements Statement, AcceptsStatementVisitor
Creates a shell script. 
- 
- 
Constructor Summary
Constructors Constructor Description ScriptBuilder() 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StatementVisitor visitor)ScriptBuilderaddEnvironmentVariableScope(String scopeName, Map<String,String> variables)Exports a variable inside the scriptScriptBuilderaddStatement(Statement statement)static Statementcall(String fn, String... args)static StatementfindPid(String pid)static Statementforget(String instanceName, String script, String logDir)Iterable<String>functionDependencies(OsFamily family)Stringrender(OsFamily osFamily)builds the shell script, by adding the following shell declaration line variable exports case/switchstatic Map<String,String>resolveFunctionDependenciesForStatements(Map<String,String> knownFunctions, Iterable<Statement> statements, OsFamily osFamily)ScriptBuilderunsetEnvironmentVariable(String name)Unsets a variable to ensure it is set within the script.static voidwriteFunctions(Map<String,String> functionsToWrite, OsFamily osFamily, StringBuilder builder) 
 - 
 
- 
- 
Method Detail
- 
addStatement
public ScriptBuilder addStatement(Statement statement)
 
- 
unsetEnvironmentVariable
public ScriptBuilder unsetEnvironmentVariable(String name)
Unsets a variable to ensure it is set within the script.- Parameters:
 variable- name in UPPER_UNDERSCORE case format
 
- 
addEnvironmentVariableScope
public ScriptBuilder addEnvironmentVariableScope(String scopeName, Map<String,String> variables)
Exports a variable inside the script- Parameters:
 scopeName-variables- keys are the variables to export in UPPER_UNDERSCORE case format
 
- 
render
public String render(OsFamily osFamily)
builds the shell script, by adding the following- shell declaration line
 - variable exports
 - case/switch
 
 
- 
writeFunctions
public static void writeFunctions(Map<String,String> functionsToWrite, OsFamily osFamily, StringBuilder builder)
 
- 
resolveFunctionDependenciesForStatements
public static Map<String,String> resolveFunctionDependenciesForStatements(Map<String,String> knownFunctions, Iterable<Statement> statements, OsFamily osFamily)
 
- 
functionDependencies
public Iterable<String> functionDependencies(OsFamily family)
- Specified by:
 functionDependenciesin interfaceStatement
 
- 
accept
public void accept(StatementVisitor visitor)
- Specified by:
 acceptin interfaceAcceptsStatementVisitor
 
 - 
 
 -