當前位置: 首頁>>代碼示例>>Java>>正文


Java CompositeConfiguration.addConfiguration方法代碼示例

本文整理匯總了Java中org.apache.commons.configuration.CompositeConfiguration.addConfiguration方法的典型用法代碼示例。如果您正苦於以下問題:Java CompositeConfiguration.addConfiguration方法的具體用法?Java CompositeConfiguration.addConfiguration怎麽用?Java CompositeConfiguration.addConfiguration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.configuration.CompositeConfiguration的用法示例。


在下文中一共展示了CompositeConfiguration.addConfiguration方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderWithPrettyUrls

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
@Test
public void renderWithPrettyUrls() throws Exception {
    Map<String, Object> testProperties = new HashMap<String, Object>();
    testProperties.put(Keys.URI_NO_EXTENSION, true);
    testProperties.put(Keys.URI_NO_EXTENSION_PREFIX, "/blog");

    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new MapConfiguration(testProperties));
    config.addConfiguration(ConfigUtil.load(new File(this.getClass().getResource("/").getFile())));

    Crawler crawler = new Crawler(db, sourceFolder, config);
    crawler.crawl(new File(sourceFolder.getPath() + File.separator + config.getString(Keys.CONTENT_FOLDER)));

    Assert.assertEquals(4, db.getDocumentCount("post"));
    Assert.assertEquals(3, db.getDocumentCount("page"));

    DocumentList documents = db.getPublishedPosts();

    for (Map<String, Object> model : documents) {
        String noExtensionUri = "blog/\\d{4}/" + FilenameUtils.getBaseName((String) model.get("file")) + "/";

        Assert.assertThat(model.get("noExtensionUri"), RegexMatcher.matches(noExtensionUri));
        Assert.assertThat(model.get("uri"), RegexMatcher.matches(noExtensionUri + "index\\.html"));
    }
}
 
開發者ID:ghaseminya,項目名稱:jbake-rtl-jalaali,代碼行數:26,代碼來源:CrawlerTest.java

示例2: createConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
protected CompositeConfiguration createConfiguration() throws ConfigurationException {
    final CompositeConfiguration config = new CompositeConfiguration();

    if (properties != null) {
        config.addConfiguration(new MapConfiguration(properties));
    }
    config.addConfiguration(new MapConfiguration(project.getProperties()));
    config.addConfiguration(ConfigUtil.load(inputDirectory));
    
    if (getLog().isDebugEnabled()) {
        getLog().debug("Configuration:");

        Iterator<String> iter = config.getKeys();
        while (iter.hasNext()) {
            String key = iter.next();
            getLog().debug(key + ": " + config.getString(key));
        }
    }

    return config;
}
 
開發者ID:Blazebit,項目名稱:jbake-maven-plugin,代碼行數:22,代碼來源:BuildMojo.java

示例3: getCommonConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public Configuration getCommonConfiguration() throws IOException {
    CompositeConfiguration conf = new CompositeConfiguration();
    Enumeration<URL> resources = SAMLConfiguration.class.getClassLoader().getResources("oiosaml-common.properties");
    while (resources.hasMoreElements()) {
        URL u = resources.nextElement();
        log.debug("Loading config from " + u);
        try {
            conf.addConfiguration(new PropertiesConfiguration(u));
        } catch (ConfigurationException e) {
            log.error("Cannot load the configuration file", e);
            throw new WrappedException(Layer.DATAACCESS, e);
        }
    }

    return conf;
}
 
開發者ID:amagdenko,項目名稱:oiosaml.java,代碼行數:17,代碼來源:FileConfiguration.java

示例4: getCommonConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public Configuration getCommonConfiguration() throws IOException {
	CompositeConfiguration conf = new CompositeConfiguration();
	Enumeration<URL> resources = SAMLConfiguration.class.getClassLoader().getResources("oiosaml-common.properties");
	while (resources.hasMoreElements()) {
		URL u = resources.nextElement();
		log.debug("Loading config from " + u);
		try {
			conf.addConfiguration(new PropertiesConfiguration(u));
		} catch (ConfigurationException e) {
			log.error("Cannot load the configuration file", e);
			throw new WrappedException(Layer.DATAACCESS, e);
		}
	}

	return conf;
}
 
開發者ID:amagdenko,項目名稱:oiosaml.java,代碼行數:17,代碼來源:FileConfiguration.java

示例5: createConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
@Override
protected Configuration createConfiguration(String name) throws ConfigurationException {
  CompositeConfiguration config = new CompositeConfiguration();
  config.addConfiguration(new SystemConfiguration());
  try {
    if (ConfigFactory.DEFAULT_CONFIG_NAME.equals(name)) {
      config.addConfiguration(new PropertiesConfiguration("config.properties"));
    } else {
      config.addConfiguration(new PropertiesConfiguration(name));
    }
  } catch (ConfigurationException e) {
    String message = "No properties file found: " + name
        + ". Using an empty BaseConfiguration instead.";
    if (ConfigFactory.DEFAULT_CONFIG_NAME.equals(name)) {
      LOG.info(message);
    } else {
      LOG.warn(message);
    }
    BaseConfiguration base = new BaseConfiguration();
    config.addConfiguration(base);
  }
  return config;
}
 
開發者ID:irenical,項目名稱:jindy,代碼行數:24,代碼來源:CommonsSimpleImpl.java

示例6: getConfig

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
/**
 * The combined config = current user config + defaults for non-specified properties.
 * TODO: instead of re-reading user config every time, it would be better
 *       to set up Commons Configuration listeners on the userfile.
 * @return even if reading user config fails, will return default config
 */
public CompositeConfiguration getConfig() {

    // try loading user config
    FileConfiguration userConfig = null;
    try {
        userConfig = BmConfig.forClass(BaseMap2D.class);
    } catch (ConfigurationException | IOException ex) {
        Exceptions.printStackTrace(ex);
    }
    CompositeConfiguration compositeConfig = new CompositeConfiguration();
    // the order of adding configurations to combined configuration is important
    // whoever is added first "shadows" the same key in all subsequently added
    // configuraions. Thus, add the DEFAULTs at the very end
    if (userConfig != null) {
        compositeConfig.addConfiguration(userConfig);
    }
    compositeConfig.addConfiguration(defaultConfig);

    return compositeConfig;
}
 
開發者ID:chhh,項目名稱:batmass,代碼行數:27,代碼來源:Map2DOptions.java

示例7: getConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static Configuration getConfiguration(Session pSession) {
	try {
		PropertiesConfiguration prop = new PropertiesConfiguration();
		for(Object aKey : pSession.getProperties().keySet()) {
			Object aValue = pSession.getProperties().get(aKey);

			prop.addProperty(aKey.toString(), aValue);
		}

		CompositeConfiguration config = new CompositeConfiguration();
		config.addConfiguration(prop);
		URL lURL = Thread.currentThread().getContextClassLoader().getResource("javamail-ews-bridge.default.properties");
		config.addConfiguration(new PropertiesConfiguration(lURL));
		return config;
	} catch (ConfigurationException e) {
		throw new RuntimeException(e.getMessage(), e);
	}
}
 
開發者ID:gartcimore,項目名稱:javamail4ews,代碼行數:19,代碼來源:Util.java

示例8: main

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws ConfigurationException {
        log.setLevel(Level.DEBUG);

        CompositeConfiguration conf = new CompositeConfiguration();
        conf.addConfiguration(new PropertiesConfiguration("kafka.properties"));
        conf.addConfiguration(new PropertiesConfiguration("cassandra.properties"));
        conf.addConfiguration(new PropertiesConfiguration("spark.properties"));
        conf.addConfiguration(new PropertiesConfiguration("es.properties"));

//        Path filePath = Paths.get("/media/sf_Download/ipinyou/new");
//        Path filePath = Paths.get("/media/sf_Download/data/iPinYou/ipinyou.contest.dataset_unpacked/training2nd/data");


//        Path filePath = Paths.get("/media/sf_Download/data/mors/new");
        Path filePath = Paths.get("/media/sf_Download/data/mors/cassandra_test"); // Cassandra TEST
        String esIdxSuffix = "log_%s/bid";

        BiddingLogWorkflow wf = new BiddingLogWorkflow();

        try {
            wf.runBatch(conf, filePath, esIdxSuffix);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
開發者ID:ogidogi,項目名稱:laughing-octo-sansa,代碼行數:26,代碼來源:BiddingLogWorkflow.java

示例9: main

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws ConfigurationException {
    PredictionFlow workflow = new PredictionFlow();
    log.setLevel(Level.DEBUG);

    CompositeConfiguration conf = new CompositeConfiguration();
    conf.addConfiguration(new PropertiesConfiguration("kafka.properties"));
    conf.addConfiguration(new PropertiesConfiguration("spark.properties"));
    conf.addConfiguration(new PropertiesConfiguration("cassandra.properties"));
    conf.addConfiguration(new PropertiesConfiguration("es.properties"));

    try {
        workflow.run(conf);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:ogidogi,項目名稱:laughing-octo-sansa,代碼行數:17,代碼來源:PredictionFlow.java

示例10: main

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws ConfigurationException {
    StreamingUserTypeClassification workflow = new StreamingUserTypeClassification();
    log.setLevel(Level.DEBUG);

    CompositeConfiguration conf = new CompositeConfiguration();
    conf.addConfiguration(new PropertiesConfiguration("kafka.properties"));
    conf.addConfiguration(new PropertiesConfiguration("spark.properties"));
    conf.addConfiguration(new PropertiesConfiguration("es.properties"));

    try {
        workflow.run(conf);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
開發者ID:ogidogi,項目名稱:laughing-octo-sansa,代碼行數:17,代碼來源:StreamingUserTypeClassification.java

示例11: main

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws ConfigurationException {
    KafkaSparkCassandraFlow workflow = new KafkaSparkCassandraFlow();
    log.setLevel(Level.DEBUG);

    CompositeConfiguration conf = new CompositeConfiguration();
    conf.addConfiguration(new PropertiesConfiguration("kafka.properties"));
    conf.addConfiguration(new PropertiesConfiguration("spark.properties"));
    conf.addConfiguration(new PropertiesConfiguration("cassandra.properties"));

    try {
        workflow.run(conf);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
開發者ID:ogidogi,項目名稱:laughing-octo-sansa,代碼行數:17,代碼來源:KafkaSparkCassandraFlow.java

示例12: main

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws ConfigurationException {
    KafkaSparkEsFlow workflow = new KafkaSparkEsFlow();
    log.setLevel(Level.DEBUG);

    CompositeConfiguration conf = new CompositeConfiguration();
    conf.addConfiguration(new PropertiesConfiguration("kafka.properties"));
    conf.addConfiguration(new PropertiesConfiguration("spark.properties"));
    conf.addConfiguration(new PropertiesConfiguration("es.properties"));

    try {
        workflow.run(conf);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
開發者ID:ogidogi,項目名稱:laughing-octo-sansa,代碼行數:17,代碼來源:KafkaSparkEsFlow.java

示例13: ArchaiusInitializingBeanPostProcessor

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public ArchaiusInitializingBeanPostProcessor(ConfigurableApplicationContext applicationContext, AbstractPollingScheduler pollingScheduler, SpringEnvironmentPolledConfigurationSource polledConfigurationSource, List<ClasspathPropertySource> propertyBindings) {
  this.applicationContext = Objects.requireNonNull(applicationContext, "applicationContext");
  this.pollingScheduler = Objects.requireNonNull(pollingScheduler, "pollingScheduler");
  this.polledConfigurationSource = Objects.requireNonNull(polledConfigurationSource, "polledConfigurationSource");
  this.propertyBindings = propertyBindings != null ? propertyBindings : Collections.emptyList();
  initPropertyBindings();

  configurationInstance = new DynamicConfiguration(polledConfigurationSource, pollingScheduler);
  if (!ConfigurationManager.isConfigurationInstalled()) {
    ConfigurationManager.install(new CompositeConfiguration());
  }
  CompositeConfiguration config = (CompositeConfiguration) ConfigurationManager.getConfigInstance();
  config.addConfiguration(configurationInstance);

  applicationContext.getBeanFactory().registerSingleton("environmentBackedConfig", ConfigurationManager.getConfigInstance());
  applicationContext.getBeanFactory().registerAlias("environmentBackedConfig", "abstractConfiguration");
}
 
開發者ID:spinnaker,項目名稱:kork,代碼行數:18,代碼來源:ArchaiusConfiguration.java

示例14: testConfigLoadingInValidMissingDelay

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
/**
 * Failure Testing:
 *
 * Test that missing delay fails.
 * If we have no delay then we do not pick a default. So a Configuration
 * Exception is thrown.
 *
 * */
public void testConfigLoadingInValidMissingDelay()
{
    SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

    XMLConfiguration xmlconfig = new XMLConfiguration();

    xmlconfig.addProperty("timeunit", TimeUnit.SECONDS.toString());

    // Create a CompositeConfiguration as this is what the broker uses
    CompositeConfiguration composite = new CompositeConfiguration();
    composite.addConfiguration(xmlconfig);
    try
    {
        config.setConfiguration("", composite);
        fail("Configuration should fail to validate");
    }
    catch (ConfigurationException e)
    {
        assertEquals("Incorrect message.", "SlowConsumerDetectionConfiguration: unable to configure invalid delay:null", e.getMessage());
    }
}
 
開發者ID:wso2,項目名稱:andes,代碼行數:30,代碼來源:SlowConsumerDetectionConfigurationTest.java

示例15: setConfiguration

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
/**
 * Apply the given configuration to this VirtualHostConfiguration
 *
 * @param config
 *         the config to apply
 * @throws ConfigurationException
 *         if a problem occurs with configuration
 */
public void setConfiguration(Configuration config) throws ConfigurationException {
    setConfiguration("virtualhosts.virtualhost", config);

    Iterator i = getListValue("queues.queue.name").iterator();

    while (i.hasNext()) {
        String queueName = (String) i.next();
        _queues.put(queueName, new QueueConfiguration(queueName, this));
    }

    i = getListValue("exchanges.exchange.name").iterator();
    int count = 0;
    while (i.hasNext()) {
        CompositeConfiguration mungedConf = new CompositeConfiguration();
        mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")"));
        mungedConf.addConfiguration(_configuration.subset("exchanges"));
        String exchName = (String) i.next();
        _exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf));
    }
}
 
開發者ID:wso2,項目名稱:andes,代碼行數:29,代碼來源:VirtualHostConfiguration.java


注:本文中的org.apache.commons.configuration.CompositeConfiguration.addConfiguration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。