コード例 #1
0
  protected NamedConfigParametersModule readConfiguration(final String configFile) {
    final List<Object> beans = getCommandConfigurationBeans();
    for (Object bean : beans) {
      jadConfig.addConfigurationBean(bean);
    }
    jadConfig.setRepositories(getConfigRepositories(configFile));

    LOG.debug("Loading configuration from config file: {}", configFile);
    try {
      jadConfig.process();
    } catch (RepositoryException e) {
      LOG.error("Couldn't load configuration: {}", e.getMessage());
      System.exit(1);
    } catch (ParameterException | ValidationException e) {
      LOG.error("Invalid configuration", e);
      System.exit(1);
    }

    if (configuration.getRestTransportUri() == null) {
      configuration.setRestTransportUri(configuration.getDefaultRestTransportUri());
      LOG.debug(
          "No rest_transport_uri set. Using default [{}].", configuration.getRestTransportUri());
    }

    return new NamedConfigParametersModule(jadConfig.getConfigurationBeans());
  }
コード例 #2
0
  private String getPluginPath(String configFile) {
    PluginLoaderConfig pluginLoaderConfig = new PluginLoaderConfig();
    JadConfig jadConfig = new JadConfig(getConfigRepositories(configFile), pluginLoaderConfig);

    try {
      jadConfig.process();
    } catch (RepositoryException e) {
      LOG.error("Couldn't load configuration: {}", e.getMessage());
      System.exit(1);
    } catch (ParameterException | ValidationException e) {
      LOG.error("Invalid configuration", e);
      System.exit(1);
    }

    return pluginLoaderConfig.getPluginDir();
  }