Package io.vertx.core.spi.launcher
Interface Command
-
- All Known Implementing Classes:
DefaultCommand
public interface Command
A plug-in to the Vert.x command orLauncher
class. Each command instance is created by aCommandFactory
.Command
implementation can retrieve argument and option using theArgument
andOption
annotations. Documentation / help is provided using theSummary
(single sentence) andDescription
annotations.Commands follow a strict lifecycle. The
setUp(ExecutionContext)
method is called with an execution context. It lets you validate the inputs and prepare the environment is needed. Therun()
method is called immediately aftersetUp(ExecutionContext)
, and executes the command. Finally, once the command has completed, thetearDown()
method is called. In this method you have the opportunity to cleanup.- Author:
- Clement Escoffier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
run()
Executes the command.void
setUp(ExecutionContext context)
Set up the command execution environment.void
tearDown()
The command has been executed.
-
-
-
Method Detail
-
setUp
void setUp(ExecutionContext context) throws CLIException
Set up the command execution environment. The command line model has been retrieved and is frozen. Values has been set / injected. You can use this callback to validate the inputs.- Parameters:
context
- the context- Throws:
CLIException
- if the validation failed
-
run
void run() throws CLIException
Executes the command.- Throws:
CLIException
- If anything went wrong.
-
tearDown
void tearDown() throws CLIException
The command has been executed. Use this method to cleanup the environment.- Throws:
CLIException
- if anything went wrong
-
-