Class CLIBootstrap
- java.lang.Object
-
- org.glassfish.appclient.client.CLIBootstrap
-
public class CLIBootstrap extends Object
Constructs a java command to launch the ACC with the correct agent and command line arguments, based on the current operating environment and the user's own command-line arguments.The user might have specified JVM options as well as ACC options as well as arguments to be passed to the client. Further, we need to make sure that the GlassFish extension libraries directories directories are included regardless of whether the user specified any explicitly.
This program emits a java command line that will run the ACC so that it will launch the client. The emitted command will need to look like this:
java \ (user-specified JVM options except -jar) \ -javaagent:(path-to-gf-client.jar)=(option string for our agent) \ (main class setting: "-jar x.jar" or "a.b.Main" or "path-to-file.class") (arguments to be passed to the client)
The general design of this class uses several inner classes, CommandLineElement and its extensions. These classes have slightly different behavior depending on the specific type of command line element each represents. Each has a regex pattern which it uses to decide whether it recognizes a particular command line element or not. Each also implements (or inherits) the processValue method which actually consumes the command line element being handled -- and sometimes the next one as well if the element takes a value (such as -classpath).
- Author:
- Tim Quinn
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILE_OPTIONS_INTRODUCER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
decodeArg(String input)
Replaces occurrences of comma encoding with commas.static String
encodeArg(String input)
Replaces commas in an argument value (which can confuse the ACC agent argument parsing because shells strip out double-quotes) with a special sequence.static void
main(String[] args)
-
-
-
Field Detail
-
FILE_OPTIONS_INTRODUCER
public static final String FILE_OPTIONS_INTRODUCER
- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(String[] args)
- Parameters:
args
- the command line arguments
-
encodeArg
public static String encodeArg(String input)
Replaces commas in an argument value (which can confuse the ACC agent argument parsing because shells strip out double-quotes) with a special sequence.- Parameters:
input
- string to encode- Returns:
- encoded string
-
-