Package org.jclouds.scriptbuilder
Class InitScript
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- org.jclouds.scriptbuilder.InitScript
-
- All Implemented Interfaces:
AcceptsStatementVisitor,Statement
public class InitScript extends com.google.common.collect.ForwardingObject implements Statement, AcceptsStatementVisitor
Creates an init script file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInitScript.Builder
-
Field Summary
Fields Modifier and Type Field Description protected ScriptBuilderdelegateprotected Map<String,String>exportsprotected StatementListinitprotected StringinstanceHomeprotected StringinstanceNameprotected StringlogDirprotected StatementListrun
-
Constructor Summary
Constructors Modifier Constructor Description protectedInitScript(String instanceName, String instanceHome, String logDir, Map<String,String> exports, StatementList init, StatementList run)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StatementVisitor visitor)static InitScript.Builderbuilder()protected ScriptBuilderdelegate()booleanequals(Object obj)Iterable<String>functionDependencies(OsFamily family)StatementListgetInitStatement()StringgetInstanceHome()default/tmp/$INSTANCE_NAMEStringgetInstanceName()StringgetLogDir()default$INSTANCE_HOMEStatementListgetRunStatement()inthashCode()static ScriptBuildermakeInitScriptStatement(String instanceName, String instanceHome, String logDir, Map<String,String> exports, StatementList init, StatementList run)Stringrender(OsFamily family)StringtoString()
-
-
-
Field Detail
-
instanceName
protected final String instanceName
-
instanceHome
protected final String instanceHome
-
logDir
protected final String logDir
-
init
protected final StatementList init
-
run
protected final StatementList run
-
delegate
protected final ScriptBuilder delegate
-
-
Constructor Detail
-
InitScript
protected InitScript(String instanceName, String instanceHome, String logDir, Map<String,String> exports, StatementList init, StatementList run)
- Parameters:
exports- keys are the variables to export in UPPER_UNDERSCORE case format
-
-
Method Detail
-
builder
public static InitScript.Builder builder()
-
makeInitScriptStatement
public static ScriptBuilder makeInitScriptStatement(String instanceName, String instanceHome, String logDir, Map<String,String> exports, StatementList init, StatementList run)
- Parameters:
exports- keys are the variables to export in UPPER_UNDERSCORE case format
-
getInstanceName
public String getInstanceName()
- Returns:
- what will be bound to the INSTANCE_NAME variable, and uniquely identifies the process
-
getInstanceHome
public String getInstanceHome()
default/tmp/$INSTANCE_NAME
note
The parent directory should be set with unix sticky-bit or otherwise made available to all users. Otherwise, new instances by other users may fail due to not being able to create a directory. This is why the default is set to/tmp- Returns:
- what will be bound to the INSTANCE_HOME variable, and represents the working directory of the instance
-
getLogDir
public String getLogDir()
default$INSTANCE_HOME- Returns:
- what will be bound to the LOG_DIR variable, and represents where stdout and stderr.logs are written.
-
getInitStatement
public StatementList getInitStatement()
- Returns:
- statements that will be executed upon the init command
-
getRunStatement
public StatementList getRunStatement()
- Returns:
- statements that will be executed upon the run or start commands
-
toString
public String toString()
- Overrides:
toStringin classcom.google.common.collect.ForwardingObject
-
accept
public void accept(StatementVisitor visitor)
- Specified by:
acceptin interfaceAcceptsStatementVisitor
-
functionDependencies
public Iterable<String> functionDependencies(OsFamily family)
- Specified by:
functionDependenciesin interfaceStatement
-
delegate
protected ScriptBuilder delegate()
- Specified by:
delegatein classcom.google.common.collect.ForwardingObject
-
-