Like {@link #load()} but allows specifying parse options and resolve
options.

@param parseOptions
Options for parsing resources
@param resolveOptions
options for resolving the assembled config stack
@return configuration for an application

@since 1.3.0
18213
public static Config load(ConfigParseOptions parseOptions, final ConfigResolveOptions resolveOptions) {
        final ConfigParseOptions withLoader = ensureClassLoader(parseOptions, "load");
        return load(defaultApplication(withLoader), resolveOptions);
    }
89415
public static Config loadConfig(ConfigParseOptions parseOptions,
            ConfigResolveOptions resolveOptions, String configFile) {
        return loadConfig(parseOptions, resolveOptions, new File(configFile));
    }
796290
public static void loadConfig(String options, boolean force) {
        if (sIsInitialized && !force) return;
        sIsInitialized = true;

        Properties commandProperties = unpackOptions(options);
        String userHome = getUserHome();
        File userHomeDir = new File(userHome, Names.EKSTAZI_CONFIG_FILE);
        Properties homeProperties = getProperties(userHomeDir);
        File userDir = new File(System.getProperty("user.dir"), Names.EKSTAZI_CONFIG_FILE);
        Properties userProperties = getProperties(userDir);
        loadProperties(homeProperties);
        loadProperties(userProperties);
        loadProperties(commandProperties);
        // Init Log before any print of config/debug.
        Log.init(DEBUG_MODE_V == DebugMode.SCREEN || DEBUG_MODE_V == DebugMode.EVERYWHERE,
                DEBUG_MODE_V == DebugMode.FILE || DEBUG_MODE_V == DebugMode.EVERYWHERE,
                createFileNameInCoverageDir("debug.log"));

        // Print configuration.
        printVerbose(userHomeDir, userDir);
    }
327847
public static Config loadConfig(ClassLoader classLoader, String configResource,
            boolean useSystemEnvironment) {
        return loadConfig(ConfigParseOptions.defaults(),
                ConfigResolveOptions.defaults().setUseSystemEnvironment(useSystemEnvironment),
                classLoader, configResource);
    }
1054518
static Config loadConfig(String userResources) {
    Config config = ConfigFactory.load("agent");
    if (userResources != null && !"".equals(userResources)) {
      for (String userResource : userResources.split("[,\\s]+")) {
        if (userResource.startsWith("file:")) {
          File file = new File(userResource.substring("file:".length()));
          LOGGER.info("loading configuration from file: {}", file);
          Config user = ConfigFactory.parseFile(file);
          config = user.withFallback(config);
        } else {
          LOGGER.info("loading configuration from resource: {}", userResource);
          Config user = ConfigFactory.parseResourcesAnySyntax(userResource);
          config = user.withFallback(config);
        }
      }
    }
    return config.resolve().getConfig("netflix.spectator.agent");
  }
1268081
public static void parseNonReqOptionsAsProperties(final Properties defaultProperties, final String[] args) throws Exception {

        // loop thru each argument on cmdline
        for (final String argProp : args) {
            //System.out.println("parseNonReqOptionsAsProperties(), argProp: " + argProp);

            // ignore anything that does not start with --
            if (!argProp.startsWith("--")) {
                continue;
            }

            final String propName = convert2PropName(argProp);

            // get the desired property value from cmdline that we want to reset this property with
            // this value is the rhs of the = sign

            final int equalsAt = argProp.indexOf('=');
            final String propValue = argProp.substring(equalsAt + 1);

            if (null == propValue || "".equals(propValue)) {
                throw new Exception("argument: " + argProp + " not valid");
            }

            defaultProperties.setProperty(propName, propValue);
        }

    }
626028
public String resolve( Map<String, String> configuration )
    {
        StringBuilder buffer = new StringBuilder();
        append( buffer, configuration, null );
        return buffer.toString();
    }
1106201
private Option resolveOption(String name) {
        name = OptionUtils.stripLeadingHyphens(name);
        for (Option option : options) {
            if (name.equals(option.getName())) {
                return option;
            }
            if (name.equals(option.getLongName())) {
                return option;
            }
        }
        return null;
    }
918875
public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) {
        return Parseable.newReader(reader, options).parseConfigDocument();
    }
628608
private Option resolveOption(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);
        for (Option option : options)
        {
            if (opt.equals(option.getOpt()))
            {
                return option;
            }

            if (opt.equals(option.getLongOpt()))
            {
                return option;
            }

        }
        return null;
    }
464425
public Class< ? > loadClass(final String name,
                                final boolean resolve) throws ClassNotFoundException {
        Class cls = loader.get().load( this,
                                       name,
                                       resolve );
        if ( cls == null ) {
            throw new ClassNotFoundException( "Unable to load class: " + name );
        }

        return cls;
    }
272035
protected Option<TextBundle> loadJavaBundle(String bundleName, Locale locale) {
    Properties properties = new Properties();
    String resource = toJavaResourceName(bundleName, locale);
    try {
      InputStream is = ClassLoaders.getResourceAsStream(resource, getClass());
      if (null == is) return Option.none();
      properties.load(is);
      is.close();
    } catch (IOException e) {
      return Option.none();
    } finally {
    }
    return Option.<TextBundle> from(new DefaultTextBundle(locale, resource, properties));
  }
820760
public static Repository load(Resolver resolver) throws IOException {
        Repository repository;

        repository = new Repository();
        repository.loadClasspath(resolver);
        repository.link();
        return repository;
    }
506109
function resolve (options) {
  return {
    apiBuilders: resolveOption(options, 'apiBuilders'),
    languages: resolveOption(options, 'languages'),
    targetVersions: resolveOption(options, 'targetVersions'),
    issueUrl: resolveOption(options, 'issueUrl'),
    processChangelogs: resolveOption(options, 'processChangelogs'),
    changelogReverseVisibleList: resolveOption(options, 'changelogReverseVisibleList'),
    changelogGroupByApi: resolveOption(options, 'changelogGroupByApi')
  }
}
78168
public CliCommandBuilder addJavaOptions(final String... javaOpts) {
        if (javaOpts != null) {
            for (String javaOpt : javaOpts) {
                addJavaOption(javaOpt);
            }
        }
        return this;
    }
785968
public static Config load(final String... resources) {
        final ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
        try (final InputStream resourceAsStream = findResource("jjs-config-utils.js")) {
            engine.eval(new InputStreamReader(resourceAsStream));
            loadResources(engine, resources);
        } catch (final ScriptException se) {
            throw new IllegalArgumentException("unable to execute main javascript.", se);
        } catch (final Exception ex) {
            if (ex instanceof IllegalArgumentException) {
                throw (IllegalArgumentException) ex;
            }
            throw new IllegalArgumentException("unable to load main resource ", ex);
        }
        return loadFromObject(engine.get("config"));
    }
970503
protected void parseOptions(String configuration) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(configuration)) {
            return;
        }
        if (!configuration.startsWith("{")) {
            // add curly braces if not present
            configuration = "{" + configuration + "}";
        }
        try {
            JSONObject json = new JSONObject(configuration);
            if (json.has(OPTION_LAT)) {
                setLat((float)json.getDouble(OPTION_LAT));
            }
            if (json.has(OPTION_LNG)) {
                setLng((float)json.getDouble(OPTION_LNG));
            }
            if (json.has(OPTION_ZOOM)) {
                setZoom(json.getInt(OPTION_ZOOM));
            }
            if (json.has(OPTION_WIDTH)) {
                setWidth(json.getInt(OPTION_WIDTH));
            }
            if (json.has(OPTION_HEIGHT)) {
                setHeight(json.getInt(OPTION_HEIGHT));
            }
            if (json.has(OPTION_TYPE)) {
                setType(MapType.valueOf(json.getString(OPTION_TYPE)));
            }
            if (json.has(OPTION_MODE)) {
                // do not use value of, as the client side string is not equal to the enumeration mode name
                setMode(MapMode.parseMode(json.getString(OPTION_MODE)));
            }
        } catch (JSONException e) {
            // something went wrong
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
            return;
        }
    }