List of usage examples for org.apache.commons.configuration DatabaseConfiguration DatabaseConfiguration
public DatabaseConfiguration(DataSource datasource, String table, String nameColumn, String keyColumn,
String valueColumn, String name)
From source file:com.kuzumeji.framework.enterprise.domain.ConfigTest.java
/** @see DatabaseConfiguration */ @Test/* w w w .j a v a 2 s. com*/ public final void test() { final Configuration testee = new DatabaseConfiguration(dataSource, "config", "name", "key", "value", "testee"); assertThat(testee, is(not(nullValue()))); }
From source file:com.germinus.easyconf.DatasourceURL.java
public DatabaseConfiguration getConfiguration() { return new DatabaseConfiguration(getDatasource(), getTableName(), getComponentColumnName(), getKeyColumnName(), getValueColumnName(), getCompanyComponentValue()); }
From source file:org.chenillekit.core.services.impl.ConfigurationServiceImpl.java
/** * Build a configuration from a table containing multiple configurations. * * @param datasource the datasource to connect to the database * @param table the name of the table containing the configurations * @param nameColumn the column containing the name of the configuration * @param keyColumn the column containing the keys of the configuration * @param valueColumn the column containing the values of the configuration * @param name the name of the configuration *//* w ww . j a v a 2 s . c om*/ public Configuration getConfiguration(DataSource datasource, String table, String nameColumn, String keyColumn, String valueColumn, String name) { return new DatabaseConfiguration(datasource, table, nameColumn, keyColumn, valueColumn, name); }
From source file:org.nuxeo.ecm.platform.configuration.ConfigurationServiceImpl.java
@Override public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception { if (CONFIGURATION_EP.equals(extensionPoint) && contribution instanceof ConfigurationDescriptor) { log.debug("Registering contribution..."); ConfigurationDescriptor desc = (ConfigurationDescriptor) contribution; String name = desc.getName(); String type = desc.getType(); if (ConfigurationConstants.TYPE_SYSTEM.equals(type)) { log.debug("Using system properties"); SystemConfiguration conf = new SystemConfiguration(); configurations.put(name, conf); } else if (ConfigurationConstants.TYPE_PROPERTIES.equals(type)) { String path = Framework.expandVars(desc.getFile()); log.debug("Using properties file: " + path); PropertiesConfiguration conf = new PropertiesConfiguration(path); conf.setAutoSave(true);/*from w w w .j a va2 s . co m*/ configurations.put(name, conf); } else if (ConfigurationConstants.TYPE_DATABASE.equals(type)) { String ns = desc.getDbnamespace(); log.debug("Using database namespace: " + ns); DataSource dataSource = DataSourceHelper.getDataSource(ConfigurationConstants.DATASOURCE); DatabaseConfiguration conf = new DatabaseConfiguration(dataSource, ConfigurationConstants.TABLE, ConfigurationConstants.COL_NAMESPACE, ConfigurationConstants.COL_KEY, ConfigurationConstants.COL_VALUE, ns); configurations.put(name, conf); } else { log.warn("Unsuported type: " + type + ", skipping contribution."); return; } if (names.contains(name)) { log.warn("Overriding existing configuration: " + name); } names.add(name); log.info("Contribution " + name + " registered."); } }