org.jclouds.scriptbuilder
Class ScriptBuilder

java.lang.Object
  extended by org.jclouds.scriptbuilder.ScriptBuilder
All Implemented Interfaces:
AcceptsStatementVisitor, Statement
Direct Known Subclasses:
InitBuilder

public class ScriptBuilder
extends Object
implements Statement, AcceptsStatementVisitor

Creates a shell script.

Author:
Adrian Cole

Constructor Summary
ScriptBuilder()
           
 
Method Summary
 void accept(StatementVisitor visitor)
           
 ScriptBuilder addEnvironmentVariableScope(String scopeName, Map<String,String> variables)
          Exports a variable inside the script
 ScriptBuilder addStatement(Statement statement)
           
 Iterable<String> functionDependencies(OsFamily family)
           
 String render(OsFamily osFamily)
          builds the shell script, by adding the following shell declaration line variable exports case/switch
 ScriptBuilder unsetEnvironmentVariable(String name)
          Unsets a variable to ensure it is set within the script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptBuilder

public ScriptBuilder()
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.


addEnvironmentVariableScope

public ScriptBuilder addEnvironmentVariableScope(String scopeName,
                                                 Map<String,String> variables)
Exports a variable inside the script


render

public String render(OsFamily osFamily)
builds the shell script, by adding the following
  1. shell declaration line
  2. variable exports
  3. case/switch

Specified by:
render in interface Statement
Parameters:
osFamily - whether to write a cmd or bash script.

functionDependencies

public Iterable<String> functionDependencies(OsFamily family)
Specified by:
functionDependencies in interface Statement

accept

public void accept(StatementVisitor visitor)
Specified by:
accept in interface AcceptsStatementVisitor


Copyright © 2009-2011 jclouds. All Rights Reserved.