atom feed1 message in org.apache.incubator.accumulo-commitssvn commit: r1391754 [7/11] - in /acc...
FromSent OnAttachments
vin...@apache.orgSep 28, 2012 10:43 pm 
Subject:svn commit: r1391754 [7/11] - in /accumulo/branches/ACCUMULO-259: ./ assemble/ conf/ conf/examples/1GB/native-standalone/ conf/examples/1GB/standalone/ conf/examples/2GB/native-standalone/ conf/examples/2GB/standalone/ conf/examples/3GB/native-standalo...
From:vin...@apache.org (vin@apache.org)
Date:Sep 28, 2012 10:43:13 pm
List:org.apache.incubator.accumulo-commits

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java
Sat Sep 29 05:42:59 2012 @@ -35,7 +35,7 @@ public class QuotedStringTokenizer imple private ArrayList<String> tokens; private String input;

- public QuotedStringTokenizer(String t) throws BadArgumentException { + public QuotedStringTokenizer(final String t) throws BadArgumentException { tokens = new ArrayList<String>(); this.input = t; try { @@ -55,27 +55,29 @@ public class QuotedStringTokenizer imple String hexChars = null; char inQuoteChar = '"';

- byte[] token = new byte[input.length()]; + final byte[] token = new byte[input.length()]; int tokenLength = 0; - byte[] inputBytes = input.getBytes(); + final byte[] inputBytes = input.getBytes(); for (int i = 0; i < input.length(); ++i) { - char ch = input.charAt(i); + final char ch = input.charAt(i);

// if I ended up in an escape sequence, check for valid escapable
character, and add it as a literal if (inEscapeSequence) { inEscapeSequence = false; - if (ch == 'x') + if (ch == 'x') { hexChars = ""; - else if (ch == ' ' || ch == '\'' || ch == '"' || ch == '\\') + } else if (ch == ' ' || ch == '\'' || ch == '"' || ch == '\\') { token[tokenLength++] = inputBytes[i]; - else + } else { throw new BadArgumentException("can only escape single quotes, double
quotes, the space character, the backslash, and hex input", input, i); + } } // in a hex escape sequence else if (hexChars != null) { - int digit = Character.digit(ch, 16); - if (digit < 0) + final int digit = Character.digit(ch, 16); + if (digit < 0) { throw new BadArgumentException("expected hex character", input, i); + } hexChars += ch; if (hexChars.length() == 2) { byte b; @@ -96,10 +98,11 @@ public class QuotedStringTokenizer imple inQuote = false; tokens.add(new String(token, 0, tokenLength, Shell.CHARSET)); tokenLength = 0; - } else if (ch == '\\') + } else if (ch == '\\') { inEscapeSequence = true; - else + } else { token[tokenLength++] = inputBytes[i]; + } } // not in a quote, either enter a quote, end a token, start escape, or
continue a token else { @@ -113,18 +116,21 @@ public class QuotedStringTokenizer imple } else if (ch == ' ' && tokenLength > 0) { tokens.add(new String(token, 0, tokenLength, Shell.CHARSET)); tokenLength = 0; - } else if (ch == '\\') + } else if (ch == '\\') { inEscapeSequence = true; - else if (ch != ' ') + } else if (ch != ' ') { token[tokenLength++] = inputBytes[i]; + } } } - if (inQuote) + if (inQuote) { throw new BadArgumentException("missing terminating quote", input,
input.length()); - else if (inEscapeSequence || hexChars != null) + } else if (inEscapeSequence || hexChars != null) { throw new BadArgumentException("escape sequence not complete", input,
input.length()); - if (tokenLength > 0) + } + if (tokenLength > 0) { tokens.add(new String(token, 0, tokenLength, Shell.CHARSET)); + } }

@Override

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java
Sat Sep 29 05:42:59 2012 @@ -30,7 +30,7 @@ import org.apache.commons.cli.CommandLin

public class RenameTableCommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException, + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, TableExistsException { shellState.getConnector().tableOperations().rename(cl.getArgs()[0],
cl.getArgs()[1]); if (shellState.getTableName().equals(cl.getArgs()[0])) @@ -48,7 +48,7 @@ public class RenameTableCommand extends return "renames a table"; }

- public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> completionSet) { + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> completionSet) { registerCompletionForTables(root, completionSet); }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java
Sat Sep 29 05:42:59 2012 @@ -40,7 +40,7 @@ public class RevokeCommand extends Table private String[] permission;

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws Exception { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws Exception { user = cl.hasOption(userOpt.getOpt()) ? cl.getOptionValue(userOpt.getOpt())
: shellState.getConnector().whoami();

permission = cl.getArgs()[0].split("\\.", 2); @@ -60,7 +60,7 @@ public class RevokeCommand extends Table }

@Override - protected void doTableOp(Shell shellState, String tableName) throws Exception
{ + protected void doTableOp(final Shell shellState, final String tableName)
throws Exception { try { shellState.getConnector().securityOperations().revokeTablePermission(user,
tableName, TablePermission.valueOf(permission[1])); Shell.log.debug("Revoked from " + user + " the " + permission[1] + "
permission on table " + tableName); @@ -80,8 +80,8 @@ public class RevokeCommand extends Table }

@Override - public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> completionSet) { - Token cmd = new Token(getName()); + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> completionSet) { + final Token cmd = new Token(getName()); cmd.addSubcommand(new Token(TablePermission.printableValues())); cmd.addSubcommand(new Token(SystemPermission.printableValues())); root.addSubcommand(cmd); @@ -90,9 +90,9 @@ public class RevokeCommand extends Table @Override public Options getOptions() { super.getOptions(); - Options o = new Options(); + final Options o = new Options();

- OptionGroup group = new OptionGroup(); + final OptionGroup group = new OptionGroup();

systemOpt = new Option("s", "system", false, "revoke a system permission");

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
Sat Sep 29 05:42:59 2012 @@ -20,18 +20,22 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map.Entry; +import java.util.concurrent.TimeUnit;

import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ScannerBase; +import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.format.BinaryFormatter; import org.apache.accumulo.core.util.format.Formatter; +import org.apache.accumulo.core.util.interpret.DefaultScanInterpreter; +import org.apache.accumulo.core.util.interpret.ScanInterpreter; import org.apache.accumulo.core.util.shell.Shell; import org.apache.accumulo.core.util.shell.Shell.Command; import org.apache.accumulo.start.classloader.AccumuloClassLoader; @@ -42,40 +46,40 @@ import org.apache.hadoop.io.Text;

public class ScanCommand extends Command {

- private Option scanOptAuths, scanOptRow, scanOptColumns,
disablePaginationOpt, showFewOpt, formatterOpt; + private Option scanOptAuths, scanOptRow, scanOptColumns,
disablePaginationOpt, showFewOpt, formatterOpt, interpreterOpt,
formatterInterpeterOpt; protected Option timestampOpt; private Option optStartRowExclusive; private Option optEndRowExclusive; + private Option timeoutOption;

- public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws Exception { - String tableName = OptUtil.getTableOpt(cl, shellState); + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws Exception { + final String tableName = OptUtil.getTableOpt(cl, shellState);

- Class<? extends Formatter> formatter = null; - - // Use the configured formatter unless one was provided - if (!cl.hasOption(formatterOpt.getOpt())) { - formatter = FormatterCommand.getCurrentFormatter(tableName, shellState); - } + final Class<? extends Formatter> formatter = getFormatter(cl, tableName,
shellState); + final ScanInterpreter interpeter = getInterpreter(cl, tableName,
shellState);

// handle first argument, if present, the authorizations list to // scan with - Authorizations auths = getAuths(cl, shellState); - Scanner scanner = shellState.getConnector().createScanner(tableName,
auths); + final Authorizations auths = getAuths(cl, shellState); + final Scanner scanner = shellState.getConnector().createScanner(tableName,
auths);

// handle session-specific scan iterators addScanIterators(shellState, scanner, tableName);

// handle remaining optional arguments - scanner.setRange(getRange(cl)); + scanner.setRange(getRange(cl, interpeter));

// handle columns - fetchColumns(cl, scanner); + fetchColumns(cl, scanner, interpeter);

+ // set timeout + scanner.setTimeout(getTimeout(cl), TimeUnit.MILLISECONDS); + // output the records if (cl.hasOption(showFewOpt.getOpt())) { - String showLength = cl.getOptionValue(showFewOpt.getOpt()); + final String showLength = cl.getOptionValue(showFewOpt.getOpt()); try { - int length = Integer.parseInt(showLength); + final int length = Integer.parseInt(showLength); if (length < 1) { throw new IllegalArgumentException(); } @@ -88,18 +92,22 @@ public class ScanCommand extends Command }

} else { - if (null == formatter) { - printRecords(cl, shellState, scanner); - } else { printRecords(cl, shellState, scanner, formatter); - } }

return 0; }

- protected void addScanIterators(Shell shellState, Scanner scanner, String
tableName) { - List<IteratorSetting> tableScanIterators =
shellState.scanIteratorOptions.get(shellState.getTableName()); + protected long getTimeout(final CommandLine cl) { + if (cl.hasOption(timeoutOption.getLongOpt())) { + return
AccumuloConfiguration.getTimeInMillis(cl.getOptionValue(timeoutOption.getLongOpt())); + } + + return Long.MAX_VALUE; + } + + protected void addScanIterators(final Shell shellState, final Scanner
scanner, final String tableName) { + final List<IteratorSetting> tableScanIterators =
shellState.scanIteratorOptions.get(shellState.getTableName()); if (tableScanIterators == null) { Shell.log.debug("Found no scan iterators to set"); return; @@ -116,42 +124,67 @@ public class ScanCommand extends Command } }

- protected void printRecords(CommandLine cl, Shell shellState,
Iterable<Entry<Key,Value>> scanner) throws IOException { - if (cl.hasOption(formatterOpt.getOpt())) { - try { - String className = cl.getOptionValue(formatterOpt.getOpt()); - Class<? extends Formatter> formatterClass =
AccumuloClassLoader.loadClass(className, Formatter.class); - - printRecords(cl, shellState, scanner, formatterClass); - } catch (ClassNotFoundException e) { - shellState.getReader().printString("Formatter class could not be
loaded.\n" + e.getMessage() + "\n"); - } - } else { - shellState.printRecords(scanner, cl.hasOption(timestampOpt.getOpt()),
!cl.hasOption(disablePaginationOpt.getOpt())); - } - } - - protected void printRecords(CommandLine cl, Shell shellState,
Iterable<Entry<Key,Value>> scanner, Class<? extends Formatter> formatter) throws
IOException { + protected void printRecords(final CommandLine cl, final Shell shellState,
final Iterable<Entry<Key,Value>> scanner, final Class<? extends Formatter>
formatter) throws IOException { shellState.printRecords(scanner, cl.hasOption(timestampOpt.getOpt()),
!cl.hasOption(disablePaginationOpt.getOpt()), formatter); }

- protected void printBinaryRecords(CommandLine cl, Shell shellState,
Iterable<Entry<Key,Value>> scanner) throws IOException { + protected void printBinaryRecords(final CommandLine cl, final Shell
shellState, final Iterable<Entry<Key,Value>> scanner) throws IOException { shellState.printBinaryRecords(scanner, cl.hasOption(timestampOpt.getOpt()),
!cl.hasOption(disablePaginationOpt.getOpt())); }

- protected void fetchColumns(CommandLine cl, ScannerBase scanner) throws
UnsupportedEncodingException { + protected ScanInterpreter getInterpreter(final CommandLine cl, final String
tableName, final Shell shellState) throws Exception { + + Class<? extends ScanInterpreter> clazz = null; + try { + if (cl.hasOption(interpreterOpt.getOpt())) { + clazz =
AccumuloClassLoader.loadClass(cl.getOptionValue(interpreterOpt.getOpt()),
ScanInterpreter.class); + } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) { + clazz =
AccumuloClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()),
ScanInterpreter.class); + } + } catch (ClassNotFoundException e) { + shellState.getReader().printString("Interpreter class could not be
loaded.\n" + e.getMessage() + "\n"); + } + + if (clazz == null) + clazz = InterpreterCommand.getCurrentInterpreter(tableName, shellState); + + if (clazz == null) + clazz = DefaultScanInterpreter.class; + + return clazz.newInstance(); + } + + protected Class<? extends Formatter> getFormatter(final CommandLine cl, final
String tableName, final Shell shellState) throws IOException { + + try { + if (cl.hasOption(formatterOpt.getOpt())) { + return
AccumuloClassLoader.loadClass(cl.getOptionValue(formatterOpt.getOpt()),
Formatter.class); + + } else if (cl.hasOption(formatterInterpeterOpt.getOpt())) { + return
AccumuloClassLoader.loadClass(cl.getOptionValue(formatterInterpeterOpt.getOpt()),
Formatter.class); + } + } catch (ClassNotFoundException e) { + shellState.getReader().printString("Formatter class could not be
loaded.\n" + e.getMessage() + "\n"); + } + + return shellState.getFormatter(tableName); + } + + protected void fetchColumns(final CommandLine cl, final ScannerBase scanner,
final ScanInterpreter formatter) throws UnsupportedEncodingException { if (cl.hasOption(scanOptColumns.getOpt())) { for (String a : cl.getOptionValue(scanOptColumns.getOpt()).split(",")) { - String sa[] = a.split(":", 2); - if (sa.length == 1) - scanner.fetchColumnFamily(new Text(a.getBytes(Shell.CHARSET))); - else - scanner.fetchColumn(new Text(sa[0].getBytes(Shell.CHARSET)), new
Text(sa[1].getBytes(Shell.CHARSET))); + final String sa[] = a.split(":", 2); + if (sa.length == 1) { + scanner.fetchColumnFamily(formatter.interpretColumnFamily(new
Text(a.getBytes(Shell.CHARSET)))); + } else { + scanner.fetchColumn(formatter.interpretColumnFamily(new
Text(sa[0].getBytes(Shell.CHARSET))), + formatter.interpretColumnQualifier(new
Text(sa[1].getBytes(Shell.CHARSET)))); + } } } }

- protected Range getRange(CommandLine cl) throws UnsupportedEncodingException
{ + protected Range getRange(final CommandLine cl, final ScanInterpreter
formatter) throws UnsupportedEncodingException { if ((cl.hasOption(OptUtil.START_ROW_OPT) ||
cl.hasOption(OptUtil.END_ROW_OPT)) && cl.hasOption(scanOptRow.getOpt())) { // did not see a way to make commons cli do this check... it has mutually
exclusive options but does not support the or throw new IllegalArgumentException("Options -" + scanOptRow.getOpt() + "
AND (-" + OptUtil.START_ROW_OPT + " OR -" + OptUtil.END_ROW_OPT @@ -159,18 +192,22 @@ public class ScanCommand extends Command }

if (cl.hasOption(scanOptRow.getOpt())) { - return new Range(new
Text(cl.getOptionValue(scanOptRow.getOpt()).getBytes(Shell.CHARSET))); + return new Range(formatter.interpretRow(new
Text(cl.getOptionValue(scanOptRow.getOpt()).getBytes(Shell.CHARSET)))); } else { Text startRow = OptUtil.getStartRow(cl); + if (startRow != null) + startRow = formatter.interpretBeginRow(startRow); Text endRow = OptUtil.getEndRow(cl); - boolean startInclusive = !cl.hasOption(optStartRowExclusive.getOpt()); - boolean endInclusive = !cl.hasOption(optEndRowExclusive.getOpt()); + if (endRow != null) + endRow = formatter.interpretEndRow(endRow); + final boolean startInclusive =
!cl.hasOption(optStartRowExclusive.getOpt()); + final boolean endInclusive = !cl.hasOption(optEndRowExclusive.getOpt()); return new Range(startRow, startInclusive, endRow, endInclusive); } }

- protected Authorizations getAuths(CommandLine cl, Shell shellState) throws
AccumuloSecurityException, AccumuloException { - String user = shellState.getConnector().whoami(); + protected Authorizations getAuths(final CommandLine cl, final Shell
shellState) throws AccumuloSecurityException, AccumuloException { + final String user = shellState.getConnector().whoami(); Authorizations auths =
shellState.getConnector().securityOperations().getUserAuthorizations(user); if (cl.hasOption(scanOptAuths.getOpt())) { auths =
CreateUserCommand.parseAuthorizations(cl.getOptionValue(scanOptAuths.getOpt())); @@ -185,7 +222,7 @@ public class ScanCommand extends Command

@Override public Options getOptions() { - Options o = new Options(); + final Options o = new Options();

scanOptAuths = new Option("s", "scan-authorizations", true, "scan
authorizations (all user auths are used if this argument is not specified)"); optStartRowExclusive = new Option("be", "begin-exclusive", false, "make
start row exclusive (by default it's inclusive)"); @@ -198,6 +235,10 @@ public class ScanCommand extends Command disablePaginationOpt = new Option("np", "no-pagination", false, "disable
pagination of output"); showFewOpt = new Option("f", "show few", true, "show only a specified
number of characters"); formatterOpt = new Option("fm", "formatter", true, "fully qualified name of
the formatter class to use"); + interpreterOpt = new Option("i", "interpreter", true, "fully qualified name
of the interpreter class to use"); + formatterInterpeterOpt = new Option("fi", "fmt-interpreter", true, "fully
qualified name of a class that is a formatter and interpreter"); + timeoutOption = new Option(null, "timeout", true, + "time before scan should fail if no data is returned. If no unit is
given assumes seconds. Units d,h,m,s,and ms are supported. e.g. 30s or
100ms");

scanOptAuths.setArgName("comma-separated-authorizations"); scanOptRow.setArgName("row"); @@ -205,6 +246,7 @@ public class ScanCommand extends Command showFewOpt.setRequired(false); showFewOpt.setArgName("int"); formatterOpt.setArgName("className"); + timeoutOption.setArgName("timeout");

o.addOption(scanOptAuths); o.addOption(scanOptRow); @@ -218,6 +260,9 @@ public class ScanCommand extends Command o.addOption(OptUtil.tableOpt("table to be scanned")); o.addOption(showFewOpt); o.addOption(formatterOpt); + o.addOption(interpreterOpt); + o.addOption(formatterInterpeterOpt); + o.addOption(timeoutOption);

return o; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java
Sat Sep 29 05:42:59 2012 @@ -35,9 +35,9 @@ public class SetAuthsCommand extends Com private Option clearOptAuths;

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException { - String user = cl.getOptionValue(userOpt.getOpt(),
shellState.getConnector().whoami()); - String scanOpts = cl.hasOption(clearOptAuths.getOpt()) ? null :
cl.getOptionValue(scanOptAuths.getOpt()); + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException { + final String user = cl.getOptionValue(userOpt.getOpt(),
shellState.getConnector().whoami()); + final String scanOpts = cl.hasOption(clearOptAuths.getOpt()) ? null :
cl.getOptionValue(scanOptAuths.getOpt()); shellState.getConnector().securityOperations().changeUserAuthorizations(user,
CreateUserCommand.parseAuthorizations(scanOpts)); Shell.log.debug("Changed record-level authorizations for user " + user); return 0; @@ -49,14 +49,14 @@ public class SetAuthsCommand extends Com }

@Override - public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> completionSet) { + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> completionSet) { registerCompletionForUsers(root, completionSet); }

@Override public Options getOptions() { - Options o = new Options(); - OptionGroup setOrClear = new OptionGroup(); + final Options o = new Options(); + final OptionGroup setOrClear = new OptionGroup(); scanOptAuths = new Option("s", "scan-authorizations", true, "scan
authorizations to set"); scanOptAuths.setArgName("comma-separated-authorizations"); setOrClear.addOption(scanOptAuths);

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java
Sat Sep 29 05:42:59 2012 @@ -33,17 +33,18 @@ public class SetGroupsCommand extends Co }

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws Exception { - String tableName = OptUtil.getTableOpt(cl, shellState); + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws Exception { + final String tableName = OptUtil.getTableOpt(cl, shellState);

- HashMap<String,Set<Text>> groups = new HashMap<String,Set<Text>>(); + final HashMap<String,Set<Text>> groups = new HashMap<String,Set<Text>>();

for (String arg : cl.getArgs()) { - String sa[] = arg.split("=", 2); - if (sa.length < 2) + final String sa[] = arg.split("=", 2); + if (sa.length < 2) { throw new IllegalArgumentException("Missing '='"); - String group = sa[0]; - HashSet<Text> colFams = new HashSet<Text>(); + } + final String group = sa[0]; + final HashSet<Text> colFams = new HashSet<Text>();

for (String family : sa[1].split(",")) { colFams.add(new Text(family.getBytes(Shell.CHARSET))); @@ -69,7 +70,7 @@ public class SetGroupsCommand extends Co

@Override public Options getOptions() { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptUtil.tableOpt("table to fetch locality groups for")); return opts; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
Sat Sep 29 05:42:59 2012 @@ -55,65 +55,70 @@ public class SetIterCommand extends Comm private Option mincScopeOpt, majcScopeOpt, scanScopeOpt, nameOpt,
priorityOpt; private Option aggTypeOpt, ageoffTypeOpt, regexTypeOpt, versionTypeOpt,
reqvisTypeOpt, classnameTypeOpt;

- public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException, + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, IOException, ShellCommandException { - String tableName = OptUtil.getTableOpt(cl, shellState); + final String tableName = OptUtil.getTableOpt(cl, shellState);

- int priority = Integer.parseInt(cl.getOptionValue(priorityOpt.getOpt())); + final int priority =
Integer.parseInt(cl.getOptionValue(priorityOpt.getOpt()));

- Map<String,String> options = new HashMap<String,String>(); + final Map<String,String> options = new HashMap<String,String>(); String classname = cl.getOptionValue(classnameTypeOpt.getOpt()); if (cl.hasOption(aggTypeOpt.getOpt())) { Shell.log.warn("aggregators are deprecated"); classname = AggregatingIterator.class.getName(); - } else if (cl.hasOption(regexTypeOpt.getOpt())) + } else if (cl.hasOption(regexTypeOpt.getOpt())) { classname = RegExFilter.class.getName(); - else if (cl.hasOption(ageoffTypeOpt.getOpt())) + } else if (cl.hasOption(ageoffTypeOpt.getOpt())) { classname = AgeOffFilter.class.getName(); - else if (cl.hasOption(versionTypeOpt.getOpt())) + } else if (cl.hasOption(versionTypeOpt.getOpt())) { classname = VersioningIterator.class.getName(); - else if (cl.hasOption(reqvisTypeOpt.getOpt())) + } else if (cl.hasOption(reqvisTypeOpt.getOpt())) { classname = ReqVisFilter.class.getName(); + }

- if
(!shellState.getConnector().instanceOperations().testClassLoad(classname,
SortedKeyValueIterator.class.getName())) + if
(!shellState.getConnector().instanceOperations().testClassLoad(classname,
SortedKeyValueIterator.class.getName())) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE,
"Servers are unable to load " + classname + " as type " + SortedKeyValueIterator.class.getName()); + } + final String name = cl.getOptionValue(nameOpt.getOpt(),
setUpOptions(shellState.getReader(), classname, options));

- String name = cl.getOptionValue(nameOpt.getOpt(),
setUpOptions(shellState.getReader(), classname, options)); - - String aggregatorClass = options.get("aggregatorClass"); - if (aggregatorClass != null &&
!shellState.getConnector().instanceOperations().testClassLoad(aggregatorClass,
Aggregator.class.getName())) + final String aggregatorClass = options.get("aggregatorClass"); + if (aggregatorClass != null &&
!shellState.getConnector().instanceOperations().testClassLoad(aggregatorClass,
Aggregator.class.getName())) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE,
"Servers are unable to load " + aggregatorClass + " as type " + Aggregator.class.getName()); - + } setTableProperties(cl, shellState, tableName, priority, options, classname,
name);

return 0; }

- protected void setTableProperties(CommandLine cl, Shell shellState, String
tableName, int priority, Map<String,String> options, String classname, String
name) + protected void setTableProperties(final CommandLine cl, final Shell
shellState, final String tableName, final int priority, final Map<String,String>
options, final String classname, final String name) throws AccumuloException, AccumuloSecurityException,
ShellCommandException, TableNotFoundException { // remove empty values for (Iterator<Entry<String,String>> i = options.entrySet().iterator();
i.hasNext();) { - Entry<String,String> entry = i.next(); - if (entry.getValue() == null || entry.getValue().isEmpty()) + final Entry<String,String> entry = i.next(); + if (entry.getValue() == null || entry.getValue().isEmpty()) { i.remove(); + } } - EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class); - if (cl.hasOption(mincScopeOpt.getOpt())) + final EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class); + if (cl.hasOption(mincScopeOpt.getOpt())) { scopes.add(IteratorScope.minc); - if (cl.hasOption(majcScopeOpt.getOpt())) + } + if (cl.hasOption(majcScopeOpt.getOpt())) { scopes.add(IteratorScope.majc); - if (cl.hasOption(scanScopeOpt.getOpt())) + } + if (cl.hasOption(scanScopeOpt.getOpt())) { scopes.add(IteratorScope.scan); - if (scopes.isEmpty()) + } + if (scopes.isEmpty()) { throw new IllegalArgumentException("You must select at least one scope to
configure"); - - IteratorSetting setting = new IteratorSetting(priority, name, classname,
options); + } + final IteratorSetting setting = new IteratorSetting(priority, name,
classname, options); shellState.getConnector().tableOperations().attachIterator(tableName,
setting, scopes); }

- private static String setUpOptions(ConsoleReader reader, String className,
Map<String,String> options) throws IOException, ShellCommandException { + private static String setUpOptions(final ConsoleReader reader, final String
className, final Map<String,String> options) throws IOException,
ShellCommandException { String input; OptionDescriber skvi; Class<? extends OptionDescriber> clazz; @@ -131,19 +136,20 @@ public class SetIterCommand extends Comm + "; configure with 'config' instead"); }

- IteratorOptions itopts = skvi.describeOptions(); - if (itopts.getName() == null) + final IteratorOptions itopts = skvi.describeOptions(); + if (itopts.getName() == null) { throw new IllegalArgumentException(className + " described its default
distinguishing name as null"); - + } String shortClassName = className; - if (className.contains(".")) + if (className.contains(".")) { shortClassName = className.substring(className.lastIndexOf('.') + 1); - - Map<String,String> localOptions = new HashMap<String,String>(); + } + final Map<String,String> localOptions = new HashMap<String,String>(); do { // clean up the overall options that caused things to fail - for (String key : localOptions.keySet()) + for (String key : localOptions.keySet()) { options.remove(key); + } localOptions.clear();

reader.printString(itopts.getDescription()); @@ -207,7 +213,7 @@ public class SetIterCommand extends Comm }

public Options getOptions() { - Options o = new Options(); + final Options o = new Options();

priorityOpt = new Option("p", "priority", true, "the order in which the
iterator is applied"); priorityOpt.setArgName("pri"); @@ -220,7 +226,7 @@ public class SetIterCommand extends Comm majcScopeOpt = new Option(IteratorScope.majc.name(), "major-compaction",
false, "applied at major compaction"); scanScopeOpt = new Option(IteratorScope.scan.name(), "scan-time", false,
"applied at scan time");

- OptionGroup typeGroup = new OptionGroup(); + final OptionGroup typeGroup = new OptionGroup(); classnameTypeOpt = new Option("class", "class-name", true, "a java class
that implements SortedKeyValueIterator"); classnameTypeOpt.setArgName("name"); aggTypeOpt = new Option("agg", "aggregator", false, "an aggregating type");

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java
Sat Sep 29 05:42:59 2012 @@ -41,30 +41,31 @@ import org.apache.commons.cli.Options;

public class SetScanIterCommand extends SetIterCommand { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException, + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, IOException, ShellCommandException { return super.execute(fullCommand, cl, shellState); }

@Override - protected void setTableProperties(CommandLine cl, Shell shellState, String
tableName, int priority, Map<String,String> options, String classname, String
name) + protected void setTableProperties(final CommandLine cl, final Shell
shellState, final String tableName, final int priority, final Map<String,String>
options, final String classname, final String name) throws AccumuloException, AccumuloSecurityException,
ShellCommandException, TableNotFoundException { // instead of setting table properties, just put the options in a list to
use at scan time - if
(!shellState.getConnector().instanceOperations().testClassLoad(classname,
SortedKeyValueIterator.class.getName())) + if
(!shellState.getConnector().instanceOperations().testClassLoad(classname,
SortedKeyValueIterator.class.getName())) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE,
"Servers are unable to load " + classname + " as type " + SortedKeyValueIterator.class.getName()); + } List<IteratorSetting> tableScanIterators =
shellState.scanIteratorOptions.get(tableName); if (tableScanIterators == null) { tableScanIterators = new ArrayList<IteratorSetting>(); shellState.scanIteratorOptions.put(tableName, tableScanIterators); } - IteratorSetting setting = new IteratorSetting(priority, name, classname); + final IteratorSetting setting = new IteratorSetting(priority, name,
classname); setting.addOptions(options);

// initialize a scanner to ensure the new setting does not conflict with
existing settings - String user = shellState.getConnector().whoami(); - Authorizations auths =
shellState.getConnector().securityOperations().getUserAuthorizations(user); - Scanner scanner = shellState.getConnector().createScanner(tableName,
auths); + final String user = shellState.getConnector().whoami(); + final Authorizations auths =
shellState.getConnector().securityOperations().getUserAuthorizations(user); + final Scanner scanner = shellState.getConnector().createScanner(tableName,
auths); for (IteratorSetting s : tableScanIterators) { scanner.addScanIterator(s); } @@ -84,9 +85,9 @@ public class SetScanIterCommand extends public Options getOptions() { // Remove the options that specify which type of iterator this is, since // they are all scan iterators with this command. - HashSet<OptionGroup> groups = new HashSet<OptionGroup>(); - Options parentOptions = super.getOptions(); - Options modifiedOptions = new Options(); + final HashSet<OptionGroup> groups = new HashSet<OptionGroup>(); + final Options parentOptions = super.getOptions(); + final Options modifiedOptions = new Options(); for (Iterator<?> it = parentOptions.getOptions().iterator(); it.hasNext();)
{ Option o = (Option) it.next(); if (!IteratorScope.majc.name().equals(o.getOpt()) &&
!IteratorScope.minc.name().equals(o.getOpt()) &&
!IteratorScope.scan.name().equals(o.getOpt())) {

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java
Sat Sep 29 05:42:59 2012 @@ -23,8 +23,8 @@ import org.apache.commons.cli.CommandLin public class SleepCommand extends Command {

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws Exception { - double secs = Double.parseDouble(cl.getArgs()[0]); + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws Exception { + final double secs = Double.parseDouble(cl.getArgs()[0]); Thread.sleep((long) (secs * 1000)); return 0; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
Sat Sep 29 05:42:59 2012 @@ -25,9 +25,10 @@ import org.apache.commons.cli.CommandLin

public class SystemPermissionsCommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws IOException { - for (String p : SystemPermission.printableValues()) + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws IOException { + for (String p : SystemPermission.printableValues()) { shellState.getReader().printString(p + "\n"); + } return 0; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java
Sat Sep 29 05:42:59 2012 @@ -29,11 +29,11 @@ import org.apache.commons.cli.CommandLin

public class TableCommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException { - String tableName = cl.getArgs()[0]; - if (!shellState.getConnector().tableOperations().exists(tableName)) + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException { + final String tableName = cl.getArgs()[0]; + if (!shellState.getConnector().tableOperations().exists(tableName)) { throw new TableNotFoundException(null, tableName, null); - + } shellState.setTableName(tableName); return 0; } @@ -44,7 +44,7 @@ public class TableCommand extends Comman }

@Override - public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> special) { + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> special) { registerCompletionForTables(root, special); }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
Sat Sep 29 05:42:59 2012 @@ -36,18 +36,20 @@ public abstract class TableOperation ext private boolean force = true; private boolean useCommandLine = true;

- public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws Exception { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws Exception { // populate the tableSet set with the tables you want to operate on - SortedSet<String> tableSet = new TreeSet<String>(); + final SortedSet<String> tableSet = new TreeSet<String>(); if (cl.hasOption(optTablePattern.getOpt())) { for (String table : shellState.getConnector().tableOperations().list()) - if (table.matches(cl.getOptionValue(optTablePattern.getOpt()))) + if (table.matches(cl.getOptionValue(optTablePattern.getOpt()))) { tableSet.add(table); + } } else if (cl.hasOption(optTableName.getOpt())) { tableSet.add(cl.getOptionValue(optTableName.getOpt())); } else if (useCommandLine && cl.getArgs().length > 0) { - for (String tableName : cl.getArgs()) + for (String tableName : cl.getArgs()) { tableSet.add(tableName); + } } else { shellState.checkTableState(); tableSet.add(shellState.getTableName()); @@ -59,10 +61,12 @@ public abstract class TableOperation ext boolean more = true; // flush the tables for (String tableName : tableSet) { - if (!more) + if (!more) { break; - if (!shellState.getConnector().tableOperations().exists(tableName)) + } + if (!shellState.getConnector().tableOperations().exists(tableName)) { throw new TableNotFoundException(null, tableName, null); + } boolean operate = true; if (!force) { shellState.getReader().flushConsole(); @@ -70,8 +74,9 @@ public abstract class TableOperation ext more = line != null; operate = line != null && (line.equalsIgnoreCase("y") ||
line.equalsIgnoreCase("yes")); } - if (operate) + if (operate) { doTableOp(shellState, tableName); + } }

return 0; @@ -86,7 +91,7 @@ public abstract class TableOperation ext

@Override public Options getOptions() { - Options o = new Options(); + final Options o = new Options();

optTablePattern = new Option("p", "pattern", true, "regex pattern of table
names to operate on"); optTablePattern.setArgName("pattern"); @@ -94,7 +99,7 @@ public abstract class TableOperation ext optTableName = new Option(Shell.tableOption, "table", true, "name of a
table to operate on"); optTableName.setArgName("tableName");

- OptionGroup opg = new OptionGroup(); + final OptionGroup opg = new OptionGroup();

opg.addOption(optTablePattern); opg.addOption(optTableName); @@ -106,10 +111,7 @@ public abstract class TableOperation ext

@Override public int numArgs() { - if (useCommandLine) - return Shell.NO_FIXED_ARG_LENGTH_CHECK; - else - return 0; + return useCommandLine ? Shell.NO_FIXED_ARG_LENGTH_CHECK : 0; }

protected void force() { @@ -130,7 +132,7 @@ public abstract class TableOperation ext }

@Override - public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> special) { + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> special) { if (useCommandLine) registerCompletionForTables(root, special); }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
Sat Sep 29 05:42:59 2012 @@ -25,9 +25,10 @@ import org.apache.commons.cli.CommandLin

public class TablePermissionsCommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws IOException { - for (String p : TablePermission.printableValues()) + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws IOException { + for (String p : TablePermission.printableValues()) { shellState.getReader().printString(p + "\n"); + } return 0; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
Sat Sep 29 05:42:59 2012 @@ -31,14 +31,16 @@ public class TablesCommand extends Comma private Option tableIdOption;

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, IOException { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
IOException { if (cl.hasOption(tableIdOption.getOpt())) { - Map<String,String> tableIds =
shellState.getConnector().tableOperations().tableIdMap(); - for (String tableName :
shellState.getConnector().tableOperations().list()) - shellState.getReader().printString(String.format("%-15s => %10s\n",
tableName, tableIds.get(tableName))); + final Map<String,String> tableIds =
shellState.getConnector().tableOperations().tableIdMap(); + for (String tableName :
shellState.getConnector().tableOperations().list()) { + shellState.getReader().printString(String.format("%-15s => %10s%n",
tableName, tableIds.get(tableName))); + } } else { - for (String table : shellState.getConnector().tableOperations().list()) + for (String table : shellState.getConnector().tableOperations().list()) { shellState.getReader().printString(table + "\n"); + } } return 0; } @@ -50,7 +52,7 @@ public class TablesCommand extends Comma

@Override public Options getOptions() { - Options o = new Options(); + final Options o = new Options(); tableIdOption = new Option("l", "list-ids", false, "display internal table
ids along with the table name"); o.addOption(tableIdOption); return o;

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
Sat Sep 29 05:42:59 2012 @@ -34,26 +34,26 @@ import org.apache.hadoop.io.Text;

public class TraceCommand extends DebugCommand {

- public int execute(String fullCommand, CommandLine cl, final Shell
shellState) throws IOException { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws IOException { if (cl.getArgs().length == 1) { if (cl.getArgs()[0].equalsIgnoreCase("on")) { Trace.on("shell:" + shellState.getCredentials().user); } else if (cl.getArgs()[0].equalsIgnoreCase("off")) { if (Trace.isTracing()) { - long trace = Trace.currentTrace().traceId(); + final long trace = Trace.currentTrace().traceId(); Trace.off(); for (int i = 0; i < 10; i++) { try { - Map<String,String> properties =
shellState.getConnector().instanceOperations().getSystemConfiguration(); - String table = properties.get(Property.TRACE_TABLE.getKey()); - String user = shellState.getConnector().whoami(); - Authorizations auths =
shellState.getConnector().securityOperations().getUserAuthorizations(user); - Scanner scanner = shellState.getConnector().createScanner(table,
auths); + final Map<String,String> properties =
shellState.getConnector().instanceOperations().getSystemConfiguration(); + final String table =
properties.get(Property.TRACE_TABLE.getKey()); + final String user = shellState.getConnector().whoami(); + final Authorizations auths =
shellState.getConnector().securityOperations().getUserAuthorizations(user); + final Scanner scanner =
shellState.getConnector().createScanner(table, auths); scanner.setRange(new Range(new Text(Long.toHexString(trace)))); final StringBuffer sb = new StringBuffer(); if (TraceDump.printTrace(scanner, new Printer() { @Override - public void print(String line) { + public void print(final String line) { try { sb.append(line + "\n"); } catch (Exception ex) {

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
Sat Sep 29 05:42:59 2012 @@ -30,7 +30,7 @@ import org.apache.accumulo.core.util.she import org.apache.commons.cli.CommandLine;

public class UserCommand extends Command { - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, IOException { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
IOException { // save old credentials and connection in case of failure String user = cl.getArgs()[0]; byte[] pass; @@ -38,7 +38,7 @@ public class UserCommand extends Command // We can't let the wrapping try around the execute method deal // with the exceptions because we have to do something if one // of these methods fails - String p = shellState.readMaskedLine("Enter password for user " + user + ":
", '*'); + final String p = shellState.readMaskedLine("Enter password for user " +
user + ": ", '*'); if (p == null) { shellState.getReader().printNewline(); return 0; @@ -54,7 +54,7 @@ public class UserCommand extends Command }

@Override - public void registerCompletion(Token root,
Map<Command.CompletionSet,Set<String>> special) { + public void registerCompletion(final Token root, final
Map<Command.CompletionSet,Set<String>> special) { registerCompletionForUsers(root, special); }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
Sat Sep 29 05:42:59 2012 @@ -33,13 +33,13 @@ public class UserPermissionsCommand exte private static int runOnce = 0;

@Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, IOException { - String user = cl.getOptionValue(userOpt.getOpt(),
shellState.getConnector().whoami()); + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
IOException { + final String user = cl.getOptionValue(userOpt.getOpt(),
shellState.getConnector().whoami());

String delim = ""; shellState.getReader().printString("System permissions: "); for (SystemPermission p : SystemPermission.values()) { - if
(shellState.getConnector().securityOperations().hasSystemPermission(user, p) & p
!= null) { + if (p != null &&
shellState.getConnector().securityOperations().hasSystemPermission(user, p)) { shellState.getReader().printString(delim + "System." + p.name()); delim = ", "; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
Sat Sep 29 05:42:59 2012 @@ -26,9 +26,10 @@ import org.apache.commons.cli.CommandLin

public class UsersCommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws AccumuloException, AccumuloSecurityException, IOException { - for (String user :
shellState.getConnector().securityOperations().listUsers()) + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws AccumuloException, AccumuloSecurityException,
IOException { + for (String user :
shellState.getConnector().securityOperations().listUsers()) { shellState.getReader().printString(user + "\n"); + } return 0; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
Sat Sep 29 05:42:59 2012 @@ -24,7 +24,7 @@ import org.apache.commons.cli.CommandLin

public class WhoAmICommand extends Command { @Override - public int execute(String fullCommand, CommandLine cl, Shell shellState)
throws IOException { + public int execute(final String fullCommand, final CommandLine cl, final
Shell shellState) throws IOException { shellState.getReader().printString(shellState.getConnector().whoami() +
"\n"); return 0; }

Modified:
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
Sat Sep 29 05:42:59 2012 @@ -20,11 +20,11 @@ import org.apache.accumulo.core.Constant import org.apache.accumulo.core.client.Instance;

public class ZooUtil extends org.apache.accumulo.fate.zookeeper.ZooUtil { - public static String getRoot(Instance instance) { + public static String getRoot(final Instance instance) { return getRoot(instance.getInstanceID()); }

- public static String getRoot(String instanceId) { + public static String getRoot(final String instanceId) { return Constants.ZROOT + "/" + instanceId; } }

Modified: accumulo/branches/ACCUMULO-259/core/src/main/thrift/client.thrift URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/thrift/client.thrift?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== --- accumulo/branches/ACCUMULO-259/core/src/main/thrift/client.thrift (original) +++ accumulo/branches/ACCUMULO-259/core/src/main/thrift/client.thrift Sat Sep 29
05:42:59 2012 @@ -34,6 +34,8 @@ enum TableOperation { DELETE_RANGE, BULK_IMPORT, COMPACT + IMPORT + EXPORT }

enum TableOperationExceptionType {

Modified: accumulo/branches/ACCUMULO-259/core/src/main/thrift/master.thrift URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/thrift/master.thrift?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== --- accumulo/branches/ACCUMULO-259/core/src/main/thrift/master.thrift (original) +++ accumulo/branches/ACCUMULO-259/core/src/main/thrift/master.thrift Sat Sep 29
05:42:59 2012 @@ -123,6 +123,8 @@ enum TableOperation { DELETE_RANGE BULK_IMPORT COMPACT + IMPORT + EXPORT }

service MasterClientService {

Modified: accumulo/branches/ACCUMULO-259/core/src/main/thrift/thrift.sh URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/thrift/thrift.sh?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== --- accumulo/branches/ACCUMULO-259/core/src/main/thrift/thrift.sh (original) +++ accumulo/branches/ACCUMULO-259/core/src/main/thrift/thrift.sh Sat Sep 29
05:42:59 2012 @@ -25,7 +25,10 @@ fail() { VERSION=`thrift -version 2>/dev/null | grep "0.8" | wc -l` if [ "$VERSION" -ne 1 ] ; then # Nope: bail - echo "thrift is not available" + echo "***********************************************" + echo "* thrift is not available *" + echo "* expecting 'thrift -version' to return 0.8 *" + echo "***********************************************" exit 0 fi CLOUDTRACE=../trace @@ -42,6 +45,7 @@ do thrift ${THRIFT_ARGS} --gen rb $f || fail unable to generate ruby thrift
classes done find target/gen-java -name '*.java' -print | xargs sed -i.orig -e 's/public
class /@SuppressWarnings("all") public class /' +find target/gen-java -name '*.java' -print | xargs sed -i.orig -e 's/public
enum /@SuppressWarnings("all") public enum /' find target/gen-java -name '*.orig' -print | xargs rm -f # copy only files that have changed for d in gc master tabletserver security client/impl data

Modified:
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/ClientSideIteratorTest.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/ClientSideIteratorTest.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/ClientSideIteratorTest.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/ClientSideIteratorTest.java
Sat Sep 29 05:42:59 2012 @@ -53,10 +53,10 @@ public class ClientSideIteratorTest { resultSet3.add(new Key("part2", "", "DOC2")); }

- public void checkResults(Iterable<Entry<Key,Value>> scanner, List<Key>
results, PartialKey pk) { + public void checkResults(final Iterable<Entry<Key,Value>> scanner, final
List<Key> results, final PartialKey pk) { int i = 0; for (Entry<Key,Value> entry : scanner) { - assertTrue(0 == entry.getKey().compareTo(results.get(i++), pk)); + assertTrue(entry.getKey().equals(results.get(i++), pk)); } assertEquals(i, results.size()); } @@ -66,7 +66,7 @@ public class ClientSideIteratorTest { Instance instance = new MockInstance("local"); Connector conn = instance.getConnector("root", "".getBytes()); conn.tableOperations().create("intersect"); - BatchWriter bw = conn.createBatchWriter("intersect", 1000, 10l, 1); + BatchWriter bw = conn.createBatchWriter("intersect", new
BatchWriterConfig()); Mutation m = new Mutation("part1"); m.put("bar", "doc1", "value"); m.put("bar", "doc2", "value"); @@ -83,8 +83,8 @@ public class ClientSideIteratorTest { bw.addMutation(m); bw.flush();

- ClientSideIteratorScanner csis = new
ClientSideIteratorScanner(conn.createScanner("intersect", new
Authorizations())); - IteratorSetting si = new IteratorSetting(10, "intersect",
IntersectingIterator.class); + final ClientSideIteratorScanner csis = new
ClientSideIteratorScanner(conn.createScanner("intersect", new
Authorizations())); + final IteratorSetting si = new IteratorSetting(10, "intersect",
IntersectingIterator.class); IntersectingIterator.setColumnFamilies(si, new Text[] {new Text("bar"), new
Text("foo")}); csis.addScanIterator(si);

@@ -93,13 +93,13 @@ public class ClientSideIteratorTest {

@Test public void testVersioning() throws Exception { - Instance instance = new MockInstance("local"); - Connector conn = instance.getConnector("root", "".getBytes()); + final Instance instance = new MockInstance("local"); + final Connector conn = instance.getConnector("root", "".getBytes()); conn.tableOperations().create("table"); conn.tableOperations().removeProperty("table", "table.iterator.scan.vers"); conn.tableOperations().removeProperty("table", "table.iterator.majc.vers"); conn.tableOperations().removeProperty("table", "table.iterator.minc.vers"); - BatchWriter bw = conn.createBatchWriter("table", 1000, 10l, 1); + final BatchWriter bw = conn.createBatchWriter("table", new
BatchWriterConfig()); Mutation m = new Mutation("row1"); m.put("colf", "colq", 1l, "value"); m.put("colf", "colq", 2l, "value"); @@ -111,10 +111,10 @@ public class ClientSideIteratorTest { bw.addMutation(m); bw.flush();

- Scanner scanner = conn.createScanner("table", new Authorizations()); + final Scanner scanner = conn.createScanner("table", new Authorizations());

- ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner); - IteratorSetting si = new IteratorSetting(10, "localvers",
VersioningIterator.class); + final ClientSideIteratorScanner csis = new
ClientSideIteratorScanner(scanner); + final IteratorSetting si = new IteratorSetting(10, "localvers",
VersioningIterator.class); si.addOption("maxVersions", "2"); csis.addScanIterator(si);

Modified:
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
Sat Sep 29 05:42:59 2012 @@ -35,23 +35,23 @@ import org.junit.Test;

public class RowIteratorTest {

- Iterator<Entry<Key,Value>> makeIterator(String... args) { - Map<Key,Value> result = new TreeMap<Key,Value>(); + Iterator<Entry<Key,Value>> makeIterator(final String... args) { + final Map<Key,Value> result = new TreeMap<Key,Value>(); for (String s : args) { - String parts[] = s.split("[ \t]"); - Key key = new Key(parts[0], parts[1], parts[2]); - Value value = new Value(parts[3].getBytes()); + final String parts[] = s.split("[ \t]"); + final Key key = new Key(parts[0], parts[1], parts[2]); + final Value value = new Value(parts[3].getBytes()); result.put(key, value); } return result.entrySet().iterator(); }

- List<List<Entry<Key,Value>>> getRows(Iterator<Entry<Key,Value>> iter) { - List<List<Entry<Key,Value>>> result = new
ArrayList<List<Entry<Key,Value>>>(); - RowIterator riter = new RowIterator(iter); + List<List<Entry<Key,Value>>> getRows(final Iterator<Entry<Key,Value>> iter) { + final List<List<Entry<Key,Value>>> result = new
ArrayList<List<Entry<Key,Value>>>(); + final RowIterator riter = new RowIterator(iter); while (riter.hasNext()) { - Iterator<Entry<Key,Value>> row = riter.next(); - List<Entry<Key,Value>> rlist = new ArrayList<Entry<Key,Value>>(); + final Iterator<Entry<Key,Value>> row = riter.next(); + final List<Entry<Key,Value>> rlist = new ArrayList<Entry<Key,Value>>(); while (row.hasNext()) rlist.add(row.next()); result.add(rlist); @@ -100,7 +100,7 @@ public class RowIteratorTest {

@Test public void testUnreadRow() { - RowIterator i = new RowIterator(makeIterator("a b c d", "a 1 2 3", "b 1 2
3")); + final RowIterator i = new RowIterator(makeIterator("a b c d", "a 1 2 3", "b
1 2 3")); assertTrue(i.hasNext()); Iterator<Entry<Key,Value>> firstRow = i.next(); assertEquals(0, i.getKVCount());

Modified:
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
Sat Sep 29 05:42:59 2012 @@ -23,6 +23,7 @@ import junit.framework.TestCase;

import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchWriter; +import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.mock.MockInstance; @@ -51,7 +52,7 @@ public class FindMaxTest extends TestCas Connector conn = mi.getConnector("root", "foo"); conn.tableOperations().create("foo");

- BatchWriter bw = conn.createBatchWriter("foo", 1000000, 60000l, 2); + BatchWriter bw = conn.createBatchWriter("foo", new BatchWriterConfig());

bw.addMutation(nm(new byte[] {0})); bw.addMutation(nm(new byte[] {0, 0}));

Modified:
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
Sat Sep 29 05:42:59 2012 @@ -182,6 +182,12 @@ public class TableOperationsHelperTest { } Assert.assertEquals(expected, settings.get(tablename)); } + + @Override + public void importTable(String tableName, String exportDir) throws
TableExistsException, AccumuloException, AccumuloSecurityException {} + + @Override + public void exportTable(String tableName, String exportDir) throws
TableNotFoundException, AccumuloException, AccumuloSecurityException {} }

@Test

Modified:
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java URL:
http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java?rev=1391754&r1=1391753&r2=1391754&view=diff ============================================================================== ---
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
(original) +++
accumulo/branches/ACCUMULO-259/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
Sat Sep 29 05:42:59 2012 @@ -27,6 +27,7 @@ import org.apache.accumulo.core.conf.Pro import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.util.ContextFactory; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.JobContext; import org.apache.hadoop.mapreduce.RecordWriter; @@ -59,17 +60,6 @@ public class AccumuloFileOutputFormatTes }

@Test - public void testSet() throws IOException, InterruptedException { - AccumuloFileOutputFormat.setBlockSize(job.getConfiguration(), 300); - validate(300); - } - - @Test - public void testUnset() throws IOException, InterruptedException { - validate((int)
AccumuloConfiguration.getDefaultConfiguration().getMemoryInBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE)); - } - - @Test public void testEmptyWrite() throws IOException, InterruptedException { handleWriteTests(false); } @@ -97,10 +87,28 @@ public class AccumuloFileOutputFormatTes file.getFileSystem(tac.getConfiguration()).delete(file.getParent(), true); }

- public void validate(int size) throws IOException, InterruptedException { - AccumuloFileOutputFormat.handleBlockSize(job.getConfiguration()); - int detSize =
job.getConfiguration().getInt("io.seqfile.compress.blocksize", -1); - assertEquals(size, detSize); + @Test + public void validateConfiguration() throws IOException, InterruptedException
{ + Configuration conf = job.getConfiguration(); + AccumuloConfiguration acuconf =
AccumuloConfiguration.getDefaultConfiguration(); + + int a = 7; + long b = 300l; + long c = 50l; + long d = 10l; + String e = "type"; + + AccumuloFileOutputFormat.setReplication(conf, a); + AccumuloFileOutputFormat.setDFSBlockSize(conf, b); + AccumuloFileOutputFormat.setCompressedBlockSize(conf, c); + AccumuloFileOutputFormat.setCompressedBlockSizeIndex(conf, d); + AccumuloFileOutputFormat.setCompressionType(conf, e); + + assertEquals(a, conf.getInt(Property.TABLE_FILE_REPLICATION.getKey(),
acuconf.getCount(Property.TABLE_FILE_REPLICATION))); + assertEquals(b, conf.getLong(Property.TABLE_FILE_BLOCK_SIZE.getKey(),
acuconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE))); + assertEquals(c,
conf.getLong(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(),
acuconf.getMemoryInBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE))); + assertEquals(d, + conf.getLong(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(),
acuconf.getMemoryInBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX))); + assertEquals(e, conf.get(Property.TABLE_FILE_COMPRESSION_TYPE.getKey(),
acuconf.get(Property.TABLE_FILE_COMPRESSION_TYPE))); } - }