Return-Path: X-Original-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A846B422 for ; Fri, 20 Jan 2012 15:38:42 +0000 (UTC) Received: (qmail 50707 invoked by uid 500); 20 Jan 2012 15:38:42 -0000 Delivered-To: apmail-incubator-accumulo-commits-archive@incubator.apache.org Received: (qmail 50671 invoked by uid 500); 20 Jan 2012 15:38:41 -0000 Mailing-List: contact accumulo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: accumulo-dev@incubator.apache.org Delivered-To: mailing list accumulo-commits@incubator.apache.org Received: (qmail 50664 invoked by uid 99); 20 Jan 2012 15:38:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 15:38:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 15:38:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D7A6223889B8; Fri, 20 Jan 2012 15:38:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1233965 - in /incubator/accumulo/trunk: ./ src/core/ src/core/src/main/java/org/apache/accumulo/core/client/admin/ src/core/src/main/java/org/apache/accumulo/core/util/shell/ src/core/src/main/java/org/apache/accumulo/core/util/shell/comma... Date: Fri, 20 Jan 2012 15:38:15 -0000 To: accumulo-commits@incubator.apache.org From: billie@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120120153815.D7A6223889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: billie Date: Fri Jan 20 15:38:14 2012 New Revision: 1233965 URL: http://svn.apache.org/viewvc?rev=1233965&view=rev Log: ACCUMULO-311 created listiter command, changed return type of tableOperations().listIterators(tableName) - merged to trunk Added: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java - copied unchanged from r1233959, incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java Modified: incubator/accumulo/trunk/ (props changed) incubator/accumulo/trunk/src/core/ (props changed) incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java incubator/accumulo/trunk/src/server/ (props changed) Propchange: incubator/accumulo/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Jan 20 15:38:14 2012 @@ -1,3 +1,3 @@ /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043 /incubator/accumulo/branches/1.3.5rc:1209938 -/incubator/accumulo/branches/1.4:1201902-1233703 +/incubator/accumulo/branches/1.4:1201902-1233959 Propchange: incubator/accumulo/trunk/src/core/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Jan 20 15:38:14 2012 @@ -1,3 +1,3 @@ -/incubator/accumulo/branches/1.3.5rc/src/core:1209938 /incubator/accumulo/branches/1.3/src/core:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215 -/incubator/accumulo/branches/1.4/src/core:1201902-1233703 +/incubator/accumulo/branches/1.3.5rc/src/core:1209938 +/incubator/accumulo/branches/1.4/src/core:1201902-1233959 Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java (original) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java Fri Jan 20 15:38:14 2012 @@ -522,7 +522,7 @@ public interface TableOperations { * @throws AccumuloException * @throws TableNotFoundException */ - public Set listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException; + public Map> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException; /** * Check whether a given iterator configuration conflicts with existing configuration; in particular, determine if the name or priority are already in use for Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java (original) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java Fri Jan 20 15:38:14 2012 @@ -18,10 +18,8 @@ package org.apache.accumulo.core.client. import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.TreeMap; import org.apache.accumulo.core.client.AccumuloException; @@ -93,19 +91,20 @@ public abstract class TableOperationsHel } @Override - public Set listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { + public Map> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { if (!exists(tableName)) throw new TableNotFoundException(null, tableName, null); - Set result = new HashSet(); - Set lifecycles = new HashSet(); - for (IteratorScope scope : IteratorScope.values()) - lifecycles.add(scope.name().toLowerCase()); + Map> result = new TreeMap>(); for (Entry property : this.getProperties(tableName)) { String name = property.getKey(); String[] parts = name.split("\\."); if (parts.length == 4) { - if (parts[0].equals("table") && parts[1].equals("iterator") && lifecycles.contains(parts[2])) - result.add(parts[3]); + if (parts[0].equals("table") && parts[1].equals("iterator")) { + IteratorScope scope = IteratorScope.valueOf(parts[2]); + if (!result.containsKey(parts[3])) + result.put(parts[3], EnumSet.noneOf(IteratorScope.class)); + result.get(parts[3]).add(scope); + } } } return result; Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Fri Jan 20 15:38:14 2012 @@ -102,6 +102,7 @@ import org.apache.accumulo.core.util.she import org.apache.accumulo.core.util.shell.commands.ImportDirectoryCommand; import org.apache.accumulo.core.util.shell.commands.InfoCommand; import org.apache.accumulo.core.util.shell.commands.InsertCommand; +import org.apache.accumulo.core.util.shell.commands.ListIterCommand; import org.apache.accumulo.core.util.shell.commands.ListScansCommand; import org.apache.accumulo.core.util.shell.commands.MasterStateCommand; import org.apache.accumulo.core.util.shell.commands.MaxRowCommand; @@ -165,7 +166,7 @@ public class Shell { private AuthInfo credentials; private Class defaultFormatterClass = DefaultFormatter.class; private Class binaryFormatterClass = BinaryFormatter.class; - private Map> tableFormatters = new HashMap>(); + private Map> tableFormatters = new HashMap>(); public Map> scanIteratorOptions = new HashMap>(); private Token rootToken; @@ -356,12 +357,12 @@ public class Shell { new DeleteTableCommand(), new DeleteUserCommand(), new DropTableCommand(), new DropUserCommand(), new DUCommand(), new EGrepCommand(), new ExecfileCommand(), new ExitCommand(), new FlushCommand(), new FormatterCommand(), new GetAuthsCommand(), new GetGroupsCommand(), new GetSplitsCommand(), new GrantCommand(), new GrepCommand(), new HelpCommand(), new HiddenCommand(), new HistoryCommand(), - new ImportDirectoryCommand(), new InfoCommand(), new InsertCommand(), new ListScansCommand(), new MasterStateCommand(), new MaxRowCommand(), - new MergeCommand(), new NoTableCommand(), new OfflineCommand(), new OnlineCommand(), new PasswdCommand(), new QuestionCommand(), new QuitCommand(), - new RenameTableCommand(), new RevokeCommand(), new ScanCommand(), new SelectCommand(), new SelectrowCommand(), new SetAuthsCommand(), - new SetGroupsCommand(), new SetIterCommand(), new SetScanIterCommand(), new SleepCommand(), new SystemPermissionsCommand(), new TableCommand(), - new TablePermissionsCommand(), new TablesCommand(), new TraceCommand(), new UserCommand(), new UserPermissionsCommand(), new UsersCommand(), - new WhoAmICommand(),}; + new ImportDirectoryCommand(), new InfoCommand(), new InsertCommand(), new ListIterCommand(), new ListScansCommand(), new MasterStateCommand(), + new MaxRowCommand(), new MergeCommand(), new NoTableCommand(), new OfflineCommand(), new OnlineCommand(), new PasswdCommand(), new QuestionCommand(), + new QuitCommand(), new RenameTableCommand(), new RevokeCommand(), new ScanCommand(), new SelectCommand(), new SelectrowCommand(), + new SetAuthsCommand(), new SetGroupsCommand(), new SetIterCommand(), new SetScanIterCommand(), new SleepCommand(), new SystemPermissionsCommand(), + new TableCommand(), new TablePermissionsCommand(), new TablesCommand(), new TraceCommand(), new UserCommand(), new UserPermissionsCommand(), + new UsersCommand(), new WhoAmICommand(),}; for (Command cmd : external) { commandFactory.put(cmd.getName(), cmd); } @@ -463,7 +464,7 @@ public class Shell { sb.append("- Debug: ").append(isDebuggingEnabled() ? "on" : "off").append("\n"); if (!tableFormatters.isEmpty()) { sb.append("- Active Formatters"); - for (Entry> entry : tableFormatters.entrySet()) { + for (Entry> entry : tableFormatters.entrySet()) { if (null != entry.getValue()) { sb.append("- Table: ").append(entry.getKey()).append(", ").append(entry.getValue().getName()).append("\n"); } @@ -1004,6 +1005,7 @@ public class Shell { /** * Pull the current formatter for the given table and cache it. + * * @param tableName * @return The formatter class for the given table */ Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java (original) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java Fri Jan 20 15:38:14 2012 @@ -36,7 +36,6 @@ import org.apache.accumulo.core.iterator import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig; import org.apache.accumulo.core.security.VisibilityConstraint; import org.apache.accumulo.core.util.BadArgumentException; -import org.apache.accumulo.core.util.format.DefaultFormatter; 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; @@ -131,12 +130,13 @@ public class CreateTableCommand extends TimeType timeType = TimeType.MILLIS; if (cl.hasOption(createTableOptTimeLogical.getOpt())) timeType = TimeType.LOGICAL; - // create table shellState.getConnector().tableOperations().create(tableName, true, timeType); - shellState.getConnector().tableOperations().addSplits(tableName, partitions); - shellState.getConnector().tableOperations().addAggregators(tableName, aggregators); + if (partitions.size() > 0) + shellState.getConnector().tableOperations().addSplits(tableName, partitions); + if (aggregators.size() > 0) + shellState.getConnector().tableOperations().addAggregators(tableName, aggregators); shellState.setTableName(tableName); // switch shell to new table // context @@ -178,15 +178,15 @@ public class CreateTableCommand extends shellState.getConnector().tableOperations() .setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX.getKey() + (max + 1), VisibilityConstraint.class.getName()); } - + // Load custom formatter if set if (cl.hasOption(createTableOptFormatter.getOpt())) { - String formatterClass = cl.getOptionValue(createTableOptFormatter.getOpt()); - - shellState.setFormatterClass(tableName, AccumuloClassLoader.loadClass(formatterClass, Formatter.class)); - - shellState.getConnector().tableOperations().setProperty(tableName, Property.TABLE_FORMATTER_CLASS.toString(), formatterClass); - } + String formatterClass = cl.getOptionValue(createTableOptFormatter.getOpt()); + + shellState.setFormatterClass(tableName, AccumuloClassLoader.loadClass(formatterClass, Formatter.class)); + + shellState.getConnector().tableOperations().setProperty(tableName, Property.TABLE_FORMATTER_CLASS.toString(), formatterClass); + } return 0; } Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java (original) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java Fri Jan 20 15:38:14 2012 @@ -46,7 +46,7 @@ public class DeleteIterCommand extends C } String name = cl.getOptionValue(nameOpt.getOpt()); - if (!shellState.getConnector().tableOperations().listIterators(tableName).contains(name)) { + if (!shellState.getConnector().tableOperations().listIterators(tableName).containsKey(name)) { Shell.log.warn("no iterators found that match your criteria"); return 0; } Modified: incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java?rev=1233965&r1=1233964&r2=1233965&view=diff ============================================================================== --- incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java (original) +++ incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java Fri Jan 20 15:38:14 2012 @@ -213,16 +213,22 @@ public class TableOperationsHelperTest { t.check("table", new String[] {"table.iterator.majc.someName=10,foo.bar", "table.iterator.majc.someName.opt.key=value", "table.iterator.scan.someName=10,foo.bar",}); + t.removeIterator("table", "someName", EnumSet.of(IteratorScope.scan)); setting = new IteratorSetting(20, "otherName", "some.classname"); setting.setScopes(EnumSet.of(IteratorScope.majc)); setting.addOptions(Collections.singletonMap("key", "value")); t.attachIterator("table", setting); setting = new IteratorSetting(20, "otherName", "some.classname"); t.attachIterator("table", setting); - Set two = t.listIterators("table"); + Map> two = t.listIterators("table"); Assert.assertEquals(2, two.size()); - Assert.assertTrue(two.contains("otherName")); - Assert.assertTrue(two.contains("someName")); + Assert.assertTrue(two.containsKey("otherName")); + Assert.assertTrue(two.get("otherName").size() == 2); + Assert.assertTrue(two.get("otherName").contains(IteratorScope.majc)); + Assert.assertTrue(two.get("otherName").contains(IteratorScope.scan)); + Assert.assertTrue(two.containsKey("someName")); + Assert.assertTrue(two.get("someName").size() == 1); + Assert.assertTrue(two.get("someName").contains(IteratorScope.majc)); t.removeIterator("table", "someName", EnumSet.allOf(IteratorScope.class)); t.check("table", new String[] {"table.iterator.majc.otherName=20,some.classname", "table.iterator.majc.otherName.opt.key=value", "table.iterator.scan.otherName=20,some.classname",}); Propchange: incubator/accumulo/trunk/src/server/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Jan 20 15:38:14 2012 @@ -1,3 +1,3 @@ -/incubator/accumulo/branches/1.3.5rc/src/server:1209938 /incubator/accumulo/branches/1.3/src/server:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611 -/incubator/accumulo/branches/1.4/src/server:1201902-1233703 +/incubator/accumulo/branches/1.3.5rc/src/server:1209938 +/incubator/accumulo/branches/1.4/src/server:1201902-1233959