Ejemplo n.º 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());
  }
Ejemplo n.º 2
0
 private PluginBindings installPluginConfigAndBindings(String pluginPath) {
   final Set<Plugin> plugins = loadPlugins(pluginPath);
   final PluginBindings pluginBindings = new PluginBindings(plugins);
   for (final Plugin plugin : plugins) {
     for (final PluginModule pluginModule : plugin.modules()) {
       for (final PluginConfigBean configBean : pluginModule.getConfigBeans()) {
         jadConfig.addConfigurationBean(configBean);
       }
     }
   }
   return pluginBindings;
 }
Ejemplo n.º 3
0
 private void dumpDefaultConfigAndExit() {
   for (Object bean : getCommandConfigurationBeans()) jadConfig.addConfigurationBean(bean);
   dumpCurrentConfigAndExit();
 }