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"); } }
@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(); }
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); }
public boolean isMasking() { return shell.isMasking(); }
public void printInfo() throws IOException { shell.printInfo(); }
public String getPrompt() { return shell.getDefaultPrompt(); }