Class CommandLineArguments
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.CommandLineArguments
-
public class CommandLineArguments extends java.lang.ObjectHelper class to encapsulate the funcionality concerning command line arguments- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 16, 2013
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLIENT_OPTIONstatic java.lang.StringGAME_LOCALEstatic java.lang.StringHELP_OPTIONstatic java.lang.StringSERVER_OPTIONstatic java.lang.StringVERSION_OPTION
-
Constructor Summary
Constructors Constructor Description CommandLineArguments()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.cli.OptionscreateCommandLineOptions()booleanisClient(org.apache.commons.cli.CommandLine cmdLine)Check weather the application is started as client.booleanisServer(org.apache.commons.cli.CommandLine cmdLine)Check weather the application is started as server.booleanisStandalone(org.apache.commons.cli.CommandLine cmdLine)Check wether the commandline arguments for standalone are set.org.apache.commons.cli.CommandLineparseCommandLine(org.apache.commons.cli.Options options, java.lang.String[] args)voidpersistAsPropertyFile(org.apache.commons.cli.CommandLine cmdLine)Set the spring profiles and write some properties, which will be used by Spring.voidprintHelp(org.apache.commons.cli.Options options)
-
-
-
Field Detail
-
VERSION_OPTION
public static final java.lang.String VERSION_OPTION
- See Also:
- Constant Field Values
-
HELP_OPTION
public static final java.lang.String HELP_OPTION
- See Also:
- Constant Field Values
-
GAME_LOCALE
public static final java.lang.String GAME_LOCALE
- See Also:
- Constant Field Values
-
CLIENT_OPTION
public static final java.lang.String CLIENT_OPTION
- See Also:
- Constant Field Values
-
SERVER_OPTION
public static final java.lang.String SERVER_OPTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
createCommandLineOptions
public org.apache.commons.cli.Options createCommandLineOptions()
-
parseCommandLine
public org.apache.commons.cli.CommandLine parseCommandLine(org.apache.commons.cli.Options options, java.lang.String[] args)
-
printHelp
public void printHelp(org.apache.commons.cli.Options options)
-
isStandalone
public boolean isStandalone(org.apache.commons.cli.CommandLine cmdLine)
Check wether the commandline arguments for standalone are set.- Parameters:
cmdLine- command line object- Returns:
- true if both client and server arguments are specified or neither.
-
isServer
public boolean isServer(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as server.- Parameters:
cmdLine- command line object- Returns:
- true if only the server flag is set
-
isClient
public boolean isClient(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as client.- Parameters:
cmdLine- command line object- Returns:
- true if only the client flag is set
-
persistAsPropertyFile
public void persistAsPropertyFile(org.apache.commons.cli.CommandLine cmdLine)
Set the spring profiles and write some properties, which will be used by Spring.- Parameters:
cmdLine- command line object
-
-