accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1346360 - in /accumulo/branches/ACCUMULO-578: ./ conf/ core/ core/src/main/java/org/apache/accumulo/core/client/ core/src/main/java/org/apache/accumulo/core/client/impl/ core/src/main/java/org/apache/accumulo/core/client/mock/ core/src/mai...
Date Tue, 05 Jun 2012 11:53:50 GMT
Author: ecn
Date: Tue Jun  5 11:53:48 2012
New Revision: 1346360

URL: http://svn.apache.org/viewvc?rev=1346360&view=rev
Log:
ACCUMULO-578 merge trunk to sandbox

Added:
    accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
      - copied unchanged from r1346359, accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/ShellServlet.java
Modified:
    accumulo/branches/ACCUMULO-578/   (props changed)
    accumulo/branches/ACCUMULO-578/conf/   (props changed)
    accumulo/branches/ACCUMULO-578/core/   (props changed)
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/conf/Property.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
    accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
    accumulo/branches/ACCUMULO-578/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
    accumulo/branches/ACCUMULO-578/server/   (props changed)
    accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
    accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
    accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
    accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
    accumulo/branches/ACCUMULO-578/server/src/main/resources/web/screen.css
    accumulo/branches/ACCUMULO-578/src/   (props changed)

Propchange: accumulo/branches/ACCUMULO-578/
------------------------------------------------------------------------------
  Merged /accumulo/trunk:r1345121-1346359

Propchange: accumulo/branches/ACCUMULO-578/conf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun  5 11:53:48 2012
@@ -8,9 +8,15 @@ monitor
 accumulo-env.sh
 accumulo-site.xml
 accumulo_user_manual.pdf
+<<<<<<< (modified)
 
 log4j.properties
 
 monitor_logger.xml
 
 generic_logger.xml
+=======
+log4j.properties
+generic_logger.xml
+monitor_logger.xml
+>>>>>>> (latest)

Propchange: accumulo/branches/ACCUMULO-578/core/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/core:r1345121-1346359

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java Tue Jun  5 11:53:48 2012
@@ -25,7 +25,6 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.impl.ScannerOptions;
 import org.apache.accumulo.core.client.mock.IteratorAdapter;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -134,9 +133,9 @@ public class ClientSideIteratorScanner e
    */
   public ClientSideIteratorScanner(Scanner scanner) {
     smi = new ScannerTranslator(scanner);
-    this.range = new Range((Key) null, (Key) null);
-    this.size = Constants.SCAN_BATCH_SIZE;
-    this.timeOut = Integer.MAX_VALUE;
+    this.range = scanner.getRange();
+    this.size = scanner.getBatchSize();
+    this.timeOut = scanner.getTimeOut();
   }
   
   /**

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java Tue Jun  5 11:53:48 2012
@@ -20,7 +20,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Map.Entry;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.impl.IsolationException;
 import org.apache.accumulo.core.client.impl.ScannerOptions;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -219,9 +218,9 @@ public class IsolatedScanner extends Sca
   
   public IsolatedScanner(Scanner scanner, RowBufferFactory bufferFactory) {
     this.scanner = scanner;
-    this.range = new Range();
-    this.timeOut = Integer.MAX_VALUE;
-    this.batchSize = Constants.SCAN_BATCH_SIZE;
+    this.range = scanner.getRange();
+    this.timeOut = scanner.getTimeOut();
+    this.batchSize = scanner.getBatchSize();
     this.bufferFactory = bufferFactory;
   }
   

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java Tue Jun  5 11:53:48 2012
@@ -132,8 +132,10 @@ public class MetadataLocationObtainer im
     ResultReceiver rr = new ResultReceiver() {
       
       @Override
-      public void receive(Key key, Value value) {
-        results.put(key, value);
+      public void receive(List<Entry<Key,Value>> entries) {
+        for (Entry<Key,Value> entry : entries) {
+          results.put(entry.getKey(), entry.getValue());
+        }
       }
     };
     

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java Tue Jun  5 11:53:48 2012
@@ -30,8 +30,10 @@ import org.apache.accumulo.core.data.Mut
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.thrift.AuthInfo;
 import org.apache.accumulo.core.util.ArgumentChecker;
+import org.apache.log4j.Logger;
 
 public class MultiTableBatchWriterImpl implements MultiTableBatchWriter {
+  static final Logger log = Logger.getLogger(MultiTableBatchWriterImpl.class);
   private boolean closed;
   
   private class TableBatchWriter implements BatchWriter {
@@ -86,6 +88,22 @@ public class MultiTableBatchWriterImpl i
     this.closed = true;
   }
   
+  /**
+   * Warning: do not rely upon finalize to close this class. Finalize is not guaranteed to be called.
+   */
+  @Override
+  protected void finalize() {
+    if (!closed) {
+      log.warn(MultiTableBatchWriterImpl.class.getSimpleName() + " not shutdown; did you forget to call close()?");
+      try {
+        close();
+      } catch (MutationsRejectedException mre) {
+        log.error(MultiTableBatchWriterImpl.class.getSimpleName() + " internal error.", mre);
+        throw new RuntimeException("Exception when closing " + MultiTableBatchWriterImpl.class.getSimpleName(), mre);
+      }
+    }
+  }
+  
   @Override
   public synchronized BatchWriter getBatchWriter(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     ArgumentChecker.notNull(tableName);

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java Tue Jun  5 11:53:48 2012
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.NoSuchElementException;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Semaphore;
@@ -82,8 +83,10 @@ public class TabletServerBatchReaderIter
   private final ExecutorService queryThreadPool;
   private final ScannerOptions options;
   
-  private ArrayBlockingQueue<Entry<Key,Value>> resultsQueue = new ArrayBlockingQueue<Entry<Key,Value>>(1000);
-  private Entry<Key,Value> nextEntry = null;
+  private ArrayBlockingQueue<List<Entry<Key,Value>>> resultsQueue;
+  private Iterator<Entry<Key,Value>> batchIterator;
+  private List<Entry<Key,Value>> batch;
+  private static final List<Entry<Key,Value>> LAST_BATCH = new ArrayList<Map.Entry<Key,Value>>();
   private Object nextLock = new Object();
   
   private long failSleepTime = 100;
@@ -91,7 +94,7 @@ public class TabletServerBatchReaderIter
   private volatile Throwable fatalException = null;
   
   public interface ResultReceiver {
-    void receive(Key key, Value value);
+    void receive(List<Entry<Key,Value>> entries);
   }
   
   private static class MyEntry implements Entry<Key,Value> {
@@ -131,6 +134,7 @@ public class TabletServerBatchReaderIter
     this.numThreads = numThreads;
     this.queryThreadPool = queryThreadPool;
     this.options = new ScannerOptions(scannerOptions);
+    resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads);
     
     if (options.fetchedColumns.size() > 0) {
       ArrayList<Range> ranges2 = new ArrayList<Range>(ranges.size());
@@ -144,14 +148,14 @@ public class TabletServerBatchReaderIter
     ResultReceiver rr = new ResultReceiver() {
       
       @Override
-      public void receive(Key key, Value value) {
+      public void receive(List<Entry<Key,Value>> entries) {
         try {
-          resultsQueue.put(new MyEntry(key, value));
+          resultsQueue.put(entries);
         } catch (InterruptedException e) {
           if (TabletServerBatchReaderIterator.this.queryThreadPool.isShutdown())
-            log.debug("Failed to add Batch Scan result for key " + key, e);
+            log.debug("Failed to add Batch Scan result", e);
           else
-            log.warn("Failed to add Batch Scan result for key " + key, e);
+            log.warn("Failed to add Batch Scan result", e);
           fatalException = e;
           throw new RuntimeException(e);
           
@@ -169,17 +173,21 @@ public class TabletServerBatchReaderIter
     }
   }
   
+
   @Override
   public boolean hasNext() {
     synchronized (nextLock) {
-      // check if one was cached
-      if (nextEntry != null)
-        return nextEntry.getKey() != null && nextEntry.getValue() != null;
+      if (batch == LAST_BATCH)
+        return false;
+      
+      if (batch != null && batchIterator.hasNext())
+        return true;
       
       // don't have one cached, try to cache one and return success
       try {
-        while (nextEntry == null && fatalException == null && !queryThreadPool.isShutdown())
-          nextEntry = resultsQueue.poll(1, TimeUnit.SECONDS);
+        batch = null;
+        while (batch == null && fatalException == null && !queryThreadPool.isShutdown())
+          batch = resultsQueue.poll(1, TimeUnit.SECONDS);
         
         if (fatalException != null)
           if (fatalException instanceof RuntimeException)
@@ -190,7 +198,8 @@ public class TabletServerBatchReaderIter
         if (queryThreadPool.isShutdown())
           throw new RuntimeException("scanner closed");
 
-        return nextEntry.getKey() != null && nextEntry.getValue() != null;
+        batchIterator = batch.iterator();
+        return batch != LAST_BATCH;
       } catch (InterruptedException e) {
         throw new RuntimeException(e);
       }
@@ -199,17 +208,13 @@ public class TabletServerBatchReaderIter
   
   @Override
   public Entry<Key,Value> next() {
-    Entry<Key,Value> current = null;
-    
     // if there's one waiting, or hasNext() can get one, return it
     synchronized (nextLock) {
-      if (hasNext()) {
-        current = nextEntry;
-        nextEntry = null;
-      }
+      if (hasNext())
+        return batchIterator.next();
+      else
+        throw new NoSuchElementException();
     }
-    
-    return current;
   }
   
   @Override
@@ -391,22 +396,22 @@ public class TabletServerBatchReaderIter
             
             if (fatalException != null) {
               // we are finished with this batch query
-              if (!resultsQueue.offer(new MyEntry(null, null))) {
+              if (!resultsQueue.offer(LAST_BATCH)) {
                 log.debug("Could not add to result queue after seeing fatalException in processFailures", fatalException);
               }
             }
           } else {
             // we are finished with this batch query
             if (fatalException != null) {
-              if (!resultsQueue.offer(new MyEntry(null, null))) {
+              if (!resultsQueue.offer(LAST_BATCH)) {
                 log.debug("Could not add to result queue after seeing fatalException", fatalException);
               }
             } else {
               try {
-                resultsQueue.put(new MyEntry(null, null));
+                resultsQueue.put(LAST_BATCH);
               } catch (InterruptedException e) {
                 fatalException = e;
-                if (!resultsQueue.offer(new MyEntry(null, null))) {
+                if (!resultsQueue.offer(LAST_BATCH)) {
                   log.debug("Could not add to result queue after seeing fatalException", fatalException);
                 }
               }
@@ -549,9 +554,14 @@ public class TabletServerBatchReaderIter
         opTimer.stop("Got 1st multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? "  scanID=" + imsr.scanID : "")
             + " in %DURATION%");
         
+        ArrayList<Entry<Key,Value>> entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
         for (TKeyValue kv : scanResult.results) {
-          receiver.receive(new Key(kv.key), new Value(kv.value));
+          entries.add(new MyEntry(new Key(kv.key), new Value(kv.value)));
         }
+        
+        if (entries.size() > 0)
+          receiver.receive(entries);
+
         trackScanning(failures, unscanned, scanResult);
         
         while (scanResult.more) {
@@ -560,9 +570,14 @@ public class TabletServerBatchReaderIter
           scanResult = client.continueMultiScan(null, imsr.scanID);
           opTimer.stop("Got more multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? "  scanID=" + imsr.scanID : "")
               + " in %DURATION%");
+          
+          entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
           for (TKeyValue kv : scanResult.results) {
-            receiver.receive(new Key(kv.key), new Value(kv.value));
+            entries.add(new MyEntry(new Key(kv.key), new Value(kv.value)));
           }
+          
+          if (entries.size() > 0)
+            receiver.receive(entries);
           trackScanning(failures, unscanned, scanResult);
         }
         

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/client/mock/MockShell.java Tue Jun  5 11:53:48 2012
@@ -28,8 +28,7 @@ import org.apache.accumulo.core.util.she
 import org.apache.commons.cli.CommandLine;
 
 /**
- * An Accumulo Shell implementation that allows a developer to attach
- * an InputStream and Writer to the Shell for testing purposes.
+ * An Accumulo Shell implementation that allows a developer to attach an InputStream and Writer to the Shell for testing purposes.
  */
 public class MockShell extends Shell {
   private static final String NEWLINE = "\n";
@@ -43,14 +42,13 @@ public class MockShell extends Shell {
     this.writer = writer;
   }
   
-  public void config(String... args) {
-    super.config(args);
+  public boolean config(String... args) {
+    configError = super.config(args);
     
     // Update the ConsoleReader with the input and output "redirected"
     try {
       this.reader = new ConsoleReader(in, writer);
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       printException(e);
       configError = true;
     }
@@ -61,8 +59,9 @@ public class MockShell extends Shell {
     
     // Make the parsing from the client easier;
     this.verbose = false;
+    return configError;
   }
-
+  
   @Override
   protected void setInstance(CommandLine cl) {
     // We always want a MockInstance for this test
@@ -89,7 +88,7 @@ public class MockShell extends Shell {
     }
     
     while (true) {
-      if (exit)
+      if (hasExited())
         return exitCode;
       
       reader.setDefaultPrompt(getDefaultPrompt());
@@ -104,14 +103,16 @@ public class MockShell extends Shell {
   }
   
   /**
-   * @param in the in to set
+   * @param in
+   *          the in to set
    */
   public void setConsoleInputStream(InputStream in) {
     this.in = in;
   }
-
+  
   /**
-   * @param writer the writer to set
+   * @param writer
+   *          the writer to set
    */
   public void setConsoleWriter(Writer writer) {
     this.writer = writer;
@@ -119,7 +120,8 @@ public class MockShell extends Shell {
   
   /**
    * Convenience method to create the byte-array to hand to the console
-   * @param commands 
+   * 
+   * @param commands
    *          An array of commands to run
    * @return A byte[] input stream which can be handed to the console.
    */

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/conf/Property.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/conf/Property.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/conf/Property.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/conf/Property.java Tue Jun  5 11:53:48 2012
@@ -173,6 +173,10 @@ public enum Property {
   MONITOR_BANNER_COLOR("monitor.banner.color", "#c4c4c4", PropertyType.STRING, "The color of the banner text displayed on the monitor page."),
   MONITOR_BANNER_BACKGROUND("monitor.banner.background", "#304065", PropertyType.STRING,
       "The background color of the banner text displayed on the monitor page."),
+  MONITOR_SSL_KEYSTORE("monitor.ssl.keyStore", "", PropertyType.PATH, "The keystore for enabling monitor SSL."),
+  MONITOR_SSL_KEYSTOREPASS("monitor.ssl.keyStorePassword", "", PropertyType.STRING, "The keystore password for enabling monitor SSL."),
+  MONITOR_SSL_TRUSTSTORE("monitor.ssl.trustStore", "", PropertyType.PATH, "The truststore for enabling monitor SSL."),
+  MONITOR_SSL_TRUSTSTOREPASS("monitor.ssl.trustStorePassword", "", PropertyType.STRING, "The truststore password for enabling monitor SSL."),
   
   TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of distributed tracing."),
   TRACE_PORT("trace.port.client", "12234", PropertyType.PORT, "The listening port for the trace server"),
@@ -204,7 +208,7 @@ public enum Property {
   TABLE_MINC_COMPACT_IDLETIME("table.compaction.minor.idle", "5m", PropertyType.TIMEDURATION,
       "After a tablet has been idle (no mutations) for this time period it may have its "
           + "in-memory map flushed to disk in a minor compaction.  There is no guarantee an idle " + "tablet will be compacted."),
-  TABLE_SCAN_MAXMEM("table.scan.max.memory", "1M", PropertyType.MEMORY,
+  TABLE_SCAN_MAXMEM("table.scan.max.memory", "512K", PropertyType.MEMORY,
       "The maximum amount of memory that will be used to cache results of a client query/scan. "
           + "Once this limit is reached, the buffered data is sent to the client."),
   TABLE_FILE_TYPE("table.file.type", RFile.EXTENSION, PropertyType.STRING, "Change the type of file a table writes"),
@@ -329,6 +333,7 @@ public enum Property {
   
   private static final EnumSet<Property> fixedProperties = EnumSet.of(Property.TSERV_CLIENTPORT, Property.TSERV_NATIVEMAP_ENABLED,
       Property.TSERV_SCAN_MAX_OPENFILES, Property.MASTER_CLIENTPORT, Property.GC_PORT);
+      Property.TSERV_SCAN_MAX_OPENFILES, Property.MASTER_CLIENTPORT, Property.GC_PORT);
   
   public static boolean isFixedZooPropertyKey(Property key) {
     return fixedProperties.contains(key);

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Tue Jun  5 11:53:48 2012
@@ -170,7 +170,7 @@ public class Shell extends ShellOptions 
   protected boolean configError = false;
   
   // exit if true
-  protected boolean exit = false;
+  private boolean exit = false;
   
   // file to execute commands from
   protected String execFile = null;
@@ -182,10 +182,12 @@ public class Shell extends ShellOptions 
   private boolean disableAuthTimeout;
   private long authTimeout;
   private long lastUserActivity = System.currentTimeMillis();
+  private boolean logErrorsToConsole = false;
+  private PrintWriter writer = null;
+  private boolean masking = false;
   
   public Shell() throws IOException {
-    super();
-    this.reader = new ConsoleReader();
+    this(new ConsoleReader());
   }
   
   public Shell(ConsoleReader reader) {
@@ -193,8 +195,13 @@ public class Shell extends ShellOptions 
     this.reader = reader;
   }
   
+  public Shell(ConsoleReader reader, PrintWriter writer) {
+    this(reader);
+    this.writer = writer;
+  }
+  
   // Not for client use
-  public void config(String... args) {
+  public boolean config(String... args) {
     
     CommandLine cl;
     try {
@@ -205,7 +212,7 @@ public class Shell extends ShellOptions 
       if (cl.hasOption(helpOpt.getOpt())) {
         configError = true;
         printHelp("shell", SHELL_DESCRIPTION, opts);
-        return;
+        return true;
       }
       
       setDebugging(cl.hasOption(debugOption.getLongOpt()));
@@ -219,7 +226,7 @@ public class Shell extends ShellOptions 
       configError = true;
       printException(e);
       printHelp("shell", SHELL_DESCRIPTION, opts);
-      return;
+      return true;
     }
     
     // get the options that were parsed
@@ -249,11 +256,11 @@ public class Shell extends ShellOptions 
       });
       
       if (passw == null)
-        passw = reader.readLine("Enter current password for '" + user + "'@'" + instance.getInstanceName() + "': ", '*');
+        passw = readMaskedLine("Enter current password for '" + user + "'@'" + instance.getInstanceName() + "': ", '*');
       if (passw == null) {
         reader.printNewline();
         configError = true;
-        return;
+        return true;
       } // user canceled
       
       pass = passw.getBytes();
@@ -317,6 +324,7 @@ public class Shell extends ShellOptions 
     for (Command cmd : otherCommands) {
       commandFactory.put(cmd.getName(), cmd);
     }
+    return configError;
   }
   
   @SuppressWarnings("deprecation")
@@ -390,7 +398,7 @@ public class Shell extends ShellOptions 
     }
     
     while (true) {
-      if (exit)
+      if (hasExited())
         return exitCode;
       
       // If tab completion is true we need to reset
@@ -417,6 +425,7 @@ public class Shell extends ShellOptions 
     reader.printString("\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();
   }
   
   public void printVerboseInfo() throws IOException {
@@ -446,7 +455,7 @@ public class Shell extends ShellOptions 
     reader.printString(sb.toString());
   }
   
-  protected String getDefaultPrompt() {
+  public String getDefaultPrompt() {
     return connector.whoami() + "@" + connector.getInstance().getInstanceName() + (getTableName().isEmpty() ? "" : " ") + getTableName() + "> ";
   }
   
@@ -479,6 +488,7 @@ public class Shell extends ShellOptions 
         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();
           return;
         }
         
@@ -486,7 +496,7 @@ public class Shell extends ShellOptions 
           reader.printString("Shell has been idle for too long. Please re-authenticate.\n");
           boolean authFailed = true;
           do {
-            String pwd = reader.readLine("Enter current password for '" + connector.whoami() + "': ", '*');
+            String pwd = readMaskedLine("Enter current password for '" + connector.whoami() + "': ", '*');
             if (pwd == null) {
               reader.printNewline();
               return;
@@ -515,7 +525,7 @@ public class Shell extends ShellOptions 
         int expectedArgLen = sc.numArgs();
         if (cl.hasOption(helpOption)) {
           // Display help if asked to; otherwise execute the command
-          sc.printHelp();
+          sc.printHelp(this);
         } else if (expectedArgLen != NO_FIXED_ARG_LENGTH_CHECK && actualArgLen != expectedArgLen) {
           ++exitCode;
           // Check for valid number of fixed arguments (if not
@@ -523,7 +533,7 @@ public class Shell extends ShellOptions 
           // vararg-like commands)
           printException(new IllegalArgumentException(String.format("Expected %d argument%s. There %s %d.", expectedArgLen, expectedArgLen == 1 ? "" : "s",
               actualArgLen == 1 ? "was" : "were", actualArgLen)));
-          sc.printHelp();
+          sc.printHelp(this);
         } else {
           int tmpCode = sc.execute(input, cl, this);
           exitCode += tmpCode;
@@ -546,7 +556,7 @@ public class Shell extends ShellOptions 
           printException(e);
         }
         if (sc != null)
-          sc.printHelp();
+          sc.printHelp(this);
       } catch (Exception e) {
         ++exitCode;
         printException(e);
@@ -555,6 +565,7 @@ public class Shell extends ShellOptions 
       ++exitCode;
       printException(new BadArgumentException("Unrecognized empty command", command, -1));
     }
+    reader.flushConsole();
   }
   
   /**
@@ -683,12 +694,12 @@ public class Shell extends ShellOptions 
     
     // The general version of this method uses the HelpFormatter
     // that comes with the apache Options package to print out the help
-    public final void printHelp() {
-      Shell.printHelp(usage(), "description: " + this.description(), getOptionsWithHelp());
+    public final void printHelp(Shell shellState) {
+      shellState.printHelp(usage(), "description: " + this.description(), getOptionsWithHelp());
     }
     
-    public final void printHelp(int width) {
-      Shell.printHelp(usage(), "description: " + this.description(), getOptionsWithHelp(), width);
+    public final void printHelp(Shell shellState, int width) {
+      shellState.printHelp(usage(), "description: " + this.description(), getOptionsWithHelp(), width);
     }
     
     // Get options with help
@@ -829,20 +840,20 @@ public class Shell extends ShellOptions 
     printException(cve, "");
     int COL1 = 50, COL2 = 14;
     int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTermwidth() - COL1 - COL2 - 6));
-    log.error(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%" + col3 + "s\n", repeat("-", COL1), repeat("-", COL2), repeat("-", col3)));
-    log.error(String.format("%-" + COL1 + "s | %" + COL2 + "s | %-" + col3 + "s\n", "Constraint class", "Violation code", "Violation Description"));
-    log.error(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", 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)));
     for (TConstraintViolationSummary cvs : cve.violationSummaries)
-      log.error(String.format("%-" + COL1 + "s | %" + COL2 + "d | %-" + col3 + "s\n", cvs.constrainClass, cvs.violationCode, cvs.violationDescription));
-    log.error(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%" + col3 + "s\n", repeat("-", COL1), repeat("-", COL2), repeat("-", col3)));
+      logError(String.format("%-" + COL1 + "s | %" + COL2 + "d | %-" + col3 + "s\n", cvs.constrainClass, cvs.violationCode, cvs.violationDescription));
+    logError(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%" + col3 + "s\n", repeat("-", COL1), repeat("-", COL2), repeat("-", col3)));
   }
   
-  public static final void printException(Exception e) {
+  public final void printException(Exception e) {
     printException(e, e.getMessage());
   }
   
-  private static final void printException(Exception e, String msg) {
-    log.error(e.getClass().getName() + (msg != null ? ": " + msg : ""));
+  private final void printException(Exception e, String msg) {
+    logError(e.getClass().getName() + (msg != null ? ": " + msg : ""));
     log.debug(e.getClass().getName() + (msg != null ? ": " + msg : ""), e);
   }
   
@@ -854,14 +865,18 @@ public class Shell extends ShellOptions 
     return Logger.getLogger(Constants.CORE_PACKAGE_NAME).isTraceEnabled();
   }
   
-  private static final void printHelp(String usage, String description, Options opts) {
+  private final void printHelp(String usage, String description, Options opts) {
     printHelp(usage, description, opts, Integer.MAX_VALUE);
   }
   
-  private static final void printHelp(String usage, String description, Options opts, int width) {
+  private final void printHelp(String usage, String description, Options opts, int width) {
     PrintWriter pw = new PrintWriter(System.err);
     new HelpFormatter().printHelp(pw, width, usage, description, opts, 2, 5, null, true);
     pw.flush();
+    if (logErrorsToConsole && writer != null) {
+      new HelpFormatter().printHelp(writer, width, usage, description, opts, 2, 5, null, true);
+      writer.flush();
+    }
   }
   
   public int getExitCode() {
@@ -921,10 +936,39 @@ public class Shell extends ShellOptions 
     Class<? extends Formatter> formatter = FormatterCommand.getCurrentFormatter(tableName, this);
     
     if (null == formatter) {
-      log.error("Could not load the specified formatter. Using the DefaultFormatter");
+      logError("Could not load the specified formatter. Using the DefaultFormatter");
       return this.defaultFormatterClass;
     } else {
       return formatter;
     }
   }
+  
+  public void setLogErrorsToConsole() {
+    this.logErrorsToConsole = true;
+  }
+  
+  private void logError(String s) {
+    log.error(s);
+    if (logErrorsToConsole) {
+      try {
+        reader.printString("ERROR: " + s + "\n");
+        reader.flushConsole();
+      } catch (IOException e) {}
+    }
+  }
+  
+  public String readMaskedLine(String prompt, Character mask) throws IOException {
+    this.masking = true;
+    String s = reader.readLine(prompt, mask);
+    this.masking = false;
+    return s;
+  }
+  
+  public boolean isMasking() {
+    return masking;
+  }
+  
+  public boolean hasExited() {
+    return exit;
+  }
 }

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java Tue Jun  5 11:53:48 2012
@@ -31,7 +31,7 @@ public class AuthenticateCommand extends
   @Override
   public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
     String user = cl.getArgs()[0];
-    String p = shellState.getReader().readLine("Enter current password for '" + user + "': ", '*');
+    String p = shellState.readMaskedLine("Enter current password for '" + user + "': ", '*');
     if (p == null) {
       shellState.getReader().printNewline();
       return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java Tue Jun  5 11:53:48 2012
@@ -46,12 +46,12 @@ public class CreateUserCommand extends C
     String password = null;
     String passwordConfirm = null;
     
-    password = shellState.getReader().readLine("Enter new password for '" + user + "': ", '*');
+    password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
     if (password == null) {
       shellState.getReader().printNewline();
       return 0;
     } // user canceled
-    passwordConfirm = shellState.getReader().readLine("Please confirm new password for '" + user + "': ", '*');
+    passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
     if (passwordConfirm == null) {
       shellState.getReader().printNewline();
       return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java Tue Jun  5 11:53:48 2012
@@ -39,8 +39,8 @@ public class DebugCommand extends Comman
     } else if (cl.getArgs().length == 0) {
       shellState.getReader().printString(Shell.isDebuggingEnabled() ? "on\n" : "off\n");
     } else {
-      Shell.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
-      printHelp();
+      shellState.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
+      printHelp(shellState);
       return 1;
     }
     return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/HelpCommand.java Tue Jun  5 11:53:48 2012
@@ -89,7 +89,7 @@ public class HelpCommand extends Command
       if (c == null)
         shellState.getReader().printString(String.format("Unknown command \"%s\".  Enter \"help\" for a list possible commands.\n", cmd));
       else
-        c.printHelp(numColumns);
+        c.printHelp(shellState, numColumns);
     }
     return 0;
   }

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java Tue Jun  5 11:53:48 2012
@@ -41,7 +41,7 @@ public class PasswdCommand extends Comma
     String passwordConfirm = null;
     String oldPassword = null;
     
-    oldPassword = shellState.getReader().readLine("Enter current password for '" + currentUser + "': ", '*');
+    oldPassword = shellState.readMaskedLine("Enter current password for '" + currentUser + "': ", '*');
     if (oldPassword == null) {
       shellState.getReader().printNewline();
       return 0;
@@ -50,12 +50,12 @@ public class PasswdCommand extends Comma
     if (!shellState.getConnector().securityOperations().authenticateUser(currentUser, oldPassword.getBytes()))
       throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
     
-    password = shellState.getReader().readLine("Enter new password for '" + user + "': ", '*');
+    password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
     if (password == null) {
       shellState.getReader().printNewline();
       return 0;
     } // user canceled
-    passwordConfirm = shellState.getReader().readLine("Please confirm new password for '" + user + "': ", '*');
+    passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
     if (passwordConfirm == null) {
       shellState.getReader().printNewline();
       return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Tue Jun  5 11:53:48 2012
@@ -153,11 +153,13 @@ public class SetIterCommand extends Comm
       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();
           input = reader.readLine(prompt);
           if (input == null) {
             reader.printNewline();
             throw new IOException("Input stream closed");
+          } else {
+            input = new String(input);
           }
           // Places all Parameters and Values into the LocalOptions, even if the value is "".
           // This allows us to check for "" values when setting the iterators and allows us to remove
@@ -173,10 +175,13 @@ public class SetIterCommand extends Comm
           while (true) {
             prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): ";
             
+            reader.flushConsole();
             input = reader.readLine(prompt);
             if (input == null) {
               reader.printNewline();
               throw new IOException("Input stream closed");
+            } else {
+              input = new String(input);
             }
             
             if (input.length() == 0)

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java Tue Jun  5 11:53:48 2012
@@ -32,7 +32,6 @@ import org.apache.accumulo.core.util.she
 import org.apache.commons.cli.CommandLine;
 import org.apache.hadoop.io.Text;
 
-
 public class TraceCommand extends DebugCommand {
   
   public int execute(String fullCommand, CommandLine cl, final Shell shellState) throws IOException {
@@ -66,7 +65,7 @@ public class TraceCommand extends DebugC
                 break;
               }
             } catch (Exception ex) {
-              Shell.printException(ex);
+              shellState.printException(ex);
             }
             shellState.getReader().printString("Waiting for trace information\n");
             shellState.getReader().flushConsole();
@@ -80,8 +79,8 @@ public class TraceCommand extends DebugC
     } else if (cl.getArgs().length == 0) {
       shellState.getReader().printString(Trace.isTracing() ? "on\n" : "off\n");
     } else {
-      Shell.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
-      printHelp();
+      shellState.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
+      printHelp(shellState);
       return 1;
     }
     return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Tue Jun  5 11:53:48 2012
@@ -38,7 +38,7 @@ public class UserCommand extends Command
     // We can't let the wrapping try around the execute method deal
     // with the exceptions because we have to do something if one
     // of these methods fails
-    String p = shellState.getReader().readLine("Enter password for user " + user + ": ", '*');
+    String p = shellState.readMaskedLine("Enter password for user " + user + ": ", '*');
     if (p == null) {
       shellState.getReader().printNewline();
       return 0;

Modified: accumulo/branches/ACCUMULO-578/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java (original)
+++ accumulo/branches/ACCUMULO-578/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java Tue Jun  5 11:53:48 2012
@@ -32,7 +32,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class ShellTest {
-  class TestOutputStream extends OutputStream {
+  static class TestOutputStream extends OutputStream {
     StringBuilder sb = new StringBuilder();
     
     @Override
@@ -62,7 +62,7 @@ public class ShellTest {
     if (expectGoodExit)
       assertGoodExit("", true);
     else
-      assertBadExit();
+      assertBadExit("", true);
   }
   
   void exec(String cmd, boolean expectGoodExit, String expectString) throws IOException {
@@ -74,7 +74,7 @@ public class ShellTest {
     if (expectGoodExit)
       assertGoodExit(expectString, stringPresent);
     else
-      assertBadExit();
+      assertBadExit(expectString, stringPresent);
   }
   
   @Before
@@ -82,6 +82,7 @@ public class ShellTest {
     Shell.log.setLevel(Level.OFF);
     output = new TestOutputStream();
     shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), new OutputStreamWriter(output)));
+    shell.setLogErrorsToConsole();
     shell.config("--fake", "-p", "pass");
   }
   
@@ -92,9 +93,11 @@ public class ShellTest {
       assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
   }
   
-  void assertBadExit() {
+  void assertBadExit(String s, boolean stringPresent) {
     Shell.log.debug(output.get());
     assertTrue(shell.getExitCode() > 0);
+    if (s.length() > 0)
+      assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
     shell.resetExitCode();
   }
   
@@ -103,13 +106,13 @@ public class ShellTest {
     Shell.log.debug("Starting about test -----------------------------------");
     exec("about", true, "Shell - Apache Accumulo Interactive Shell");
     exec("about -v", true, "Current user:");
-    exec("about arg", false);
+    exec("about arg", false, "java.lang.IllegalArgumentException: Expected 0 arguments");
   }
   
   @Test
   public void addGetSplitsTest() throws IOException {
     Shell.log.debug("Starting addGetSplits test ----------------------------");
-    exec("addsplits arg", false);
+    exec("addsplits arg", false, "java.lang.IllegalStateException: Not in a table context");
     exec("createtable test", true);
     exec("addsplits 1 \\x80", true);
     exec("getsplits", true, "1\n\\x80");
@@ -119,8 +122,8 @@ public class ShellTest {
   @Test
   public void insertDeleteScanTest() throws IOException {
     Shell.log.debug("Starting insertDeleteScan test ------------------------");
-    exec("insert r f q v", false);
-    exec("delete r f q", false);
+    exec("insert r f q v", false, "java.lang.IllegalStateException: Not in a table context");
+    exec("delete r f q", false, "java.lang.IllegalStateException: Not in a table context");
     exec("createtable test", true);
     exec("insert r f q v", true);
     exec("scan", true, "r f:q []    v");

Propchange: accumulo/branches/ACCUMULO-578/server/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/server:r1345121-1346359

Modified: accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java (original)
+++ accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java Tue Jun  5 11:53:48 2012
@@ -59,6 +59,7 @@ import org.apache.accumulo.server.monito
 import org.apache.accumulo.server.monitor.servlets.MasterServlet;
 import org.apache.accumulo.server.monitor.servlets.OperationServlet;
 import org.apache.accumulo.server.monitor.servlets.ProblemServlet;
+import org.apache.accumulo.server.monitor.servlets.ShellServlet;
 import org.apache.accumulo.server.monitor.servlets.TServersServlet;
 import org.apache.accumulo.server.monitor.servlets.TablesServlet;
 import org.apache.accumulo.server.monitor.servlets.VisServlet;
@@ -147,6 +148,8 @@ public class Monitor {
   
   private static ServerConfiguration config;
   
+  private static EmbeddedWebServer server;
+  
   public static Map<String,Double> summarizeTableStats(MasterMonitorInfo mmi) {
     Map<String,Double> compactingByTable = new HashMap<String,Double>();
     if (mmi != null && mmi.tServerInfo != null) {
@@ -315,7 +318,7 @@ public class Monitor {
         indexCacheRequestTracker.startingUpdates();
         dataCacheHitTracker.startingUpdates();
         dataCacheRequestTracker.startingUpdates();
-        
+
         for (TabletServerStatus server : mmi.tServerInfo) {
           TableInfo summary = Monitor.summarizeTableStats(server);
           totalIngestRate += summary.ingestRate;
@@ -460,7 +463,6 @@ public class Monitor {
   public void run(String hostname) {
     Monitor.START_TIME = System.currentTimeMillis();
     int port = config.getConfiguration().getPort(Property.MONITOR_PORT);
-    EmbeddedWebServer server;
     try {
       log.debug("Creating monitor on port " + port);
       server = EmbeddedWebServer.create(port);
@@ -483,6 +485,8 @@ public class Monitor {
     server.addServlet(Summary.class, "/trace/summary");
     server.addServlet(ListType.class, "/trace/listType");
     server.addServlet(ShowTrace.class, "/trace/show");
+    if (server.isUsingSsl())
+      server.addServlet(ShellServlet.class, "/shell");
     LogService.startLogListener(Monitor.getSystemConfiguration());
     server.start();
     
@@ -542,7 +546,7 @@ public class Monitor {
   public static double getTotalScanRate() {
     return totalScanRate;
   }
-
+  
   public static double getTotalQueryByteRate() {
     return totalQueryByteRate;
   }
@@ -628,7 +632,7 @@ public class Monitor {
       return new ArrayList<Pair<Long,Integer>>(scanRateOverTime);
     }
   }
-
+  
   public static List<Pair<Long,Double>> getQueryByteRateOverTime() {
     synchronized (queryByteRateOverTime) {
       return new ArrayList<Pair<Long,Double>>(queryByteRateOverTime);
@@ -654,4 +658,8 @@ public class Monitor {
   public static Instance getInstance() {
     return instance;
   }
+  
+  public static boolean isUsingSsl() {
+    return server.isUsingSsl();
+  }
 }

Modified: accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java (original)
+++ accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java Tue Jun  5 11:53:48 2012
@@ -73,7 +73,7 @@ abstract public class BasicServlet exten
     }
   }
   
-  protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     doGet(req, resp);
   }
   
@@ -136,7 +136,8 @@ abstract public class BasicServlet exten
     // BEGIN HEADER
     sb.append("<head>\n");
     sb.append("<title>").append(getTitle(req)).append(" - Accumulo ").append(Constants.VERSION).append("</title>\n");
-    if ((refresh > 0) && (req.getRequestURI().startsWith("/docs") == false) && (req.getRequestURI().startsWith("/vis") == false))
+    if ((refresh > 0) && (req.getRequestURI().startsWith("/docs") == false) && (req.getRequestURI().startsWith("/vis") == false)
+        && (req.getRequestURI().startsWith("/shell") == false))
       sb.append("<meta http-equiv='refresh' content='" + refresh + "' />\n");
     sb.append("<meta http-equiv='Content-Type' content='").append(DEFAULT_CONTENT_TYPE).append("' />\n");
     sb.append("<meta http-equiv='Content-Script-Type' content='text/javascript' />\n");
@@ -189,6 +190,8 @@ abstract public class BasicServlet exten
     sb.append("<hr />\n");
     sb.append("<a href='/xml'>XML</a><br />\n");
     sb.append("<a href='/json'>JSON</a><hr />\n");
+    if (Monitor.isUsingSsl())
+      sb.append("<a href='/shell'>Shell</a><hr />\n");
     sb.append("<div class='smalltext'>[<a href='").append("/op?action=refresh&value=").append(refresh < 1 ? "5" : "-1");
     sb.append("&redir=").append(currentPage(req)).append("'>");
     sb.append(refresh < 1 ? "en" : "dis").append("able&nbsp;auto-refresh</a>]</div>\n");

Modified: accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Tue Jun  5 11:53:48 2012
@@ -967,7 +967,8 @@ public class TabletServer extends Abstra
           if (isCancelled() || session == null)
             return;
           
-          long maxResultsSize = acuConf.getMemoryInBytes(Property.TABLE_SCAN_MAXMEM);
+          TableConfiguration acuTableConf = ServerConfiguration.getTableConfiguration(instance, session.threadPoolExtent.getTableId().toString());
+          long maxResultsSize = acuTableConf.getMemoryInBytes(Property.TABLE_SCAN_MAXMEM);
           long bytesAdded = 0;
           long maxScanTime = 4000;
           

Modified: accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java (original)
+++ accumulo/branches/ACCUMULO-578/server/src/main/java/org/apache/accumulo/server/util/EmbeddedWebServer.java Tue Jun  5 11:53:48 2012
@@ -16,29 +16,25 @@
  */
 package org.apache.accumulo.server.util;
 
-import java.lang.reflect.Method;
-
 import javax.servlet.http.HttpServlet;
 
-// Work very hard to make this jetty stuff work with Hadoop 0.20 and 0.19.0 which changed
-// the version of jetty from 5.1.4 to 6.1.14.
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.server.monitor.Monitor;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.jetty.security.SslSocketConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.SessionHandler;
 
 public class EmbeddedWebServer {
   
   public static EmbeddedWebServer create(int port) throws ClassNotFoundException {
-    try {
-      return new EmbeddedWebServer5_1(port);
-    } catch (ClassNotFoundException ex) {
-      return new EmbeddedWebServer6_1(port);
-    }
+    return new EmbeddedWebServer6_1(port);
   }
   
   public static EmbeddedWebServer create() throws ClassNotFoundException {
-    try {
-      return new EmbeddedWebServer5_1();
-    } catch (ClassNotFoundException ex) {
-      return new EmbeddedWebServer6_1();
-    }
+    return new EmbeddedWebServer6_1();
   }
   
   public void addServlet(Class<? extends HttpServlet> klass, String where) {}
@@ -51,61 +47,57 @@ public class EmbeddedWebServer {
   
   public void stop() {}
   
+  public boolean isUsingSsl() {
+    return false;
+  }
+  
   static public class EmbeddedWebServer6_1 extends EmbeddedWebServer {
     // 6.1
-    Object server = null;
-    Object sock;
-    Object handler;
+    Server server = null;
+    SocketConnector sock;
+    ContextHandlerCollection handler;
+    Context root;
+    boolean usingSsl;
     
     public EmbeddedWebServer6_1() throws ClassNotFoundException {
       this(0);
     }
     
-    public EmbeddedWebServer6_1(int port) throws ClassNotFoundException {
-      // Works for both
-      try {
-        ClassLoader loader = this.getClass().getClassLoader();
-        server = loader.loadClass("org.mortbay.jetty.Server").getConstructor().newInstance();
-        sock = loader.loadClass("org.mortbay.jetty.bio.SocketConnector").getConstructor().newInstance();
-        handler = loader.loadClass("org.mortbay.jetty.servlet.ServletHandler").getConstructor().newInstance();
-        Method method = sock.getClass().getMethod("setPort", Integer.TYPE);
-        method.invoke(sock, port);
-      } catch (ClassNotFoundException ex) {
-        throw ex;
-      } catch (Exception e) {
-        throw new RuntimeException(e);
+    public EmbeddedWebServer6_1(int port) {
+      server = new Server();
+      handler = new ContextHandlerCollection();
+      root = new Context(handler, "/", new SessionHandler(), null, null, null);
+      
+      if (Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTORE) == ""
+          || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTOREPASS) == ""
+          || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTORE) == ""
+          || Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTOREPASS) == "") {
+        sock = new SocketConnector();
+        usingSsl = false;
+      } else {
+        sock = new SslSocketConnector();
+        ((SslSocketConnector) sock).setKeystore(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTORE));
+        ((SslSocketConnector) sock).setKeyPassword(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_KEYSTOREPASS));
+        ((SslSocketConnector) sock).setTruststore(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTORE));
+        ((SslSocketConnector) sock).setTrustPassword(Monitor.getSystemConfiguration().get(Property.MONITOR_SSL_TRUSTSTOREPASS));
+        usingSsl = true;
       }
+      sock.setPort(port);
     }
     
     public void addServlet(Class<? extends HttpServlet> klass, String where) {
-      try {
-        Method method = handler.getClass().getMethod("addServletWithMapping", klass.getClass(), where.getClass());
-        method.invoke(handler, klass, where);
-      } catch (Exception ex) {
-        throw new RuntimeException(ex);
-      }
+      root.addServlet(klass, where);
     }
     
     public int getPort() {
-      try {
-        
-        Method method = sock.getClass().getMethod("getLocalPort");
-        return (Integer) method.invoke(sock);
-      } catch (Exception ex) {
-        throw new RuntimeException(ex);
-      }
+      return sock.getLocalPort();
     }
     
     public void start() {
       try {
-        Class<?> klass = server.getClass().getClassLoader().loadClass("org.mortbay.jetty.Connector");
-        Method method = server.getClass().getMethod("addConnector", klass);
-        method.invoke(server, sock);
-        klass = server.getClass().getClassLoader().loadClass("org.mortbay.jetty.Handler");
-        method = server.getClass().getMethod("setHandler", klass);
-        method.invoke(server, handler);
-        method = server.getClass().getMethod("start");
-        method.invoke(server);
+        server.addConnector(sock);
+        server.setHandler(handler);
+        server.start();
       } catch (Exception e) {
         stop();
         throw new RuntimeException(e);
@@ -114,81 +106,14 @@ public class EmbeddedWebServer {
     
     public void stop() {
       try {
-        Method method = server.getClass().getMethod("stop");
-        method.invoke(server);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-  
-  static public class EmbeddedWebServer5_1 extends EmbeddedWebServer {
-    Object sock;
-    Object server = null;
-    
-    public EmbeddedWebServer5_1() throws ClassNotFoundException {
-      this(0);
-    }
-    
-    public EmbeddedWebServer5_1(int port) throws ClassNotFoundException {
-      Method method;
-      try {
-        ClassLoader loader = this.getClass().getClassLoader();
-        server = loader.loadClass("org.mortbay.jetty.Server").getConstructor().newInstance();
-        sock = loader.loadClass("org.mortbay.http.SocketListener").getConstructor().newInstance();
-        method = sock.getClass().getMethod("setPort", Integer.TYPE);
-        method.invoke(sock, port);
-      } catch (ClassNotFoundException ex) {
-        throw ex;
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-      
-    }
-    
-    public void addServlet(Class<? extends HttpServlet> klass, String where) {
-      try {
-        Method method = server.getClass().getMethod("getContext", String.class);
-        Object ctx = method.invoke(server, "/");
-        method = ctx.getClass().getMethod("addServlet", String.class, String.class, String.class);
-        method.invoke(ctx, where, where, klass.getName());
-        Class<?> httpContextClass = this.getClass().getClassLoader().loadClass("org.mortbay.http.HttpContext");
-        method = server.getClass().getMethod("addContext", httpContextClass);
-        method.invoke(server, ctx);
-      } catch (Exception ex) {
-        throw new RuntimeException(ex);
-      }
-    }
-    
-    public int getPort() {
-      try {
-        Method method = sock.getClass().getMethod("getPort");
-        return (Integer) method.invoke(sock);
+        server.stop();
       } catch (Exception e) {
         throw new RuntimeException(e);
       }
     }
     
-    public void start() {
-      try {
-        Class<?> listener = getClass().getClassLoader().loadClass("org.mortbay.http.HttpListener");
-        Method method = server.getClass().getMethod("addListener", listener);
-        method.invoke(server, sock);
-        method = server.getClass().getMethod("start");
-        method.invoke(server);
-      } catch (Exception e) {
-        stop();
-        throw new RuntimeException(e);
-      }
-    }
-    
-    public void stop() {
-      try {
-        Method method = server.getClass().getMethod("stop");
-        method.invoke(server);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
+    public boolean isUsingSsl() {
+      return usingSsl;
     }
   }
 }

Modified: accumulo/branches/ACCUMULO-578/server/src/main/resources/web/screen.css
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-578/server/src/main/resources/web/screen.css?rev=1346360&r1=1346359&r2=1346360&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-578/server/src/main/resources/web/screen.css (original)
+++ accumulo/branches/ACCUMULO-578/server/src/main/resources/web/screen.css Tue Jun  5 11:53:48 2012
@@ -341,3 +341,48 @@ pre.logevent {
     border: 1px solid #c4c4c4;
     background-color: #ffffff;
 }
+
+#shell {
+    text-align: left;
+    color: #55d839;
+    border: 1px;
+    padding-left: 5px;
+    background-color: #000000;
+    height: 40em;
+    overflow: auto;
+    font-family: Monaco, monospace;
+    font-size: 100%;
+}
+
+#shell span {
+    display: inline;
+}
+
+#shell input {
+    display: inline;
+    border: none;
+    width: 60%;
+    color: #55d839;
+    background-color: #000000;
+    font-family: Monaco, monospace;
+    font-size: 100%;
+}
+
+#shell pre {
+    font-family: Monaco, monospace;
+    font-size: 100%;
+}
+
+#login {
+    text-align: left;
+}
+
+#login table {
+    margin-left: 0;
+    min-width: 0%;
+}
+
+#loginError {
+    text-align: left;
+    color: red;
+}

Propchange: accumulo/branches/ACCUMULO-578/src/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/src:r1345121-1346359



Mime
View raw message