JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
conn = ConnectorFactory.getConnector(config.gethostname(), config.getport());
jmxc = conn.getConnector();
mbsc = conn.getMBeanServerConnection();
if (config.checkoptionsetting("r", commandlineoptionparser.getAlloptions())) {
JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
ReportGenerator reportgen = new ReportGenerator(config.optionchecker("r", commandlineoptionparser.getAlloptions()), info);
reportgen.loadproperties();
reportgen.run();
}
/* This implementation is for the people who are using the interactive
mode for one shot this run the user given command and exit */
for (int i = 0; i < args.length; i++) {
if (args[i].compareTo("list") == 0 || args[i].compareTo("info") == 0 || args[i].compareTo("view") == 0 || args[i].compareTo("viewcontent") == 0
|| args[i].compareTo("delete") == 0 || args[i].compareTo("move") == 0) {
oneshotmode(args,commandlineoptionparser,jmxc,mbsc);
return;
}
}
} catch (Exception ex) {
connectionrefuse();
return;
}
/* In this point connection has been established */
String line;
String[] command;
/* prividing GNU readline features using Jline library */
//String list = "list";
PrintWriter out = new PrintWriter(System.out);
reader.addCompletor(new ArgumentCompletor(
new SimpleCompletor(new String[]{"list", "info", "exit", "quit", "delete", "move", "view", "viewcontent", "queue", "exchange", "connection", "usermanagement", "virtualhost"})));
while ((line = reader.readLine("qpid-admin-$ ")) != null) {
out.flush();
if (removeSpaces(line).equalsIgnoreCase("quit") || removeSpaces(line).equalsIgnoreCase("exit"))
break;
else if (line.length() == 0)
continue;
else {
command = line.split("\\s+");
commandlineoptionparser = new CommandLineOptionParser(command);
JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
CommandExecusionEngine engine = new CommandExecusionEngine(info);
if (engine.CommandSelector())
engine.runcommand();
}
}