use of alma.acs.commandcenter.app.CommandCenterLogic in project ACS by ACS-Community.
the class CommandCenter method main.
public static void main(String[] args) {
for (Handler h : Logger.getLogger("").getHandlers()) {
if (h instanceof ConsoleHandler) {
h.setFormatter(new Formatter() {
DateFormat df = new SimpleDateFormat("HH:mm:ss ");
@Override
public String format(LogRecord record) {
String s = df.format(new Date(record.getMillis()));
s += record.getMessage() + "\n";
return s;
}
});
}
}
// --- parse the command line
StartupOptions startupOptions = new StartupOptions();
for (int i = 0; i < args.length; i++) {
if (i == 0 && equalsOneOf(args[i], new String[] { "-h", "-help", "--help" })) {
printUsage(System.out);
return;
}
try {
if (equalsOneOf(args[i], new String[] { "-r", "-retrieve", "--retrieve" })) {
startupOptions.project = new File(args[++i]);
continue;
}
if (equalsOneOf(args[i], new String[] { "-g", "-geometry", "--geometry" })) {
StringTokenizer toky = new StringTokenizer(args[++i], "x+");
int w = Integer.parseInt(toky.nextToken());
int h = Integer.parseInt(toky.nextToken());
int x = Integer.parseInt(toky.nextToken());
int y = Integer.parseInt(toky.nextToken());
startupOptions.geometry = new Rectangle(x, y, w, h);
continue;
}
if (equalsOneOf(args[i], new String[] { "-x", "-noexit", "--noexit" })) {
startupOptions.doExitOnClose = false;
continue;
}
if (equalsOneOf(args[i], new String[] { "-useNativeSSH", "--useNativeSSH" })) {
log.warning("command line option '-useNativeSSH' no longer supported.");
continue;
}
if (equalsOneOf(args[i], new String[] { "-killNativeSSH", "--killNativeSSH" })) {
log.warning("command line option '-killNativeSSH' no longer supported.");
continue;
}
// msc (Oct 24, 2005): stand-alone argument should be considered a project name
// msc (Apr 28, 2006): alternatively it could be a manager location
String standalone = args[i];
if (standalone.length() > 8 && standalone.substring(0, 8).equalsIgnoreCase("corbaloc")) {
startupOptions.manager = standalone;
continue;
}
String mgrArg = MiscUtils.convertShortNotationToCorbaloc(standalone);
if (mgrArg != null) {
startupOptions.manager = mgrArg;
continue;
}
startupOptions.project = new File(standalone);
} catch (Exception exc) {
// ArrayIndexOutOfBounds, NumberFormat, ...
startupOptions = new StartupOptions();
log.warning("command line argument(s) invalid, some arguments may be ignored: " + Arrays.asList(args));
printUsage(System.err);
}
}
// --- instantiate appropriate logic
commandCenterLogic = new CommandCenterLogic();
commandCenterLogic.prepare(startupOptions);
if (startupOptions.project != null) {
commandCenterLogic.loadProject(startupOptions.project);
}
commandCenterLogic.go();
}
Aggregations