コード例 #1
0
 private ShellExecutionThread(String username, String password, String mock) throws IOException {
   this.done = false;
   this.cmd = null;
   this.cmdIndex = 0;
   this.readWait = false;
   this.output = new StringBuilderOutputStream();
   ConsoleReader reader = new ConsoleReader(this, new OutputStreamWriter(output));
   this.shell = new Shell(reader, new PrintWriter(output));
   shell.setLogErrorsToConsole();
   if (mock != null) {
     if (shell.config("--fake", "-u", username, "-p", password))
       throw new IOException("mock shell config error");
   } else if (shell.config("-u", username, "-p", password)) {
     throw new IOException("shell config error");
   }
 }
コード例 #2
0
 @Override
 public synchronized void run() {
   Thread.currentThread().setName("shell thread");
   while (!shell.hasExited()) {
     while (cmd == null) {
       try {
         this.wait();
       } catch (InterruptedException e) {
       }
     }
     String tcmd = cmd;
     cmd = null;
     cmdIndex = 0;
     try {
       shell.execCommand(tcmd, false, true);
     } catch (IOException e) {
     }
     this.notifyAll();
   }
   done = true;
   this.notifyAll();
 }
コード例 #3
0
  public static void main(String[] args) throws IOException {
    Logger.getRootLogger().setLevel(Level.WARN);

    final String instanceName =
        (System.getProperty("instanceName") != null)
            ? System.getProperty("instanceName")
            : "geowave";
    final String password =
        (System.getProperty("password") != null) ? System.getProperty("password") : "password";

    String[] shellArgs =
        new String[] {"-u", "root", "-p", password, "-z", instanceName, "localhost:2181"};
    Shell.main(shellArgs);
  }
コード例 #4
0
 public boolean isMasking() {
   return shell.isMasking();
 }
コード例 #5
0
 public void printInfo() throws IOException {
   shell.printInfo();
 }
コード例 #6
0
 public String getPrompt() {
   return shell.getDefaultPrompt();
 }