You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by me...@apache.org on 2012/09/11 21:28:51 UTC
svn commit: r1383568 - in
/accumulo/trunk/core/src/main/java/org/apache/accumulo/core:
util/shell/commands/ zookeeper/
Author: medined
Date: Tue Sep 11 19:28:49 2012
New Revision: 1383568
URL: http://svn.apache.org/viewvc?rev=1383568&view=rev
Log:
add final to parameters .. guided by PMD
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListScansCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/NoTableCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java Tue Sep 11 19:28:49 2012
@@ -34,18 +34,18 @@ public class ListIterCommand extends Com
private Map<IteratorScope,Option> scopeOpts;
@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);
- Map<String,EnumSet<IteratorScope>> iterators = shellState.getConnector().tableOperations().listIterators(tableName);
+ final Map<String,EnumSet<IteratorScope>> iterators = shellState.getConnector().tableOperations().listIterators(tableName);
if (cl.hasOption(nameOpt.getOpt())) {
- String name = cl.getOptionValue(nameOpt.getOpt());
+ final String name = cl.getOptionValue(nameOpt.getOpt());
if (!iterators.containsKey(name)) {
Shell.log.warn("no iterators found that match your criteria");
return 0;
}
- EnumSet<IteratorScope> scopes = iterators.get(name);
+ final EnumSet<IteratorScope> scopes = iterators.get(name);
iterators.clear();
iterators.put(name, scopes);
}
@@ -55,10 +55,10 @@ public class ListIterCommand extends Com
if (cl.hasOption(scopeOpts.get(scope).getOpt()))
hasScope = true;
}
- if (!hasScope)
+ if (!hasScope) {
throw new IllegalArgumentException("You must select at least one scope to configure");
-
- StringBuilder sb = new StringBuilder("-\n");
+ }
+ final StringBuilder sb = new StringBuilder("-\n");
for (String name : iterators.keySet()) {
for (IteratorScope scope : iterators.get(name)) {
if (cl.hasOption(scopeOpts.get(scope).getOpt())) {
@@ -89,7 +89,7 @@ public class ListIterCommand extends Com
@Override
public Options getOptions() {
- Options o = new Options();
+ final Options o = new Options();
nameOpt = new Option("n", "name", true, "iterator to list");
nameOpt.setArgName("itername");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListScansCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListScansCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListScansCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListScansCommand.java Tue Sep 11 19:28:49 2012
@@ -36,13 +36,13 @@ public class ListScansCommand extends Co
}
@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 {
List<String> tservers;
- InstanceOperations instanceOps = shellState.getConnector().instanceOperations();
+ final InstanceOperations instanceOps = shellState.getConnector().instanceOperations();
- boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
+ final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
tservers = new ArrayList<String>();
@@ -63,7 +63,7 @@ public class ListScansCommand extends Co
@Override
public Options getOptions() {
- Options opts = new Options();
+ final Options opts = new Options();
tserverOption = new Option("ts", "tabletServer", true, "tablet server to list scans for");
tserverOption.setArgName("tablet server");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MaxRowCommand.java Tue Sep 11 19:28:49 2012
@@ -25,21 +25,22 @@ import org.apache.hadoop.io.Text;
public class MaxRowCommand extends ScanCommand {
- 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);
- ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
+ final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
- Range range = getRange(cl, interpeter);
- Authorizations auths = getAuths(cl, shellState);
- Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow();
- Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow();
+ final Range range = getRange(cl, interpeter);
+ final Authorizations auths = getAuths(cl, shellState);
+ final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow();
+ final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow();
try {
- Text max = shellState.getConnector().tableOperations()
+ final Text max = shellState.getConnector().tableOperations()
.getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive());
- if (max != null)
+ if (max != null) {
shellState.getReader().printString(max.toString() + "\n");
+ }
} catch (Exception e) {
e.printStackTrace();
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/MergeCommand.java Tue Sep 11 19:28:49 2012
@@ -31,25 +31,27 @@ public class MergeCommand extends Comman
private Option verboseOpt, forceOpt, sizeOpt;
@Override
- public int execute(String fullCommand, CommandLine cl, final Shell shellState) throws Exception {
+ public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
boolean verbose = shellState.isVerbose();
boolean force = false;
long size = -1;
- String tableName = OptUtil.getTableOpt(cl, shellState);
- Text startRow = OptUtil.getStartRow(cl);
- Text endRow = OptUtil.getEndRow(cl);
- if (cl.hasOption(verboseOpt.getOpt()))
+ final String tableName = OptUtil.getTableOpt(cl, shellState);
+ final Text startRow = OptUtil.getStartRow(cl);
+ final Text endRow = OptUtil.getEndRow(cl);
+ if (cl.hasOption(verboseOpt.getOpt())) {
verbose = true;
- if (cl.hasOption(forceOpt.getOpt()))
+ }
+ if (cl.hasOption(forceOpt.getOpt())) {
force = true;
+ }
if (cl.hasOption(sizeOpt.getOpt())) {
size = AccumuloConfiguration.getMemoryInBytes(cl.getOptionValue(sizeOpt.getOpt()));
}
- if (size < 0)
+ if (size < 0) {
shellState.getConnector().tableOperations().merge(tableName, startRow, endRow);
- else {
+ } else {
final boolean finalVerbose = verbose;
- Merge merge = new Merge() {
+ final Merge merge = new Merge() {
protected void message(String fmt, Object... args) {
if (finalVerbose) {
try {
@@ -78,7 +80,7 @@ public class MergeCommand extends Comman
@Override
public Options getOptions() {
- Options o = new Options();
+ final Options o = new Options();
verboseOpt = new Option("v", "verbose", false, "verbose output during merge");
sizeOpt = new Option("s", "size", true, "merge tablets to the given size over the entire table");
forceOpt = new Option("f", "force", false, "merge small tablets to large tablets, even if it goes over the given size");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/NoTableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/NoTableCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/NoTableCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/NoTableCommand.java Tue Sep 11 19:28:49 2012
@@ -22,7 +22,7 @@ import org.apache.commons.cli.CommandLin
public class NoTableCommand extends Command {
@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 {
shellState.setTableName("");
return 0;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java Tue Sep 11 19:28:49 2012
@@ -28,7 +28,7 @@ public class OfflineCommand extends Tabl
return "starts the process of taking table offline";
}
- protected void doTableOp(Shell shellState, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
Shell.log.info(" You cannot take the " + Constants.METADATA_TABLE_NAME + " offline.");
} else {
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java Tue Sep 11 19:28:49 2012
@@ -28,7 +28,7 @@ public class OnlineCommand extends Table
return "starts the process of putting a table online";
}
- protected void doTableOp(Shell shellState, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
Shell.log.info(" The " + Constants.METADATA_TABLE_NAME + " is always online.");
} else {
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java Tue Sep 11 19:28:49 2012
@@ -29,13 +29,14 @@ public abstract class OptUtil {
public static final String START_ROW_OPT = "b";
public static final String END_ROW_OPT = "e";
- public static String getTableOpt(CommandLine cl, Shell shellState) throws TableNotFoundException {
+ public static String getTableOpt(final CommandLine cl, final Shell shellState) throws TableNotFoundException {
String tableName;
if (cl.hasOption(Shell.tableOption)) {
tableName = cl.getOptionValue(Shell.tableOption);
- if (!shellState.getConnector().tableOperations().exists(tableName))
+ if (!shellState.getConnector().tableOperations().exists(tableName)) {
throw new TableNotFoundException(tableName, tableName, "specified table that doesn't exist");
+ }
} else {
shellState.checkTableState();
tableName = shellState.getTableName();
@@ -48,8 +49,8 @@ public abstract class OptUtil {
return tableOpt("tableName");
}
- public static Option tableOpt(String description) {
- Option tableOpt = new Option(Shell.tableOption, "table", true, description);
+ public static Option tableOpt(final String description) {
+ final Option tableOpt = new Option(Shell.tableOption, "table", true, description);
tableOpt.setArgName("table");
tableOpt.setRequired(false);
return tableOpt;
@@ -65,7 +66,7 @@ public abstract class OptUtil {
}
}
- public static AdlOpt getAldOpt(CommandLine cl) {
+ public static AdlOpt getAldOpt(final CommandLine cl) {
if (cl.hasOption(AdlOpt.ADD.opt)) {
return AdlOpt.ADD;
} else if (cl.hasOption(AdlOpt.DELETE.opt)) {
@@ -75,11 +76,11 @@ public abstract class OptUtil {
}
}
- public static OptionGroup addListDeleteGroup(String name) {
- Option addOpt = new Option(AdlOpt.ADD.opt, "add", false, "add " + name);
- Option deleteOpt = new Option(AdlOpt.DELETE.opt, "delete", false, "delete " + name);
- Option listOpt = new Option(AdlOpt.LIST.opt, "list", false, "list " + name + "(s)");
- OptionGroup og = new OptionGroup();
+ public static OptionGroup addListDeleteGroup(final String name) {
+ final Option addOpt = new Option(AdlOpt.ADD.opt, "add", false, "add " + name);
+ final Option deleteOpt = new Option(AdlOpt.DELETE.opt, "delete", false, "delete " + name);
+ final Option listOpt = new Option(AdlOpt.LIST.opt, "list", false, "list " + name + "(s)");
+ final OptionGroup og = new OptionGroup();
og.addOption(addOpt);
og.addOption(deleteOpt);
og.addOption(listOpt);
@@ -88,28 +89,30 @@ public abstract class OptUtil {
}
public static Option startRowOpt() {
- Option o = new Option(START_ROW_OPT, "begin-row", true, "begin row (inclusive)");
+ final Option o = new Option(START_ROW_OPT, "begin-row", true, "begin row (inclusive)");
o.setArgName("begin-row");
return o;
}
public static Option endRowOpt() {
- Option o = new Option(END_ROW_OPT, "end-row", true, "end row (inclusive)");
+ final Option o = new Option(END_ROW_OPT, "end-row", true, "end row (inclusive)");
o.setArgName("end-row");
return o;
}
- public static Text getStartRow(CommandLine cl) throws UnsupportedEncodingException {
- if (cl.hasOption(START_ROW_OPT))
+ public static Text getStartRow(final CommandLine cl) throws UnsupportedEncodingException {
+ if (cl.hasOption(START_ROW_OPT)) {
return new Text(cl.getOptionValue(START_ROW_OPT).getBytes(Shell.CHARSET));
- else
+ } else {
return null;
+ }
}
- public static Text getEndRow(CommandLine cl) throws UnsupportedEncodingException {
- if (cl.hasOption(END_ROW_OPT))
+ public static Text getEndRow(final CommandLine cl) throws UnsupportedEncodingException {
+ if (cl.hasOption(END_ROW_OPT)) {
return new Text(cl.getOptionValue(END_ROW_OPT).getBytes(Shell.CHARSET));
- else
+ } else {
return null;
+ }
}
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java Tue Sep 11 19:28:49 2012
@@ -33,9 +33,9 @@ public class PasswdCommand extends Comma
private Option userOpt;
@Override
- public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
- String currentUser = shellState.getConnector().whoami();
- String user = cl.getOptionValue(userOpt.getOpt(), currentUser);
+ public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
+ final String currentUser = shellState.getConnector().whoami();
+ final String user = cl.getOptionValue(userOpt.getOpt(), currentUser);
String password = null;
String passwordConfirm = null;
@@ -61,15 +61,16 @@ public class PasswdCommand extends Comma
return 0;
} // user canceled
- if (!password.equals(passwordConfirm))
+ if (!password.equals(passwordConfirm)) {
throw new IllegalArgumentException("Passwords do not match");
-
+ }
byte[] pass = password.getBytes();
shellState.getConnector().securityOperations().changeUserPassword(user, pass);
// update the current credentials if the password changed was for
// the current user
- if (shellState.getConnector().whoami().equals(user))
+ if (shellState.getConnector().whoami().equals(user)) {
shellState.updateUser(new AuthInfo(user, ByteBuffer.wrap(pass), shellState.getConnector().getInstance().getInstanceID()));
+ }
Shell.log.debug("Changed password for user " + user);
return 0;
}
@@ -81,7 +82,7 @@ public class PasswdCommand extends Comma
@Override
public Options getOptions() {
- Options o = new Options();
+ final Options o = new Options();
userOpt = new Option(Shell.userOption, "user", true, "user to operate on");
userOpt.setArgName("user");
o.addOption(userOpt);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/QuotedStringTokenizer.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RenameTableCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/RevokeCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java Tue Sep 11 19:28:49 2012
@@ -49,16 +49,16 @@ public class ScanCommand extends Command
private Option optStartRowExclusive;
private Option optEndRowExclusive;
- 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 = getFormatter(cl, tableName, shellState);
- ScanInterpreter interpeter = getInterpreter(cl, 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);
@@ -71,9 +71,9 @@ public class ScanCommand extends Command
// 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();
}
@@ -92,8 +92,8 @@ public class ScanCommand extends Command
return 0;
}
- protected void addScanIterators(Shell shellState, Scanner scanner, String tableName) {
- List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(shellState.getTableName());
+ 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;
@@ -110,15 +110,15 @@ public class ScanCommand extends Command
}
}
- 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 ScanInterpreter getInterpreter(CommandLine cl, String tableName, Shell shellState) throws Exception {
+ protected ScanInterpreter getInterpreter(final CommandLine cl, final String tableName, final Shell shellState) throws Exception {
Class<? extends ScanInterpreter> clazz = null;
try {
@@ -140,7 +140,7 @@ public class ScanCommand extends Command
return clazz.newInstance();
}
- protected Class<? extends Formatter> getFormatter(CommandLine cl, String tableName, Shell shellState) throws IOException {
+ protected Class<? extends Formatter> getFormatter(final CommandLine cl, final String tableName, final Shell shellState) throws IOException {
try {
if (cl.hasOption(formatterOpt.getOpt())) {
@@ -156,20 +156,21 @@ public class ScanCommand extends Command
return shellState.getFormatter(tableName);
}
- protected void fetchColumns(CommandLine cl, ScannerBase scanner, ScanInterpreter formatter) throws UnsupportedEncodingException {
+ 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)
+ final String sa[] = a.split(":", 2);
+ if (sa.length == 1) {
scanner.fetchColumnFamily(formatter.interpretColumnFamily(new Text(a.getBytes(Shell.CHARSET))));
- else
+ } 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, ScanInterpreter formatter) 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
@@ -185,14 +186,14 @@ public class ScanCommand extends Command
Text endRow = OptUtil.getEndRow(cl);
if (endRow != null)
endRow = formatter.interpretEndRow(endRow);
- boolean startInclusive = !cl.hasOption(optStartRowExclusive.getOpt());
- boolean endInclusive = !cl.hasOption(optEndRowExclusive.getOpt());
+ 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()));
@@ -207,7 +208,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)");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetAuthsCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetGroupsCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetScanIterCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ShellPluginConfigurationCommand.java Tue Sep 11 19:28:49 2012
@@ -41,15 +41,15 @@ public abstract class ShellPluginConfigu
private String classOpt;
- ShellPluginConfigurationCommand(String typeName, Property tableProp, String classOpt) {
+ ShellPluginConfigurationCommand(final String typeName, final Property tableProp, final String classOpt) {
this.pluginType = typeName;
this.tableProp = tableProp;
this.classOpt = classOpt;
}
@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);
if (cl.hasOption(removePluginOption.getOpt())) {
// Remove the property
@@ -58,7 +58,7 @@ public abstract class ShellPluginConfigu
shellState.getReader().printString("Removed "+pluginType+" on " + tableName + "\n");
} else if (cl.hasOption(listPluginOption.getOpt())) {
// Get the options for this table
- Iterator<Entry<String,String>> iter = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
+ final Iterator<Entry<String,String>> iter = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
while (iter.hasNext()) {
Entry<String,String> ent = iter.next();
@@ -79,15 +79,15 @@ public abstract class ShellPluginConfigu
return 0;
}
- protected void setPlugin(CommandLine cl, Shell shellState, String tableName, String className) throws AccumuloException, AccumuloSecurityException {
+ protected void setPlugin(final CommandLine cl, final Shell shellState, final String tableName, final String className) throws AccumuloException, AccumuloSecurityException {
shellState.getConnector().tableOperations().setProperty(tableName, tableProp.toString(), className);
}
- protected void removePlugin(CommandLine cl, Shell shellState, String tableName) throws AccumuloException, AccumuloSecurityException {
+ protected void removePlugin(final CommandLine cl, final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException {
shellState.getConnector().tableOperations().removeProperty(tableName, tableProp.toString());
}
- public static <T> Class<? extends T> getPluginClass(String tableName, Shell shellState, Class<T> clazz, Property pluginProp) {
+ public static <T> Class<? extends T> getPluginClass(final String tableName, final Shell shellState, final Class<T> clazz, final Property pluginProp) {
Iterator<Entry<String,String>> props;
try {
props = shellState.getConnector().tableOperations().getProperties(tableName).iterator();
@@ -98,7 +98,7 @@ public abstract class ShellPluginConfigu
}
while (props.hasNext()) {
- Entry<String,String> ent = props.next();
+ final Entry<String,String> ent = props.next();
if (ent.getKey().equals(pluginProp.toString())) {
Class<? extends T> pluginClazz;
try {
@@ -117,8 +117,8 @@ public abstract class ShellPluginConfigu
@Override
public Options getOptions() {
- Options o = new Options();
- OptionGroup actionGroup = new OptionGroup();
+ final Options o = new Options();
+ final OptionGroup actionGroup = new OptionGroup();
pluginClassOption = new Option(classOpt, pluginType, true, "fully qualified name of the " + pluginType + " class to use");
pluginClassOption.setArgName("className");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SleepCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SystemPermissionsCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TableOperation.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablePermissionsCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java Tue Sep 11 19:28:49 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())
+ 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java Tue Sep 11 19:28:49 2012
@@ -33,8 +33,8 @@ 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: ");
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UsersCommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/WhoAmICommand.java Tue Sep 11 19:28:49 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/trunk/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java?rev=1383568&r1=1383567&r2=1383568&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooUtil.java Tue Sep 11 19:28:49 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;
}
}