throw new OozieCLIException(ex.toString(), ex);
}
}
private void adminCommand(CommandLine commandLine) throws OozieCLIException {
XOozieClient wc = createXOozieClient(commandLine);
List<String> options = new ArrayList<String>();
for (Option option : commandLine.getOptions()) {
options.add(option.getOpt());
}
try {
SYSTEM_MODE status = SYSTEM_MODE.NORMAL;
if (options.contains(VERSION_OPTION)) {
System.out.println("Oozie server build version: " + wc.getServerBuildVersion());
}
else if (options.contains(SYSTEM_MODE_OPTION)) {
String systemModeOption = commandLine.getOptionValue(SYSTEM_MODE_OPTION).toUpperCase();
try {
status = SYSTEM_MODE.valueOf(systemModeOption);
}
catch (Exception e) {
throw new OozieCLIException("Invalid input provided for option: " + SYSTEM_MODE_OPTION
+ " value given :" + systemModeOption
+ " Expected values are: NORMAL/NOWEBSERVICE/SAFEMODE ");
}
wc.setSystemMode(status);
System.out.println("System mode: " + status);
}
else if (options.contains(STATUS_OPTION)) {
status = wc.getSystemMode();
System.out.println("System mode: " + status);
}
else if (options.contains(QUEUE_DUMP_OPTION)) {
List<String> list = wc.getQueueDump();
if (list != null && list.size() != 0) {
for (String str : list) {
System.out.println(str);
}
}