public class ScriptBuilder extends Object implements Statement, AcceptsStatementVisitor
Constructor and Description |
---|
ScriptBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
accept(StatementVisitor visitor) |
ScriptBuilder |
addEnvironmentVariableScope(String scopeName,
Map<String,String> variables)
Exports a variable inside the script
|
ScriptBuilder |
addStatement(Statement statement) |
static Statement |
call(String fn,
String... args) |
static Statement |
findPid(String pid) |
static Statement |
forget(String instanceName,
String script,
String logDir) |
Iterable<String> |
functionDependencies(OsFamily family) |
String |
render(OsFamily osFamily)
builds the shell script, by adding the following
shell declaration line
variable exports
case/switch
|
static Map<String,String> |
resolveFunctionDependenciesForStatements(Map<String,String> knownFunctions,
Iterable<Statement> statements,
OsFamily osFamily) |
ScriptBuilder |
unsetEnvironmentVariable(String name)
Unsets a variable to ensure it is set within the script.
|
static void |
writeFunctions(Map<String,String> functionsToWrite,
OsFamily osFamily,
StringBuilder builder) |
public ScriptBuilder addStatement(Statement statement)
public ScriptBuilder unsetEnvironmentVariable(String name)
variable
- name in UPPER_UNDERSCORE case formatpublic ScriptBuilder addEnvironmentVariableScope(String scopeName, Map<String,String> variables)
scopeName
- variables
- keys are the variables to export in UPPER_UNDERSCORE case formatpublic String render(OsFamily osFamily)
public static void writeFunctions(Map<String,String> functionsToWrite, OsFamily osFamily, StringBuilder builder)
public static Map<String,String> resolveFunctionDependenciesForStatements(Map<String,String> knownFunctions, Iterable<Statement> statements, OsFamily osFamily)
public Iterable<String> functionDependencies(OsFamily family)
functionDependencies
in interface Statement
public void accept(StatementVisitor visitor)
accept
in interface AcceptsStatementVisitor
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.