private static Options constructCliOptions() {
    Options options = new Options();

    Option cluster = Option.builder("c")
        .desc("Cluster name in which the topology needs to run on")
        .longOpt(CliArgs.CLUSTER.text)
        .hasArgs()
        .argName(CliArgs.CLUSTER.text)
        .required()
        .build();

    Option role = Option.builder("r")
        .desc("Role under which the topology needs to run")
        .longOpt(CliArgs.ROLE.text)
        .hasArgs()
        .argName(CliArgs.ROLE.text)
        .required()
        .build();

    Option environment = Option.builder("e")
        .desc("Environment under which the topology needs to run")
        .longOpt(CliArgs.ENVIRONMENT.text)
        .hasArgs()
        .argName(CliArgs.ENVIRONMENT.text)
        .build();

    Option heronHome = Option.builder("d")
        .desc("Directory where heron is installed")
        .longOpt(CliArgs.HERON_HOME.text)
        .hasArgs()
        .argName("heron home dir")
        .build();

    Option configFile = Option.builder("p")
        .desc("Path of the config files")
        .longOpt(CliArgs.CONFIG_PATH.text)
        .hasArgs()
        .argName("config path")
        .build();

    Option topologyName = Option.builder("n")
        .desc("Name of the topology")
        .longOpt(CliArgs.TOPOLOGY_NAME.text)
        .hasArgs()
        .argName("topology name")
        .required()
        .build();

    Option metricsSourceURL = Option.builder("t")
        .desc("metrics data source url with port number")
        .longOpt(CliArgs.METRIC_SOURCE_URL.text)
        .hasArgs()
        .argName("data source url")
        .build();

    // candidate metrics sources are:
    // org.apache.heron.healthmgr.sensors.TrackerMetricsProvider (default)
    // org.apache.heron.healthmgr.sensors.MetricsCacheMetricsProvider
    Option metricsSourceType = Option.builder("s")
        .desc("metrics data source type")
        .longOpt(CliArgs.METRIC_SOURCE_TYPE.text)
        .hasArg()
        .argName("data source type")
        .build();

    // candidates:
    // local: Health manager is started manually
    // cluster: Health manager is started by executor on container 0 (default)
    Option mode = Option.builder("m")
        .desc("Health manager process mode, cluster or local")
        .longOpt(CliArgs.MODE.text)
        .hasArg()
        .argName("process mode")
        .build();

    Option metricsMgrPort = Option.builder("m")
        .desc("Port of local MetricsManager")
        .longOpt(CliArgs.METRICSMGR_PORT.text)
        .hasArgs()
        .argName("metrics_manager port")
        .required()
        .build();

    Option verbose = Option.builder("v")
        .desc("Enable debug logs")
        .longOpt(CliArgs.VERBOSE.text)
        .build();

    options.addOption(cluster);
    options.addOption(role);
    options.addOption(environment);
    options.addOption(heronHome);
    options.addOption(configFile);
    options.addOption(topologyName);
    options.addOption(metricsSourceType);
    options.addOption(metricsSourceURL);
    options.addOption(mode);
    options.addOption(metricsMgrPort);
    options.addOption(verbose);

    return options;
  }
private static Options constructCliOptions ( ) { Options options = new Options ( ) ; Option cluster = Option . builder ( "c" ) . desc ( "Cluster name in which the topology needs to run on" ) . longOpt ( CliArgs . CLUSTER . text ) . hasArgs ( ) . argName ( CliArgs . CLUSTER . text ) . required ( ) . build ( ) ; Option role = Option . builder ( "r" ) . desc ( "Role under which the topology needs to run" ) . longOpt ( CliArgs . ROLE . text ) . hasArgs ( ) . argName ( CliArgs . ROLE . text ) . required ( ) . build ( ) ; Option environment = Option . builder ( "e" ) . desc ( "Environment under which the topology needs to run" ) . longOpt ( CliArgs . ENVIRONMENT . text ) . hasArgs ( ) . argName ( CliArgs . ENVIRONMENT . text ) . build ( ) ; Option heronHome = Option . builder ( "d" ) . desc ( "Directory where heron is installed" ) . longOpt ( CliArgs . HERON_HOME . text ) . hasArgs ( ) . argName ( "heron home dir" ) . build ( ) ; Option configFile = Option . builder ( "p" ) . desc ( "Path of the config files" ) . longOpt ( CliArgs . CONFIG_PATH . text ) . hasArgs ( ) . argName ( "config path" ) . build ( ) ; Option topologyName = Option . builder ( "n" ) . desc ( "Name of the topology" ) . longOpt ( CliArgs . TOPOLOGY_NAME . text ) . hasArgs ( ) . argName ( "topology name" ) . required ( ) . build ( ) ; Option metricsSourceURL = Option . builder ( "t" ) . desc ( "metrics data source url with port number" ) . longOpt ( CliArgs . METRIC_SOURCE_URL . text ) . hasArgs ( ) . argName ( "data source url" ) . build ( ) ; Option metricsSourceType = Option . builder ( "s" ) . desc ( "metrics data source type" ) . longOpt ( CliArgs . METRIC_SOURCE_TYPE . text ) . hasArg ( ) . argName ( "data source type" ) . build ( ) ; Option mode = Option . builder ( "m" ) . desc ( "Health manager process mode, cluster or local" ) . longOpt ( CliArgs . MODE . text ) . hasArg ( ) . argName ( "process mode" ) . build ( ) ; Option metricsMgrPort = Option . builder ( "m" ) . desc ( "Port of local MetricsManager" ) . longOpt ( CliArgs . METRICSMGR_PORT . text ) . hasArgs ( ) . argName ( "metrics_manager port" ) . required ( ) . build ( ) ; Option verbose = Option . builder ( "v" ) . desc ( "Enable debug logs" ) . longOpt ( CliArgs . VERBOSE . text ) . build ( ) ; options . addOption ( cluster ) ; options . addOption ( role ) ; options . addOption ( environment ) ; options . addOption ( heronHome ) ; options . addOption ( configFile ) ; options . addOption ( topologyName ) ; options . addOption ( metricsSourceType ) ; options . addOption ( metricsSourceURL ) ; options . addOption ( mode ) ; options . addOption ( metricsMgrPort ) ; options . addOption ( verbose ) ; return options ; }
Construct all required command line options