Package org.wildfly.security.tool
Class Command
- java.lang.Object
-
- org.wildfly.security.tool.Command
-
- Direct Known Subclasses:
CredentialStoreCommand
,FileSystemEncryptRealmCommand
,FileSystemRealmCommand
,MaskCommand
,VaultCommand
public abstract class Command extends Object
Base command class- Author:
- Peter Skopek
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
enableDebug
static int
GENERAL_CONFIGURATION_ERROR
General configuration error exit code.static int
INPUT_DATA_NOT_CONFIRMED
private List<String>
redirectionValues
private int
status
private String
toolCommand
Command used to execute the tool.static int
WIDTH
Default help line width.
-
Constructor Summary
Constructors Constructor Description Command()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Set<String>
aliases()
abstract void
execute(String[] args)
protected Supplier<Provider[]>
getProvidersSupplier(String providersList)
int
getStatus()
String
getToolCommand()
Get tool commandvoid
help()
Display help to the command.boolean
isAlias(String alias)
boolean
isEnableDebug()
Get the command debug optionstatic boolean
isWindows()
void
printDuplicatesWarning(org.apache.commons.cli.CommandLine cmdLine)
Alerts if any of the command line options used are duplicatedvoid
printDuplicatesWarning(org.apache.commons.cli.CommandLine cmdLine, List<String> duplicatesAllowed)
Alerts if any of the command line options used are duplicated, excluding commands that are allowed to have duplicatesprotected String
prompt(boolean echo, String prompt, boolean confirm, String confirmPrompt)
Prompt for interactive user input with possible confirmation of input data.void
setEnableDebug(boolean enableDebug)
Set the command debug optionprotected void
setStatus(int status)
void
setToolCommand(String toolCommand)
Set tool command
-
-
-
Field Detail
-
GENERAL_CONFIGURATION_ERROR
public static final int GENERAL_CONFIGURATION_ERROR
General configuration error exit code.- See Also:
- Constant Field Values
-
INPUT_DATA_NOT_CONFIRMED
public static final int INPUT_DATA_NOT_CONFIRMED
- See Also:
- Constant Field Values
-
status
private int status
-
enableDebug
private boolean enableDebug
-
toolCommand
private String toolCommand
Command used to execute the tool.
-
WIDTH
public static final int WIDTH
Default help line width.- See Also:
- Constant Field Values
-
-
Method Detail
-
help
public void help()
Display help to the command.
-
isAlias
public boolean isAlias(String alias)
-
getStatus
public int getStatus()
-
setStatus
protected void setStatus(int status)
-
isWindows
public static boolean isWindows()
-
prompt
protected String prompt(boolean echo, String prompt, boolean confirm, String confirmPrompt) throws Exception
Prompt for interactive user input with possible confirmation of input data. When data are not confirmed tool exits withINPUT_DATA_NOT_CONFIRMED
exit code- Parameters:
echo
- echo the characters typedprompt
- text to display before the inputconfirm
- confirm data after the first inputconfirmPrompt
- confirmation text- Returns:
- data as user inputs it
- Throws:
Exception
-
printDuplicatesWarning
public void printDuplicatesWarning(org.apache.commons.cli.CommandLine cmdLine)
Alerts if any of the command line options used are duplicated- Parameters:
cmdLine
- the command line options used when invoking the command, after parsing
-
printDuplicatesWarning
public void printDuplicatesWarning(org.apache.commons.cli.CommandLine cmdLine, List<String> duplicatesAllowed)
Alerts if any of the command line options used are duplicated, excluding commands that are allowed to have duplicates- Parameters:
cmdLine
- the command line options used when invoking the command, after parsingduplicatesAllowed
- list of the commands line options that can be duplicated. For example:List
allowedDuplicates = new ArrayList () {{ add(PASSWORD_CREDENTIAL_VALUE_PARAM); }};
-
isEnableDebug
public boolean isEnableDebug()
Get the command debug option
-
setEnableDebug
public void setEnableDebug(boolean enableDebug)
Set the command debug option
-
getToolCommand
public String getToolCommand()
Get tool command
-
setToolCommand
public void setToolCommand(String toolCommand)
Set tool command
-
-