@Service
@PerLookup
@ContractsProvided(value={CommandRunner.class,CommandExecutorImpl.class})
public class CommandExecutorImpl
extends Object
implements CommandRunner
| Constructor and Description |
|---|
CommandExecutorImpl() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public CommandResult run(String command, String... args)
CommandRunnerGlassFish 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");
run in interface CommandRunnercommand - command to be executed.args - command arguments.CommandResult which encapsulates exit status, command output, failure cause (if any).public void setTerse(boolean terse)
CommandRunnersetTerse in interface CommandRunnerterse - true to get concise output, false otherwise.Copyright © 2019. All rights reserved.