+ }
+ return 0;
+ }
+
+ private static int handleCommands(Namespace ns, ProvisioningManager pm) {
+ String commandKey = ns.getString("command");
+ final Map<String, Command> commands = Commands.getCommands();
+ if (commands.containsKey(commandKey)) {
+ Command command = commands.get(commandKey);
+
+ if (command instanceof ProvisioningCommand) {
+ return ((ProvisioningCommand) command).handleCommand(ns, pm);
+ } else {
+ System.err.println(commandKey + " only works with a username");
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ private static int handleCommands(Namespace ns, Manager m) {
+ String commandKey = ns.getString("command");
+ final Map<String, Command> commands = Commands.getCommands();
+ if (commands.containsKey(commandKey)) {
+ Command command = commands.get(commandKey);
+
+ if (command instanceof LocalCommand) {
+ return ((LocalCommand) command).handleCommand(ns, m);
+ } else if (command instanceof DbusCommand) {
+ return ((DbusCommand) command).handleCommand(ns, new DbusSignalImpl(m));
+ } else if (command instanceof ExtendedDbusCommand) {
+ System.err.println(commandKey + " only works via dbus");