|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jclouds.scriptbuilder.util.Utils
public class Utils
Utilities used to build init scripts.
| Nested Class Summary | |
|---|---|
static class |
Utils.VariableNameForOsFamily
In ShellToken, the values whose names end in _VARIABLE designate variable
names we know how to translate from one platform to another. |
| Field Summary | |
|---|---|
static Map<OsFamily,String> |
OS_TO_LOCAL_VAR_PATTERN
|
static Map<OsFamily,String> |
OS_TO_POSITIONAL_VAR_PATTERN
|
static Map<OsFamily,String> |
OS_TO_ZERO_PATH
|
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | ||
|---|---|---|
static String |
replaceTokens(String input,
Map<String,String> replacements)
replaces tokens that are expressed as {token}
ex. |
|
static
|
transformKeys(Map<K1,V> in,
com.google.common.base.Function<K1,K2> fn)
change the keys but keep the values in-tact. |
|
static String |
writeComment(String comment,
OsFamily family)
|
|
static String |
writeFunction(String function,
String source)
|
|
static String |
writeFunction(String function,
String source,
OsFamily family)
|
|
static String |
writeFunctionFromResource(String function,
OsFamily family)
|
|
static String |
writePositionalVars(Iterable<String> positionalVariables,
OsFamily family)
Writes an initialization statement for use inside a script or a function. |
|
static String |
writeUnsetVariables(Iterable<String> variablesToUnset,
OsFamily family)
Ensures that variables come from a known source instead of bleeding in from a profile |
|
static String |
writeVariableExporters(Map<String,String> exports)
converts a map into variable exporters in shell intermediate language. |
|
static String |
writeVariableExporters(Map<String,String> exports,
OsFamily family)
converts a map into variable exports relevant to the specified platform. |
|
static String |
writeZeroPath(OsFamily family)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Map<OsFamily,String> OS_TO_POSITIONAL_VAR_PATTERN
public static final Map<OsFamily,String> OS_TO_LOCAL_VAR_PATTERN
public static final Map<OsFamily,String> OS_TO_ZERO_PATH
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static String replaceTokens(String input,
Map<String,String> replacements)
{token}
ex. if input is "hello {where}"
input - source to replacereplacements - token/value pairs
public static String writeVariableExporters(Map<String,String> exports,
OsFamily family)
keys is the map: "MAVEN_OPTS" -> "-Xms64m -Xmx256m" export MAVEN_OPTS="-Xms64m -Xmx256m"\n
exports - keys are the variables to export in UPPER_UNDERSCORE case formatfamily - operating system for formattingUtils.VariableNameForOsFamilypublic static String writeVariableExporters(Map<String,String> exports)
exports - keys are the variables to export in UPPER_UNDERSCORE case format
public static String writeFunction(String function,
String source,
OsFamily family)
public static String writeFunctionFromResource(String function,
OsFamily family)
public static String writeFunction(String function,
String source)
public static String writePositionalVars(Iterable<String> positionalVariables,
OsFamily family)
positionalVariables - - transfer the value of args into these statements. Note that there is no check to
ensure that all source args are indeed present.
public static String writeUnsetVariables(Iterable<String> variablesToUnset,
OsFamily family)
variablesToUnset - - System variables to unsetUtils.VariableNameForOsFamilypublic static String writeZeroPath(OsFamily family)
public static String writeComment(String comment,
OsFamily family)
public static <K1,K2,V> Map<K2,V> transformKeys(Map<K1,V> in,
com.google.common.base.Function<K1,K2> fn)
K1 - input key typeK2 - output key typeV - value typein - input map to transformfn - how to transform the values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||