public static NameNode createNameNode(String argv[], Configuration conf)
throws IOException {
if (conf == null)
conf = new HdfsConfiguration();
StartupOption startOpt = parseArguments(argv);
if (startOpt == null) {
printUsage();
return null;
}
setStartupOption(conf, startOpt);
switch (startOpt) {
case FORMAT:
boolean aborted = format(conf, true);
System.exit(aborted ? 1 : 0);
return null; // avoid javac warning
case FINALIZE:
aborted = finalize(conf, true);
System.exit(aborted ? 1 : 0);
return null; // avoid javac warning
case BACKUP:
case CHECKPOINT:
return new BackupNode(conf, startOpt.toNodeRole());
default:
return new NameNode(conf);
}
}