org.springframework.shell.core.ExitShellRequest Java Examples

The following examples show how to use org.springframework.shell.core.ExitShellRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BootShim.java    From hdfs-shell with Apache License 2.0 5 votes vote down vote up
public ExitShellRequest run() throws IllegalAccessException {
    sw.start();
    String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute();
    JLineShellComponent shell = this.ctx.getBean("shell", JLineShellComponent.class);
    ExitShellRequest exitShellRequest;
    if (null != commandsToExecuteAndThenQuit) {
        boolean successful = false;
        exitShellRequest = ExitShellRequest.FATAL_EXIT;
        for (String cmd : commandsToExecuteAndThenQuit) {
            successful = shell.executeCommand(cmd).isSuccess();
            if (!successful) {
                break;
            }
        }
        if (successful) {
            exitShellRequest = ExitShellRequest.NORMAL_EXIT;
        }
    } else {
        shell.start();
        shell.promptLoop();
        exitShellRequest = shell.getExitShellRequest();
        if (exitShellRequest == null) {
            exitShellRequest = ExitShellRequest.NORMAL_EXIT;
        }
        shell.waitForComplete();
    }
    sw.stop();
    if (shell.isDevelopmentMode()) {
        System.out.println("Total execution time: " + sw.getLastTaskTimeMillis() + " ms");
    }
    return exitShellRequest;
}
 
Example #2
Source File: ShellCommands.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
@CliCommand(value = { CliStrings.EXIT, "quit" }, help = CliStrings.EXIT__HELP)
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH})
public ExitShellRequest exit() throws IOException {
  Gfsh gfshInstance = getGfsh();

  gfshInstance.stop();

  ExitShellRequest exitShellRequest = gfshInstance.getExitShellRequest();
  if (exitShellRequest == null) {
    // shouldn't really happen, but we'll fallback to this anyway
    exitShellRequest = ExitShellRequest.NORMAL_EXIT;
  }

  return exitShellRequest;
}
 
Example #3
Source File: BootShim.java    From spring-data-dev-tools with Apache License 2.0 5 votes vote down vote up
public ExitShellRequest run() {
	sw.start();
	String[] commandsToExecuteAndThenQuit = commandLine.getShellCommandsToExecute();
	JLineShellComponent shell = (JLineShellComponent) this.ctx.getBean("shell", JLineShellComponent.class);
	ExitShellRequest exitShellRequest;
	if (null != commandsToExecuteAndThenQuit) {
		boolean successful = false;
		exitShellRequest = ExitShellRequest.FATAL_EXIT;
		String[] arr$ = commandsToExecuteAndThenQuit;
		int len$ = commandsToExecuteAndThenQuit.length;

		for (int i$ = 0; i$ < len$; ++i$) {
			String cmd = arr$[i$];
			successful = shell.executeCommand(cmd).isSuccess();
			if (!successful) {
				break;
			}
		}

		if (successful) {
			exitShellRequest = ExitShellRequest.NORMAL_EXIT;
		}
	} else {
		shell.start();
		shell.promptLoop();
		exitShellRequest = shell.getExitShellRequest();
		if (exitShellRequest == null) {
			exitShellRequest = ExitShellRequest.NORMAL_EXIT;
		}

		shell.waitForComplete();
	}

	sw.stop();
	if (shell.isDevelopmentMode()) {
		System.out.println("Total execution time: " + sw.getLastTaskTimeMillis() + " ms");
	}

	return exitShellRequest;
}
 
Example #4
Source File: ShellCommands.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
@CliCommand(value = { CliStrings.EXIT, "quit" }, help = CliStrings.EXIT__HELP)
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH})
public ExitShellRequest exit() throws IOException {
  Gfsh gfshInstance = getGfsh();

  gfshInstance.stop();

  ExitShellRequest exitShellRequest = gfshInstance.getExitShellRequest();
  if (exitShellRequest == null) {
    // shouldn't really happen, but we'll fallback to this anyway
    exitShellRequest = ExitShellRequest.NORMAL_EXIT;
  }

  return exitShellRequest;
}
 
Example #5
Source File: ShellCommandLineRunner.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
public ShellExitCodeGenerator(ExitShellRequest exitShellRequest) {
    this.exitShellRequest = exitShellRequest;
}
 
Example #6
Source File: ShellCommandLineRunner.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
private ExitShellRequest doRun() {
    this.stopWatch.start();
    try {

        String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
        ExitShellRequest exitShellRequest;
        if (null != commandsToExecuteAndThenQuit) {

            boolean successful = false;
            exitShellRequest = ExitShellRequest.FATAL_EXIT;

            for (String cmd : commandsToExecuteAndThenQuit) {
                if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
                    break;
            }

            if (successful) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
        }
        else if (this.applicationArguments.containsOption("help")) {
            System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
            exitShellRequest = ExitShellRequest.NORMAL_EXIT;
        } else {
            this.lineShellComponent.start();
            this.lineShellComponent.promptLoop();
            exitShellRequest = this.lineShellComponent.getExitShellRequest();
            if (exitShellRequest == null) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
            this.lineShellComponent.waitForComplete();
        }

        if (this.lineShellComponent.isDevelopmentMode()) {
            System.out.println("Total execution time: " + this.stopWatch
                    .getLastTaskTimeMillis() + " ms");
        }

        return exitShellRequest;
    } catch (Exception ex) {
        throw new ShellException(ex.getMessage(), ex);
    } finally {
        HandlerUtils.flushAllHandlers(this.logger);
        this.stopWatch.stop();
    }
}
 
Example #7
Source File: Launcher.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private int parseCommandLineCommand(final String... args) {
  Gfsh gfsh = null;
  try {
    gfsh = Gfsh.getInstance(false, args, new GfshConfig());
    this.startupTimeLogHelper.logStartupTime();
  } catch (ClassNotFoundException cnfex) {
    log(cnfex, gfsh);
  } catch (IOException ioex) {
    log(ioex, gfsh);
  } catch (IllegalStateException isex) {
    System.err.println("ERROR : " + isex.getMessage());
  }

  ExitShellRequest exitRequest = ExitShellRequest.NORMAL_EXIT;
  
  if (gfsh != null) {
    final String commandLineCommand = combineStrings(args);

    if (commandLineCommand.startsWith(HELP)) {
      if (commandLineCommand.equals(HELP)) {
        printUsage(gfsh, System.out);
      } else {
        // help is also available for commands which are not available under allowedCommandLineCommands
        gfsh.executeCommand(commandLineCommand);
      }
    } else {
      boolean commandIsAllowed = false;
      for (String allowedCommandLineCommand : this.allowedCommandLineCommands) {
        if (commandLineCommand.startsWith(allowedCommandLineCommand)) {
          commandIsAllowed = true;
          break;
        }
      }

      if (!commandIsAllowed) {
        System.err.println(CliStrings.format(MSG_INVALID_COMMAND_OR_OPTION, CliUtil.arrayToString(args)));
      } else {
        if (!gfsh.executeCommand(commandLineCommand) || gfsh.getLastExecutionStatus() != 0) {
          exitRequest = ExitShellRequest.FATAL_EXIT;
        }
      }
    }
  }
  
  return exitRequest.getExitCode();
}
 
Example #8
Source File: Launcher.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private int parseOptions(final String... args) {
  OptionSet parsedOptions;
  try {
    parsedOptions = this.commandLineParser.parse(args);
  } catch (OptionException e) {
    System.err.println(CliStrings.format(MSG_INVALID_COMMAND_OR_OPTION, CliUtil.arrayToString(args)));
    return ExitShellRequest.FATAL_EXIT.getExitCode();
  }
  boolean launchShell    = true;
  boolean onlyPrintUsage = parsedOptions.has(HELP_OPTION);
  if (parsedOptions.has(EXECUTE_OPTION) || onlyPrintUsage) {
    launchShell = false;
  }

  Gfsh gfsh = null;
  try {
    gfsh = Gfsh.getInstance(launchShell, args, new GfshConfig());
    this.startupTimeLogHelper.logStartupTime();
  } catch (ClassNotFoundException cnfex) {
    log(cnfex, gfsh);
  } catch (IOException ioex) {
    log(ioex, gfsh);
  } catch (IllegalStateException isex) {
    System.err.println("ERROR : " + isex.getMessage());
  }

  ExitShellRequest exitRequest = ExitShellRequest.NORMAL_EXIT;

  if (gfsh != null) {
    try {
      if (launchShell) {
        gfsh.start();
        gfsh.waitForComplete();
        exitRequest = gfsh.getExitShellRequest();
      } else if (onlyPrintUsage) {
        printUsage(gfsh, System.out);
      } else {
        @SuppressWarnings("unchecked")
        List<String> commandsToExecute = (List<String>) parsedOptions.valuesOf(EXECUTE_OPTION);

        // Execute all of the commands in the list, one at a time.
        for (int i = 0; i < commandsToExecute.size() && exitRequest == ExitShellRequest.NORMAL_EXIT; i++) {
          String command = commandsToExecute.get(i);
          System.out.println(GfshParser.LINE_SEPARATOR + "(" + (i + 1) + ") Executing - " + command
              + GfshParser.LINE_SEPARATOR);
          if (!gfsh.executeCommand(command) || gfsh.getLastExecutionStatus() != 0) {
            exitRequest = ExitShellRequest.FATAL_EXIT;
          }
        }
      }
    } catch (InterruptedException iex) {
      log(iex, gfsh);
    }
  }

  return exitRequest.getExitCode();
}
 
Example #9
Source File: Gfsh.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void promptLoop() {
  String line   = null;
  String prompt = getPromptText();
  try {
    gfshHistory.setAutoFlush(false);
    // NOTE: Similar code is in executeScript()
    while (exitShellRequest == null && (line = readLine(reader, prompt)) != null) {
      if (!line.endsWith(SyntaxConstants.CONTINUATION_CHARACTER)) { // see 45893
        String command = null;
        do {
          int index = line.indexOf(SyntaxConstants.COMMAND_DELIMITER);
          if (index != -1) {
            command = line.substring(0, index+1);
          } else {
            command = line;
          }
          String trimmedCommand = command.trim();
          if (trimmedCommand.equals(SyntaxConstants.COMMAND_DELIMITER)) {
            // do nothing // see 46098 - skip if line contains only a ';'
          } else if (!trimmedCommand.isEmpty()) {
            executeCommand(command);
          }
          line = line.substring(index + 1);
        } while (ParserUtils.contains(line, SyntaxConstants.COMMAND_DELIMITER));
        prompt = getPromptText();
      } else {
        prompt = getDefaultSecondaryPrompt();
        reader.getCursorBuffer().cursor = 0;
        reader.getCursorBuffer().write(removeBackslash(line) + LINE_SEPARATOR);
      }
    }
    if (line == null) {
      // Possibly Ctrl-D was pressed on empty prompt. ConsoleReader.readLine
      // returns null on Ctrl-D
      this.exitShellRequest = ExitShellRequest.NORMAL_EXIT;
      gfshFileLogger.info("Exiting gfsh, it seems Ctrl-D was pressed.");
    }
  } catch (IOException e) {
    logSevere(e.getMessage(), e);
  }
  println((line == null ? LINE_SEPARATOR : "") + "Exiting... ");
  setShellStatus(Status.SHUTTING_DOWN);
}
 
Example #10
Source File: TestableGfsh.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Following code is copied from JLineShell of spring shell
 * to manipulate consoleReader.
 * JLineShell adds its own completorAdaptor.
 *
 * Another addition is using of ThreadLocal for storing Gfsh
 * instead of static singleton instance
 *
 */
@Override
public void run() {


  gfshThreadLocal.set(this);
  Util.debug("Setting threadLocal " + gfshThreadLocal.get());

  reader = createConsoleReader();

  setPromptPath(null);

  JLineLogHandler handler = new JLineLogHandler(reader, this);
  JLineLogHandler.prohibitRedraw(); // Affects this thread only
  Logger mainLogger = Logger.getLogger("");
  myremoveHandlers(mainLogger);
  mainLogger.addHandler(handler);

  //reader.addCompletor(new JLineCompletorAdapter(getParser()));
  reader.addCompletor(completorAdaptor);

  reader.setBellEnabled(true);
  if (Boolean.getBoolean("jline.nobell")) {
    reader.setBellEnabled(false);
  }

  // reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true)));

  /*-
  openFileLogIfPossible();
  this.reader.getHistory().setMaxSize(getHistorySize());
  // Try to build previous command history from the project's log
  String[] filteredLogEntries = filterLogEntry();
  for (String logEntry : filteredLogEntries) {
    reader.getHistory().addToHistory(logEntry);
  }*/

  //flashMessageRenderer();
  flash(Level.FINE, this.getProductName() + " " + this.getVersion(), Shell.WINDOW_TITLE_SLOT);
  printBannerAndWelcome();

  String startupNotifications = getStartupNotifications();
  if (StringUtils.hasText(startupNotifications)) {
    logger.info(startupNotifications);
  }

  setShellStatus(Status.STARTED);
  /*-
  // Monitor CTRL+C initiated shutdowns (ROO-1599)
  Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
    public void run() {
      shutdownHookFired = true;
      // We don't need to closeShell(), as the shutdown hook in o.s.r.bootstrap.Main calls stop() which calls JLineShellComponent.deactivate() and that calls closeShell()
    }
  }, getProductName() + " JLine Shutdown Hook")); */

  // Handle any "execute-then-quit" operation

  String rooArgs = System.getProperty("roo.args");
  if (rooArgs != null && !"".equals(rooArgs)) {
    setShellStatus(Status.USER_INPUT);
    boolean success = executeCommand(rooArgs);
    if (exitShellRequest == null) {
      // The command itself did not specify an exit shell code, so we'll fall back to something sensible here
      executeCommand("quit"); // ROO-839
      exitShellRequest = success ? ExitShellRequest.NORMAL_EXIT : ExitShellRequest.FATAL_EXIT;
    }
    setShellStatus(Status.SHUTTING_DOWN);
  }
  else {
    // Normal RPEL processing
    promptLoop();
  }
  Util.debug("Exiting the shell");
}
 
Example #11
Source File: ShellCommandLineRunner.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
private ExitShellRequest doRun() {
	this.stopWatch.start();
	try {

		String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
		ExitShellRequest exitShellRequest;
		if (null != commandsToExecuteAndThenQuit) {

			boolean successful = false;
			exitShellRequest = ExitShellRequest.FATAL_EXIT;

			for (String cmd : commandsToExecuteAndThenQuit) {
				if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
					break;
			}

			if (successful) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
		}
		else if (this.applicationArguments.containsOption("help")) {
			System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
			exitShellRequest = ExitShellRequest.NORMAL_EXIT;
		}
		else {
			this.lineShellComponent.start();
			this.lineShellComponent.promptLoop();
			exitShellRequest = this.lineShellComponent.getExitShellRequest();
			if (exitShellRequest == null) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
			this.lineShellComponent.waitForComplete();
		}

		if (this.lineShellComponent.isDevelopmentMode()) {
			System.out.println("Total execution time: " + this.stopWatch.getLastTaskTimeMillis() + " ms");
		}

		return exitShellRequest;
	}
	catch (Exception ex) {
		throw new ShellException(ex.getMessage(), ex);
	}
	finally {
		HandlerUtils.flushAllHandlers(this.logger);
		this.stopWatch.stop();
	}
}
 
Example #12
Source File: ShellCommandLineRunner.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
public ShellExitCodeGenerator(ExitShellRequest exitShellRequest) {
	this.exitShellRequest = exitShellRequest;
}
 
Example #13
Source File: Launcher.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private int parseCommandLineCommand(final String... args) {
  Gfsh gfsh = null;
  try {
    gfsh = Gfsh.getInstance(false, args, new GfshConfig());
    this.startupTimeLogHelper.logStartupTime();
  } catch (ClassNotFoundException cnfex) {
    log(cnfex, gfsh);
  } catch (IOException ioex) {
    log(ioex, gfsh);
  } catch (IllegalStateException isex) {
    System.err.println("ERROR : " + isex.getMessage());
  }

  ExitShellRequest exitRequest = ExitShellRequest.NORMAL_EXIT;
  
  if (gfsh != null) {
    final String commandLineCommand = combineStrings(args);

    if (commandLineCommand.startsWith(HELP)) {
      if (commandLineCommand.equals(HELP)) {
        printUsage(gfsh, System.out);
      } else {
        // help is also available for commands which are not available under allowedCommandLineCommands
        gfsh.executeCommand(commandLineCommand);
      }
    } else {
      boolean commandIsAllowed = false;
      for (String allowedCommandLineCommand : this.allowedCommandLineCommands) {
        if (commandLineCommand.startsWith(allowedCommandLineCommand)) {
          commandIsAllowed = true;
          break;
        }
      }

      if (!commandIsAllowed) {
        System.err.println(CliStrings.format(MSG_INVALID_COMMAND_OR_OPTION, CliUtil.arrayToString(args)));
      } else {
        if (!gfsh.executeCommand(commandLineCommand) || gfsh.getLastExecutionStatus() != 0) {
          exitRequest = ExitShellRequest.FATAL_EXIT;
        }
      }
    }
  }
  
  return exitRequest.getExitCode();
}
 
Example #14
Source File: Launcher.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private int parseOptions(final String... args) {
  OptionSet parsedOptions;
  try {
    parsedOptions = this.commandLineParser.parse(args);
  } catch (OptionException e) {
    System.err.println(CliStrings.format(MSG_INVALID_COMMAND_OR_OPTION, CliUtil.arrayToString(args)));
    return ExitShellRequest.FATAL_EXIT.getExitCode();
  }
  boolean launchShell    = true;
  boolean onlyPrintUsage = parsedOptions.has(HELP_OPTION);
  if (parsedOptions.has(EXECUTE_OPTION) || onlyPrintUsage) {
    launchShell = false;
  }

  Gfsh gfsh = null;
  try {
    gfsh = Gfsh.getInstance(launchShell, args, new GfshConfig());
    this.startupTimeLogHelper.logStartupTime();
  } catch (ClassNotFoundException cnfex) {
    log(cnfex, gfsh);
  } catch (IOException ioex) {
    log(ioex, gfsh);
  } catch (IllegalStateException isex) {
    System.err.println("ERROR : " + isex.getMessage());
  }

  ExitShellRequest exitRequest = ExitShellRequest.NORMAL_EXIT;

  if (gfsh != null) {
    try {
      if (launchShell) {
        gfsh.start();
        gfsh.waitForComplete();
        exitRequest = gfsh.getExitShellRequest();
      } else if (onlyPrintUsage) {
        printUsage(gfsh, System.out);
      } else {
        @SuppressWarnings("unchecked")
        List<String> commandsToExecute = (List<String>) parsedOptions.valuesOf(EXECUTE_OPTION);

        // Execute all of the commands in the list, one at a time.
        for (int i = 0; i < commandsToExecute.size() && exitRequest == ExitShellRequest.NORMAL_EXIT; i++) {
          String command = commandsToExecute.get(i);
          System.out.println(GfshParser.LINE_SEPARATOR + "(" + (i + 1) + ") Executing - " + command
              + GfshParser.LINE_SEPARATOR);
          if (!gfsh.executeCommand(command) || gfsh.getLastExecutionStatus() != 0) {
            exitRequest = ExitShellRequest.FATAL_EXIT;
          }
        }
      }
    } catch (InterruptedException iex) {
      log(iex, gfsh);
    }
  }

  return exitRequest.getExitCode();
}
 
Example #15
Source File: Gfsh.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void promptLoop() {
  String line   = null;
  String prompt = getPromptText();
  try {
    gfshHistory.setAutoFlush(false);
    // NOTE: Similar code is in executeScript()
    while (exitShellRequest == null && (line = readLine(reader, prompt)) != null) {
      if (!line.endsWith(SyntaxConstants.CONTINUATION_CHARACTER)) { // see 45893
        String command = null;
        do {
          int index = line.indexOf(SyntaxConstants.COMMAND_DELIMITER);
          if (index != -1) {
            command = line.substring(0, index+1);
          } else {
            command = line;
          }
          String trimmedCommand = command.trim();
          if (trimmedCommand.equals(SyntaxConstants.COMMAND_DELIMITER)) {
            // do nothing // see 46098 - skip if line contains only a ';'
          } else if (!trimmedCommand.isEmpty()) {
            executeCommand(command);
          }
          line = line.substring(index + 1);
        } while (ParserUtils.contains(line, SyntaxConstants.COMMAND_DELIMITER));
        prompt = getPromptText();
      } else {
        prompt = getDefaultSecondaryPrompt();
        reader.getCursorBuffer().cursor = 0;
        reader.getCursorBuffer().write(removeBackslash(line) + LINE_SEPARATOR);
      }
    }
    if (line == null) {
      // Possibly Ctrl-D was pressed on empty prompt. ConsoleReader.readLine
      // returns null on Ctrl-D
      this.exitShellRequest = ExitShellRequest.NORMAL_EXIT;
      gfshFileLogger.info("Exiting gfsh, it seems Ctrl-D was pressed.");
    }
  } catch (IOException e) {
    logSevere(e.getMessage(), e);
  }
  println((line == null ? LINE_SEPARATOR : "") + "Exiting... ");
  setShellStatus(Status.SHUTTING_DOWN);
}
 
Example #16
Source File: TestableGfsh.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Following code is copied from JLineShell of spring shell
 * to manipulate consoleReader.
 * JLineShell adds its own completorAdaptor.
 *
 * Another addition is using of ThreadLocal for storing Gfsh
 * instead of static singleton instance
 *
 */
@Override
public void run() {


  gfshThreadLocal.set(this);
  Util.debug("Setting threadLocal " + gfshThreadLocal.get());

  reader = createConsoleReader();

  setPromptPath(null);

  JLineLogHandler handler = new JLineLogHandler(reader, this);
  JLineLogHandler.prohibitRedraw(); // Affects this thread only
  Logger mainLogger = Logger.getLogger("");
  myremoveHandlers(mainLogger);
  mainLogger.addHandler(handler);

  //reader.addCompletor(new JLineCompletorAdapter(getParser()));
  reader.addCompletor(completorAdaptor);

  reader.setBellEnabled(true);
  if (Boolean.getBoolean("jline.nobell")) {
    reader.setBellEnabled(false);
  }

  // reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true)));

  /*-
  openFileLogIfPossible();
  this.reader.getHistory().setMaxSize(getHistorySize());
  // Try to build previous command history from the project's log
  String[] filteredLogEntries = filterLogEntry();
  for (String logEntry : filteredLogEntries) {
    reader.getHistory().addToHistory(logEntry);
  }*/

  //flashMessageRenderer();
  flash(Level.FINE, this.getProductName() + " " + this.getVersion(), Shell.WINDOW_TITLE_SLOT);
  printBannerAndWelcome();

  String startupNotifications = getStartupNotifications();
  if (StringUtils.hasText(startupNotifications)) {
    logger.info(startupNotifications);
  }

  setShellStatus(Status.STARTED);
  /*-
  // Monitor CTRL+C initiated shutdowns (ROO-1599)
  Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
    public void run() {
      shutdownHookFired = true;
      // We don't need to closeShell(), as the shutdown hook in o.s.r.bootstrap.Main calls stop() which calls JLineShellComponent.deactivate() and that calls closeShell()
    }
  }, getProductName() + " JLine Shutdown Hook")); */

  // Handle any "execute-then-quit" operation

  String rooArgs = System.getProperty("roo.args");
  if (rooArgs != null && !"".equals(rooArgs)) {
    setShellStatus(Status.USER_INPUT);
    boolean success = executeCommand(rooArgs);
    if (exitShellRequest == null) {
      // The command itself did not specify an exit shell code, so we'll fall back to something sensible here
      executeCommand("quit"); // ROO-839
      exitShellRequest = success ? ExitShellRequest.NORMAL_EXIT : ExitShellRequest.FATAL_EXIT;
    }
    setShellStatus(Status.SHUTTING_DOWN);
  }
  else {
    // Normal RPEL processing
    promptLoop();
  }
  Util.debug("Exiting the shell");
}