org.eclipse.jetty.start
Class CommandLineBuilder

java.lang.Object
  extended by org.eclipse.jetty.start.CommandLineBuilder

public class CommandLineBuilder
extends Object


Constructor Summary
CommandLineBuilder(String bin)
           
 
Method Summary
 void addArg(String arg)
          Add a simple argument to the command line.
 void addEqualsArg(String name, String value)
          Similar to addArg(String) but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is undefined or empty.
 void addRawArg(String arg)
          Add a simple argument to the command line.
 List<String> getArgs()
           
static String quote(String arg)
          Perform an optional quoting of the argument, being intelligent with spaces and quotes as needed.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandLineBuilder

public CommandLineBuilder(String bin)
Method Detail

addArg

public void addArg(String arg)
Add a simple argument to the command line.

Will quote arguments that have a space in them.

Parameters:
arg - the simple argument to add

addEqualsArg

public void addEqualsArg(String name,
                         String value)
Similar to addArg(String) but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is undefined or empty.

   addEqualsArg("-Dname", "value") = "-Dname=value"
   addEqualsArg("-Djetty.home", "/opt/company inc/jetty (7)/") = "-Djetty.home=/opt/company\ inc/jetty\ (7)/"
   addEqualsArg("-Djenkins.workspace", "/opt/workspaces/jetty jdk7/") = "-Djenkins.workspace=/opt/workspaces/jetty\ jdk7/"
   addEqualsArg("-Dstress", null) = "-Dstress"
   addEqualsArg("-Dstress", "") = "-Dstress"
 

Parameters:
name - the name
value - the value

addRawArg

public void addRawArg(String arg)
Add a simple argument to the command line.

Will NOT quote/escape arguments that have a space in them.

Parameters:
arg - the simple argument to add

getArgs

public List<String> getArgs()

quote

public static String quote(String arg)
Perform an optional quoting of the argument, being intelligent with spaces and quotes as needed.

Parameters:
arg -
Returns:

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.