aboutsummaryrefslogtreecommitdiffstats
path: root/tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java')
-rw-r--r--tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java
new file mode 100644
index 0000000000..a4f74de535
--- /dev/null
+++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java
@@ -0,0 +1,40 @@
+package uk.ac.cam.cl.xeno.domctl;
+
+public class Main
+{
+ static CommandHelp help = new CommandHelp ();
+ static CommandNew newdom = new CommandNew ();
+ static CommandStart start = new CommandStart ();
+ static CommandStop stop = new CommandStop ();
+ static CommandDestroy destroy = new CommandDestroy ();
+ static CommandList list = new CommandList ();
+ static Command commands[] = { help, newdom, start, stop, destroy, list };
+
+ public static void main (String[] args)
+ {
+ Defaults d = new Defaults ();
+ int ec = -1;
+
+ if (args.length == 0) {
+ ec = help.doCommand (d, args);
+ } else {
+ String c = args[0];
+ int i;
+ for (i = 0; i < commands.length; i ++) {
+ if (commands[i].getName().equals(c)) {
+ if (commands[i].getFlagParameter (args, '?')) {
+ ec = help.doHelpFor (commands[i]);
+ } else {
+ ec = commands[i].doCommand (d, args);
+ }
+ break;
+ }
+ }
+ if (i == commands.length) {
+ System.out.println ("Unknown command " + c);
+ }
+ }
+
+ System.exit (ec);
+ }
+}