Apply options based on given argument line.
@param configuration
@param arguments
501161
public static <T extends CitrusAppConfiguration> T apply(T configuration, String[] arguments) {
        LinkedList<String> args = new LinkedList<>(Arrays.asList(arguments));

        CitrusAppOptions options = new CitrusAppOptions();
        while (!args.isEmpty()) {
            String arg = args.removeFirst();

            for (CliOption option : options.options) {
                if (option.processOption(configuration, arg, args)) {
                    break;
                }
            }
        }

        return configuration;
    }
1146662
@Override
    public void configure(String parameters) {
        if (parameters.isEmpty()) {
            return;
        }
        List<String> values = Op.split(parameters, " ");
        int required = 4;
        if (values.size() < required) {
            throw new RuntimeException(String.format(
                    "[configuration error] term <%s> requires <%d> parameters",
                    this.getClass().getSimpleName(), required));
        }
        Iterator<String> it = values.iterator();
        setLeft(Op.toDouble(it.next()));
        setRising(Op.toDouble(it.next()));
        setFalling(Op.toDouble(it.next()));
        setRight(Op.toDouble(it.next()));
        if (values.size() > required) {
            setHeight(Op.toDouble(it.next()));
        }
    }
267630
public void setConfigurations(Collection<? extends Configuration> configurations) {
		Assert.notNull(configurations, "Configurations must not be null");
		this.configurations = new ArrayList<>(configurations);
	}
744749
public void run(String[] args) {
        String context = args.length > 0 ? args[0] : "";
        String action = args.length > 1 ? args[1] : "";
        String option = args.length > 2 ? args[2] : "";

        switch (context) {
            case "server":
                server(action, option);
                break;
            case "version":
                version();
                break;
            default:
                help();
        }
    }
536994
public static void setSearchArgument(Configuration conf, SearchArgument searchArgument) {
    if (searchArgument != null) {
      setSearchArgumentKryo(conf, searchArgument.toKryo());
    }
  }
1297490
private void addConfigParams(Map<String, Object> map) throws ConfigurationException {
        for (String name : map.keySet()) {
            addConfigParam(name, map.get(name));
        }
    }
415715
@Override
    public void applyConfiguration(@NonNull Configuration configuration) {
        if (!wasInitialised.get()) {
            globalLock.writeLock().lock();

            this.configuration = configuration;

            globalLock.writeLock().unlock();
        }
    }
1088336
public void setArgs(String args) {
    for (String s : args.trim().split("\\s*,\\s*"))
      argv.add(s);
  }
959191
private void setOption(String opt, String argument) {
        String[] option = { opt, argument };
        options.append(option);
    }
982202
@Override
	public void configure(Configuration parameters) {
		super.configure(parameters);

		if (charsetName == null || !Charset.isSupported(charsetName)) {
			throw new RuntimeException("Unsupported charset: " + charsetName);
		}
	}
758501
private static void configure(InputStream input, Map<String, String> substitutionVariables) {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(configureContext(lc, substitutionVariables));
      configurator.doConfigure(input);
    } catch (JoranException e) {
      // StatusPrinter will handle this
    } finally {
      IOUtils.closeQuietly(input);
    }
    StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
  }
223591
@Override
	public int parseArgument(Options opts, String[] args, int i) throws BadCommandLineException {
		initLoggerIfNecessary(opts);

		int recognized = 0;

		String arg = args[i];
		logger.trace("Argument[" + i + "] = " + arg);

		if (arg.equals(getArgumentName(ConfigurationOption.APPLY_PLURAL_FORM.optionName()))) {
			globalConfiguration.setApplyPluralForm(true);
			return 1;
		}
		else if ((recognized = parseArgument(args, i, ConfigurationOption.CONTROL)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.SUMMARY)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.COLLECTION_INTERFACE)) == 0 // longer option name comes first
		            && (recognized = parseArgument(args, i, ConfigurationOption.COLLECTION_IMPLEMENTATION)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.INSTANTIATION_MODE)) == 0) {
			if (arg.startsWith(getArgumentName(""))) {
				throw new BadCommandLineException("Invalid argument " + arg);
			}
		}

		return recognized;
	}
1013925
public void configure(Object configuration) {

        if (!(configuration instanceof Properties) && !(configuration.toString() instanceof String))
            throw new IllegalArgumentException("Configuration for DAR must be of type Properties or String; "
                    + configuration.getClass().getName() + " was received");

        Properties properties = new Properties();
        if (configuration instanceof String) {
            try {
                properties.load(new StringReader((String) configuration));
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
        } else if (configuration instanceof Properties) {
            properties = (Properties) configuration;
        }
        try {
            defaultSipApplicationRouterInfos = this.defaultApplicationRouterParser.parse(properties);
        } catch (ParseException e1) {
            throw new IllegalArgumentException("Failed to parse the new DAR properties", e1);
        }

        String configFileLocation = defaultApplicationRouterParser.getDarConfigurationFileLocation();

        if (configFileLocation.startsWith("file:/")) {
            int i = 5;
            while (configFileLocation.charAt(i) == '/')
                i++;
            configFileLocation = configFileLocation.substring(i - 1);
        } else {
            log.warn("Can not write persist DAR configuration to "
                    + configFileLocation
                    + ". Make sure you have write permissions and make sure it's a local file. NOTE THAT THE NEW DAR CONFIGURATION IS LOADED AND EFFECTIVE.");
            return;
        }

        if (configFileLocation == null || configFileLocation.length() < 1)
            throw new IllegalStateException("Configuration file name is empty.");

        File configFile = new File(configFileLocation);
        FileOutputStream fis = null;
        try {
            fis = new FileOutputStream(configFile);
            properties.store(fis, "Application Router Configuration");
        } catch (Exception e) {
            throw new IllegalStateException("Failed to store configuration file.", e);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    log.error("fail to close the following file " + configFile.getAbsolutePath(), e);
                }
            }
        }

        log.info("Stored DAR configuration in " + configFile.getAbsolutePath());
    }
1227948
public void run(String... arguments) throws Exception {
        final Bootstrap<T> bootstrap = new Bootstrap<>(this);
        addDefaultCommands(bootstrap);
        initialize(bootstrap);
        // Should be called after initialize to give an opportunity to set a custom metric registry
        bootstrap.registerMetrics();

        final Cli cli = new Cli(new JarLocation(getClass()), bootstrap, System.out, System.err);
        if (!cli.run(arguments)) {
            // only exit if there's an error running the command
            onFatalError();
        }
    }
193334
public static void run(final Configuration conf) throws IOException {
		final String inputString = conf.get("input");
		if (inputString == null)
			throw new IllegalArgumentException(
				"String property \"input\" path not found in given Configuration");

		final FileSystem fs = FileSystem.get(conf);

		final Path input = new Path(inputString);

		SplittingBAMIndexer.index(
			fs.open(input),
			fs.create(input.suffix(OUTPUT_FILE_EXTENSION)),
			fs.getFileStatus(input).getLen(),
			conf.getInt("granularity", DEFAULT_GRANULARITY));
	}
853206
@Override
    public void configure(String parameters) {
        if (parameters.isEmpty()) {
            return;
        }
        LinkedList<Double> values = new LinkedList<Double>();

        List<String> strValues = Op.split(parameters, " ");
        for (String strValue : strValues) {
            values.add(Op.toDouble(strValue));
        }

        if (values.size() % 2 == 0) {
            setHeight(1.0);
        } else {
            setHeight(values.removeLast());
        }
        setXY(toPairs(values));
    }
551158
@Override
	public void configure(Configuration parameters) {

		// enforce sequential configuration() calls
		synchronized (CONFIGURE_MUTEX) {
			// configure MR InputFormat if necessary
			if (this.mapredInputFormat instanceof Configurable) {
				((Configurable) this.mapredInputFormat).setConf(this.jobConf);
			} else if (this.mapredInputFormat instanceof JobConfigurable) {
				((JobConfigurable) this.mapredInputFormat).configure(this.jobConf);
			}
		}
	}