Package edu.uiuc.ncsa.security.util.cli
Class CLIDriver
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.cli.CLIDriver
-
- Direct Known Subclasses:
SASCLIDriver
,SASServerSideCLiDriver
public class CLIDriver extends Object
A driver program that does introspection on a set of CLICommandsCreated by Jeff Gaynor
on 5/17/13 at 3:01 PM
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CLIDriver(Commands... cci)
CLIDriver(IOInterface ioInterface)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommands(Commands... cci)
protected void
doBufferRead(String cmdLine)
protected void
doBufferWrite(String cmdLine)
protected void
doHelp(InputLine inputLine)
protected String
doHistory(String cmdLine)
protected String
doRepeatCommand(String cmdLine)
int
execute(InputLine cliAV)
Returns a logical true if one of the command lines executes the line successfully.int
execute(String cmdLine)
Commands[]
getCLICommands()
protected int
getCommandType(String cmdLine)
ComponentManager
getComponentManager()
Map
getEnv()
HelpUtil
getHelpUtil()
IOInterface
getIOInterface()
String
getLineCommentStart()
boolean
hasComments()
boolean
hasEnv()
boolean
isTraceOn()
protected void
listCLIMethods(InputLine inputLine)
protected void
printHelp()
protected void
printHelpTopics(InputLine inputLine)
void
quit(InputLine inputLine)
protected String
readline(String prompt)
protected void
say(String x)
For use with informational messages.protected void
say2(String x)
For use with prompts.protected void
setCLICommands(Commands[] commands)
void
setComponentManager(ComponentManager componentManager)
void
setEnv(Map env)
void
setHelpUtil(HelpUtil helpUtil)
void
setIOInterface(IOInterface ioInterface)
void
setLineCommentStart(String lineCommentStart)
void
setTraceOn(boolean traceOn)
protected void
shutdown()
void
start()
Actual method that starts up this driver and sets out prompts etc.
-
-
-
Field Detail
-
EXIT_COMMAND
public static final String EXIT_COMMAND
If a user enters this string at any point, the current operation should end. An ExitException is thrown.- See Also:
- Constant Field Values
-
lineCommentStart
protected String lineCommentStart
-
OK_RC
public static final int OK_RC
- See Also:
- Constant Field Values
-
ABNORMAL_RC
public static final int ABNORMAL_RC
- See Also:
- Constant Field Values
-
USER_EXIT_RC
public static final int USER_EXIT_RC
- See Also:
- Constant Field Values
-
SHUTDOWN_RC
public static final int SHUTDOWN_RC
- See Also:
- Constant Field Values
-
HELP_RC
public static final int HELP_RC
- See Also:
- Constant Field Values
-
HELP_SWITCH
public static final String HELP_SWITCH
- See Also:
- Constant Field Values
-
PRINT_HELP_COMMAND
public static final String PRINT_HELP_COMMAND
- See Also:
- Constant Field Values
-
CLEAR_BUFFER_COMMAND
public static final String CLEAR_BUFFER_COMMAND
- See Also:
- Constant Field Values
-
LOAD_BUFFER_COMMAND
public static final String LOAD_BUFFER_COMMAND
- See Also:
- Constant Field Values
-
HISTORY_LIST_COMMAND
public static final String HISTORY_LIST_COMMAND
- See Also:
- Constant Field Values
-
SHORT_EXIT_COMMAND
public static final String SHORT_EXIT_COMMAND
- See Also:
- Constant Field Values
-
REPEAT_LAST_COMMAND
public static final String REPEAT_LAST_COMMAND
- See Also:
- Constant Field Values
-
WRITE_BUFFER_COMMAND
public static final String WRITE_BUFFER_COMMAND
- See Also:
- Constant Field Values
-
COMPONENT_COMMAND
public static final String COMPONENT_COMMAND
- See Also:
- Constant Field Values
-
LIST_ALL_METHODS_COMMAND
public static final String LIST_ALL_METHODS_COMMAND
- See Also:
- Constant Field Values
-
TRACE_COMMAND
public static final String TRACE_COMMAND
- See Also:
- Constant Field Values
-
ONLINE_HELP_COMMAND
public static final String ONLINE_HELP_COMMAND
- See Also:
- Constant Field Values
-
USER_DEFINED_COMMAND
protected static final int USER_DEFINED_COMMAND
- See Also:
- Constant Field Values
-
NO_OP_VALUE
protected static final int NO_OP_VALUE
- See Also:
- Constant Field Values
-
REPEAT_COMMAND_VALUE
protected static final int REPEAT_COMMAND_VALUE
- See Also:
- Constant Field Values
-
HISTORY_COMMAND_VALUE
protected static final int HISTORY_COMMAND_VALUE
- See Also:
- Constant Field Values
-
WRITE_BUFFER_COMMAND_VALUE
protected static final int WRITE_BUFFER_COMMAND_VALUE
- See Also:
- Constant Field Values
-
READ_BUFFER_COMMAND_VALUE
protected static final int READ_BUFFER_COMMAND_VALUE
- See Also:
- Constant Field Values
-
CLEAR_BUFFER_COMMAND_VALUE
protected static final int CLEAR_BUFFER_COMMAND_VALUE
- See Also:
- Constant Field Values
-
SHORT_EXIT_COMMAND_VALUE
protected static final int SHORT_EXIT_COMMAND_VALUE
- See Also:
- Constant Field Values
-
PRINT_HELP_COMMAND_VALUE
protected static final int PRINT_HELP_COMMAND_VALUE
- See Also:
- Constant Field Values
-
LIST_ALL_METHODS_COMMAND_VALUE
protected static final int LIST_ALL_METHODS_COMMAND_VALUE
- See Also:
- Constant Field Values
-
TRACE_COMMAND_VALUE
protected static final int TRACE_COMMAND_VALUE
- See Also:
- Constant Field Values
-
COMPONENT_COMMAND_VALUE
protected static final int COMPONENT_COMMAND_VALUE
- See Also:
- Constant Field Values
-
ONLINE_HELP_COMMAND_VALUE
public static final int ONLINE_HELP_COMMAND_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CLIDriver
public CLIDriver(Commands... cci)
-
CLIDriver
public CLIDriver(IOInterface ioInterface)
-
-
Method Detail
-
getLineCommentStart
public String getLineCommentStart()
-
setLineCommentStart
public void setLineCommentStart(String lineCommentStart)
-
hasComments
public boolean hasComments()
-
getEnv
public Map getEnv()
-
setEnv
public void setEnv(Map env)
-
hasEnv
public boolean hasEnv()
-
addCommands
public void addCommands(Commands... cci)
-
getCLICommands
public Commands[] getCLICommands()
-
setCLICommands
protected void setCLICommands(Commands[] commands)
-
readline
protected String readline(String prompt) throws IOException
- Throws:
IOException
-
getCommandType
protected int getCommandType(String cmdLine)
-
printHelp
protected void printHelp()
-
getComponentManager
public ComponentManager getComponentManager()
-
setComponentManager
public void setComponentManager(ComponentManager componentManager)
-
start
public void start()
Actual method that starts up this driver and sets out prompts etc.- Throws:
Exception
-
isTraceOn
public boolean isTraceOn()
-
setTraceOn
public void setTraceOn(boolean traceOn)
-
execute
public int execute(String cmdLine)
-
execute
public int execute(InputLine cliAV)
Returns a logical true if one of the command lines executes the line successfully. This will also throw a shutdown exception if the user asks it to... Otherwise it returns false;- Parameters:
cliAV
-- Returns:
-
getHelpUtil
public HelpUtil getHelpUtil()
-
setHelpUtil
public void setHelpUtil(HelpUtil helpUtil)
-
doHelp
protected void doHelp(InputLine inputLine)
-
printHelpTopics
protected void printHelpTopics(InputLine inputLine)
-
listCLIMethods
protected void listCLIMethods(InputLine inputLine)
-
quit
public void quit(InputLine inputLine)
-
shutdown
protected void shutdown()
-
say
protected void say(String x)
For use with informational messages.- Parameters:
x
-
-
say2
protected void say2(String x)
For use with prompts.- Parameters:
x
-
-
getIOInterface
public IOInterface getIOInterface()
-
setIOInterface
public void setIOInterface(IOInterface ioInterface)
-
-