accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/3] git commit: ACCUMULO-2022 Add a -all flag to listiter.
Date Wed, 08 Jan 2014 21:06:54 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 443cba7a7 -> 43b3533f4
  refs/heads/master 5f2ddfae5 -> 7903d0968


ACCUMULO-2022 Add a -all flag to listiter.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/43b3533f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/43b3533f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/43b3533f

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 43b3533f4e85781184f95a1d84929308a69327ce
Parents: 443cba7
Author: Josh Elser <elserj@apache.org>
Authored: Wed Jan 8 16:05:34 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Jan 8 16:06:34 2014 -0500

----------------------------------------------------------------------
 .../core/util/shell/commands/ListIterCommand.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/43b3533f/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
index e29c5e6..6c93e76 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
@@ -18,8 +18,10 @@ package org.apache.accumulo.core.util.shell.commands;
 
 import java.util.EnumMap;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
@@ -31,7 +33,7 @@ import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 
 public class ListIterCommand extends Command {
-  private Option nameOpt;
+  private Option nameOpt, allScopesOpt;
   private Map<IteratorScope,Option> scopeOpts;
 
   @Override
@@ -60,18 +62,19 @@ public class ListIterCommand extends Command {
       iterators.put(name, scopes);
     }
 
-    boolean hasScope = false;
+    final boolean allScopes = cl.hasOption(allScopesOpt.getOpt());
+    Set<IteratorScope> desiredScopes = new HashSet<IteratorScope>();
     for (IteratorScope scope : IteratorScope.values()) {
-      if (cl.hasOption(scopeOpts.get(scope).getOpt()))
-        hasScope = true;
+      if (allScopes || cl.hasOption(scopeOpts.get(scope).getOpt()))
+        desiredScopes.add(scope);
     }
-    if (!hasScope) {
+    if (desiredScopes.isEmpty()) {
       throw new IllegalArgumentException("You must select at least one scope to configure");
     }
     final StringBuilder sb = new StringBuilder("-\n");
     for (String name : iterators.keySet()) {
       for (IteratorScope scope : iterators.get(name)) {
-        if (cl.hasOption(scopeOpts.get(scope).getOpt())) {
+        if (desiredScopes.contains(scope)) {
           IteratorSetting setting;
           if (namespaces) {
             setting = shellState.getConnector().namespaceOperations().getIteratorSetting(OptUtil.getNamespaceOpt(cl,
shellState), name, scope);
@@ -112,6 +115,9 @@ public class ListIterCommand extends Command {
     nameOpt = new Option("n", "name", true, "iterator to list");
     nameOpt.setArgName("itername");
 
+    allScopesOpt = new Option("all", "all-scopes", false, "list from all scopes");
+    o.addOption(allScopesOpt);
+    
     scopeOpts = new EnumMap<IteratorScope,Option>(IteratorScope.class);
     scopeOpts.put(IteratorScope.minc, new Option(IteratorScope.minc.name(), "minor-compaction",
false, "list iterator for minor compaction scope"));
     scopeOpts.put(IteratorScope.majc, new Option(IteratorScope.majc.name(), "major-compaction",
false, "list iterator for major compaction scope"));


Mime
View raw message