T - the type of configuration class for this applicationpublic abstract class Application<T extends Configuration> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Application() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDefaultCommands(Bootstrap<T> bootstrap)
Called by
run(String...) to add the standard "server" and "check" commands |
Class<T> |
getConfigurationClass()
Returns the
Class of the configuration class type parameter. |
String |
getName()
Returns the name of the application.
|
void |
initialize(Bootstrap<T> bootstrap)
Initializes the application bootstrap.
|
protected void |
onFatalError()
Called by
run(String...) to indicate there was a fatal error running the requested command. |
void |
run(String... arguments)
Parses command-line arguments and runs the application.
|
abstract void |
run(T configuration,
Environment environment)
When the application runs, this is called after the
Bundles are run. |
public final Class<T> getConfigurationClass()
Class of the configuration class type parameter.Generics.getTypeParameter(Class, Class)public String getName()
public void initialize(Bootstrap<T> bootstrap)
bootstrap - the application bootstrappublic abstract void run(T configuration, Environment environment) throws Exception
Bundles are run. Override it to add
providers, resources, etc. for your application.configuration - the parsed Configuration objectenvironment - the application's EnvironmentException - if something goes wrongpublic void run(String... arguments) throws Exception
public
static void main entry point in your application.arguments - the command-line argumentsException - if something goes wrongprotected void addDefaultCommands(Bootstrap<T> bootstrap)
run(String...) to add the standard "server" and "check" commandsbootstrap - the bootstrap instanceprotected void onFatalError()
run(String...) to indicate there was a fatal error running the requested command.
The default implementation calls System.exit(int) with a non-zero status code to terminate the
application.Copyright © 2016. All rights reserved.