List of usage examples for org.apache.commons.configuration ConfigurationException getMessage
public String getMessage()
From source file:org.eclipse.winery.repository.export.CSARExporter.java
/** * Writes the configured mapping namespaceprefix -> namespace to the archive * /*from w ww. jav a2s .c o m*/ * This is kind of a quick hack. TODO: during the import, the prefixes should be extracted using * JAXB and stored in the NamespacesResource * * @throws IOException */ private void addNamespacePrefixes(ArchiveOutputStream zos) throws IOException { Configuration configuration = Repository.INSTANCE.getConfiguration(new NamespacesId()); if (configuration instanceof PropertiesConfiguration) { // Quick hack: direct serialization only works for PropertiesConfiguration PropertiesConfiguration pconf = (PropertiesConfiguration) configuration; ArchiveEntry archiveEntry = new ZipArchiveEntry(CSARExporter.PATH_TO_NAMESPACES_PROPERTIES); zos.putArchiveEntry(archiveEntry); try { pconf.save(zos); } catch (ConfigurationException e) { CSARExporter.logger.debug(e.getMessage(), e); zos.write("#Could not export properties".getBytes()); zos.write(("#" + e.getMessage()).getBytes()); } zos.closeArchiveEntry(); } }
From source file:org.eclipse.winery.repository.export.ZipExporter.java
/** * Writes the configured mapping namespaceprefix -> namespace to the archive * //from ww w . j a va 2 s .c o m * This is kind of a quick hack. TODO: during the import, the prefixes should be extracted using * JAXB and stored in the NamespacesResource * * @throws IOException */ private void addNamespacePrefixes(ArchiveOutputStream zos) throws IOException { Configuration configuration = Repository.INSTANCE.getConfiguration(new NamespacesId()); if (configuration instanceof PropertiesConfiguration) { // Quick hack: direct serialization only works for PropertiesConfiguration PropertiesConfiguration pconf = (PropertiesConfiguration) configuration; ArchiveEntry archiveEntry = new ZipArchiveEntry(ZipExporter.PATH_TO_NAMESPACES_PROPERTIES); zos.putArchiveEntry(archiveEntry); try { pconf.save(zos); } catch (ConfigurationException e) { ZipExporter.logger.debug(e.getMessage(), e); zos.write("#Could not export properties".getBytes()); zos.write(("#" + e.getMessage()).getBytes()); } zos.closeArchiveEntry(); } }
From source file:org.eclipse.winery.repository.importing.CSARImporter.java
/** * Import namespace prefixes. This is kind of a quick hack. TODO: during the import, the prefixes * should be extracted using JAXB and stored in the NamespacesResource * /* w w w . ja v a2s. c om*/ * @param rootPath the root path of the extracted CSAR */ private void importNamespacePrefixes(Path rootPath) { Path properties = rootPath.resolve(CSARExporter.PATH_TO_NAMESPACES_PROPERTIES); if (Files.exists(properties)) { PropertiesConfiguration pconf; try { pconf = new PropertiesConfiguration(properties.toFile()); } catch (ConfigurationException e) { CSARImporter.logger.debug(e.getMessage(), e); return; } Iterator<String> namespaces = pconf.getKeys(); while (namespaces.hasNext()) { boolean addToStorage = false; String namespace = namespaces.next(); if (NamespacesResource.INSTANCE.getIsPrefixKnownForNamespace(namespace)) { String storedPrefix = NamespacesResource.getPrefix(namespace); // QUICK HACK to check whether the prefix is a generated one // We assume we know the internal generation routine Matcher m = CSARImporter.GENERATED_PREFIX_PATTERN.matcher(storedPrefix); if (m.matches()) { // the stored prefix is a generated one // replace it by the one stored in the exported properties addToStorage = true; } } else { addToStorage = true; } if (addToStorage) { String prefix = pconf.getString(namespace); NamespacesResource.INSTANCE.addNamespace(namespace, prefix); } } } }
From source file:org.glite.authz.pap.common.PAPConfiguration.java
/** * Loads the PAP startup configuration.//from www .ja v a2 s .c om */ private void loadStartupConfiguration() { // logger.info( "Loading pap startup configuration..." ); String papConfDir = configuration.getString("papConfigurationDir"); File papConfFile = new File(papConfDir + "/" + DEFAULT_PAP_CONFIGURATION_FILE_NAME); if (!papConfFile.exists()) throw new PAPConfigurationException( "PAP startup configuration file does not exists on path:" + papConfFile.getAbsolutePath()); try { startupConfiguration = new INIConfiguration(papConfFile); configuration.addConfiguration(startupConfiguration); } catch (org.apache.commons.configuration.ConfigurationException e) { logger.error("Error parsing PAP distribution configuration: " + e.getMessage(), e); throw new PAPConfigurationException("Error parsing PAP distribution configuration: " + e.getMessage(), e); } }
From source file:org.glite.authz.pap.common.PAPConfiguration.java
public void saveStartupConfiguration() { try {// w ww . j av a2 s . c o m startupConfiguration.save(); } catch (ConfigurationException e) { throw new PAPConfigurationException("Error saving policy distribution configuration: " + e.getMessage(), e); } }
From source file:org.glite.security.voms.admin.configuration.VOMSConfiguration.java
public void loadServiceProperties() { String fileName = getVomsServicePropertiesFileName(); try {/*w ww . jav a 2 s .c o m*/ PropertiesConfiguration vomsServiceProperties = new PropertiesConfiguration( getVomsServicePropertiesFileName()); config.addConfiguration(vomsServiceProperties); } catch (ConfigurationException e) { log.error("Error loading service properties from " + fileName); if (log.isDebugEnabled()) log.error(e.getMessage(), e); throw new VOMSConfigurationException("Error loading service properties from " + fileName, e); } log.debug("VOMS Admin service properties loaded!"); }
From source file:org.glite.security.voms.admin.configuration.VOMSConfiguration.java
private void loadVersionProperties() { InputStream versionPropStream = this.getClass().getClassLoader().getResourceAsStream("version.properties"); PropertiesConfiguration versionProperties = new PropertiesConfiguration(); try {/*from ww w . j av a 2 s . c om*/ versionProperties.load(versionPropStream); config.addConfiguration(versionProperties); } catch (ConfigurationException e) { log.error("Error configuring version properties:" + e.getMessage(), e); throw new VOMSConfigurationException("Error configuring version properties!", e); } }
From source file:org.graphwalker.Util.java
public static String readWSPort() { PropertiesConfiguration conf = null; if (new File("graphwalker.properties").canRead()) { try {//from www . j av a2 s.com conf = new PropertiesConfiguration("graphwalker.properties"); } catch (ConfigurationException e) { Util.logger.error(e.getMessage()); } } else { conf = new PropertiesConfiguration(); try { conf.load(Util.class.getResourceAsStream("/org/graphwalker/resources/graphwalker.properties")); } catch (ConfigurationException e) { Util.logger.error(e.getMessage()); } } String port = conf.getString("graphwalker.ws.port"); Util.logger.debug("Read graphwalker.ws.port from graphwalker.properties: " + port); if (port == null) { port = "9090"; Util.logger.debug("Setting port to: 9090"); } return port; }
From source file:org.ihtsdo.classifier.ClassificationRunner.java
@SuppressWarnings("unchecked") private void getParams() throws ConfigurationException { try {// w w w. j av a2 s . co m xmlConfig = new XMLConfiguration(config); } catch (ConfigurationException e) { logger.info("ClassificationRunner - Error happened getting params file." + e.getMessage()); throw e; } this.module = xmlConfig.getString(I_Constants.MODULEID); this.releaseDate = xmlConfig.getString(I_Constants.RELEASEDATE); this.equivalencyReport = xmlConfig.getString(I_Constants.EQUIVALENT_CONCEPTS_OUTPUT_FILE); this.newInferredRelationships = xmlConfig.getString(I_Constants.INFERRED_RELATIONSHIPS_OUTPUT_FILE); concepts = xmlConfig.getList(I_Constants.CONCEPT_SNAPSHOT_FILES); statedRelationships = xmlConfig.getList(I_Constants.RELATIONSHIP_SNAPSHOT_FILES); previousInferredRelationships = xmlConfig.getList(I_Constants.PREVIOUS_INFERRED_RELATIONSHIP_FILES); logger.info("Classification - Parameters:"); logger.info("Module = " + module); logger.info("Release date = " + releaseDate); logger.info("Equivalent Concept Output file = " + equivalencyReport); logger.info("Previous Inferred Relationship file = " + previousInferredRelationships); logger.info("Inferred Relationship Output file = " + newInferredRelationships); logger.info("Concept files : "); for (String concept : concepts) { logger.info(concept); } logger.info("Stated Relationship files : "); for (String relFile : statedRelationships) { logger.info(relFile); } logger.info("Previous Relationship files : "); if (previousInferredRelationships != null) { for (String relFile : previousInferredRelationships) { logger.info(relFile); } } }
From source file:org.ihtsdo.classifier.CycleCheck.java
@SuppressWarnings("unchecked") private void getParams() throws ConfigurationException { try {//from w ww. j a v a 2 s. c o m xmlConfig = new XMLConfiguration(config); } catch (ConfigurationException e) { logger.info("CycleCheck - Error happened getting params file." + e.getMessage()); throw e; } conceptFilePaths = xmlConfig.getList(I_Constants.CONCEPT_SNAPSHOT_FILES); relationshipFilePaths = xmlConfig.getList(I_Constants.RELATIONSHIP_SNAPSHOT_FILES); outputFile = xmlConfig.getString(I_Constants.DETECTED_CYCLE_OUTPUT_FILE); logger.info("CheckCycle - Parameters:"); logger.info("Concept files : "); for (String concept : conceptFilePaths) { logger.info(concept); } logger.info("Relationship files : "); for (String relFile : relationshipFilePaths) { logger.info(relFile); } logger.info("Detected cycle output file = " + outputFile); }