List of usage examples for org.apache.commons.configuration PropertiesConfiguration getURL
public URL getURL()
From source file:com.xemantic.tadedon.configuration.Configurations.java
public static void merge(PropertiesConfiguration defaultConf, PropertiesConfiguration conf) { LOG.debug("Merging: {} <-> {}", defaultConf.getURL(), conf.getURL()); for (@SuppressWarnings("unchecked") Iterator<String> iterator = defaultConf.getKeys(); iterator.hasNext();) { String key = iterator.next(); if (!conf.containsKey(key)) { copyProperty(key, defaultConf, conf); }//from w ww .jav a2 s. com } try { conf.save(); } catch (ConfigurationException e) { throw new RuntimeException("Could no save configuration file: " + conf.getFileName(), e); } }
From source file:org.betaconceptframework.astroboa.portal.managedbean.AstroboaClientFactory.java
@Factory("astroboaClient") public AstroboaClient initializeRepository() { logger.debug("Astroboa Client Factory Entered"); AstroboaClient astroboaClient = null; try {/*from w w w . j a v a 2 s . c om*/ PropertiesConfiguration portalConfiguration = new PropertiesConfiguration("portal.properties"); String currentlyConnectedRepositoryServer = portalConfiguration .getString(PortalStringConstants.ASTROBOA_SERVER); String currentlyConnectedRepository = portalConfiguration.getString(PortalStringConstants.REPOSITORY); String clientPermanentKey = portalConfiguration .getString(PortalStringConstants.ASTROBOA_CLIENT_PERMANENT_KEY); astroboaClient = new AstroboaClient(currentlyConnectedRepositoryServer); astroboaClient.loginAsAnonymous(currentlyConnectedRepository, clientPermanentKey); String propertiesFilePath = "portal.properties"; if (portalConfiguration.getURL() != null) { propertiesFilePath = portalConfiguration.getURL().toString(); } if (logger.isDebugEnabled()) { logger.debug("Created Astroboa repository client {} from properties file {}", astroboaClient.getInfo(), propertiesFilePath); } } catch (ConfigurationException e) { logger.error( "A problem occured while reading repository client settings from portal configuration file.", e); } catch (Exception e) { logger.error("A problem occured while connecting repository client to Astroboa Repository", e); } return astroboaClient; }