while (!isDone) { try { say2(prompt); cmdLine = readline(); switch (execute(cmdLine)) { case HELP_RC: listCLIMethods(); break; case SHUTDOWN_RC: isDone = false; // just in case. quit(null); return; case USER_EXIT_RC: say("User exit encountered"); break; case OK_RC: case ABNORMAL_RC: default: say("Command not found/understood. Try typing help or exit."); listCLIMethods(); ioe.printStackTrace(); say("Internal error reading line:/n" + ioe.getMessage());
protected String readline() throws IOException { return getBufferedReader().readLine(); }
protected void listCLIMethods() { say("Here are the commands available:"); String[] tempCCIN = CLIReflectionUtil.getCommandsNameList(getCLICommands()); for (int i = 0; i < tempCCIN.length; i++) { say(tempCCIN[i]); } say("To get more information on a command type\n"); say("command --help"); }
protected void shutdown() { say("exiting ..."); /* Don't close the buffered reader since it will close System.in and make it impossible to run another CLI in this JVM. */ }
for (int i = 0; i < getCLICommands().length; i++) { try { invokeMethod(commands[i], cmdS, cliAV); say("Exception. The cause is: " + itx.getCause().getMessage()); }else{ say("Invocation target exception encountered:" + itx.getTargetException()); say(" Could not execute command. Message:" + nsmx.getMessage()); nsmx.printStackTrace(); say(" >>Couldn't parse the command");
protected void runComponent(String componentName) throws Exception { CommonCommands commonCommands = null; if (componentName.equals(CLIENTS)) { commonCommands = getNewClientStoreCommands(); } if (componentName.equals(CLIENT_APPROVALS)) { commonCommands = getNewClientApprovalStoreCommands(); } if (componentName.equals(COPY)) { commonCommands = getNewCopyCommands(); } if (commonCommands != null) { CLIDriver cli = new CLIDriver(commonCommands); cli.start(); } }
public static void main(String[] args) { try { OA2Tester testCommands = new OA2Tester(null); testCommands.start(args); OA2TestCommands usc = new OA2TestCommands(testCommands.getMyLogger(), (ClientEnvironment) testCommands.getEnvironment()); CLIDriver cli = new CLIDriver(usc); cli.start(); } catch (Exception e) { e.printStackTrace(); } }
@Override public boolean use(InputLine inputLine) throws Exception { CommonCommands commands = null; if (inputLine.hasArg(CLIENTS)) { commands = getNewClientStoreCommands(); } if (inputLine.hasArg(CLIENT_APPROVALS)) { commands = getNewClientApprovalStoreCommands(); } if (inputLine.hasArg(COPY)) { commands = getNewCopyCommands(); } if (commands != null) { CLIDriver cli = new CLIDriver(commands); cli.start(); return true; } if (super.use(inputLine)) { return true; } return false; }
@Override public boolean use(InputLine inputLine) throws Exception { CommonCommands commands = null; if (inputLine.hasArg(ADMINS)) { commands = getAdminClientCommands(); } if (inputLine.hasArg(KEYS)) { commands = new SigningCommands(getOA2SE()); } if (inputLine.hasArg(PERMISSIONS)) { commands = getPermissionCommands(); } if (commands != null) { CLIDriver cli = new CLIDriver(commands); cli.start(); return true; } if (super.use(inputLine)) { return true; } return false; } }