| java.lang.Object net.sourceforge.cruisecontrol.util.Commandline
All known Subclasses: net.sourceforge.cruisecontrol.util.MockCommandline, net.sourceforge.cruisecontrol.util.EnvCommandline,
Commandline | public class Commandline implements Cloneable(Code) | | Commandline objects help handling command lines specifying processes to execute.
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<someelement>
<acommandline executable="/executable/to/run">
<argument value="argument 1" />
<argument line="argument_1 argument_2 argument_3" />
<argument value="argument 4" />
</acommandline>
</someelement>
The element someelement must provide a method createAcommandline which returns
an instance of this class.
author: thomas.haas@softwired-inc.com author: Stefan Bodewig |
Inner Class :public static class Argument | |
Inner Class :public class Marker | |
Commandline | public Commandline()(Code) | | |
clear | public void clear()(Code) | | Clear out the whole command line.
|
clearArgs | public void clearArgs()(Code) | | Clear out the arguments but leave the executable in place for another operation.
|
createArgument | public Argument createArgument()(Code) | | Creates an argument object.
Each commandline object has at most one instance of the argument class. This method calls
this.createArgument(false) .
See Also: Commandline.createArgument(boolean) the argument object. |
createArgument | public Argument createArgument(boolean insertAtStart)(Code) | | Creates an argument object and adds it to our list of args.
Each commandline object has at most one instance of the argument class.
Parameters: insertAtStart - if true, the argument is inserted at the beginning of the list of args, otherwise it is appended. |
createArgument | public Argument createArgument(String value)(Code) | | Same as calling createArgument().setValue(value), but much more convenient.
|
createArguments | public void createArguments(String first, String second)(Code) | | Same as calling createArgument twice in a row, but can be used to make more obvious a relationship between to
command line arguments, like "-folder c:\myfolder".
|
createMarker | public Marker createMarker()(Code) | | Return a marker.
This marker can be used to locate a position on the commandline - to insert something for example - when all
parameters have been set.
|
executeAndWait | public void executeAndWait(Logger log) throws CruiseControlException(Code) | | Executes the command and wait for it to finish.
Parameters: log - where the output and error streams are logged |
getArguments | public String[] getArguments()(Code) | | Returns all arguments defined by addLine , addValue or the argument object.
|
getCommandline | public String[] getCommandline()(Code) | | Returns the executable and all defined arguments.
|
getWorkingDirectory | public File getWorkingDirectory()(Code) | | |
quoteArgument | public static String quoteArgument(String argument) throws CruiseControlException(Code) | | Put quotes around the given String if necessary.
If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single
quotes - else surround the argument by double quotes.
exception: CruiseControlException - if the argument contains both, single and double quotes. |
setExecutable | public void setExecutable(String executable)(Code) | | Sets the executable to run.
|
toStringNoQuoting | public String toStringNoQuoting()(Code) | | Converts the command line to a string without adding quotes to any of the arguments.
|
useSafeQuoting | public void useSafeQuoting(boolean safe)(Code) | | Enables and disables safe quoting when executing a command. When enabled: Quotes any arguments that need it when
executing command. This should handle filenames with spaces, but may fall over if the arguments already have
quoting within them. When disables: Arguments are passed as is.
|
|
|