Exemplo n.º 1
0
 @Override
 public void updatePrompt() {
   if (app.isConnected()) {
     String path = app.getContext().getPath().getLastSegment();
     if (path == null) {
       path = "/";
     }
     console.setPrompt("|" + app.getUsername() + "@" + app.getHost() + ":" + path + "> ");
   } else {
     console.setPrompt("|> ");
   }
 }
Exemplo n.º 2
0
 @Override
 public String promptPassword() throws IOException {
   String prompt = this.console.getPrompt();
   String password = console.readLine("Password: ", new Character('\0'));
   console.setPrompt(prompt);
   return password;
 }
Exemplo n.º 3
0
  public CHIA(Writer out) throws IOException {
    Preconditions.checkNotNull(out);
    this.out = out;

    this.automataConsole = new CHIAAutomataConsole();
    this.console = new ConsoleReader();
    this.console.setExpandEvents(false);

    console.setPrompt("CHIA> ");
    usage();

    if (ClassLoader.getSystemResource("History.txt") != null) {
      console.setHistory(
          new FileHistory(new File(ClassLoader.getSystemResource("History.txt").getPath())));
    } else {
      out.write("The History file cannot be loaded" + "\n");
    }
    out.write("CHIA Started\n");
    out.flush();
    if (ClassLoader.getSystemResource("log4j.properties") != null) {

      PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties"));
    } else {
      out.write("The logging file cannot be loaded" + "\n");
    }
    out.flush();
  }