Executes the SAVEPOINT action.

@param args Command line arguments for the savepoint action.
771584
protected void savepoint(String[] args) throws Exception {
		LOG.info("Running 'savepoint' command.");

		final Options commandOptions = CliFrontendParser.getSavepointCommandOptions();

		final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);

		final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);

		final SavepointOptions savepointOptions = new SavepointOptions(commandLine);

		// evaluate help flag
		if (savepointOptions.isPrintHelp()) {
			CliFrontendParser.printHelpForSavepoint(customCommandLines);
			return;
		}

		final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);

		if (savepointOptions.isDispose()) {
			runClusterAction(
				activeCommandLine,
				commandLine,
				clusterClient -> disposeSavepoint(clusterClient, savepointOptions.getSavepointPath()));
		} else {
			String[] cleanedArgs = savepointOptions.getArgs();

			final JobID jobId;

			if (cleanedArgs.length >= 1) {
				String jobIdString = cleanedArgs[0];

				jobId = parseJobId(jobIdString);
			} else {
				throw new CliArgsException("Missing JobID. " +
					"Specify a Job ID to trigger a savepoint.");
			}

			final String savepointDirectory;
			if (cleanedArgs.length >= 2) {
				savepointDirectory = cleanedArgs[1];
			} else {
				savepointDirectory = null;
			}

			// Print superfluous arguments
			if (cleanedArgs.length >= 3) {
				logAndSysout("Provided more arguments than required. Ignoring not needed arguments.");
			}

			runClusterAction(
				activeCommandLine,
				commandLine,
				clusterClient -> triggerSavepoint(clusterClient, jobId, savepointDirectory));
		}

	}
1006778
def execute(self, *args, **kwargs):
        
        args = self.parser.parse_args(*args, **kwargs)
        self.process(args)
176675
public void runArgs(String[] args) {
        CommandLineParser clParser = new DefaultParser();
        CommandLine line;
        String host;
        String port;
        CMD cmd;
        String[] cmdArgs;
        final PrintStream CONSOLE = System.out;
        try {
            // parse the command line arguments
            line = clParser.parse(options, args);

            if (line.hasOption("output")){
                String location = line.getOptionValue("output");
                File output = new File(location);
                FileOutputStream fos;
                try {
                    fos = new FileOutputStream(output);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    throw new ParseException(String.format("Wrong -o option. args %s\n",Arrays.asList(args)));
                }
                PrintStream out = new PrintStream(fos);
                System.setOut(out);

            }
            if (line.getOptions().length==0 || line.hasOption("help")) {
                if ((line.getOptions().length > 2) || (line.getOptions().length==2 && !line.hasOption("output"))){
                    throw new ParseException(String.format("Wrong -help option. args %s\n", Arrays.asList(args)));
                }
                printUsage(System.out);
            }
            if (line.hasOption("server")) {
                String server = line.getOptionValue("server");
                try {
                    host = server.split(":")[0];
                    port = server.split(":")[1];
                }catch (Exception e){
                    throw new ParseException(String.format("Wrong -server option. args %s\n", Arrays.asList(args)));
                }
                ServiceDirectory.getServiceDirectoryConfig().setProperty(
                        DirectoryServiceRestfulClient.SD_API_SD_SERVER_FQDN_PROPERTY,
                        host);
                ServiceDirectory.getServiceDirectoryConfig().setProperty(
                        DirectoryServiceRestfulClient.SD_API_SD_SERVER_PORT_PROPERTY,
                        port);
            }

            if (line.hasOption("exec")) {
                String commandString = line.getOptionValue("exec");
                cmdArgs = parseCommand(commandString);
                try {
                    cmd = CMD.valueOf(cmdArgs[0]);
                } catch (IllegalArgumentException e) {
                    throw new ParseException(String.format("Unknown command [ %s ] \n", commandString));
                }
                if (cmd.sizeOfArgs + 1 != cmdArgs.length) {
                    throw new ParseException(
                            String.format("Wrong arguments number for command %s, required %s but %s \n",
                                    cmdArgs[0], cmd.sizeOfArgs, cmdArgs.length - 1));
                }
                switch (cmd) {
                    case getInstanceOf:
                        lookupInstance(cmdArgs);
                        break;
                    case getAllInstancesOf:
                        lookupInstances(cmdArgs);
                        break;
                    case getAllServices:
                        getAllServices();
                        break;
                    case registerService:
                        registerService(cmdArgs);
                        break;
                    default:
                        fail("command " + cmd + " is unsupported yet");
                        break;
                }

            }
        } catch (ParseException exp) {
            // oops, something went wrong
            exp.printStackTrace();
            try {
                TimeUnit.MILLISECONDS.sleep(100L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            printUsage(System.err);
        }
        System.setOut(CONSOLE);
    }
853578
@SuppressWarnings("unchecked")
        public static void executeCommand(String[] args) throws Exception {

            OptionParser parser = getParser();

            // declare parameters
            List<String> meta = null;
            String url = null;
            List<Integer> nodeIds = null;
            Boolean allNodes = true;
            Boolean confirm = false;

            // parse command-line input
            args = AdminToolUtils.copyArrayAddFirst(args, "--" + OPT_HEAD_META_SET);
            OptionSet options = parser.parse(args);
            if(options.has(AdminParserUtils.OPT_HELP)) {
                printHelp(System.out);
                return;
            }

            // check required options and/or conflicting options
            AdminParserUtils.checkRequired(options, OPT_HEAD_META_SET);
            AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);
            AdminParserUtils.checkOptional(options,
                                           AdminParserUtils.OPT_NODE,
                                           AdminParserUtils.OPT_ALL_NODES);

            // load parameters
            meta = AdminToolUtils.getValueList((List<String>) options.valuesOf(OPT_HEAD_META_SET),
                                               "=");
            if(meta.size() != 2 && meta.size() != 4) {
                throw new VoldemortException("Invalid metakey-metafile pairs.");
            }
            url = (String) options.valueOf(AdminParserUtils.OPT_URL);
            if(options.has(AdminParserUtils.OPT_NODE)) {
                nodeIds = (List<Integer>) options.valuesOf(AdminParserUtils.OPT_NODE);
                allNodes = false;
            }
            if(options.has(AdminParserUtils.OPT_CONFIRM)) {
                confirm = true;
            }

            // print summary
            System.out.println("Set metadata");
            System.out.println("Metadata:");
            for(Integer i = 0; i < meta.size(); i += 2) {
                System.out.println("  set \'" + meta.get(i) + "\' from file \'" + meta.get(i + 1)
                                   + "\'");
            }
            System.out.println("Location:");
            System.out.println("  bootstrap url = " + url);
            if(allNodes) {
                System.out.println("  node = all nodes");
            } else {
                System.out.println("  node = " + Joiner.on(", ").join(nodeIds));
            }

            AdminClient adminClient = AdminToolUtils.getAdminClient(url);

            if(allNodes) {
                nodeIds = AdminToolUtils.getAllNodeIds(adminClient);
            }

            AdminToolUtils.assertServerNotInRebalancingState(adminClient, nodeIds);

            if(meta.size() == 2) {
                String metaKey = meta.get(0), metaValue = meta.get(1);
                String metaFile = metaValue.replace("~", System.getProperty("user.home"));

                if(metaKey.equals(MetadataStore.STORES_KEY)) {
                    if(!Utils.isReadableFile(metaFile)) {
                        throw new VoldemortException("Stores definition xml file path incorrect");
                    }
                    StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
                    List<StoreDefinition> newStoreDefs = mapper.readStoreList(new File(metaFile));
                    StoreDefinitionUtils.validateSchemasAsNeeded(newStoreDefs);

                    // original metadata
                    Integer nodeIdToGetStoreXMLFrom = nodeIds.iterator().next();
                    Versioned<String> storesXML = adminClient.metadataMgmtOps.getRemoteMetadata(nodeIdToGetStoreXMLFrom,
                                                                                                MetadataStore.STORES_KEY);

                    List<StoreDefinition> oldStoreDefs = mapper.readStoreList(new StringReader(storesXML.getValue()));

                    printChangeStoreSummary(oldStoreDefs, newStoreDefs, System.err);
                    if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                        return;
                    }

                    // execute command
                    doMetaSet(adminClient, nodeIds, metaKey, mapper.writeStoreList(newStoreDefs));
                    if(!allNodes) {
                        System.err.println("WARNING: Metadata version update of stores goes to all servers, "
                                           + "although this set-metadata oprations only goes to node: ");
                        for(Integer nodeId: nodeIds) {
                            System.err.println(nodeId);
                        }
                    }
                    doMetaUpdateVersionsOnStores(adminClient, oldStoreDefs, newStoreDefs);
                } else {

                    // execute command
                    if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                        return;
                    }

                    if(metaKey.equals(MetadataStore.CLUSTER_KEY)
                       || metaKey.equals(MetadataStore.REBALANCING_SOURCE_CLUSTER_XML)) {
                        if(!Utils.isReadableFile(metaFile)) {
                            throw new VoldemortException("Cluster xml file path incorrect");
                        }
                        ClusterMapper mapper = new ClusterMapper();
                        Cluster newCluster = mapper.readCluster(new File(metaFile));
                        doMetaSet(adminClient, nodeIds, metaKey, mapper.writeCluster(newCluster));
                    } else if(metaKey.equals(MetadataStore.SLOP_STREAMING_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.PARTITION_STREAMING_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.READONLY_FETCH_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.QUOTA_ENFORCEMENT_ENABLED_KEY)) {
                        doMetaSet(adminClient, nodeIds, metaKey, metaValue);
                    } else if(metaKey.equals(KEY_OFFLINE)) {
                        boolean setOffline = Boolean.parseBoolean(metaValue);
                        if(setOffline && nodeIds.size() > 1) {
                            throw new VoldemortException("Setting more than one node to offline is not allowed.");
                        }
                        for(Integer nodeId: nodeIds) {
                            adminClient.metadataMgmtOps.setRemoteOfflineState(nodeId, setOffline);
                        }
                    } else if(metaKey.equals(MetadataStore.REBALANCING_STEAL_INFO)) {
                        if(!Utils.isReadableFile(metaFile)) {
                            throw new VoldemortException("Rebalancing steal info file path incorrect");
                        }
                        String rebalancingStealInfoJsonString = FileUtils.readFileToString(new File(metaFile));
                        RebalancerState state = RebalancerState.create(rebalancingStealInfoJsonString);
                        doMetaSet(adminClient, nodeIds, metaKey, state.toJsonString());
                    } else {
                        throw new VoldemortException("Incorrect metadata key");
                    }
                }
            } else if(meta.size() == 4) {
                // set metadata pair cluster.xml, stores.xml
                String clusterFile, storesFile;

                if(meta.get(0).equals(MetadataStore.CLUSTER_KEY)
                   && meta.get(2).equals(MetadataStore.STORES_KEY)) {
                    clusterFile = meta.get(1);
                    storesFile = meta.get(3);
                } else if(meta.get(0).equals(MetadataStore.STORES_KEY)
                          && meta.get(2).equals(MetadataStore.CLUSTER_KEY)) {
                    storesFile = meta.get(1);
                    clusterFile = meta.get(3);
                } else {
                    throw new VoldemortException("meta set-pair keys must be <cluster.xml, stores.xml>");
                }

                clusterFile = clusterFile.replace("~", System.getProperty("user.home"));
                storesFile = storesFile.replace("~", System.getProperty("user.home"));

                ClusterMapper clusterMapper = new ClusterMapper();
                StoreDefinitionsMapper storeDefsMapper = new StoreDefinitionsMapper();

                // original metadata
                Integer nodeIdToGetStoreXMLFrom = nodeIds.iterator().next();
                Versioned<String> storesXML = adminClient.metadataMgmtOps.getRemoteMetadata(nodeIdToGetStoreXMLFrom,
                                                                                            MetadataStore.STORES_KEY);

                List<StoreDefinition> oldStoreDefs = storeDefsMapper.readStoreList(new StringReader(storesXML.getValue()));

                if(!Utils.isReadableFile(clusterFile)) {
                    throw new VoldemortException("Cluster xml file path incorrect");
                }
                Cluster cluster = clusterMapper.readCluster(new File(clusterFile));

                if(!Utils.isReadableFile(storesFile)) {
                    throw new VoldemortException("Stores definition xml file path incorrect");
                }
                List<StoreDefinition> newStoreDefs = storeDefsMapper.readStoreList(new File(storesFile));

                StoreDefinitionUtils.validateSchemasAsNeeded(newStoreDefs);

                printChangeStoreSummary(oldStoreDefs, newStoreDefs, System.err);

                if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                    return;
                }

                // execute command
                doMetaSetPair(adminClient,
                              nodeIds,
                              clusterMapper.writeCluster(cluster),
                              storeDefsMapper.writeStoreList(newStoreDefs));
                if(!allNodes) {
                    System.err.println("WARNING: Metadata version update of stores goes to all servers, "
                                       + "although this set-metadata oprations only goes to node: ");
                    for(Integer nodeId: nodeIds) {
                        System.err.println(nodeId);
                    }
                }
                doMetaUpdateVersionsOnStores(adminClient, oldStoreDefs, newStoreDefs);
            }
        }
399410
public void run(String[] args) {
    LOG.info("Starting GA4GHPicardRunner");
    try {
      parseCmdLine(args);
      buildPicardCommand();
      startProcess();
      pumpInputData();
      waitForProcessEnd();
    } catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }
  }
268815
public static void executeCommand(String[] args) throws IOException {

            OptionParser parser = getParser();

            // declare parameters
            String url = null;

            // parse command-line input
            OptionSet options = parser.parse(args);
            if(options.has(AdminParserUtils.OPT_HELP)) {
                printHelp(System.out);
                return;
            }

            // check required options and/or conflicting options
            AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);

            // load parameters
            url = (String) options.valueOf(AdminParserUtils.OPT_URL);

            // execute command
            AdminClient adminClient = AdminToolUtils.getAdminClient(url);

            doMetaCheckVersion(adminClient);
        }
837922
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("add")) {
            SubCommandStoreAdd.executeCommand(args);
        } else if(subCmd.equals("update")) {
            SubCommandStoreUpdate.executeCommand(args);
        } else if(subCmd.equals("delete")) {
            SubCommandStoreDelete.executeCommand(args);
        } else if(subCmd.equals("rollback-ro")) {
            SubCommandStoreRollbackReadOnly.executeCommand(args);
        } else if(subCmd.equals("truncate-partition")) {
            SubCommandStoreTruncatePartition.executeCommand(args);
        } else if(subCmd.equals("truncate-store")) {
            SubCommandStoreTruncateStore.executeCommand(args);
        } else {
            printHelp(System.out);
        }
    }
327952
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("native-backup")) {
            SubCommandNativeBackup.executeCommand(args);
        } else if(subCmd.equals("restore-from-replica")) {
            SubCommandRestoreFromReplica.executeCommand(args);
        } else {
            AdminCommand.printHelp(System.out);
        }
    }
873321
public static void main(String[] args)
   {
      EventQueue.invokeLater(new Runnable()
      {
         @Override public void run()
         {
            try
            {
               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
               ProjectExplorer window = new ProjectExplorer();
               window.m_frame.setVisible(true);
            }
            catch (Exception e)
            {
               e.printStackTrace();
            }
         }
      });
   }
271707
public static void main(final String[] args) {
        new SpringApplicationBuilder(CasCommandLineShellApplication.class)
            .banner(new DefaultCasBanner())
            .bannerMode(Banner.Mode.CONSOLE)
            .logStartupInfo(true)
            .web(WebApplicationType.NONE)
            .run(args);
    }
1135701
protected void launch(String[] args) {
        try {
            JarFile.registerUrlProtocolHandler();
            ClassLoader classLoader = createClassLoader(getClassPathArchives());
            launch(args, getMainClass(), classLoader);
        } catch (Exception ex) {
            ex.printStackTrace();
            System.exit(1);
        }
    }
861635
public void run(String[] args) {
		System.out.println("SampleStarter.run(String[])");
		System.out.println("- args.length: " + args.length);
		for (String arg : args) System.out.println("  - " + arg);
		System.out.println(this);
	}
1185216
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = CoordinatorAdminUtils.copyArrayCutFirst(args);
        if(subCmd.equals("get")) {
            SubCommandGet.executeCommand(args);
        } else if(subCmd.equals("put")) {
            SubCommandPut.executeCommand(args);
        } else if(subCmd.equals("delete")) {
            SubCommandDelete.executeCommand(args);
        } else {
            args = CoordinatorAdminUtils.copyArrayAddFirst(args, subCmd);
            executeHelp(args, System.out);
        }
    }
931855
public static void main(String[] args) throws Exception {
    int exitCode =  new Submitter().run(args);
    System.exit(exitCode);
  }
1973
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("list")) {
            SubCommandScheduledList.executeCommand(args);
        } else if(subCmd.equals("stop")) {
            SubCommandScheduledStop.executeCommand(args);
        } else if(subCmd.equals("enable")) {
            SubCommandScheduledEnable.executeCommand(args);
        } else {
            printHelp(System.out);
        }
    }
336807
public static void main(String[] args) {
    try {
      System.exit( ToolRunner.run(null, new Balancer(), args) );
    } catch (Throwable e) {
      LOG.error(StringUtils.stringifyException(e));
      System.exit(-1);
    }

  }
6950
public static void main(String[] args) {
    final PrintWriter out = new PrintWriter(System.out);
    final PrintWriter err = new PrintWriter(System.err);
    final int code = Launcher.main2(out, err, Arrays.asList(args));
    System.exit(code);
  }