List of usage examples for org.apache.commons.configuration XMLConfiguration XMLConfiguration
public XMLConfiguration(URL url) throws ConfigurationException
XMLConfiguration
. From source file:org.bgp4j.apps.bgpd.config.ConfigurationFileProcessor.java
public void processConfigFile(String configFile) throws ConfigurationException { applicationConfiguration/*w w w. java2 s . c o m*/ .importConfiguration(configurationParser.parseConfiguration(new XMLConfiguration(configFile))); }
From source file:org.bgp4j.apps.easybox.ConfigurationFileProcessor.java
public void processConfigFile(String configFile) throws ConfigurationException { this.applicationConfiguration = parser.parseConfiguration(new XMLConfiguration(configFile)); }
From source file:org.bgp4j.config.ConfigTestBase.java
protected XMLConfiguration loadConfiguration(String fileName) throws Exception { return new XMLConfiguration(fileName); }
From source file:org.bgp4j.netty.fsm.CapabilitesNegotiatorTest.java
private Configuration loadConfiguration(String fileName) throws Exception { return parser.parseConfiguration(new XMLConfiguration(fileName)); }
From source file:org.bgp4j.netty.LocalhostNetworkChannelBGPv4TestBase.java
protected Configuration loadConfiguration(String fileName) throws Exception { return parser.parseConfiguration(new XMLConfiguration(fileName)); }
From source file:org.buddycode.jaxrs.samplejaxrs.authentication.AuthenticationFilter.java
/** * Load authentication handlers and register them. * * @throws InstantiationException//from ww w . j a va2 s. c om * @throws IllegalAccessException * @throws ClassNotFoundException * @throws ConfigurationException */ private void loadAuthenticationHandlers() throws InstantiationException, IllegalAccessException, ClassNotFoundException, ConfigurationException { XMLConfiguration config = new XMLConfiguration("sample_jaxrs.xml"); List<String> fields = config.getList("authenticationHandlers.handler"); for (String authenticationHandlerClassName : fields) { AuthenticationHandler authenticationHandler = (AuthenticationHandler) Class .forName(authenticationHandlerClassName).newInstance(); authenticationHandlers.add(authenticationHandler); } }
From source file:org.chenillekit.core.services.impl.ConfigurationServiceImpl.java
/** * get the configuration from the named resource. * * @param configurationResource the configuration resource * @param mergeWithSysProps merge the configuration resource with system properties * * @return the configuration/*from ww w .j av a2 s .co m*/ */ public Configuration getConfiguration(Resource configurationResource, boolean mergeWithSysProps) { Configuration configuration; assert configurationResource != null; if (!configurationResource.exists()) throw new RuntimeException( String.format("configuration resource '%s' not found", configurationResource.toString())); try { if (configurationResource.getFile().endsWith(".xml")) configuration = new XMLConfiguration(configurationResource.toURL()); else if (configurationResource.getFile().endsWith(".properties")) configuration = new PropertiesConfiguration(configurationResource.toURL()); else if (configurationResource.getFile().endsWith(".plist")) configuration = new PropertyListConfiguration(configurationResource.toURL()); else if (configurationResource.getFile().endsWith(".plist")) configuration = new PropertyListConfiguration(configurationResource.toURL()); else if (configurationResource.getFile().endsWith(".ini")) configuration = new HierarchicalINIConfiguration(configurationResource.toURL()); else throw new RuntimeException(String.format("cant resolve configuration type of resource '%s'", configurationResource.toString())); if (mergeWithSysProps) { CombinedConfiguration mergedConfiguration = new CombinedConfiguration(); mergedConfiguration.addConfiguration((AbstractConfiguration) configuration); mergedConfiguration.addConfiguration((AbstractConfiguration) getConfiguration()); configuration = mergedConfiguration; } } catch (ConfigurationException e) { throw new RuntimeException(e); } return configuration; }
From source file:org.codesearch.commons.configuration.xml.XmlConfigurationReader.java
private void loadConfig() throws InvalidConfigurationException { codesearchConfiguration = new CodesearchConfiguration(); try {//from ww w. java 2s .co m config = new XMLConfiguration(this.configPath); if (config == null) { throw new InvalidConfigurationException("Config was null at: " + this.configPath); } config.setDelimiterParsingDisabled(true); } catch (ConfigurationException ex) { throw new InvalidConfigurationException("Configuration file could not be read:\n" + ex); } loadCacheDirectory(); loadIndexLocation(); loadSearcherLocation(); loadGlobalBlacklist(); loadGlobalWhitelist(); loadRepositories(); loadJobs(); }
From source file:org.egov.infstr.utils.EGovConfig.java
/** * Initialize class variable.//ww w. j a v a2s .c om * @param xmlFileName the xml file name * @return the xML configuration */ private static XMLConfiguration initializeClassVariable(final String xmlFileName) { synchronized (EGovConfig.class) { XMLConfiguration configuration = null; try { if (configurationMap.get(xmlFileName) == null) { configuration = new XMLConfiguration(toURL(xmlFileName)); configurationMap.put(xmlFileName, configuration); } else { configuration = configurationMap.get(xmlFileName); } return configuration; } catch (final ConfigurationException cex) { LOGGER.error("Error occurred in initializeClassVariable", cex); throw new ApplicationRuntimeException("Exception in initializeClassVariable", cex); } catch (final Exception exp) { LOGGER.error("Error occurred in initializeClassVariable", exp); throw new ApplicationRuntimeException("Exception in initializeClassVariable", exp); } catch (final Error exp) { LOGGER.error("Error occurred in initializeClassVariable", exp); throw new ApplicationRuntimeException("Exception in initializeClassVariable", exp); } } }
From source file:org.encuestame.config.startup.XMLConfigurationFileSupport.java
/** * * @param file//from w w w . jav a2s. c om * @throws ConfigurationException */ private void reloadConfiguration(final File file) throws ConfigurationException { log.debug("createConfiguration " + file.exists()); log.debug("createConfiguration.... " + file.getAbsolutePath()); XMLConfigurationFileSupport.xmlConfiguration = new XMLConfiguration(file); XMLConfigurationFileSupport.xmlConfiguration.setAutoSave(true); XMLConfigurationFileSupport.xmlConfiguration.setReloadingStrategy(new FileChangedReloadingStrategy()); }