Package com.sun.identity.cli
Class SubCommand
- java.lang.Object
-
- com.sun.identity.cli.SubCommand
-
public class SubCommand extends Object
This class contains definition of sub command.
-
-
Constructor Summary
Constructors Constructor Description SubCommand(IDefinition definition, ResourceBundle rb, String name, List mandatoryOptions, List optionalOptions, List optionAliases, String implClassName, boolean webSupport, String deprecationWarning)Creates a sub command object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckboxUI(String opt)Returnstrueif option is to be displayed as checkbox in web based CLI.voidexecute(RequestContext rc)Services a CLI request.StringgetDeprecationWarning()StringgetDescription()Returns description of the sub command.StringgetLongOptionName(String name)Returns long argument/option name given its short name.ListgetMandatoryOptions()Returns list of mandatory argument/options.StringgetName()Returns name of the sub command.ListgetOptionAliases(String name)Returns option aliases.SetgetOptionAliasesGroup(String fullName)Returns option aliases group.ListgetOptionalOptions()Returns list of optional argument/options.StringgetOptionDescription(String name)Returns the description of an argument/option.StringgetOptionDescription(String name, boolean isWeb)Returns the description of an argument/option.static StringgetReservedLongOptionName(String shortName)Returns long reserved argument/option name given its short name.static StringgetReservedShortOptionName(String longName)Returns short reserved argument/option name given its long name.ResourceBundlegetResourceBundle()Returns resource bundle of the sub command.StringgetShortOptionName(String name)Returns short argument/option name given its long name.booleanisBinaryOption(String cmdName)Returnstrueif option is binary.booleanisOptionAlias(String name)Returnstrueif option is an alias.static booleanisReservedLongOption(String name)Returnstrueif an argument/option is reserved.static booleanisReservedShortOption(String name)Returnstrueif an argument/option is reserved.booleanisSupportedOption(String name)Returnsif the option is supported. booleanisUnaryOption(String cmdName)Returnstrueif option is unary.booleantextareaUI(String opt)Returnstrueif option is to be displayed as text area in web based CLI.booleanvalidateOptions(Map options, SSOToken ssoToken)Returnstrueif the given options are valid in the context of this sub command.booleanwebEnabled()Returnstrueif this command is supported on web browser.
-
-
-
Constructor Detail
-
SubCommand
public SubCommand(IDefinition definition, ResourceBundle rb, String name, List mandatoryOptions, List optionalOptions, List optionAliases, String implClassName, boolean webSupport, String deprecationWarning) throws CLIException
Creates a sub command object.- Parameters:
definition- Definition class.rb- Resource Bundle.name- Name of the Sub Command.mandatoryOptions- Formated list of mandatory argument/options.optionalOptions- Formated list of optional argument/options.optionAliases- Formated list of argument/options aliases.implClassName- Implementation class name.webSupport-trueif this command is supported on the web browser.deprecationWarning- if set to a non zero length string (default is "") then print this warning.- Throws:
CLIException- if this object cannot be constructed.
-
-
Method Detail
-
isReservedShortOption
public static boolean isReservedShortOption(String name)
Returnstrueif an argument/option is reserved.- Parameters:
name- Short name of argument/option.- Returns:
trueif an argument/option is reserved.
-
isReservedLongOption
public static boolean isReservedLongOption(String name)
Returnstrueif an argument/option is reserved.- Parameters:
name- Full name of argument/option.- Returns:
trueif an argument/option is reserved.
-
getReservedShortOptionName
public static String getReservedShortOptionName(String longName)
Returns short reserved argument/option name given its long name.- Parameters:
longName- Long name of reserved argument/option.- Returns:
- short reserved argument/option name given its long name. Returns null if short name is not found.
-
getReservedLongOptionName
public static String getReservedLongOptionName(String shortName)
Returns long reserved argument/option name given its short name.- Parameters:
shortName- Short name of reserved argument/option.- Returns:
- long reserved argument/option name given its short name. Returns null if long name is not found.
-
getName
public String getName()
Returns name of the sub command.- Returns:
- name of the sub command.
-
getDescription
public String getDescription()
Returns description of the sub command.- Returns:
- description of the sub command.
-
getOptionalOptions
public List getOptionalOptions()
Returns list of optional argument/options.- Returns:
- list of optional argument/options.
-
getMandatoryOptions
public List getMandatoryOptions()
Returns list of mandatory argument/options.- Returns:
- list of mandatory argument/options.
-
getOptionAliases
public List getOptionAliases(String name)
Returns option aliases.- Parameters:
name- Full name of argument/option.- Returns:
- get option aliases. Returns null of there are no aliases.
-
getOptionAliasesGroup
public Set getOptionAliasesGroup(String fullName)
Returns option aliases group.- Parameters:
fullName- Full name of argument/option.- Returns:
- option aliases group.
-
isOptionAlias
public boolean isOptionAlias(String name)
Returnstrueif option is an alias.- Parameters:
name- Full name of argument/option.- Returns:
trueif option is an alias.
-
execute
public void execute(RequestContext rc) throws CLIException
Services a CLI request.- Parameters:
rc- Request Context.- Throws:
CLIException- if request cannot be serviced.
-
validateOptions
public boolean validateOptions(Map options, SSOToken ssoToken)
Returnstrueif the given options are valid in the context of this sub command.- Parameters:
options- Map of argument/option full name to its values (List).ssoToken- Single Sign On token of the user.- Returns:
trueif the given options are valid.
-
getLongOptionName
public String getLongOptionName(String name)
Returns long argument/option name given its short name.- Parameters:
name- short name of argument/option.- Returns:
- long argument/option name given its short name. Returns null if short name is not found.
-
getShortOptionName
public String getShortOptionName(String name)
Returns short argument/option name given its long name.- Parameters:
name- Long name of argument/option.- Returns:
- short argument/option name given its long name. Returns null if short name is not found.
-
isSupportedOption
public boolean isSupportedOption(String name)
Returnsif the option is supported. - Parameters:
name- Name of the argument/option.- Returns:
if the option is supported.
-
getOptionDescription
public String getOptionDescription(String name)
Returns the description of an argument/option.- Parameters:
name- Name of the argument/option.- Returns:
- the description of an argument/option.
-
getOptionDescription
public String getOptionDescription(String name, boolean isWeb)
Returns the description of an argument/option.- Parameters:
name- Name of the argument/option.isWeb-trueif CLI is accessed via browser.- Returns:
- the description of an argument/option.
-
getResourceBundle
public ResourceBundle getResourceBundle()
Returns resource bundle of the sub command.- Returns:
- resource bundle of the sub command.
-
isUnaryOption
public boolean isUnaryOption(String cmdName)
Returnstrueif option is unary.- Returns:
trueif option is unary.
-
isBinaryOption
public boolean isBinaryOption(String cmdName)
Returnstrueif option is binary.- Returns:
trueif option is binary.
-
webEnabled
public boolean webEnabled()
Returnstrueif this command is supported on web browser.- Returns:
trueif this command is supported on web browser.
-
getDeprecationWarning
public String getDeprecationWarning()
- Returns:
- any deprecation warning (by default this is set to the empty string).
-
textareaUI
public boolean textareaUI(String opt)
Returnstrueif option is to be displayed as text area in web based CLI.- Parameters:
opt- Name of option.- Returns:
trueif option is to be displayed as text area.
-
checkboxUI
public boolean checkboxUI(String opt)
Returnstrueif option is to be displayed as checkbox in web based CLI.- Parameters:
opt- Name of option.- Returns:
trueif option is to be displayed as checkbox.
-
-