|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CommandRunner
GlassFish has a very sophisticated command line interface (CLI) viz., 'asadmin' to executive administrative commands.
This is a programmatic interface equivalent to 'asadmin'. This interface allows the execution of the adminstrative commands from an application which embeds GlassFish. A command runner is obtained by callingGlassFish.getCommandRunner().
A command runner is a per-lookup type object, which means each time
GlassFish.getCommandRunner() is called, it returns a new instance of command runner.
Command specific options are passed in the var-args argument of run(String, String...) method.
| Method Summary | |
|---|---|
CommandResult |
run(String command,
String... args)
Execute an administrative command in GlassFish using the supplied
command arguments. |
void |
setTerse(boolean terse)
Set the terse level. |
| Method Detail |
|---|
CommandResult run(String command,
String... args)
GlassFish using the supplied
command arguments. Refer to GlassFish Administration Guide to know about the commands supported
in GlassFish and their usage.
Example: To add an additional http listener 9090 :
commandRunner.run("create-http-listener", "--listenerport", "9090",
"--listeneraddress", "0.0.0.0",
"--defaultvs", "server",
"--securityenabled", "false",
"listener_id", "my-http-listener-1");
asadmin commands also allow option values to be specified using '=', so the above example can be written as:
commandRunner.run("create-http-listener", "--listenerport=9090",
"--listeneraddress=0.0.0.0",
"--defaultvs=server",
"--securityenabled=false",
"listener_id=my-http-listener-1");
command - command to be executed.args - command arguments.
CommandResult which encapsulates exit status, command output, failure cause (if any).void setTerse(boolean terse)
terse - true to get concise output, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||