accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [04/61] [abbrv] [partial] accumulo git commit: ACCUMULO-722 put trunk in my sandbox
Date Thu, 03 Mar 2016 21:59:29 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
new file mode 100644
index 0000000..525d9bb
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+
+import jline.ConsoleReader;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.util.BadArgumentException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.Token;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+
+public class ConfigCommand extends Command {
+  private Option tableOpt, deleteOpt, setOpt, filterOpt, disablePaginationOpt;
+  
+  private int COL1 = 8, COL2 = 7;
+  private ConsoleReader reader;
+  
+  @Override
+  public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) {
+    Token cmd = new Token(getName());
+    Token sub = new Token("-" + setOpt.getOpt());
+    for (Property p : Property.values()) {
+      if (!(p.getKey().endsWith(".")))
+        sub.addSubcommand(new Token(p.toString()));
+    }
+    cmd.addSubcommand(sub);
+    root.addSubcommand(cmd);
+  }
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+      IOException, ClassNotFoundException {
+    reader = shellState.getReader();
+    
+    String tableName = cl.getOptionValue(tableOpt.getOpt());
+    if (tableName != null && !shellState.getConnector().tableOperations().exists(tableName))
+      throw new TableNotFoundException(null, tableName, null);
+    
+    if (cl.hasOption(deleteOpt.getOpt())) {
+      // delete property from table
+      String property = cl.getOptionValue(deleteOpt.getOpt());
+      if (property.contains("="))
+        throw new BadArgumentException("Invalid '=' operator in delete operation.", fullCommand, fullCommand.indexOf('='));
+      if (tableName != null) {
+        if (!Property.isValidTablePropertyKey(property))
+          Shell.log.warn("Invalid per-table property : " + property + ", still removing from zookeeper if it's there.");
+        
+        shellState.getConnector().tableOperations().removeProperty(tableName, property);
+        Shell.log.debug("Successfully deleted table configuration option.");
+      } else {
+        if (!Property.isValidZooPropertyKey(property))
+          Shell.log.warn("Invalid per-table property : " + property + ", still removing from zookeeper if it's there.");
+        shellState.getConnector().instanceOperations().removeProperty(property);
+        Shell.log.debug("Successfully deleted system configuration option");
+      }
+    } else if (cl.hasOption(setOpt.getOpt())) {
+      // set property on table
+      String property = cl.getOptionValue(setOpt.getOpt()), value = null;
+      if (!property.contains("="))
+        throw new BadArgumentException("Missing '=' operator in set operation.", fullCommand, fullCommand.indexOf(property));
+      
+      String pair[] = property.split("=", 2);
+      property = pair[0];
+      value = pair[1];
+      
+      if (tableName != null) {
+        if (!Property.isValidTablePropertyKey(property))
+          throw new BadArgumentException("Invalid per-table property.", fullCommand, fullCommand.indexOf(property));
+        
+        if (property.equals(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey()))
+          new ColumnVisibility(value); // validate that it is a valid expression
+          
+        shellState.getConnector().tableOperations().setProperty(tableName, property, value);
+        Shell.log.debug("Successfully set table configuration option.");
+      } else {
+        if (!Property.isValidZooPropertyKey(property))
+          throw new BadArgumentException("Property cannot be modified in zookeeper", fullCommand, fullCommand.indexOf(property));
+        
+        shellState.getConnector().instanceOperations().setProperty(property, value);
+        Shell.log.debug("Successfully set system configuration option");
+      }
+    } else {
+      // display properties
+      TreeMap<String,String> systemConfig = new TreeMap<String,String>();
+      systemConfig.putAll(shellState.getConnector().instanceOperations().getSystemConfiguration());
+      
+      TreeMap<String,String> siteConfig = new TreeMap<String,String>();
+      siteConfig.putAll(shellState.getConnector().instanceOperations().getSiteConfiguration());
+      
+      TreeMap<String,String> defaults = new TreeMap<String,String>();
+      for (Entry<String,String> defaultEntry : AccumuloConfiguration.getDefaultConfiguration())
+        defaults.put(defaultEntry.getKey(), defaultEntry.getValue());
+      
+      Iterable<Entry<String,String>> acuconf = shellState.getConnector().instanceOperations().getSystemConfiguration().entrySet();
+      if (tableName != null)
+        acuconf = shellState.getConnector().tableOperations().getProperties(tableName);
+      
+      TreeMap<String,String> sortedConf = new TreeMap<String,String>();
+      for (Entry<String,String> propEntry : acuconf) {
+        sortedConf.put(propEntry.getKey(), propEntry.getValue());
+      }
+      
+      for (Entry<String,String> propEntry : acuconf) {
+        String key = propEntry.getKey();
+        // only show properties with similar names to that
+        // specified, or all of them if none specified
+        if (cl.hasOption(filterOpt.getOpt()) && !key.contains(cl.getOptionValue(filterOpt.getOpt())))
+          continue;
+        if (tableName != null && !Property.isValidTablePropertyKey(key))
+          continue;
+        COL2 = Math.max(COL2, propEntry.getKey().length() + 3);
+      }
+      
+      ArrayList<String> output = new ArrayList<String>();
+      printConfHeader(output);
+      
+      for (Entry<String,String> propEntry : sortedConf.entrySet()) {
+        String key = propEntry.getKey();
+        
+        // only show properties with similar names to that
+        // specified, or all of them if none specified
+        if (cl.hasOption(filterOpt.getOpt()) && !key.contains(cl.getOptionValue(filterOpt.getOpt())))
+          continue;
+        
+        if (tableName != null && !Property.isValidTablePropertyKey(key))
+          continue;
+        
+        String siteVal = siteConfig.get(key);
+        String sysVal = systemConfig.get(key);
+        String curVal = propEntry.getValue();
+        String dfault = defaults.get(key);
+        boolean printed = false;
+        
+        if (dfault != null && key.toLowerCase().contains("password")) {
+          dfault = curVal = curVal.replaceAll(".", "*");
+        }
+        if (sysVal != null) {
+          if (defaults.containsKey(key)) {
+            printConfLine(output, "default", key, dfault);
+            printed = true;
+          }
+          if (!defaults.containsKey(key) || !defaults.get(key).equals(siteVal)) {
+            printConfLine(output, "site", printed ? "   @override" : key, siteVal == null ? "" : siteVal);
+            printed = true;
+          }
+          if (!siteConfig.containsKey(key) || !siteVal.equals(sysVal)) {
+            printConfLine(output, "system", printed ? "   @override" : key, sysVal == null ? "" : sysVal);
+            printed = true;
+          }
+        }
+        
+        // show per-table value only if it is different (overridden)
+        if (tableName != null && !curVal.equals(sysVal))
+          printConfLine(output, "table", printed ? "   @override" : key, curVal);
+      }
+      printConfFooter(output);
+      shellState.printLines(output.iterator(), !cl.hasOption(disablePaginationOpt.getOpt()));
+    }
+    return 0;
+  }
+  
+  private void printConfHeader(ArrayList<String> output) {
+    printConfFooter(output);
+    output.add(String.format("%-" + COL1 + "s | %-" + COL2 + "s | %s", "SCOPE", "NAME", "VALUE"));
+    printConfFooter(output);
+  }
+  
+  private void printConfLine(ArrayList<String> output, String s1, String s2, String s3) {
+    if (s2.length() < COL2)
+      s2 += " " + Shell.repeat(".", COL2 - s2.length() - 1);
+    output.add(String.format("%-" + COL1 + "s | %-" + COL2 + "s | %s", s1, s2,
+        s3.replace("\n", "\n" + Shell.repeat(" ", COL1 + 1) + "|" + Shell.repeat(" ", COL2 + 2) + "|" + " ")));
+  }
+  
+  private void printConfFooter(ArrayList<String> output) {
+    int col3 = Math.max(1, Math.min(Integer.MAX_VALUE, reader.getTermwidth() - COL1 - COL2 - 6));
+    output.add(String.format("%" + COL1 + "s-+-%" + COL2 + "s-+-%-" + col3 + "s", Shell.repeat("-", COL1), Shell.repeat("-", COL2), Shell.repeat("-", col3)));
+  }
+  
+  @Override
+  public String description() {
+    return "prints system properties and table specific properties";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    OptionGroup og = new OptionGroup();
+    
+    tableOpt = new Option(Shell.tableOption, "table", true, "table to display/set/delete properties for");
+    deleteOpt = new Option("d", "delete", true, "delete a per-table property");
+    setOpt = new Option("s", "set", true, "set a per-table property");
+    filterOpt = new Option("f", "filter", true, "show only properties that contain this string");
+    disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output");
+    
+    tableOpt.setArgName("table");
+    deleteOpt.setArgName("property");
+    setOpt.setArgName("property=value");
+    filterOpt.setArgName("string");
+    
+    og.addOption(deleteOpt);
+    og.addOption(setOpt);
+    og.addOption(filterOpt);
+    
+    o.addOption(tableOpt);
+    o.addOptionGroup(og);
+    o.addOption(disablePaginationOpt);
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
new file mode 100644
index 0000000..65424bd
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.constraints.Constraint;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.ShellCommandException;
+import org.apache.accumulo.core.util.shell.ShellCommandException.ErrorCode;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+public class ConstraintCommand extends Command {
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    int i;
+    
+    switch (OptUtil.getAldOpt(cl)) {
+      case ADD:
+        for (String constraint : cl.getArgs()) {
+          if (!shellState.getConnector().instanceOperations().testClassLoad(constraint, Constraint.class.getName()))
+            throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + constraint + " as type "
+                + Constraint.class.getName());
+          i = shellState.getConnector().tableOperations().addConstraint(tableName, constraint);
+          shellState.getReader().printString("Added constraint " + constraint + " to table " + tableName + " with number " + i + "\n");
+        }
+        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");
+        }
+        break;
+      case LIST:
+        for (Entry<String,Integer> property : shellState.getConnector().tableOperations().listConstraints(tableName).entrySet())
+          shellState.getReader().printString(property.toString() + "\n");
+    }
+    
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "adds, deletes, or lists constraints for a table";
+  }
+  
+  @Override
+  public int numArgs() {
+    return Shell.NO_FIXED_ARG_LENGTH_CHECK;
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <constraint>{ <constraint>}";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    o.addOptionGroup(OptUtil.addListDeleteGroup("constraint"));
+    o.addOption(OptUtil.tableOpt("table to add, delete, or list constraints for"));
+    return o;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
new file mode 100644
index 0000000..b7d4b67
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map.Entry;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.admin.TimeType;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.iterators.IteratorUtil;
+import org.apache.accumulo.core.security.VisibilityConstraint;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.hadoop.io.Text;
+
+public class CreateTableCommand extends Command {
+  private Option createTableOptCopySplits;
+  private Option createTableOptCopyConfig;
+  private Option createTableOptSplit;
+  private Option createTableOptTimeLogical;
+  private Option createTableOptTimeMillis;
+  private Option createTableNoDefaultIters;
+  private Option createTableOptEVC;
+  private Option base64Opt;
+  private Option createTableOptFormatter;
+  public static String testTable;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableExistsException,
+      TableNotFoundException, IOException, ClassNotFoundException {
+    
+    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");
+      throw new IllegalArgumentException();
+    }
+    
+    String tableName = cl.getArgs()[0];
+    if (shellState.getConnector().tableOperations().exists(tableName))
+      throw new TableExistsException(null, tableName, null);
+    
+    SortedSet<Text> partitions = new TreeSet<Text>();
+    boolean decode = cl.hasOption(base64Opt.getOpt());
+    
+    if (cl.hasOption(createTableOptSplit.getOpt())) {
+      String f = cl.getOptionValue(createTableOptSplit.getOpt());
+      
+      String line;
+      java.util.Scanner file = new java.util.Scanner(new File(f));
+      while (file.hasNextLine()) {
+        line = file.nextLine();
+        if (!line.isEmpty())
+          partitions.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
+      }
+    } else if (cl.hasOption(createTableOptCopySplits.getOpt())) {
+      String oldTable = cl.getOptionValue(createTableOptCopySplits.getOpt());
+      if (!shellState.getConnector().tableOperations().exists(oldTable))
+        throw new TableNotFoundException(null, oldTable, null);
+      partitions.addAll(shellState.getConnector().tableOperations().getSplits(oldTable));
+    }
+    
+    if (cl.hasOption(createTableOptCopyConfig.getOpt())) {
+      String oldTable = cl.getOptionValue(createTableOptCopyConfig.getOpt());
+      if (!shellState.getConnector().tableOperations().exists(oldTable))
+        throw new TableNotFoundException(null, oldTable, null);
+    }
+    
+    TimeType timeType = TimeType.MILLIS;
+    if (cl.hasOption(createTableOptTimeLogical.getOpt()))
+      timeType = TimeType.LOGICAL;
+    
+    // create table
+    shellState.getConnector().tableOperations().create(tableName, true, timeType);
+    if (partitions.size() > 0)
+      shellState.getConnector().tableOperations().addSplits(tableName, partitions);
+    
+    shellState.setTableName(tableName); // switch shell to new table
+    // context
+    
+    if (cl.hasOption(createTableNoDefaultIters.getOpt())) {
+      for (String key : IteratorUtil.generateInitialTableProperties().keySet())
+        shellState.getConnector().tableOperations().removeProperty(tableName, key);
+    }
+    
+    // Copy options if flag was set
+    if (cl.hasOption(createTableOptCopyConfig.getOpt())) {
+      if (shellState.getConnector().tableOperations().exists(tableName)) {
+        Iterable<Entry<String,String>> configuration = shellState.getConnector().tableOperations()
+            .getProperties(cl.getOptionValue(createTableOptCopyConfig.getOpt()));
+        for (Entry<String,String> entry : configuration) {
+          if (Property.isValidTablePropertyKey(entry.getKey())) {
+            shellState.getConnector().tableOperations().setProperty(tableName, entry.getKey(), entry.getValue());
+          }
+        }
+      }
+    }
+    
+    if (cl.hasOption(createTableOptEVC.getOpt())) {
+      try {
+        shellState.getConnector().tableOperations().addConstraint(tableName, VisibilityConstraint.class.getName());
+      } catch (AccumuloException e) {
+        Shell.log.warn(e.getMessage() + " while setting visibility constraint, but table was created");
+      }
+    }
+    
+    // Load custom formatter if set
+    if (cl.hasOption(createTableOptFormatter.getOpt())) {
+      String formatterClass = cl.getOptionValue(createTableOptFormatter.getOpt());
+      
+      shellState.getConnector().tableOperations().setProperty(tableName, Property.TABLE_FORMATTER_CLASS.toString(), formatterClass);
+    }
+    
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "creates a new table, with optional aggregators and optionally pre-split";
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <tableName>";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    
+    createTableOptCopyConfig = new Option("cc", "copy-config", true, "table to copy configuration from");
+    createTableOptCopySplits = new Option("cs", "copy-splits", true, "table to copy current splits from");
+    createTableOptSplit = new Option("sf", "splits-file", true, "file with a newline-separated list of rows to split the table with");
+    createTableOptTimeLogical = new Option("tl", "time-logical", false, "use logical time");
+    createTableOptTimeMillis = new Option("tm", "time-millis", false, "use time in milliseconds");
+    createTableNoDefaultIters = new Option("ndi", "no-default-iterators", false, "prevent creation of the normal default iterator set");
+    createTableOptEVC = new Option("evc", "enable-visibility-constraint", false,
+        "prevent users from writing data they cannot read.  When enabling this, consider disabling bulk import and alter table.");
+    createTableOptFormatter = new Option("f", "formatter", true, "default formatter to set");
+    
+    createTableOptCopyConfig.setArgName("table");
+    createTableOptCopySplits.setArgName("table");
+    createTableOptSplit.setArgName("filename");
+    createTableOptFormatter.setArgName("className");
+    
+    // Splits and CopySplits are put in an optionsgroup to make them
+    // mutually exclusive
+    OptionGroup splitOrCopySplit = new OptionGroup();
+    splitOrCopySplit.addOption(createTableOptSplit);
+    splitOrCopySplit.addOption(createTableOptCopySplits);
+    
+    OptionGroup timeGroup = new OptionGroup();
+    timeGroup.addOption(createTableOptTimeLogical);
+    timeGroup.addOption(createTableOptTimeMillis);
+    
+    base64Opt = new Option("b64", "base64encoded", false, "decode encoded split points");
+    o.addOption(base64Opt);
+    
+    o.addOptionGroup(splitOrCopySplit);
+    o.addOptionGroup(timeGroup);
+    o.addOption(createTableOptSplit);
+    o.addOption(createTableOptCopyConfig);
+    o.addOption(createTableNoDefaultIters);
+    o.addOption(createTableOptEVC);
+    o.addOption(createTableOptFormatter);
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
new file mode 100644
index 0000000..3ade50d
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class CreateUserCommand extends Command {
+  private Option scanOptAuths;
+  
+  static Authorizations parseAuthorizations(String field) {
+    if (field == null || field.isEmpty())
+      return Constants.NO_AUTHS;
+    return new Authorizations(field.split(","));
+  }
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, TableNotFoundException, AccumuloSecurityException,
+      TableExistsException, IOException {
+    String user = cl.getArgs()[0];
+    String password = null;
+    String passwordConfirm = null;
+    
+    password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
+    if (password == null) {
+      shellState.getReader().printNewline();
+      return 0;
+    } // user canceled
+    passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
+    if (passwordConfirm == null) {
+      shellState.getReader().printNewline();
+      return 0;
+    } // user canceled
+    
+    if (!password.equals(passwordConfirm))
+      throw new IllegalArgumentException("Passwords do not match");
+    
+    Authorizations authorizations = parseAuthorizations(cl.hasOption(scanOptAuths.getOpt()) ? cl.getOptionValue(scanOptAuths.getOpt()) : "");
+    shellState.getConnector().securityOperations().createUser(user, password.getBytes(), authorizations);
+    Shell.log.debug("Created user " + user + " with" + (authorizations.isEmpty() ? " no" : "") + " initial scan authorizations"
+        + (!authorizations.isEmpty() ? " " + authorizations : ""));
+    return 0;
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <username>";
+  }
+  
+  @Override
+  public String description() {
+    return "creates a new user";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    scanOptAuths = new Option("s", "scan-authorizations", true, "scan authorizations");
+    scanOptAuths.setArgName("comma-separated-authorizations");
+    o.addOption(scanOptAuths);
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
new file mode 100644
index 0000000..54d0c7e
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.util.TableDiskUsage;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+
+public class DUCommand extends Command {
+  
+  private Option optTablePattern;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws IOException, TableNotFoundException {
+    
+    SortedSet<String> tablesToFlush = new TreeSet<String>(Arrays.asList(cl.getArgs()));
+    if (cl.hasOption(optTablePattern.getOpt())) {
+      for (String table : shellState.getConnector().tableOperations().list())
+        if (table.matches(cl.getOptionValue(optTablePattern.getOpt())))
+          tablesToFlush.add(table);
+    }
+    try {
+      AccumuloConfiguration acuConf = new ConfigurationCopy(shellState.getConnector().instanceOperations().getSystemConfiguration());
+      TableDiskUsage.printDiskUsage(acuConf, tablesToFlush, FileSystem.get(new Configuration()), shellState.getConnector());
+    } catch (Exception ex) {
+      throw new RuntimeException(ex);
+    }
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "prints how much space is used by files referenced by a table.  When multiple tables are specified it prints how much space is used by files shared between tables, if any.";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    
+    optTablePattern = new Option("p", "pattern", true, "regex pattern of table names");
+    optTablePattern.setArgName("pattern");
+    
+    o.addOption(optTablePattern);
+    
+    return o;
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <table>{ <table>}";
+  }
+  
+  @Override
+  public int numArgs() {
+    return Shell.NO_FIXED_ARG_LENGTH_CHECK;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
new file mode 100644
index 0000000..118b797
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DebugCommand.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.accumulo.core.util.BadArgumentException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.Token;
+import org.apache.commons.cli.CommandLine;
+
+public class DebugCommand extends Command {
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws IOException {
+    if (cl.getArgs().length == 1) {
+      if (cl.getArgs()[0].equalsIgnoreCase("on"))
+        Shell.setDebugging(true);
+      else if (cl.getArgs()[0].equalsIgnoreCase("off"))
+        Shell.setDebugging(false);
+      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(Shell.isDebuggingEnabled() ? "on\n" : "off\n");
+    } else {
+      shellState.printException(new IllegalArgumentException("Expected 0 or 1 argument. There were " + cl.getArgs().length + "."));
+      printHelp(shellState);
+      return 1;
+    }
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "turns debug logging on or off";
+  }
+  
+  @Override
+  public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> special) {
+    Token debug_command = new Token(getName());
+    debug_command.addSubcommand(Arrays.asList(new String[] {"on", "off"}));
+    root.addSubcommand(debug_command);
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " [ on | off ]";
+  }
+  
+  @Override
+  public int numArgs() {
+    return Shell.NO_FIXED_ARG_LENGTH_CHECK;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteCommand.java
new file mode 100644
index 0000000..dd39a72
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteCommand.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.hadoop.io.Text;
+
+public class DeleteCommand extends Command {
+  private Option deleteOptAuths, timestampOpt;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+      IOException, ConstraintViolationException {
+    shellState.checkTableState();
+    
+    Mutation m = new Mutation(new Text(cl.getArgs()[0].getBytes(Shell.CHARSET)));
+    Text colf = new Text(cl.getArgs()[1].getBytes(Shell.CHARSET));
+    Text colq = new Text(cl.getArgs()[2].getBytes(Shell.CHARSET));
+    
+    if (cl.hasOption(deleteOptAuths.getOpt())) {
+      ColumnVisibility le = new ColumnVisibility(cl.getOptionValue(deleteOptAuths.getOpt()));
+      if (cl.hasOption(timestampOpt.getOpt()))
+        m.putDelete(colf, colq, le, Long.parseLong(cl.getOptionValue(timestampOpt.getOpt())));
+      else
+        m.putDelete(colf, colq, le);
+    } else if (cl.hasOption(timestampOpt.getOpt()))
+      m.putDelete(colf, colq, Long.parseLong(cl.getOptionValue(timestampOpt.getOpt())));
+    else
+      m.putDelete(colf, colq);
+    
+    BatchWriter bw = shellState.getConnector().createBatchWriter(shellState.getTableName(), m.estimatedMemoryUsed() + 0L, 0L, 1);
+    bw.addMutation(m);
+    bw.close();
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a record from a table";
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <row> <colfamily> <colqualifier>";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    
+    deleteOptAuths = new Option("l", "visibility-label", true, "formatted visibility");
+    deleteOptAuths.setArgName("expression");
+    o.addOption(deleteOptAuths);
+    
+    timestampOpt = new Option("ts", "timestamp", true, "timestamp to use for deletion");
+    timestampOpt.setArgName("timestamp");
+    o.addOption(timestampOpt);
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 3;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
new file mode 100644
index 0000000..3a38d1d
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.EnumSet;
+
+import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class DeleteIterCommand extends Command {
+  private Option mincScopeOpt, majcScopeOpt, scanScopeOpt, nameOpt;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    
+    String name = cl.getOptionValue(nameOpt.getOpt());
+    if (!shellState.getConnector().tableOperations().listIterators(tableName).containsKey(name)) {
+      Shell.log.warn("no iterators found that match your criteria");
+      return 0;
+    }
+    
+    EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class);
+    if (cl.hasOption(mincScopeOpt.getOpt()))
+      scopes.add(IteratorScope.minc);
+    if (cl.hasOption(majcScopeOpt.getOpt()))
+      scopes.add(IteratorScope.majc);
+    if (cl.hasOption(scanScopeOpt.getOpt()))
+      scopes.add(IteratorScope.scan);
+    if (scopes.isEmpty())
+      throw new IllegalArgumentException("You must select at least one scope to configure");
+    shellState.getConnector().tableOperations().removeIterator(tableName, name, scopes);
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a table-specific iterator";
+  }
+  
+  public Options getOptions() {
+    Options o = new Options();
+    
+    nameOpt = new Option("n", "name", true, "iterator to delete");
+    nameOpt.setArgName("itername");
+    nameOpt.setRequired(true);
+    
+    mincScopeOpt = new Option(IteratorScope.minc.name(), "minor-compaction", false, "remove from minor compaction scope");
+    majcScopeOpt = new Option(IteratorScope.majc.name(), "major-compaction", false, "remove from major compaction scope");
+    scanScopeOpt = new Option(IteratorScope.scan.name(), "scan-time", false, "remove from scan scope");
+    
+    o.addOption(OptUtil.tableOpt("table to delete the iterator from"));
+    o.addOption(nameOpt);
+    
+    o.addOption(mincScopeOpt);
+    o.addOption(majcScopeOpt);
+    o.addOption(scanScopeOpt);
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteManyCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteManyCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteManyCommand.java
new file mode 100644
index 0000000..44b80e6
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteManyCommand.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.iterators.SortedKeyIterator;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.format.DeleterFormatter;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+public class DeleteManyCommand extends ScanCommand {
+  private Option forceOpt;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+      IOException, ParseException {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    
+    // handle first argument, if present, the authorizations list to
+    // scan with
+    Authorizations auths = getAuths(cl, shellState);
+    final Scanner scanner = shellState.getConnector().createScanner(tableName, auths);
+    
+    scanner.addScanIterator(new IteratorSetting(Integer.MAX_VALUE, "NOVALUE", SortedKeyIterator.class));
+    
+    // handle remaining optional arguments
+    scanner.setRange(getRange(cl));
+    
+    // handle columns
+    fetchColumns(cl, scanner);
+    
+    // output / delete the records
+    BatchWriter writer = shellState.getConnector().createBatchWriter(tableName, 1024 * 1024, 1000L, 4);
+    shellState.printLines(new DeleterFormatter(writer, scanner, cl.hasOption(timestampOpt.getOpt()), shellState, cl.hasOption(forceOpt.getOpt())), false);
+    
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "scans a table and deletes the resulting records";
+  }
+  
+  @Override
+  public Options getOptions() {
+    forceOpt = new Option("f", "force", false, "force deletion without prompting");
+    Options opts = super.getOptions();
+    opts.addOption(forceOpt);
+    opts.addOption(OptUtil.tableOpt("table to delete entries from"));
+    return opts;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java
new file mode 100644
index 0000000..887eeaa
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteRowsCommand.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.hadoop.io.Text;
+
+public class DeleteRowsCommand extends Command {
+  private Option forceOpt;
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, final Shell shellState) throws Exception {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    Text startRow = OptUtil.getStartRow(cl);
+    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");
+      return 1;
+    }
+    shellState.getConnector().tableOperations().deleteRows(tableName, startRow, endRow);
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a range of rows in a table.  Note that rows matching the start row ARE NOT deleted, but rows matching the end row ARE deleted.";
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    forceOpt = new Option("f", "force", false, "delete data even if start or end are not specified");
+    o.addOption(OptUtil.startRowOpt());
+    o.addOption(OptUtil.endRowOpt());
+    o.addOption(OptUtil.tableOpt("table to delete a row range from"));
+    o.addOption(forceOpt);
+    return o;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteScanIterCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteScanIterCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteScanIterCommand.java
new file mode 100644
index 0000000..90c78c8
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteScanIterCommand.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+
+public class DeleteScanIterCommand extends Command {
+  private Option nameOpt, allOpt;
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    
+    if (cl.hasOption(allOpt.getOpt())) {
+      List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.remove(tableName);
+      if (tableScanIterators == null)
+        Shell.log.info("No scan iterators set on table " + tableName);
+      else
+        Shell.log.info("Removed the following scan iterators from table " + tableName + ":" + tableScanIterators);
+    } else if (cl.hasOption(nameOpt.getOpt())) {
+      String name = cl.getOptionValue(nameOpt.getOpt());
+      List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(tableName);
+      if (tableScanIterators != null) {
+        boolean found = false;
+        for (Iterator<IteratorSetting> iter = tableScanIterators.iterator(); iter.hasNext();) {
+          if (iter.next().getName().equals(name)) {
+            iter.remove();
+            found = true;
+            break;
+          }
+        }
+        if (!found)
+          Shell.log.info("No iterator named " + name + " found for table " + tableName);
+        else {
+          Shell.log.info("Removed scan iterator " + name + " from table " + tableName + " (" + shellState.scanIteratorOptions.get(tableName).size() + " left)");
+          if (shellState.scanIteratorOptions.get(tableName).size() == 0)
+            shellState.scanIteratorOptions.remove(tableName);
+        }
+      } else {
+        Shell.log.info("No iterator named " + name + " found for table " + tableName);
+      }
+    }
+    
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a table-specific scan iterator so it is no longer used during this shell session";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    
+    OptionGroup nameGroup = new OptionGroup();
+    
+    nameOpt = new Option("n", "name", true, "iterator to delete");
+    nameOpt.setArgName("itername");
+    
+    allOpt = new Option("a", "all", false, "delete all scan iterators");
+    allOpt.setArgName("all");
+    
+    nameGroup.addOption(nameOpt);
+    nameGroup.addOption(allOpt);
+    nameGroup.setRequired(true);
+    o.addOptionGroup(nameGroup);
+    o.addOption(OptUtil.tableOpt("table to delete scan iterators from"));
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java
new file mode 100644
index 0000000..ad2fd39
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteTableCommand.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class DeleteTableCommand extends TableOperation {
+  private Option forceOpt;
+  
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    if (cl.hasOption(forceOpt.getOpt()))
+      super.force();
+    else
+      super.noForce();
+    return super.execute(fullCommand, cl, shellState);
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a table";
+  }
+  
+  @Override
+  protected void doTableOp(Shell shellState, String tableName) throws Exception {
+    shellState.getConnector().tableOperations().delete(tableName);
+    shellState.getReader().printString("Table: [" + tableName + "] has been deleted. \n");
+    if (shellState.getTableName().equals(tableName))
+      shellState.setTableName("");
+  }
+  
+  @Override
+  public Options getOptions() {
+    forceOpt = new Option("f", "force", false, "force deletion without prompting");
+    Options opts = super.getOptions();
+    
+    opts.addOption(forceOpt);
+    return opts;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteUserCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteUserCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteUserCommand.java
new file mode 100644
index 0000000..4bc563e
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteUserCommand.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+public class DeleteUserCommand extends DropUserCommand {}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropTableCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropTableCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropTableCommand.java
new file mode 100644
index 0000000..3120d6b
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropTableCommand.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+public class DropTableCommand extends DeleteTableCommand {}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropUserCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropUserCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropUserCommand.java
new file mode 100644
index 0000000..ec38556
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DropUserCommand.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.util.BadArgumentException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.Token;
+import org.apache.commons.cli.CommandLine;
+
+public class DropUserCommand extends Command {
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException {
+    String user = cl.getArgs()[0];
+    if (shellState.getConnector().whoami().equals(user))
+      throw new BadArgumentException("You cannot delete yourself", fullCommand, fullCommand.indexOf(user));
+    shellState.getConnector().securityOperations().dropUser(user);
+    Shell.log.debug("Deleted user " + user);
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "deletes a user";
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <username>";
+  }
+  
+  @Override
+  public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) {
+    registerCompletionForUsers(root, completionSet);
+  }
+  
+  @Override
+  public int numArgs() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EGrepCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EGrepCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EGrepCommand.java
new file mode 100644
index 0000000..8cb6155
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EGrepCommand.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.iterators.user.RegExFilter;
+
+public class EGrepCommand extends GrepCommand {
+  @Override
+  protected void setUpIterator(int prio, String name, String term, BatchScanner scanner) throws IOException {
+    if (prio < 0)
+      throw new IllegalArgumentException("Priority < 0 " + prio);
+    
+    IteratorSetting si = new IteratorSetting(prio, name, RegExFilter.class);
+    RegExFilter.setRegexs(si, term, term, term, term, true);
+    scanner.addScanIterator(si);
+  }
+  
+  @Override
+  public String description() {
+    return "searches each row, column family, column qualifier and value, in parallel, on the server side (using a java Matcher, so put .* before and after your term if you're not matching the whole element)";
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <regex>{ <regex>}";
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EscapeTokenizer.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EscapeTokenizer.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EscapeTokenizer.java
new file mode 100644
index 0000000..8af005a
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/EscapeTokenizer.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * 
+ * EscapeTokenizer - Supports tokenizing with delimiters while being able to escape the delims. String "1,2,3,4" with delims "," = ["1", "2", "3", "4"] String
+ * "1\,2,3,4" with delims "," = ["1,2", "3", "4"]
+ * 
+ * - The escape char '\' only has a special meaning when it is before a delim String "1,\2,3,4" with delims "," = ["1" , "\2", "3", "4"]
+ * 
+ * - Multiple delims in a row are considered one delim String "1,,,,,,,,,,,,,,2,3,4","," with delims "," = ["1", "2", "3", "4"]
+ * 
+ */
+
+public class EscapeTokenizer implements Iterable<String> {
+  
+  private List<String> tokens;
+  
+  public EscapeTokenizer(String line, String delimeters) {
+    this.tokens = new ArrayList<String>();
+    preprocess(line, delimeters);
+  }
+  
+  private void preprocess(String line, String delimeters) {
+    StringTokenizer st = new StringTokenizer(line, delimeters, true);
+    boolean inEscape = false;
+    String current = "", prev = "";
+    List<String> toks = new ArrayList<String>();
+    
+    while (st.hasMoreTokens()) {
+      current = st.nextToken();
+      if (inEscape) {
+        prev += current;
+        inEscape = false;
+      } else {
+        inEscape = current.endsWith("\\");
+        if (inEscape)
+          prev = current.substring(0, current.length() - 1);
+        else {
+          if (current.length() == 1 && delimeters.contains(current)) {
+            if (!prev.isEmpty())
+              toks.add(prev);
+          } else
+            toks.add(prev + current);
+          prev = "";
+        }
+      }
+    }
+    if (!prev.isEmpty())
+      toks.add(prev);
+    this.tokens = toks;
+  }
+  
+  @Override
+  public Iterator<String> iterator() {
+    return this.tokens.iterator();
+  }
+  
+  public int count() {
+    return tokens.size();
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
new file mode 100644
index 0000000..32a54c9
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.File;
+
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class ExecfileCommand extends Command {
+  private Option verboseOption;
+  
+  @Override
+  public String description() {
+    return "specifies a file containing accumulo commands to execute";
+  }
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    java.util.Scanner scanner = new java.util.Scanner(new File(cl.getArgs()[0]));
+    while (scanner.hasNextLine())
+      shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt()));
+    return 0;
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <fileName>";
+  }
+  
+  @Override
+  public int numArgs() {
+    return 1;
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options opts = new Options();
+    verboseOption = new Option("v", "verbose", false, "display command prompt as commands are executed");
+    opts.addOption(verboseOption);
+    return opts;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExitCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExitCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExitCommand.java
new file mode 100644
index 0000000..cc41690
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExitCommand.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+
+public class ExitCommand extends Command {
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) {
+    shellState.setExit(true);
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "exits the shell";
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExportTableCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExportTableCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExportTableCommand.java
new file mode 100644
index 0000000..3b17b8b
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExportTableCommand.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.Token;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class ExportTableCommand extends Command {
+  
+  private Option tableOpt;
+
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+      TableExistsException {
+    
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+
+    shellState.getConnector().tableOperations().exportTable(tableName, cl.getArgs()[0]);
+    return 0;
+  }
+  
+  @Override
+  public String usage() {
+    return getName() + " <export dir>";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    
+    tableOpt = new Option(Shell.tableOption, "table", true, "table to export");
+    
+    tableOpt.setArgName("table");
+    
+    o.addOption(tableOpt);
+
+    return o;
+  }
+  
+  @Override
+  public String description() {
+    return "exports a table";
+  }
+  
+  public void registerCompletion(Token root, Map<Command.CompletionSet,Set<String>> completionSet) {
+    registerCompletionForTables(root, completionSet);
+  }
+  
+  @Override
+  public int numArgs() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java
new file mode 100644
index 0000000..7e7f9d5
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.hadoop.io.Text;
+
+public class FlushCommand extends TableOperation {
+  private Text startRow;
+  private Text endRow;
+  
+  private boolean wait;
+  private Option waitOpt;
+  
+  @Override
+  public String description() {
+    return "flushes a tables data that is currently in memory to disk";
+  }
+  
+  protected void doTableOp(Shell shellState, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+    shellState.getConnector().tableOperations().flush(tableName, startRow, endRow, wait);
+    Shell.log.info("Flush of table " + tableName + (wait ? " completed." : " initiated..."));
+    if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
+      Shell.log.info("  May need to flush " + Constants.METADATA_TABLE_NAME + " table multiple times.");
+      Shell.log.info("  Flushing " + Constants.METADATA_TABLE_NAME + " causes writes to itself and");
+      Shell.log.info("  minor compactions, which also cause writes to itself.");
+      Shell.log.info("  Check the monitor web page and give it time to settle.");
+    }
+  }
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    wait = cl.hasOption(waitOpt.getLongOpt());
+    startRow = OptUtil.getStartRow(cl);
+    endRow = OptUtil.getEndRow(cl);
+    return super.execute(fullCommand, cl, shellState);
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options opts = super.getOptions();
+    waitOpt = new Option("w", "wait", false, "wait for flush to finish");
+    opts.addOption(waitOpt);
+    opts.addOption(OptUtil.startRowOpt());
+    opts.addOption(OptUtil.endRowOpt());
+    
+    return opts;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FormatterCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FormatterCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FormatterCommand.java
new file mode 100644
index 0000000..3e34c0a
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FormatterCommand.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.format.Formatter;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+
+public class FormatterCommand extends Command {
+  private Option removeFormatterOption, formatterClassOption, listClassOption;
+  
+  @Override
+  public String description() {
+    return "specifies a formatter to use for displaying table entries";
+  }
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
+    String tableName = OptUtil.getTableOpt(cl, shellState);
+    
+    if (cl.hasOption(removeFormatterOption.getOpt())) {
+      // Remove the property
+      shellState.getConnector().tableOperations().removeProperty(tableName, Property.TABLE_FORMATTER_CLASS.toString());
+      
+      shellState.getReader().printString("Removed formatter on " + tableName + "\n");
+    } else if (cl.hasOption(listClassOption.getOpt())) {
+      // Get the options for this table
+      Iterator<Entry<String,String>> iter = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
+      
+      while (iter.hasNext()) {
+        Entry<String,String> ent = iter.next();
+        
+        // List all parameters with the property name
+        if (ent.getKey().startsWith(Property.TABLE_FORMATTER_CLASS.toString())) {
+          shellState.getReader().printString(ent.getKey() + ": " + ent.getValue() + "\n");
+        }
+      }
+    } else {
+      // Set the formatter with the provided options
+      String className = cl.getOptionValue(formatterClassOption.getOpt());
+      
+      // Set the formatter property on the table
+      shellState.getConnector().tableOperations().setProperty(tableName, Property.TABLE_FORMATTER_CLASS.toString(), className);
+    }
+    
+    return 0;
+  }
+  
+  public static Class<? extends Formatter> getCurrentFormatter(String tableName, Shell shellState) {
+    Iterator<Entry<String,String>> props;
+    try {
+      props = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
+    } catch (AccumuloException e) {
+      return null;
+    } catch (TableNotFoundException e) {
+      return null;
+    }
+    
+    while (props.hasNext()) {
+      Entry<String,String> ent = props.next();
+      if (ent.getKey().equals(Property.TABLE_FORMATTER_CLASS.toString())) {
+        Class<? extends Formatter> formatter;
+        try {
+          formatter = AccumuloClassLoader.loadClass(ent.getValue(), Formatter.class);
+        } catch (ClassNotFoundException e) {
+          return null;
+        }
+        
+        return formatter;
+      }
+    }
+    
+    return null;
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    OptionGroup actionGroup = new OptionGroup();
+    
+    formatterClassOption = new Option("f", "formatter", true, "fully qualified name of the formatter class to use");
+    formatterClassOption.setArgName("className");
+    
+    // Action to take: apply (default), remove, list
+    removeFormatterOption = new Option("r", "remove", false, "remove the current formatter");
+    listClassOption = new Option("l", "list", false, "display the current formatter");
+    
+    actionGroup.addOption(formatterClassOption);
+    actionGroup.addOption(removeFormatterOption);
+    actionGroup.addOption(listClassOption);
+    actionGroup.setRequired(true);
+    
+    o.addOptionGroup(actionGroup);
+    o.addOption(OptUtil.tableOpt("table to set the formatter on"));
+    
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java
new file mode 100644
index 0000000..fc67e3a
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetAuthsCommand.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util.shell.commands;
+
+import java.io.IOException;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+public class GetAuthsCommand extends Command {
+  private Option userOpt;
+  
+  @Override
+  public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
+    String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami());
+    shellState.getReader().printString(shellState.getConnector().securityOperations().getUserAuthorizations(user) + "\n");
+    return 0;
+  }
+  
+  @Override
+  public String description() {
+    return "displays the maximum scan authorizations for a user";
+  }
+  
+  @Override
+  public Options getOptions() {
+    Options o = new Options();
+    userOpt = new Option(Shell.userOption, "user", true, "user to operate on");
+    userOpt.setArgName("user");
+    o.addOption(userOpt);
+    return o;
+  }
+  
+  @Override
+  public int numArgs() {
+    return 0;
+  }
+}


Mime
View raw message