accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1488407 - in /accumulo/trunk: ./ core/src/main/java/org/apache/accumulo/core/client/mock/ core/src/main/java/org/apache/accumulo/core/util/ core/src/main/java/org/apache/accumulo/core/util/format/ core/src/main/java/org/apache/accumulo/cor...
Date Fri, 31 May 2013 21:54:22 GMT
Author: billie
Date: Fri May 31 21:54:21 2013
New Revision: 1488407

URL: http://svn.apache.org/r1488407
Log:
ACCUMULO-1442 committed Mike Drob's patch to upgrade to jline 2

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/format/DeleterFormatter.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/ShellCompletor.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClasspathCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClearCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetGroupsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HiddenCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HistoryCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListShellIterCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java
    accumulo/trunk/pom.xml
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java Fri May 31 21:54:21 2013
@@ -20,9 +20,9 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Writer;
+import java.io.OutputStream;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.util.shell.Shell;
 import org.apache.commons.cli.CommandLine;
@@ -34,12 +34,12 @@ public class MockShell extends Shell {
   private static final String NEWLINE = "\n";
   
   protected InputStream in;
-  protected Writer writer;
+  protected OutputStream out;
   
-  public MockShell(InputStream in, Writer writer) throws IOException {
+  public MockShell(InputStream in, OutputStream out) throws IOException {
     super();
     this.in = in;
-    this.writer = writer;
+    this.out = out;
   }
   
   public boolean config(String... args) {
@@ -47,15 +47,15 @@ public class MockShell extends Shell {
     
     // Update the ConsoleReader with the input and output "redirected"
     try {
-      this.reader = new ConsoleReader(in, writer);
+      this.reader = new ConsoleReader(in, out);
     } catch (Exception e) {
       printException(e);
       configError = true;
     }
     
     // Don't need this for testing purposes
-    this.reader.setUseHistory(false);
-    this.reader.setUsePagination(false);
+    this.reader.setHistoryEnabled(false);
+    this.reader.setPaginationEnabled(false);
     
     // Make the parsing from the client easier;
     this.verbose = false;
@@ -96,10 +96,10 @@ public class MockShell extends Shell {
       if (hasExited())
         return exitCode;
       
-      reader.setDefaultPrompt(getDefaultPrompt());
+      reader.setPrompt(getDefaultPrompt());
       input = reader.readLine();
       if (input == null) {
-        reader.printNewline();
+        reader.println();
         return exitCode;
       } // user canceled
       
@@ -116,11 +116,11 @@ public class MockShell extends Shell {
   }
   
   /**
-   * @param writer
-   *          the writer to set
+   * @param out
+   *          the output stream to set
    */
-  public void setConsoleWriter(Writer writer) {
-    this.writer = writer;
+  public void setConsoleWriter(OutputStream out) {
+    this.out = out;
   }
   
   /**

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/CreateToken.java Fri May 31 21:54:21 2013
@@ -21,7 +21,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.ClientOpts.Password;

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/format/DeleterFormatter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/format/DeleterFormatter.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/format/DeleterFormatter.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/format/DeleterFormatter.java Fri May 31 21:54:21 2013
@@ -72,7 +72,7 @@ public class DeleterFormatter extends De
     boolean delete = force;
     try {
       if (!force) {
-        shellState.getReader().flushConsole();
+        shellState.getReader().flush();
         String line = shellState.getReader().readLine("Delete { " + entryStr + " } ? ");
         more = line != null;
         delete = line != null && (line.equalsIgnoreCase("y") || line.equalsIgnoreCase("yes"));
@@ -88,7 +88,7 @@ public class DeleterFormatter extends De
               log.trace(cvs.toString());
         }
       }
-      shellState.getReader().printString(String.format("[%s] %s%n", delete ? "DELETED" : "SKIPPED", entryStr));
+      shellState.getReader().print(String.format("[%s] %s%n", delete ? "DELETED" : "SKIPPED", entryStr));
     } catch (IOException e) {
       log.error("Cannot write to console", e);
       throw new RuntimeException(e);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Fri May 31 21:54:21 2013
@@ -34,8 +34,9 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.UUID;
 
-import jline.ConsoleReader;
-import jline.History;
+import jline.console.ConsoleReader;
+import jline.console.history.FileHistory;
+import jline.console.history.History;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -294,7 +295,7 @@ public class Shell extends ShellOptions 
       Runtime.getRuntime().addShutdownHook(new Thread() {
         @Override
         public void start() {
-          reader.getTerminal().enableEcho();
+          reader.getTerminal().setEchoEnabled(true);
         }
       });
       
@@ -309,7 +310,7 @@ public class Shell extends ShellOptions 
       }
       
       if (this.token == null) {
-        reader.printNewline();
+        reader.println();
         throw new MissingArgumentException("No password or token option supplied");
       } // user canceled
       
@@ -437,13 +438,26 @@ public class Shell extends ShellOptions 
     if (!accumuloDir.exists() && !accumuloDir.mkdirs())
       log.warn("Unable to make directory for history at " + accumuloDir);
     try {
-      History history = new History();
-      history.setHistoryFile(new File(historyPath));
+      final FileHistory history = new FileHistory(new File(historyPath));
       reader.setHistory(history);
+      // Add shutdown hook to flush file history, per jline javadocs
+      Runtime.getRuntime().addShutdownHook(new Thread() {
+        @Override
+        public void run() {
+          try {
+            history.flush();
+          } catch (IOException e) {
+            log.warn("Could not flush history to file.");
+          }
+        }
+      });
     } catch (IOException e) {
       log.warn("Unable to load history file at " + historyPath);
     }
     
+    // This would be a nice feature but !METADATA screws it up
+    reader.setExpandEvents(false);
+    
     ShellCompletor userCompletor = null;
     
     if (execFile != null) {
@@ -469,16 +483,16 @@ public class Shell extends ShellOptions 
       // If tab completion is true we need to reset
       if (tabCompletion) {
         if (userCompletor != null)
-          reader.removeCompletor(userCompletor);
+          reader.removeCompleter(userCompletor);
         
         userCompletor = setupCompletion();
-        reader.addCompletor(userCompletor);
+        reader.addCompleter(userCompletor);
       }
       
-      reader.setDefaultPrompt(getDefaultPrompt());
+      reader.setPrompt(getDefaultPrompt());
       input = reader.readLine();
       if (input == null) {
-        reader.printNewline();
+        reader.println();
         return exitCode;
       } // user canceled
       
@@ -487,10 +501,10 @@ public class Shell extends ShellOptions 
   }
   
   public void printInfo() throws IOException {
-    reader.printString("\n" + SHELL_DESCRIPTION + "\n" + "- \n" + "- version: " + Constants.VERSION + "\n" + "- instance name: "
+    reader.print("\n" + SHELL_DESCRIPTION + "\n" + "- \n" + "- version: " + Constants.VERSION + "\n" + "- instance name: "
         + connector.getInstance().getInstanceName() + "\n" + "- instance id: " + connector.getInstance().getInstanceID() + "\n" + "- \n"
         + "- type 'help' for a list of available commands\n" + "- \n");
-    reader.flushConsole();
+    reader.flush();
   }
   
   public void printVerboseInfo() throws IOException {
@@ -517,7 +531,7 @@ public class Shell extends ShellOptions 
       }
     }
     sb.append("-\n");
-    reader.printString(sb.toString());
+    reader.print(sb.toString());
   }
   
   public String getDefaultPrompt() {
@@ -527,9 +541,8 @@ public class Shell extends ShellOptions 
   public void execCommand(String input, boolean ignoreAuthTimeout, boolean echoPrompt) throws IOException {
     audit.log(AuditLevel.AUDIT, getDefaultPrompt() + input);
     if (echoPrompt) {
-      reader.printString(getDefaultPrompt());
-      reader.printString(input);
-      reader.printNewline();
+      reader.print(getDefaultPrompt());
+      reader.println(input);
     }
     
     if (input.startsWith(COMMENT_PREFIX)) {
@@ -556,18 +569,18 @@ public class Shell extends ShellOptions 
         // Obtain the command from the command table
         sc = commandFactory.get(command);
         if (sc == null) {
-          reader.printString(String.format("Unknown command \"%s\".  Enter \"help\" for a list possible commands.\n", command));
-          reader.flushConsole();
+          reader.println(String.format("Unknown command \"%s\".  Enter \"help\" for a list possible commands.", command));
+          reader.flush();
           return;
         }
         
         if (!(sc instanceof ExitCommand) && !ignoreAuthTimeout && System.currentTimeMillis() - lastUserActivity > authTimeout) {
-          reader.printString("Shell has been idle for too long. Please re-authenticate.\n");
+          reader.println("Shell has been idle for too long. Please re-authenticate.");
           boolean authFailed = true;
           do {
             String pwd = readMaskedLine("Enter current password for '" + connector.whoami() + "': ", '*');
             if (pwd == null) {
-              reader.printNewline();
+              reader.println();
               return;
             } // user canceled
             
@@ -579,7 +592,7 @@ public class Shell extends ShellOptions 
             }
             
             if (authFailed)
-              reader.printString("Invalid password. ");
+              reader.print("Invalid password. ");
           } while (authFailed);
           lastUserActivity = System.currentTimeMillis();
         }
@@ -606,7 +619,7 @@ public class Shell extends ShellOptions 
         } else {
           int tmpCode = sc.execute(input, cl, this);
           exitCode += tmpCode;
-          reader.flushConsole();
+          reader.flush();
         }
         
       } catch (ConstraintViolationException e) {
@@ -634,7 +647,7 @@ public class Shell extends ShellOptions 
       ++exitCode;
       printException(new BadArgumentException("Unrecognized empty command", command, -1));
     }
-    reader.flushConsole();
+    reader.flush();
   }
   
   /**
@@ -805,7 +818,7 @@ public class Shell extends ShellOptions 
     @Override
     public void print(String s) {
       try {
-        reader.printString(s + "\n");
+        reader.println(s);
       } catch (Exception ex) {
         throw new RuntimeException(ex);
       }
@@ -841,8 +854,8 @@ public class Shell extends ShellOptions 
     int linesPrinted = 0;
     String prompt = "-- hit any key to continue or 'q' to quit --";
     int lastPromptLength = prompt.length();
-    int termWidth = reader.getTermwidth();
-    int maxLines = reader.getTermheight();
+    int termWidth = reader.getTerminal().getWidth();
+    int maxLines = reader.getTerminal().getHeight();
     
     String peek = null;
     while (lines.hasNext()) {
@@ -852,8 +865,7 @@ public class Shell extends ShellOptions 
       for (String line : nextLine.split("\\n")) {
         if (out == null) {
           if (peek != null) {
-            reader.printString(peek);
-            reader.printNewline();
+            reader.println(peek);
             if (paginate) {
               linesPrinted += peek.length() == 0 ? 0 : Math.ceil(peek.length() * 1.0 / termWidth);
               
@@ -865,15 +877,16 @@ public class Shell extends ShellOptions 
                 int numdashes = (termWidth - prompt.length()) / 2;
                 String nextPrompt = repeat("-", numdashes) + prompt + repeat("-", numdashes);
                 lastPromptLength = nextPrompt.length();
-                reader.printString(nextPrompt);
-                reader.flushConsole();
-                if (Character.toUpperCase((char) reader.readVirtualKey()) == 'Q') {
-                  reader.printNewline();
+                reader.print(nextPrompt);
+                reader.flush();
+                
+                if (Character.toUpperCase((char) reader.readCharacter()) == 'Q') {
+                  reader.println();
                   return;
                 }
-                reader.printNewline();
-                termWidth = reader.getTermwidth();
-                maxLines = reader.getTermheight();
+                reader.println();
+                termWidth = reader.getTerminal().getWidth();
+                maxLines = reader.getTerminal().getHeight();
               }
             }
           }
@@ -884,8 +897,7 @@ public class Shell extends ShellOptions 
       }
     }
     if (out == null && peek != null) {
-      reader.printString(peek);
-      reader.printNewline();
+      reader.println(peek);
     }
   }
   
@@ -923,7 +935,7 @@ public class Shell extends ShellOptions 
   private final void printConstraintViolationException(ConstraintViolationException cve) {
     printException(cve, "");
     int COL1 = 50, COL2 = 14;
-    int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTermwidth() - COL1 - COL2 - 6));
+    int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTerminal().getWidth() - COL1 - COL2 - 6));
     logError(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%" + col3 + "s%n", repeat("-", COL1), repeat("-", COL2), repeat("-", col3)));
     logError(String.format("%-" + COL1 + "s | %" + COL2 + "s | %-" + col3 + "s%n", "Constraint class", "Violation code", "Violation Description"));
     logError(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%" + col3 + "s%n", repeat("-", COL1), repeat("-", COL2), repeat("-", col3)));
@@ -1044,8 +1056,8 @@ public class Shell extends ShellOptions 
     log.error(s);
     if (logErrorsToConsole) {
       try {
-        reader.printString("ERROR: " + s + "\n");
-        reader.flushConsole();
+        reader.println("ERROR: " + s);
+        reader.flush();
       } catch (IOException e) {}
     }
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/ShellCompletor.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/ShellCompletor.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/ShellCompletor.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/ShellCompletor.java Fri May 31 21:54:21 2013
@@ -22,12 +22,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import jline.Completor;
+import jline.console.completer.Completer;
 
 import org.apache.accumulo.core.util.shell.Shell.Command.CompletionSet;
 import org.apache.accumulo.core.util.shell.commands.QuotedStringTokenizer;
 
-public class ShellCompletor implements Completor {
+public class ShellCompletor implements Completer {
   
   // private static final Logger log = Logger.getLogger(ShellCompletor.class);
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java Fri May 31 21:54:21 2013
@@ -34,12 +34,12 @@ public class AuthenticateCommand extends
     final String user = cl.getArgs()[0];
     final String p = shellState.readMaskedLine("Enter current password for '" + user + "': ", '*');
     if (p == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     final byte[] password = p.getBytes();
     final boolean valid = shellState.getConnector().securityOperations().authenticateUser(user, new PasswordToken(password));
-    shellState.getReader().printString((valid ? "V" : "Not v") + "alid\n");
+    shellState.getReader().println((valid ? "V" : "Not v") + "alid");
     return 0;
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClasspathCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClasspathCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClasspathCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClasspathCommand.java Fri May 31 21:54:21 2013
@@ -18,7 +18,7 @@ package org.apache.accumulo.core.util.sh
 
 import java.io.IOException;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.util.shell.Shell;
 import org.apache.accumulo.core.util.shell.Shell.Command;
@@ -34,7 +34,7 @@ public class ClasspathCommand extends Co
       @Override
       public void print(String s) {
         try {
-          reader.printString(s + "\n");
+          reader.println(s);
         } catch (IOException ex) {
           throw new RuntimeException(ex);
         }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClearCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClearCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClearCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ClearCommand.java Fri May 31 21:54:21 2013
@@ -31,16 +31,16 @@ public class ClearCommand extends Comman
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
     // custom clear screen, so I don't have to redraw the prompt twice
-    if (!shellState.getReader().getTerminal().isANSISupported()) {
+    if (!shellState.getReader().getTerminal().isAnsiSupported()) {
       throw new IOException("Terminal does not support ANSI commands");
     }
     // send the ANSI code to clear the screen
-    shellState.getReader().printString(((char) 27) + "[2J");
-    shellState.getReader().flushConsole();
+    shellState.getReader().print(((char) 27) + "[2J");
+    shellState.getReader().flush();
     
     // then send the ANSI code to go to position 1,1
-    shellState.getReader().printString(((char) 27) + "[1;1H");
-    shellState.getReader().flushConsole();
+    shellState.getReader().print(((char) 27) + "[1;1H");
+    shellState.getReader().flush();
     
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java Fri May 31 21:54:21 2013
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -218,7 +218,7 @@ public class ConfigCommand extends Comma
   }
   
   private void printConfFooter(List<String> output) {
-    int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTermwidth() - COL1 - COL2 - 6));
+    int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTerminal().getWidth() - COL1 - COL2 - 6));
     output.add(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%-" + col3 + "s", Shell.repeat("-", COL1), Shell.repeat("-", COL2), Shell.repeat("-", col3)));
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java Fri May 31 21:54:21 2013
@@ -40,19 +40,19 @@ public class ConstraintCommand extends C
                 + Constraint.class.getName());
           }
           i = shellState.getConnector().tableOperations().addConstraint(tableName, constraint);
-          shellState.getReader().printString("Added constraint " + constraint + " to table " + tableName + " with number " + i + "\n");
+          shellState.getReader().println("Added constraint " + constraint + " to table " + tableName + " with number " + i);
         }
         break;
       case DELETE:
         for (String constraint : cl.getArgs()) {
           i = Integer.parseInt(constraint);
           shellState.getConnector().tableOperations().removeConstraint(tableName, i);
-          shellState.getReader().printString("Removed constraint " + i + " from table " + tableName + "\n");
+          shellState.getReader().println("Removed constraint " + i + " from table " + tableName);
         }
         break;
       case LIST:
         for (Entry<String,Integer> property : shellState.getConnector().tableOperations().listConstraints(tableName).entrySet()) {
-          shellState.getReader().printString(property.toString() + "\n");
+          shellState.getReader().println(property.toString());
         }
     }
     

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java Fri May 31 21:54:21 2013
@@ -59,7 +59,7 @@ public class CreateTableCommand extends 
     final String testTableName = cl.getArgs()[0];
     
     if (!testTableName.matches(Constants.VALID_TABLE_NAME_REGEX)) {
-      shellState.getReader().printString("Only letters, numbers and underscores are allowed for use in table names. \n");
+      shellState.getReader().println("Only letters, numbers and underscores are allowed for use in table names.");
       throw new IllegalArgumentException();
     }
     

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java Fri May 31 21:54:21 2013
@@ -36,12 +36,12 @@ public class CreateUserCommand extends C
     
     final String password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
     if (password == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     String passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
     if (passwordConfirm == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java Fri May 31 21:54:21 2013
@@ -60,7 +60,7 @@ public class DUCommand extends Command {
         @Override
         public void print(String line) {
           try {
-            shellState.getReader().printString(line + "\n");
+            shellState.getReader().println(line);
           } catch (IOException ex) {
             throw new RuntimeException(ex);
           }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java Fri May 31 21:54:21 2013
@@ -38,7 +38,7 @@ public class DebugCommand extends Comman
         throw new BadArgumentException("Argument must be 'on' or 'off'", fullCommand, fullCommand.indexOf(cl.getArgs()[0]));
       }
     } else if (cl.getArgs().length == 0) {
-      shellState.getReader().printString(Shell.isDebuggingEnabled() ? "on\n" : "off\n");
+      shellState.getReader().println(Shell.isDebuggingEnabled() ? "on" : "off");
     } else {
       shellState.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
       printHelp(shellState);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java Fri May 31 21:54:21 2013
@@ -32,7 +32,7 @@ public class DeleteRowsCommand extends C
     final Text startRow = OptUtil.getStartRow(cl);
     final Text endRow = OptUtil.getEndRow(cl);
     if (!cl.hasOption(forceOpt.getOpt()) && (startRow == null || endRow == null)) {
-      shellState.getReader().printString("Not deleting unbounded range. Specify both ends, or use --force\n");
+      shellState.getReader().println("Not deleting unbounded range. Specify both ends, or use --force");
       return 1;
     }
     shellState.getConnector().tableOperations().deleteRows(tableName, startRow, endRow);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java Fri May 31 21:54:21 2013
@@ -41,7 +41,7 @@ public class DeleteTableCommand extends 
   @Override
   protected void doTableOp(final Shell shellState, final String tableName) throws Exception {
     shellState.getConnector().tableOperations().delete(tableName);
-    shellState.getReader().printString("Table: [" + tableName + "] has been deleted. \n");
+    shellState.getReader().println("Table: [" + tableName + "] has been deleted.");
     if (shellState.getTableName().equals(tableName)) {
       shellState.setTableName("");
     }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java Fri May 31 21:54:21 2013
@@ -42,7 +42,7 @@ public class GetAuthsCommand extends Com
     for (byte[] auth : auths) {
       set.add(new String(auth));
     }
-    shellState.getReader().printString(StringUtils.join(set, ',') + "\n");
+    shellState.getReader().println(StringUtils.join(set, ','));
     return 0;
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetGroupsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetGroupsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetGroupsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetGroupsCommand.java Fri May 31 21:54:21 2013
@@ -36,7 +36,7 @@ public class GetGroupsCommand extends Co
     final Map<String,Set<Text>> groups = shellState.getConnector().tableOperations().getLocalityGroups(tableName);
     
     for (Entry<String,Set<Text>> entry : groups.entrySet()) {
-      shellState.getReader().printString(entry.getKey() + "=" + LocalityGroupUtil.encodeColumnFamilies(entry.getValue()) + "\n");
+      shellState.getReader().println(entry.getKey() + "=" + LocalityGroupUtil.encodeColumnFamilies(entry.getValue()));
     }
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java Fri May 31 21:54:21 2013
@@ -35,7 +35,7 @@ public class HelpCommand extends Command
   private Option noWrapOpt;
   
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws ShellCommandException, IOException {
-    int numColumns = shellState.getReader().getTermwidth();
+    int numColumns = shellState.getReader().getTerminal().getWidth();
     if (cl.hasOption(noWrapOpt.getOpt())) {
       numColumns = Integer.MAX_VALUE;
     }
@@ -91,7 +91,7 @@ public class HelpCommand extends Command
     for (String cmd : cl.getArgs()) {
       final Command c = shellState.commandFactory.get(cmd);
       if (c == null) {
-        shellState.getReader().printString(String.format("Unknown command \"%s\".  Enter \"help\" for a list possible commands.\n", cmd));
+        shellState.getReader().println(String.format("Unknown command \"%s\".  Enter \"help\" for a list possible commands.", cmd));
       } else {
         c.printHelp(shellState, numColumns);
       }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HiddenCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HiddenCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HiddenCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HiddenCommand.java Fri May 31 21:54:21 2013
@@ -38,12 +38,11 @@ public class HiddenCommand extends Comma
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
     if (rand.nextInt(10) == 0) {
       shellState.getReader().beep();
-      shellState.getReader().printNewline();
-      shellState.getReader().printString(
+      shellState.getReader().println();
+      shellState.getReader().println(
           new String(Base64.decodeBase64(("ICAgICAgIC4tLS4KICAgICAgLyAvXCBcCiAgICAgKCAvLS1cICkKICAgICAuPl8gIF88LgogICAgLyB8ICd8ICcgXAog"
               + "ICAvICB8Xy58Xy4gIFwKICAvIC98ICAgICAgfFwgXAogfCB8IHwgfFwvfCB8IHwgfAogfF98IHwgfCAgfCB8IHxffAogICAgIC8gIF9fICBcCiAgICAvICAv"
               + "ICBcICBcCiAgIC8gIC8gICAgXCAgXF8KIHwvICAvICAgICAgXCB8IHwKIHxfXy8gICAgICAgIFx8X3wK").getBytes())));
-      shellState.getReader().printNewline();
     } else {
       throw new ShellCommandException(ErrorCode.UNRECOGNIZED_COMMAND, getName());
     }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HistoryCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HistoryCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HistoryCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HistoryCommand.java Fri May 31 21:54:21 2013
@@ -16,10 +16,13 @@
  */
 package org.apache.accumulo.core.util.shell.commands;
 
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.ListIterator;
+
+import jline.console.history.History.Entry;
+import jline.console.history.History;
+import jline.console.history.PersistentHistory;
 
 import org.apache.accumulo.core.util.shell.Shell;
 import org.apache.accumulo.core.util.shell.Shell.Command;
@@ -27,8 +30,6 @@ import org.apache.commons.cli.CommandLin
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.LineIterator;
 
 public class HistoryCommand extends Command {
   private Option clearHist;
@@ -37,39 +38,27 @@ public class HistoryCommand extends Comm
   @SuppressWarnings("unchecked")
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
-    String home = System.getProperty("HOME");
-    if (home == null)
-      home = System.getenv("HOME");
-    final String historyPath = home + "/" + Shell.HISTORY_DIR_NAME + "/" + Shell.HISTORY_FILE_NAME;
-    
     if (cl.hasOption(clearHist.getOpt())) {
-      final FileOutputStream out = new FileOutputStream(historyPath);
-      out.close();
+      shellState.getReader().getHistory().clear();
     } else {
-      final LineIterator it = FileUtils.lineIterator(new File(historyPath));
-      try {
-        shellState.printLines(new HistoryLineIterator(it), !cl.hasOption(disablePaginationOpt.getOpt()));
-      } finally {
-        it.close();
-      }
+      ListIterator<Entry> it = shellState.getReader().getHistory().entries();
+      shellState.printLines(new HistoryLineIterator(it), !cl.hasOption(disablePaginationOpt.getOpt()));
     }
     
     return 0;
   }
   
   /**
-   * Decorator that prepends a running counter to an Iterator<String>.
+   * Decorator that converts an Iterator<History.Entry> to an Iterator<String>.
    */
   private static class HistoryLineIterator extends AbstractIteratorDecorator {
-    int counter = 0;
-    
-    public HistoryLineIterator(Iterator<String> iterator) {
+    public HistoryLineIterator(Iterator<Entry> iterator) {
       super(iterator);
     }
     
     @Override
-    public Object next() {
-      return counter++ + " " + super.next();
+    public String next() {
+      return super.next().toString();
     }
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java Fri May 31 21:54:21 2013
@@ -72,8 +72,8 @@ public class ListIterCommand extends Com
         }
       }
     }
-    sb.append("-\n");
-    shellState.getReader().printString(sb.toString());
+    sb.append("-");
+    shellState.getReader().println(sb.toString());
     
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListShellIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListShellIterCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListShellIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListShellIterCommand.java Fri May 31 21:54:21 2013
@@ -73,7 +73,7 @@ public class ListShellIterCommand extend
       sb.append("-\n");
     }
 
-    shellState.getReader().printString(sb.toString());
+    shellState.getReader().print(sb.toString());
 
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java Fri May 31 21:54:21 2013
@@ -39,7 +39,7 @@ public class MaxRowCommand extends ScanC
       final Text max = shellState.getConnector().tableOperations()
           .getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive());
       if (max != null) {
-        shellState.getReader().printString(max.toString() + "\n");
+        shellState.getReader().println(max.toString());
       }
     } catch (Exception e) {
       e.printStackTrace();

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java Fri May 31 21:54:21 2013
@@ -52,7 +52,7 @@ public class MergeCommand extends Comman
       size = AccumuloConfiguration.getMemoryInBytes(cl.getOptionValue(sizeOpt.getOpt()));
     }
     if (startRow == null && endRow == null && size < 0 && !all) {
-      shellState.getReader().flushConsole();
+      shellState.getReader().flush();
       String line = shellState.getReader().readLine("Merge the entire table { " + tableName + " } into one tablet (yes|no)? ");
       if (line == null)
         return 0;
@@ -67,8 +67,7 @@ public class MergeCommand extends Comman
         protected void message(String fmt, Object... args) {
           if (finalVerbose) {
             try {
-              shellState.getReader().printString(String.format(fmt, args));
-              shellState.getReader().printNewline();
+              shellState.getReader().println(String.format(fmt, args));
             } catch (IOException ex) {
               throw new RuntimeException(ex);
             }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java Fri May 31 21:54:21 2013
@@ -42,7 +42,7 @@ public class PasswdCommand extends Comma
     
     oldPassword = shellState.readMaskedLine("Enter current password for '" + currentUser + "': ", '*');
     if (oldPassword == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     
@@ -51,12 +51,12 @@ public class PasswdCommand extends Comma
     
     password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
     if (password == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
     if (passwordConfirm == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java Fri May 31 21:54:21 2013
@@ -95,9 +95,9 @@ public class ScanCommand extends Command
         BinaryFormatter.getlength(length);
         printBinaryRecords(cl, shellState, scanner, printFile);
       } catch (NumberFormatException nfe) {
-        shellState.getReader().printString("Arg must be an integer. \n");
+        shellState.getReader().println("Arg must be an integer.");
       } catch (IllegalArgumentException iae) {
-        shellState.getReader().printString("Arg must be greater than one. \n");
+        shellState.getReader().println("Arg must be greater than one.");
       }
       
     } else {
@@ -185,7 +185,7 @@ public class ScanCommand extends Command
         clazz = AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), ScanInterpreter.class);
       }
     } catch (ClassNotFoundException e) {
-      shellState.getReader().printString("Interpreter class could not be loaded.\n" + e.getMessage() + "\n");
+      shellState.getReader().println("Interpreter class could not be loaded.\n" + e.getMessage());
     }
 
     if (clazz == null)
@@ -207,7 +207,7 @@ public class ScanCommand extends Command
         return AccumuloVFSClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()), Formatter.class);
       }
     } catch (ClassNotFoundException e) {
-      shellState.getReader().printString("Formatter class could not be loaded.\n" + e.getMessage() + "\n");
+      shellState.getReader().println("Formatter class could not be loaded.\n" + e.getMessage());
     }
     
     return shellState.getFormatter(tableName);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Fri May 31 21:54:21 2013
@@ -23,7 +23,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -210,17 +210,16 @@ public class SetIterCommand extends Comm
       }
       localOptions.clear();
       
-      reader.printString(itopts.getDescription());
-      reader.printNewline();
+      reader.println(itopts.getDescription());
       
       String prompt;
       if (itopts.getNamedOptions() != null) {
         for (Entry<String,String> e : itopts.getNamedOptions().entrySet()) {
           prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " parameter " + e.getKey() + ", " + e.getValue() + ": ";
-          reader.flushConsole();
+          reader.flush();
           input = reader.readLine(prompt);
           if (input == null) {
-            reader.printNewline();
+            reader.println();
             throw new IOException("Input stream closed");
           } else {
             input = new String(input);
@@ -234,15 +233,15 @@ public class SetIterCommand extends Comm
       
       if (itopts.getUnnamedOptionDescriptions() != null) {
         for (String desc : itopts.getUnnamedOptionDescriptions()) {
-          reader.printString(Shell.repeat("-", 10) + "> entering options: " + desc + "\n");
+          reader.println(Shell.repeat("-", 10) + "> entering options: " + desc);
           input = "start";
           while (true) {
             prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): ";
             
-            reader.flushConsole();
+            reader.flush();
             input = reader.readLine(prompt);
             if (input == null) {
-              reader.printNewline();
+              reader.println();
               throw new IOException("Input stream closed");
             } else {
               input = new String(input);
@@ -259,7 +258,7 @@ public class SetIterCommand extends Comm
       
       options.putAll(localOptions);
       if (!skvi.validateOptions(options))
-        reader.printString("invalid options for " + clazz.getName() + "\n");
+        reader.println("invalid options for " + clazz.getName());
       
     } while (!skvi.validateOptions(options));
     return itopts.getName();

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java Fri May 31 21:54:21 2013
@@ -55,7 +55,7 @@ public abstract class ShellPluginConfigu
       // Remove the property
       removePlugin(cl, shellState, tableName);
       
-      shellState.getReader().printString("Removed "+pluginType+" on " + tableName + "\n");
+      shellState.getReader().println("Removed "+pluginType+" on " + tableName);
     } else if (cl.hasOption(listPluginOption.getOpt())) {
       // Get the options for this table
       final Iterator<Entry<String,String>> iter = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
@@ -65,7 +65,7 @@ public abstract class ShellPluginConfigu
         
         // List all parameters with the property name
         if (ent.getKey().startsWith(tableProp.toString())) {
-          shellState.getReader().printString(ent.getKey() + ": " + ent.getValue() + "\n");
+          shellState.getReader().println(ent.getKey() + ": " + ent.getValue());
         }
       }
     } else {

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java Fri May 31 21:54:21 2013
@@ -27,7 +27,7 @@ public class SystemPermissionsCommand ex
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
     for (String p : SystemPermission.printableValues()) {
-      shellState.getReader().printString(p + "\n");
+      shellState.getReader().println(p);
     }
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java Fri May 31 21:54:21 2013
@@ -69,7 +69,7 @@ public abstract class TableOperation ext
       }
       boolean operate = true;
       if (!force) {
-        shellState.getReader().flushConsole();
+        shellState.getReader().flush();
         String line = shellState.getReader().readLine(getName() + " { " + tableName + " } (yes|no)? ");
         more = line != null;
         operate = line != null && (line.equalsIgnoreCase("y") || line.equalsIgnoreCase("yes"));

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java Fri May 31 21:54:21 2013
@@ -27,7 +27,7 @@ public class TablePermissionsCommand ext
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
     for (String p : TablePermission.printableValues()) {
-      shellState.getReader().printString(p + "\n");
+      shellState.getReader().println(p);
     }
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java Fri May 31 21:54:21 2013
@@ -65,27 +65,27 @@ public class TraceCommand extends DebugC
                 }
               });
               if (traceCount > 0) {
-                shellState.getReader().printString(sb.toString());
+                shellState.getReader().print(sb.toString());
                 break;
               }
             } catch (Exception ex) {
               shellState.printException(ex);
             }
-            shellState.getReader().printString("Waiting for trace information\n");
-            shellState.getReader().flushConsole();
+            shellState.getReader().println("Waiting for trace information");
+            shellState.getReader().flush();
             UtilWaitThread.sleep(500);
           }
           if (traceCount < 0) {
             // display the trace even though there are unrooted spans
-            shellState.getReader().printString(sb.toString());
+            shellState.getReader().print(sb.toString());
           }
         } else {
-          shellState.getReader().printString("Not tracing\n");
+          shellState.getReader().println("Not tracing");
         }
       } else
         throw new BadArgumentException("Argument must be 'on' or 'off'", fullCommand, fullCommand.indexOf(cl.getArgs()[0]));
     } else if (cl.getArgs().length == 0) {
-      shellState.getReader().printString(Trace.isTracing() ? "on\n" : "off\n");
+      shellState.getReader().println(Trace.isTracing() ? "on" : "off");
     } else {
       shellState.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
       printHelp(shellState);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Fri May 31 21:54:21 2013
@@ -40,7 +40,7 @@ public class UserCommand extends Command
     // of these methods fails
     final String p = shellState.readMaskedLine("Enter password for user " + user + ": ", '*');
     if (p == null) {
-      shellState.getReader().printNewline();
+      shellState.getReader().println();
       return 0;
     } // user canceled
     pass = p.getBytes();

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java Fri May 31 21:54:21 2013
@@ -37,31 +37,31 @@ public class UserPermissionsCommand exte
     final String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami());
     
     String delim = "";
-    shellState.getReader().printString("System permissions: ");
+    shellState.getReader().print("System permissions: ");
     for (SystemPermission p : SystemPermission.values()) {
       if (p != null && shellState.getConnector().securityOperations().hasSystemPermission(user, p)) {
-        shellState.getReader().printString(delim + "System." + p.name());
+        shellState.getReader().print(delim + "System." + p.name());
         delim = ", ";
       }
     }
-    shellState.getReader().printNewline();
+    shellState.getReader().println();
     
     for (String t : shellState.getConnector().tableOperations().list()) {
       delim = "";
       for (TablePermission p : TablePermission.values()) {
         if (shellState.getConnector().securityOperations().hasTablePermission(user, t, p) && p != null) {
           if (runOnce == 0) {
-            shellState.getReader().printString("\nTable permissions (" + t + "): ");
+            shellState.getReader().print("\nTable permissions (" + t + "): ");
             runOnce++;
           }
-          shellState.getReader().printString(delim + "Table." + p.name());
+          shellState.getReader().print(delim + "Table." + p.name());
           delim = ", ";
         }
         
       }
       runOnce = 0;
     }
-    shellState.getReader().printNewline();
+    shellState.getReader().println();
     return 0;
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java Fri May 31 21:54:21 2013
@@ -28,7 +28,7 @@ public class UsersCommand extends Comman
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
     for (String user : shellState.getConnector().securityOperations().listLocalUsers()) {
-      shellState.getReader().printString(user + "\n");
+      shellState.getReader().println(user);
     }
     return 0;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java Fri May 31 21:54:21 2013
@@ -25,7 +25,7 @@ import org.apache.commons.cli.CommandLin
 public class WhoAmICommand extends Command {
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
-    shellState.getReader().printString(shellState.getConnector().whoami() + "\n");
+    shellState.getReader().println(shellState.getConnector().whoami());
     return 0;
   }
   

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java Fri May 31 21:54:21 2013
@@ -23,12 +23,11 @@ import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.util.format.DateStringFormatter;
 import org.apache.log4j.Level;
@@ -85,7 +84,7 @@ public class ShellTest {
   public void setup() throws IOException {
     Shell.log.setLevel(Level.OFF);
     output = new TestOutputStream();
-    shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), new OutputStreamWriter(output)));
+    shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output));
     shell.setLogErrorsToConsole();
     shell.config("--fake", "-u", "test", "-p", "secret");
   }

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java Fri May 31 21:54:21 2013
@@ -16,10 +16,9 @@
  */
 package org.apache.accumulo.core.util.shell.command;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.util.Iterator;
 import java.util.Map.Entry;
 
@@ -42,7 +41,7 @@ import org.junit.Test;
  * Uses the MockShell to test the shell output with Formatters
  */
 public class FormatterCommandTest {
-  Writer writer = null;
+  ByteArrayOutputStream out = null;
   InputStream in = null;
   
   @Test
@@ -55,9 +54,9 @@ public class FormatterCommandTest {
     final String[] commands = createCommands();
     
     in = MockShell.makeCommands(commands);
-    writer = new StringWriter();
+    out = new ByteArrayOutputStream();
     
-    final MockShell shell = new MockShell(in, writer);
+    final MockShell shell = new MockShell(in, out);
     shell.config(args);
     
     // Can't call createtable in the shell with MockAccumulo
@@ -69,9 +68,9 @@ public class FormatterCommandTest {
       Assert.fail("Exception while running commands: " + e.getMessage());
     } 
     
-    shell.getReader().flushConsole();
+    shell.getReader().flush();
     
-    final String[] output = StringUtils.split(writer.toString(), '\n');
+    final String[] output = StringUtils.split(new String(out.toByteArray()), '\n');
    
     boolean formatterOn = false;
     
@@ -94,7 +93,7 @@ public class FormatterCommandTest {
       final String line = output[outputIndex];
       
       if (line.startsWith("root@mock-instance")) {
-        if (line.contains("formatter -t test -f org.apache.accumulo.core.util.shell.command.FormatterCommandTest$HexFormatter")) {
+        if (line.contains("formatter")) {
           formatterOn = true;
         }
        

Modified: accumulo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/pom.xml?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/pom.xml (original)
+++ accumulo/trunk/pom.xml Fri May 31 21:54:21 2013
@@ -191,7 +191,7 @@
       <dependency>
         <groupId>jline</groupId>
         <artifactId>jline</artifactId>
-        <version>1.0</version>
+        <version>2.10</version>
       </dependency>
       <dependency>
         <groupId>junit</groupId>

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java Fri May 31 21:54:21 2013
@@ -19,7 +19,6 @@ package org.apache.accumulo.server.monit
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.HashMap;
 import java.util.Map;
@@ -31,7 +30,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.util.shell.Shell;
 
@@ -225,7 +224,7 @@ public class ShellServlet extends BasicS
       this.cmdIndex = 0;
       this.readWait = false;
       this.output = new StringBuilderOutputStream();
-      ConsoleReader reader = new ConsoleReader(this, new OutputStreamWriter(output));
+      ConsoleReader reader = new ConsoleReader(this, output);
       this.shell = new Shell(reader, new PrintWriter(output));
       shell.setLogErrorsToConsole();
       if (mock != null) {

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java Fri May 31 21:54:21 2013
@@ -23,7 +23,7 @@ import java.util.Locale;
 import java.util.Map.Entry;
 import java.util.UUID;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.cli.Help;
@@ -126,18 +126,14 @@ public class Initialize {
     if (ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) {
       ConsoleReader c = getConsoleReader();
       c.beep();
-      c.printNewline();
-      c.printNewline();
-      c.printString("Warning!!! Your instance secret is still set to the default, this is not secure. We highly recommend you change it.");
-      c.printNewline();
-      c.printNewline();
-      c.printNewline();
-      c.printString("You can change the instance secret in accumulo by using:");
-      c.printNewline();
-      c.printString("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
-      c.printNewline();
-      c.printString("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
-      c.printNewline();
+      c.println();
+      c.println();
+      c.println("Warning!!! Your instance secret is still set to the default, this is not secure. We highly recommend you change it.");
+      c.println();
+      c.println();
+      c.println("You can change the instance secret in accumulo by using:");
+      c.println("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
+      c.println("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
     }
     
     try {

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java?rev=1488407&r1=1488406&r2=1488407&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java Fri May 31 21:54:21 2013
@@ -20,19 +20,16 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.Map.Entry;
 
-import jline.ConsoleReader;
+import jline.console.ConsoleReader;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Connector;
@@ -78,11 +75,30 @@ public class ShellServerTest {
       sb.setLength(0);
     }
   }
+
+  public static class StringInputStream extends InputStream {
+    private String source = "";
+    private int offset = 0;
+    
+    @Override
+    public int read() throws IOException {
+      if (offset == source.length())
+        return '\n';
+      else
+        return source.charAt(offset++);
+    }
+    
+    public void set(String other) {
+      source = other;
+      offset = 0;
+    }
+  }
   
   private static String secret = "superSecret";
   public static TemporaryFolder folder = new TemporaryFolder();
   public static MiniAccumuloCluster cluster;
   public static TestOutputStream output;
+  public static StringInputStream input;
   public static Shell shell;
   private static Process traceProcess;
   
@@ -129,7 +145,7 @@ public class ShellServerTest {
       assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
     shell.resetExitCode();
   }
-
+  
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     folder.create();
@@ -141,7 +157,8 @@ public class ShellServerTest {
 
     // start the shell
     output = new TestOutputStream();
-    shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), new OutputStreamWriter(output)));
+    input = new StringInputStream();
+    shell = new Shell(new ConsoleReader(input, output));
     shell.setLogErrorsToConsole();
     shell.config("-u", "root", "-p", secret, "-z", cluster.getConfig().getInstanceName(), cluster.getConfig().getZooKeepers());
     exec("quit", true);
@@ -213,7 +230,7 @@ public class ShellServerTest {
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
-    shell.getReader().setInput(new ByteArrayInputStream("true\n\n\nSTRING\n".getBytes()));
+    input.set("true\n\n\nSTRING");
     exec("setscaniter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n name", true);
     exec("scan", true, "3", true);
     exec("deletescaniter -n name", true);
@@ -271,7 +288,7 @@ public class ShellServerTest {
   @Test(timeout = 30000)
   public void user() throws Exception {
     // createuser, deleteuser, user, users, droptable, grant, revoke
-    shell.getReader().setInput(new ByteArrayInputStream("secret\nsecret\n".getBytes()));
+    input.set("secret\nsecret\n");
     exec("createuser xyzzy", true);
     exec("users", true, "xyzzy", true);
     String perms = exec("userpermissions -u xyzzy", true);
@@ -283,14 +300,14 @@ public class ShellServerTest {
     exec("grant -u root -t !METADATA Table.GOOFY", false);
     exec("grant -u root -s foo", false);
     exec("grant -u xyzzy -t !METADATA foo", false);
-    shell.getReader().setInput(new ByteArrayInputStream("secret\nsecret\n".getBytes()));
+    input.set("secret\nsecret\n");
     exec("user xyzzy", true);
     exec("createtable t", true, "xyzzy@", true);
     exec("insert row1 cf cq 1", true);
     exec("scan", true, "row1", true);
     exec("droptable -f t", true);
     exec("deleteuser xyzzy", false, "delete yourself", true);
-    shell.getReader().setInput(new ByteArrayInputStream((secret + "\n" + secret + "\n").getBytes()));
+    input.set(secret+"\n"+secret+"\n");
     exec("user root", true);
     exec("revoke -u xyzzy -s System.CREATE_TABLE", true);
     exec("revoke -u xyzzy -s System.GOOFY", false);
@@ -309,9 +326,9 @@ public class ShellServerTest {
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
-    shell.getReader().setInput(new ByteArrayInputStream("true\n\n\nSTRING\n".getBytes()));
+    input.set("true\n\n\nSTRING\n");
     exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -pn sum -n name", true);
-    shell.getReader().setInput(new ByteArrayInputStream("true\n\n\nSTRING\n".getBytes()));
+    input.set("true\n\n\nSTRING\n");
     exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -pn sum -n xyzzy", true);
     exec("scan -pn sum", true, "3", true);
     exec("listshelliter", true, "Iterator name", true);
@@ -329,9 +346,9 @@ public class ShellServerTest {
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
     exec("insert a cf cq 1");
-    shell.getReader().setInput(new ByteArrayInputStream("true\n\n\nSTRING\n".getBytes()));
+    input.set("true\n\n\nSTRING\n");
     exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n name", true);
-    shell.getReader().setInput(new ByteArrayInputStream("true\n\n\nSTRING\n".getBytes()));
+    input.set("true\n\n\nSTRING\n");
     exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -n xyzzy", true);
     exec("scan", true, "3", true);
     exec("listiter -scan", true, "Iterator name", true);
@@ -520,10 +537,9 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  @Test(timeout = 30000)
+  @Test//(timeout = 30000)
   public void help() throws Exception {
     exec("help -np", true, "Help Commands", true);
-    shell.getReader().setInput(new ByteArrayInputStream("\n\n".getBytes()));
     exec("?", true, "Help Commands", true);
     for (String c : ("bye exit quit " + "about help info ? " + "deleteiter deletescaniter listiter setiter setscaniter "
         + "grant revoke systempermissions tablepermissions userpermissions " + "execfile history " + "authenticate cls clear notable sleep table user whoami "



Mime
View raw message