flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
/**
	 * Parses the command line arguments and starts the requested action.
	 *
	 * @param args command line arguments of the client.
	 * @return The return code of the program
	 */
Parses the command line arguments and starts the requested action.
@param args command line arguments of the client.
@return The return code of the program
Parses the command line arguments and starts the requested action . @param args command line arguments of the client . @return The return code of the program
public int parseParameters(String[] args) {
		if (args.length < 1) {
			CliFrontendParser.printHelp();
			System.out.println("Please specify an action.");
			return 1;
		}
		String action = args[0];
		final String[] params = Arrays.copyOfRange(args, 1, args.length);
		switch (action) {
			case ACTION_RUN:
				return run(params);
			case ACTION_LIST:
				return list(params);
			case ACTION_INFO:
				return info(params);
			case ACTION_CANCEL:
				return cancel(params);
			case ACTION_STOP:
				return stop(params);
			case ACTION_SAVEPOINT:
				return savepoint(params);
			case "-h":
			case "--help":
				CliFrontendParser.printHelp();
				return 0;
			case "-v":
			case "--version":
				String version = EnvironmentInformation.getVersion();
				String commitID = EnvironmentInformation.getRevisionInformation().commitId;
				System.out.print("Version: " + version);
				System.out.println(!commitID.equals(EnvironmentInformation.UNKNOWN) ? ", Commit ID: " + commitID : "");
				return 0;
			default:
				System.out.printf("\"%s\" is not a valid action.\n", action);
				System.out.println();
				System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
				System.out.println();
				System.out.println("Specify the version option (-v or --version) to print Flink version.");
				System.out.println();
				System.out.println("Specify the help option (-h or --help) to get help on the command.");
				return 1;
		}
	}
public int parseParameters ( String [ ] args ) { if ( args . length < 1 ) { CliFrontendParser . printHelp ( ) ; System . out . println ( "Please specify an action." ) ; return 1 ; } String action = args [ 0 ] ; final String [ ] params = Arrays . copyOfRange ( args , 1 , args . length ) ; switch ( action ) { case ACTION_RUN : return run ( params ) ; case ACTION_LIST : return list ( params ) ; case ACTION_INFO : return info ( params ) ; case ACTION_CANCEL : return cancel ( params ) ; case ACTION_STOP : return stop ( params ) ; case ACTION_SAVEPOINT : return savepoint ( params ) ; case "-h" : case "--help" : CliFrontendParser . printHelp ( ) ; return 0 ; case "-v" : case "--version" : String version = EnvironmentInformation . getVersion ( ) ; String commitID = EnvironmentInformation . getRevisionInformation ( ) . commitId ; System . out . print ( "Version: " + version ) ; System . out . println ( ! commitID . equals ( EnvironmentInformation . UNKNOWN ) ? ", Commit ID: " + commitID : "" ) ; return 0 ; default : System . out . printf ( "\"%s\" is not a valid action.\n" , action ) ; System . out . println ( ) ; System . out . println ( "Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\"." ) ; System . out . println ( ) ; System . out . println ( "Specify the version option (-v or --version) to print Flink version." ) ; System . out . println ( ) ; System . out . println ( "Specify the help option (-h or --help) to get help on the command." ) ; return 1 ; } }
Parses the command line arguments and starts the requested action.
Parses the command line arguments and starts the requested action .
// check for action // get action // remove action from parameters // do action