Package edu.uiuc.ncsa.security.util.cli
Class ConfigurableCommandsImpl2
- java.lang.Object
- 
- edu.uiuc.ncsa.security.util.cli.AbstractCommandsImpl
- 
- edu.uiuc.ncsa.security.util.cli.ConfigurableCommandsImpl2
 
 
- 
- All Implemented Interfaces:
- Logable,- Commands,- Serializable
 - Direct Known Subclasses:
- TestCCI
 
 public abstract class ConfigurableCommandsImpl2 extends AbstractCommandsImpl Basic implementation of Commands that supports loading configurations. It is intended as a the superclass for commands that have multiple components. NOTE This does not actually run commands! It is a top-level class that delegates to its command implementations (such as for stores, keys). Therefore, you should not put code here that actually executes things. The contract of this is that it manages logging, loading configurations and instantiating the actualCommandsimplementations that do everything.Created by Jeff Gaynor 
 on 5/20/13 at 11:35 AM- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classConfigurableCommandsImpl2.ListOnlyNotification
 - 
Field SummaryFields Modifier and Type Field Description protected StringCFG_FILE_SWITCHstatic StringCONFIG_FILE_LONG_OPTIONstatic StringCONFIG_FILE_OPTIONstatic StringCONFIG_NAME_LONG_OPTIONstatic StringCONFIG_NAME_OPTION- 
Fields inherited from class edu.uiuc.ncsa.security.util.cli.AbstractCommandsImplCL_INPUT_FILE_FLAG, CL_OUTPUT_FILE_FLAG, DEFAULT_NULL_VALUE_PLACEHOLDER, defaultIndent, INDENT, LOGO, logoName, NO_HEADER, NO_LOGO, showHeader, showLogo, SILENT
 
- 
 - 
Constructor SummaryConstructors Constructor Description ConfigurableCommandsImpl2(CLIDriver driver)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description InputLinebootstrap(InputLine args)Parses command line arguments.protected List<String>doListNames(File target)Figures out by file extension what to list.protected abstract ConfigurationLoader<? extends AbstractEnvironment>figureOutLoader(String fileName, String configName)This is done so configurations can be loaded by inheritors.abstract StringgetComponentName()For the configuration.StringgetConfigFile()StringgetConfigName()AbstractEnvironmentgetEnvironment()abstract ConfigurationLoader<? extends AbstractEnvironment>getLoader()voidinitHelp()voidinitialize()Called at initialization to read and process the command line arguments.protected voidlistConfigs(InputLine inputLine)protected List<String>listXMLConfigs(File target)voidload(InputLine inputLine)Load resources before showing logos etc.protected voidloadConfig(String filename, String configName)Loads the configuration and sets the filename and configuration given as the current ones.voidsetConfigFile(String configFile)voidsetConfigName(String configName)voidsetDriver(CLIDriver driver)Back reference to the driver for this classvoidsetEnvironment(AbstractEnvironment environment)abstract voidsetLoader(ConfigurationLoader<? extends AbstractEnvironment> loader)protected voidshowLoadHelp()protected booleanswitchOrRun(InputLine inputLine, CommonCommands2 commands)Either switch to another component or (if there are arguments) simply run the single command and return.booleanuse(InputLine inputLine)Override this to invoke the specific components that make up your CLI.abstract voiduseHelp()- 
Methods inherited from class edu.uiuc.ncsa.security.util.cli.AbstractCommandsImplabout, bootstrap, clear_env, clearEnvHelp, configureCommands, debug, error, error, get_env, getDriver, getHelpUtil, getInput, getIOInterface, getLogoName, getPropertyHelp, gracefulExit, hasLogger, indentWidth, info, isDebugOn, isOk, isShowHeader, isShowLogo, print_env, printEnvHelp, printGetEnvHelp, printReadEnvHelp, printSaveEnvHelp, printSetEnvHelp, read_env, readJSON, readline, readline, save_env, say, say, sayi, sayv, set_env, setDebugOn, setLogoName, setShowHeader, setShowLogo, showHelp, warn
 
- 
 
- 
- 
- 
Field Detail- 
CFG_FILE_SWITCHprotected String CFG_FILE_SWITCH 
 - 
CONFIG_FILE_OPTIONpublic static final String CONFIG_FILE_OPTION - See Also:
- Constant Field Values
 
 - 
CONFIG_FILE_LONG_OPTIONpublic static final String CONFIG_FILE_LONG_OPTION - See Also:
- Constant Field Values
 
 - 
CONFIG_NAME_OPTIONpublic static final String CONFIG_NAME_OPTION - See Also:
- Constant Field Values
 
 - 
CONFIG_NAME_LONG_OPTIONpublic static final String CONFIG_NAME_LONG_OPTION - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
ConfigurableCommandsImpl2public ConfigurableCommandsImpl2(CLIDriver driver) 
 
- 
 - 
Method Detail- 
getConfigNamepublic String getConfigName() 
 - 
setConfigNamepublic void setConfigName(String configName) 
 - 
loadpublic void load(InputLine inputLine) throws Throwable Description copied from class:AbstractCommandsImplLoad resources before showing logos etc. This is typically called on your behalf inAbstractCommandsImpl.bootstrap(InputLine)amd should load resources needed. Note that an exception in this does not stop booting. This allows you to start a system with a missing configuration file (for instnace) and prompt for it.
 SeeAbstractCommandsImpl.initialize()which is called after this and is charged with actually starting- Specified by:
- loadin class- AbstractCommandsImpl
- Throws:
- Throwable
 
 - 
doListNamesprotected List<String> doListNames(File target) throws Exception Figures out by file extension what to list. Override as needed. Default is .xml.- Parameters:
- target-
- Returns:
- Throws:
- Exception
 
 - 
listXMLConfigsprotected List<String> listXMLConfigs(File target) throws Exception - Throws:
- Exception
 
 - 
showLoadHelpprotected void showLoadHelp() 
 - 
getEnvironmentpublic AbstractEnvironment getEnvironment() throws Exception - Throws:
- Exception
 
 - 
setEnvironmentpublic void setEnvironment(AbstractEnvironment environment) 
 - 
getComponentNamepublic abstract String getComponentName() For the configuration. This is the tag name (e.g. "client" or "server") in the XML file. Note this is used by subclasses in other projects.- Returns:
 
 - 
getLoaderpublic abstract ConfigurationLoader<? extends AbstractEnvironment> getLoader() 
 - 
setLoaderpublic abstract void setLoader(ConfigurationLoader<? extends AbstractEnvironment> loader) 
 - 
initHelppublic void initHelp() throws Throwable- Overrides:
- initHelpin class- AbstractCommandsImpl
- Throws:
- Throwable
 
 - 
initializepublic void initialize() Called at initialization to read and process the command line arguments. NOTE that this is not called in this class, but by inheritors.- Specified by:
- initializein class- AbstractCommandsImpl
 
 - 
loadConfigprotected void loadConfig(String filename, String configName) throws Throwable Loads the configuration and sets the filename and configuration given as the current ones.- Parameters:
- filename-
- configName-
- Throws:
- Throwable
 
 - 
figureOutLoaderprotected abstract ConfigurationLoader<? extends AbstractEnvironment> figureOutLoader(String fileName, String configName) throws Throwable This is done so configurations can be loaded by inheritors.- Parameters:
- fileName-
- configName-
- Returns:
- Throws:
- Throwable
 
 - 
getConfigFilepublic String getConfigFile() 
 - 
setConfigFilepublic void setConfigFile(String configFile) 
 - 
bootstrappublic InputLine bootstrap(InputLine args) throws Throwable Parses command line arguments. This is usually called afterCLIDriver.bootstrap(String[]), which pulls off its startup options
 - 
useHelppublic abstract void useHelp() 
 - 
usepublic boolean use(InputLine inputLine) throws Throwable Override this to invoke the specific components that make up your CLI.
 - 
switchOrRunprotected boolean switchOrRun(InputLine inputLine, CommonCommands2 commands) Either switch to another component or (if there are arguments) simply run the single command and return. Note that each component has stored state, so these will be run with whatever is in that state. Requiresuse(InputLine)be overridden.- Parameters:
- inputLine-
- commands-
- Returns:
 
 - 
setDriverpublic void setDriver(CLIDriver driver) Back reference to the driver for this class- Specified by:
- setDriverin interface- Commands
- Overrides:
- setDriverin class- AbstractCommandsImpl
- Parameters:
- driver-
 
 
- 
 
-