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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ScriptBuilderprotected final StatementListprotected final Stringprotected final Stringprotected final Stringprotected final StatementList -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitScript(String instanceName, String instanceHome, String logDir, Map<String, String> exports, StatementList init, StatementList run) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(StatementVisitor visitor) static InitScript.Builderbuilder()protected ScriptBuilderdelegate()booleanfunctionDependencies(OsFamily family) default/tmp/$INSTANCE_NAMEdefault$INSTANCE_HOMEinthashCode()static ScriptBuildermakeInitScriptStatement(String instanceName, String instanceHome, String logDir, Map<String, String> exports, StatementList init, StatementList run) toString()
-
Field Details
-
instanceName
-
instanceHome
-
logDir
-
exports
-
init
-
run
-
delegate
-
-
Constructor Details
-
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 Details
-
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
- Returns:
- what will be bound to the INSTANCE_NAME variable, and uniquely identifies the process
-
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
default$INSTANCE_HOME- Returns:
- what will be bound to the LOG_DIR variable, and represents where stdout and stderr.logs are written.
-
getInitStatement
- Returns:
- statements that will be executed upon the init command
-
getRunStatement
- Returns:
- statements that will be executed upon the run or start commands
-
hashCode
public int hashCode() -
equals
-
toString
- Overrides:
toStringin classcom.google.common.collect.ForwardingObject
-
accept
- Specified by:
acceptin interfaceAcceptsStatementVisitor
-
functionDependencies
- Specified by:
functionDependenciesin interfaceStatement
-
render
-
delegate
- Specified by:
delegatein classcom.google.common.collect.ForwardingObject
-