|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.util.ArgumentListBuilder
public class ArgumentListBuilder
Used to build up arguments for a process invocation.
Constructor Summary | |
---|---|
ArgumentListBuilder()
|
|
ArgumentListBuilder(String... args)
|
Method Summary | |
---|---|
ArgumentListBuilder |
add(File f)
|
ArgumentListBuilder |
add(Object a)
|
ArgumentListBuilder |
add(Object a,
boolean mask)
|
ArgumentListBuilder |
add(String... args)
|
ArgumentListBuilder |
add(String a)
|
ArgumentListBuilder |
add(String a,
boolean mask)
Optionally hide this part of the command line from being printed to the log. |
ArgumentListBuilder |
addKeyValuePair(String prefix,
String key,
String value,
boolean mask)
|
ArgumentListBuilder |
addKeyValuePairs(String prefix,
Map<String,String> props)
Adds key value pairs as "-Dkey=value -Dkey=value ..." -D portion is configurable as the 'prefix' parameter. |
ArgumentListBuilder |
addKeyValuePairs(String prefix,
Map<String,String> props,
Set<String> propsToMask)
Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. |
ArgumentListBuilder |
addKeyValuePairsFromPropertyString(String prefix,
String properties,
VariableResolver vr)
Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using Properties . |
ArgumentListBuilder |
addKeyValuePairsFromPropertyString(String prefix,
String properties,
VariableResolver vr,
Set<String> propsToMask)
Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using Properties with masking. |
void |
addMasked(String string)
Add a masked argument |
ArgumentListBuilder |
addQuoted(String a)
Adds an argument by quoting it. |
ArgumentListBuilder |
addQuoted(String a,
boolean mask)
|
ArgumentListBuilder |
addTokenized(String s)
Decomposes the given token into multiple arguments by splitting via whitespace. |
void |
clear()
Re-initializes the arguments list. |
ArgumentListBuilder |
clone()
|
boolean |
hasMaskedArguments()
Returns true if there are any masked arguments. |
ArgumentListBuilder |
prepend(String... args)
|
String[] |
toCommandArray()
|
List<String> |
toList()
|
boolean[] |
toMaskArray()
Returns an array of booleans where the masked arguments are marked as true |
String |
toString()
Debug/error message friendly output. |
String |
toStringWithQuote()
Just adds quotes around args containing spaces, but no other special characters, so this method should generally be used only for informational/logging purposes. |
ArgumentListBuilder |
toWindowsCommand()
Calls toWindowsCommand(false) |
ArgumentListBuilder |
toWindowsCommand(boolean escapeVars)
Wrap command in a CMD.EXE call so we can return the exit code (ERRORLEVEL). |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArgumentListBuilder()
public ArgumentListBuilder(String... args)
Method Detail |
---|
public ArgumentListBuilder add(Object a)
public ArgumentListBuilder add(Object a, boolean mask)
public ArgumentListBuilder add(File f)
public ArgumentListBuilder add(String a)
public ArgumentListBuilder add(String a, boolean mask)
a
- a command argumentmask
- true to suppress in output, false to print normally
Launcher.ProcStarter.masks(boolean[])
,
Launcher.maskedPrintCommandLine(List, boolean[], FilePath)
public ArgumentListBuilder prepend(String... args)
public ArgumentListBuilder addQuoted(String a)
public ArgumentListBuilder addQuoted(String a, boolean mask)
public ArgumentListBuilder add(String... args)
public ArgumentListBuilder addTokenized(String s)
public ArgumentListBuilder addKeyValuePair(String prefix, String key, String value, boolean mask)
public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props)
public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask)
prefix
- Configures the -D portion of the example. Defaults to -D if null.props
- The map of key/value pairs to addpropsToMask
- Set containing key names to mark as masked in the argument list. Key
names that do not exist in the set will be added unmasked.public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException
Properties
.
prefix
- The '-D' portion of the example. Defaults to -D if null.properties
- The persisted form of Properties
. For example, "abc=def\nghi=jkl". Can be null, in which
case this method becomes no-op.vr
- VariableResolver
to be performed on the values.
IOException
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr, Set<String> propsToMask) throws IOException
Properties
with masking.
prefix
- The '-D' portion of the example. Defaults to -D if null.properties
- The persisted form of Properties
. For example, "abc=def\nghi=jkl". Can be null, in which
case this method becomes no-op.vr
- VariableResolver
to be performed on the values.propsToMask
- Set containing key names to mark as masked in the argument list. Key
names that do not exist in the set will be added unmasked.
IOException
public String[] toCommandArray()
public ArgumentListBuilder clone()
clone
in class Object
public void clear()
public List<String> toList()
public String toStringWithQuote()
public ArgumentListBuilder toWindowsCommand(boolean escapeVars)
escapeVars
- True to escape %VAR% references; false to leave these alone
so they may be expanded when the command is run
public ArgumentListBuilder toWindowsCommand()
toWindowsCommand(boolean)
public boolean hasMaskedArguments()
public boolean[] toMaskArray()
public void addMasked(String string)
string
- the argumentpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |