HDFS-6173. Merge r1583384 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1583385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-03-31 18:07:08 +00:00
parent e9e21c07cf
commit 0cd6f12410
2 changed files with 13 additions and 13 deletions

View File

@ -48,6 +48,9 @@ Release 2.5.0 - UNRELEASED
HDFS-6156. Simplify the JMX API that provides snapshot information. HDFS-6156. Simplify the JMX API that provides snapshot information.
(wheat9) (wheat9)
HDFS-6173. Move the default processor from Ls to Web in OfflineImageViewer.
(Akira Ajisaka via wheat9)
Release 2.4.1 - UNRELEASED Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -70,13 +70,14 @@ public class OfflineImageViewerPB {
+ "\n" + "\n"
+ "Required command line arguments:\n" + "Required command line arguments:\n"
+ "-i,--inputFile <arg> FSImage file to process.\n" + "-i,--inputFile <arg> FSImage file to process.\n"
+ "-o,--outputFile <arg> Name of output file. If the specified\n"
+ " file exists, it will be overwritten.\n"
+ "\n" + "\n"
+ "Optional command line arguments:\n" + "Optional command line arguments:\n"
+ "-o,--outputFile <arg> Name of output file. If the specified\n"
+ " file exists, it will be overwritten.\n"
+ " (output to stdout by default)\n"
+ "-p,--processor <arg> Select which type of processor to apply\n" + "-p,--processor <arg> Select which type of processor to apply\n"
+ " against image file." + " against image file. (XML|FileDistribution|Web)\n"
+ " (Ls|XML|FileDistribution).\n" + " (Web by default)\n"
+ "-h,--help Display usage information and exit\n"; + "-h,--help Display usage information and exit\n";
/** /**
@ -87,16 +88,12 @@ public class OfflineImageViewerPB {
// Build in/output file arguments, which are required, but there is no // Build in/output file arguments, which are required, but there is no
// addOption method that can specify this // addOption method that can specify this
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("outputFile");
options.addOption(OptionBuilder.create("o"));
OptionBuilder.isRequired(); OptionBuilder.isRequired();
OptionBuilder.hasArgs(); OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("inputFile"); OptionBuilder.withLongOpt("inputFile");
options.addOption(OptionBuilder.create("i")); options.addOption(OptionBuilder.create("i"));
options.addOption("o", "outputFile", true, "");
options.addOption("p", "processor", true, ""); options.addOption("p", "processor", true, "");
options.addOption("h", "help", false, ""); options.addOption("h", "help", false, "");
options.addOption("maxSize", true, ""); options.addOption("maxSize", true, "");
@ -144,11 +141,11 @@ public class OfflineImageViewerPB {
} }
String inputFile = cmd.getOptionValue("i"); String inputFile = cmd.getOptionValue("i");
String processor = cmd.getOptionValue("p", "Ls"); String processor = cmd.getOptionValue("p", "Web");
String outputFile = cmd.getOptionValue("o"); String outputFile = cmd.getOptionValue("o", "-");
PrintWriter out = (outputFile == null || outputFile.equals("-")) ? new PrintWriter( PrintWriter out = outputFile.equals("-") ?
System.out) : new PrintWriter(new File(outputFile)); new PrintWriter(System.out) : new PrintWriter(new File(outputFile));
Configuration conf = new Configuration(); Configuration conf = new Configuration();
try { try {