TruncateTranslogCommand
public abstract class EnvironmentAwareCommand extends Command
Environment
to use current paths and settings.description, parser
Constructor | Description |
---|---|
EnvironmentAwareCommand(java.lang.String description) |
Construct the command with the specified command description.
|
EnvironmentAwareCommand(java.lang.String description,
java.lang.Runnable beforeMain) |
Construct the command with the specified command description and runnable to execute before main is invoked.
|
Modifier and Type | Method | Description |
---|---|---|
protected Environment |
createEnv(Terminal terminal,
java.util.Map<java.lang.String,java.lang.String> settings) |
Create an
Environment for the command to use. |
protected void |
execute(Terminal terminal,
joptsimple.OptionSet options) |
|
protected abstract void |
execute(Terminal terminal,
joptsimple.OptionSet options,
Environment env) |
Execute the command with the initialized
Environment . |
addShutdownHook, close, exit, main, printAdditionalHelp
public EnvironmentAwareCommand(java.lang.String description)
description
- the command descriptionpublic EnvironmentAwareCommand(java.lang.String description, java.lang.Runnable beforeMain)
description
- the command descriptionbeforeMain
- the before-main runnableprotected void execute(Terminal terminal, joptsimple.OptionSet options) throws java.lang.Exception
protected Environment createEnv(Terminal terminal, java.util.Map<java.lang.String,java.lang.String> settings) throws UserException
Environment
for the command to use. Overrideable for tests.UserException
protected abstract void execute(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.Exception
Environment
.java.lang.Exception