Package org.appng.cli
Class CliCore
- java.lang.Object
-
- org.appng.cli.CliCore
-
public class CliCore extends Object
The core of the command line interface, aggregating the availableExecutableCliCommand
s to aCliCommands
-object.- Author:
- Matthias Herlitzius
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMMAND_EXECUTION_ERROR
static int
COMMAND_INVALID
protected CliCommands
commands
static int
DATABASE_ERROR
static int
OPTION_INVALID
static int
OPTION_MISSING
static int
STATUS_OK
-
Constructor Summary
Constructors Constructor Description CliCore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getStatus()
int
perform(Properties cliConfig)
Performs a cli commandboolean
processCommand(String[] args)
Parses the given command line arguments and sets the state for thisCliCore
.void
setContext(org.springframework.context.ApplicationContext platformContext)
-
-
-
Field Detail
-
STATUS_OK
public static final int STATUS_OK
- See Also:
- Constant Field Values
-
DATABASE_ERROR
public static final int DATABASE_ERROR
- See Also:
- Constant Field Values
-
COMMAND_EXECUTION_ERROR
public static final int COMMAND_EXECUTION_ERROR
- See Also:
- Constant Field Values
-
COMMAND_INVALID
public static final int COMMAND_INVALID
- See Also:
- Constant Field Values
-
OPTION_INVALID
public static final int OPTION_INVALID
- See Also:
- Constant Field Values
-
OPTION_MISSING
public static final int OPTION_MISSING
- See Also:
- Constant Field Values
-
commands
protected CliCommands commands
-
-
Method Detail
-
perform
public int perform(Properties cliConfig)
Performs a cli command- Parameters:
cliConfig
- the properties read from "/conf/appNG.properties"
-
setContext
public void setContext(org.springframework.context.ApplicationContext platformContext)
-
processCommand
public boolean processCommand(String[] args) throws com.beust.jcommander.ParameterException
Parses the given command line arguments and sets the state for thisCliCore
. Must be called beforeperform(Properties)
. Only if this method returnstrue
, it is reasonable to callperform(Properties)
.- Parameters:
args
- the command line arguments- Returns:
true
if the given arguments have been parsed to anExecutableCliCommand
andperform(Properties)
should be called,false
otherwise- Throws:
com.beust.jcommander.ParameterException
- See Also:
getStatus()
-
getStatus
public int getStatus()
-
-