You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by md...@apache.org on 2013/10/28 15:20:37 UTC
[1/2] git commit: ACCUMULO-1587 add 'print to file' for grep
Updated Branches:
refs/heads/master 8730d5cef -> 32f423e63
ACCUMULO-1587 add 'print to file' for grep
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d61afcc2
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d61afcc2
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d61afcc2
Branch: refs/heads/master
Commit: d61afcc28901c3d1bf34a5940b76f2e140f3f340
Parents: 090a8cf
Author: Mike Drob <md...@mdrob.com>
Authored: Mon Oct 28 10:08:51 2013 -0400
Committer: Mike Drob <md...@mdrob.com>
Committed: Mon Oct 28 10:08:51 2013 -0400
----------------------------------------------------------------------
.../accumulo/core/util/shell/commands/GrepCommand.java | 4 +++-
.../accumulo/core/util/shell/commands/ScanCommand.java | 10 +++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d61afcc2/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GrepCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GrepCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GrepCommand.java
index 828e0d9..c2ff232 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GrepCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GrepCommand.java
@@ -27,6 +27,7 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.format.Formatter;
import org.apache.accumulo.core.util.interpret.ScanInterpreter;
import org.apache.accumulo.core.util.shell.Shell;
+import org.apache.accumulo.core.util.shell.Shell.PrintFile;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.MissingArgumentException;
import org.apache.commons.cli.Option;
@@ -38,6 +39,7 @@ public class GrepCommand extends ScanCommand {
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
+ final PrintFile printFile = getOutputFile(cl);
final String tableName = OptUtil.getTableOpt(cl, shellState);
@@ -67,7 +69,7 @@ public class GrepCommand extends ScanCommand {
fetchColumns(cl, scanner, interpeter);
// output the records
- printRecords(cl, shellState, scanner, formatter);
+ printRecords(cl, shellState, scanner, formatter, printFile);
} finally {
scanner.close();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d61afcc2/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
index 5359ea0..74aa699 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.util.shell.commands;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
@@ -58,9 +59,7 @@ public class ScanCommand extends Command {
private Option profileOpt;
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
-
- final String outputFile = cl.getOptionValue(outputFileOpt.getOpt());
- final PrintFile printFile = outputFile == null ? null : new PrintFile(outputFile);
+ final PrintFile printFile = getOutputFile(cl);
final String tableName = OptUtil.getTableOpt(cl, shellState);
@@ -328,4 +327,9 @@ public class ScanCommand extends Command {
public int numArgs() {
return 0;
}
+
+ protected PrintFile getOutputFile(final CommandLine cl) throws FileNotFoundException {
+ final String outputFile = cl.getOptionValue(outputFileOpt.getOpt());
+ return (outputFile == null ? null : new PrintFile(outputFile));
+ }
}
[2/2] git commit: Merge branch '1.5.1-SNAPSHOT'
Posted by md...@apache.org.
Merge branch '1.5.1-SNAPSHOT'
Conflicts:
core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/32f423e6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/32f423e6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/32f423e6
Branch: refs/heads/master
Commit: 32f423e63028dce700103b3c8fbc54f10c9914da
Parents: 8730d5c d61afcc
Author: Mike Drob <md...@mdrob.com>
Authored: Mon Oct 28 10:20:20 2013 -0400
Committer: Mike Drob <md...@mdrob.com>
Committed: Mon Oct 28 10:20:20 2013 -0400
----------------------------------------------------------------------
.../accumulo/core/util/shell/commands/GrepCommand.java | 4 +++-
.../accumulo/core/util/shell/commands/ScanCommand.java | 11 +++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/32f423e6/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
index 21a7842,74aa699..f3a0663
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ScanCommand.java
@@@ -56,12 -58,9 +57,9 @@@ public class ScanCommand extends Comman
private Option timeoutOption;
private Option profileOpt;
+ @Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
-
- final String outputFile = cl.getOptionValue(outputFileOpt.getOpt());
- final PrintFile printFile = outputFile == null ? null : new PrintFile(outputFile);
-
+ final PrintFile printFile = getOutputFile(cl);
-
final String tableName = OptUtil.getTableOpt(cl, shellState);
final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);