List of usage examples for org.apache.commons.configuration ConfigurationException getMessage
public String getMessage()
From source file:com.wet.wired.jsr.recorder.ScreenRecorder.java
public synchronized void run() { BasicConfigurator.configure();// w ww . jav a 2 s. co m if (sessionId == null) { sessionId = UUID.randomUUID().toString(); } try { Idioma idioma = new Idioma(); logger.trace("Set Idioma:start()"); config = idioma.setIdioma("espanol"); logger.trace("Set Idioma:end()"); } catch (ConfigurationException e) { logger.error(e.getMessage()); } LoggerUtils loggerUtils = new LoggerUtils(); loggerUtils.load(config.getString("pathGlobal"), sessionId, config.getString("synchronizer.ruta.log"), config.getString("pathLog4j"), "synchronizer.log", "synchronizer.html"); logger.info("****************** Inicio de Screen Recorder ***************** "); logger.info("*********** " + sessionId + " *********** "); logger.info("************************************************************ "); startTime = System.currentTimeMillis(); logger.trace(startTime); recording = true; running = true; long lastFrameTime = 0; long time = 0; logger.trace("recordArea.width" + recordArea.width); logger.trace("recordArea.height" + startTime); frameSize = recordArea.width * recordArea.height; streamPacker = new StreamPacker(oStream, frameSize); while (recording) { time = System.currentTimeMillis(); while (time - lastFrameTime < 190) { try { Thread.sleep(10); } catch (Exception e) { } time = System.currentTimeMillis(); } lastFrameTime = time; try { recordFrame(); } catch (Exception e) { e.printStackTrace(); try { oStream.close(); } catch (Exception e2) { } break; } } running = false; recording = false; listener.recordingStopped(); }
From source file:fr.insalyon.creatis.vip.ssha.ConfigFile.java
private ConfigFile() { try {// w ww . j a v a 2 s . com config = new PropertiesConfiguration(new File(configFile)); gridaHost = config.getString("ssha.grida.host", "kingkong.grid.creatis.insa-lyon.fr"); gridaPort = config.getInt("ssha.grida.port", 9006); gridaProxy = config.getString("ssha.grida.proxy", "/root/.vip/proxies/x509up_server"); LOCAL_TEMP = config.getString("ssha.tempdir", "/tmp/ssh"); sleepTimeMillis = config.getInt("ssha.iteration.sleeptime", 5000); maxFilesIteration = config.getInt("ssha.iteration.maxfiles", 10); privKeyFile = config.getString("ssha.auth.privatekeyfile", "./id_rsa"); privKeyPass = config.getString("ssha.auth.privatekeypass", "changeit"); url = config.getString("ssha.db.jdbcurl", "jdbc:mysql://localhost:3306/vip"); userName = config.getString("ssha.db.user", "vip"); password = config.getString("ssha.db.password", "changeit"); nbSecond = config.getDouble("ssha.exponentielBackOff.nbSecond", 5); config.setProperty("ssha.grida.host", gridaHost); config.setProperty("ssha.grida.port", gridaPort); config.setProperty("ssha.grida.proxy", gridaProxy); config.setProperty("ssha.tempdir", LOCAL_TEMP); config.setProperty("ssha.iteration.sleeptime", sleepTimeMillis); config.setProperty("ssha.iteration.maxfiles", maxFilesIteration); config.setProperty("ssha.auth.privatekeyfile", privKeyFile); config.setProperty("ssha.auth.privatekeypass", privKeyPass); config.setProperty("ssha.db.jdbcurl", url); config.setProperty("ssha.db.user", userName); config.setProperty("ssha.db.password", password); config.setProperty("ssha.exponentielBackOff.nbSecond", nbSecond); config.save(); } catch (ConfigurationException ex) { System.out.println(ex.getMessage()); } }
From source file:com.moneydance.modules.features.importlist.util.Settings.java
Settings() { final AbstractFileConfiguration abstractFileConfiguration = new PropertiesConfiguration(); try {/* www .j av a2 s. co m*/ InputStream inputStream = Helper.getInputStreamFromResource(PROPERTIES_RESOURCE); abstractFileConfiguration.load(inputStream); } catch (ConfigurationException e) { throw new IllegalStateException(e.getMessage(), e); } this.config = abstractFileConfiguration; }
From source file:com.nilostep.xlsql.database.xlInstance.java
private xlInstance(String cfg) throws xlException { logger = Logger.getLogger(this.getClass().getName()); instance = this; try {/*from ww w . j a v a 2 s. c o m*/ PropertiesConfiguration config = new PropertiesConfiguration(); config.load(this.getClass().getResourceAsStream(cfg + ".properties")); this.config = config; engine = config.getString("general.engine"); logger.info("Configuration engine: " + engine + " loaded"); } catch (ConfigurationException e) { e.printStackTrace(); throw new xlException(e.getMessage()); } try { boolean append = true; FileHandler loghandler = new FileHandler(getLog(), append); loghandler.setFormatter(new SimpleFormatter()); logger.addHandler(loghandler); } catch (IOException e) { throw new xlException("error while creating logfile"); } logger.info("Instance created with engine " + getEngine()); }
From source file:com.vangent.hieos.empi.codes.CodesConfig.java
/** * * @param codesConfigLocation//from w w w . java2 s.c o m * @throws EMPIException */ public void loadConfiguration(String codesConfigLocation) throws EMPIException { try { XMLConfiguration xmlConfig = new XMLConfiguration(codesConfigLocation); // First load code sets (and index by code system name). List hcCodeSets = xmlConfig.configurationsAt(CODE_SETS); for (Iterator it = hcCodeSets.iterator(); it.hasNext();) { HierarchicalConfiguration hcCodeSet = (HierarchicalConfiguration) it.next(); this.loadCodeSet(hcCodeSet); } // Now load mappings (and index by code system type). List hcCodeSetMappings = xmlConfig.configurationsAt(CODE_SET_MAPPINGS); for (Iterator it = hcCodeSetMappings.iterator(); it.hasNext();) { HierarchicalConfiguration hcCodeSetMapping = (HierarchicalConfiguration) it.next(); this.loadCodeSetMapping(hcCodeSetMapping); } } catch (ConfigurationException ex) { throw new EMPIException("EMPIConfig: Could not load codes configuration from " + codesConfigLocation + " " + ex.getMessage()); } }
From source file:com.dcsquare.fileauthplugin.utility.Commands.java
/** * Delete User Command/*from w w w . j a va2 s. c om*/ * * @param username username * @return message if deletion of user was successful or not */ @CliCommand(value = "deleteUser", help = "deletes a user in the credential file") public String deleteUser( @CliOption(key = { "username" }, mandatory = true, help = "The username") final String username) { final boolean returnValue; try { returnValue = credentialProperties.deleteUser(username); } catch (ConfigurationException e) { return "Error during saving of the configuration:" + e.getMessage(); } String returnString; if (returnValue) { returnString = "User " + username + " deleted"; } else { returnString = "User " + username + " not existent"; } return returnString; }
From source file:com.dcsquare.fileauthplugin.utility.Commands.java
/** * Add User Command/* w ww . j a v a 2 s . com*/ * * @param username username * @param password plaintext password * @return message if adding the user was successful or not */ @CliCommand(value = "addUser", help = "adds a user in the credential file") public String addUser( @CliOption(key = { "username" }, mandatory = true, help = "The username") final String username, @CliOption(key = { "password" }, mandatory = true, help = "The password to hash") final String password) { String hashedString = getHashedString(password); final boolean returnValue; try { returnValue = credentialProperties.addUser(username, hashedString); } catch (ConfigurationException e) { return "Error during saving of the configuration:" + e.getMessage(); } String returnString; if (returnValue) { returnString = "User " + username + " added"; } else { returnString = "Username " + username + " already taken"; } return returnString; }
From source file:com.dcsquare.fileauthplugin.utility.Commands.java
/** * Update User Command./*www. j av a 2 s .c om*/ * * @param username username * @param password new plaintext password * @return message if updating the user was successful or not */ @CliCommand(value = "updateUser", help = "changes the password of a user in the credential file") public String updateUser( @CliOption(key = { "username" }, mandatory = true, help = "The username") final String username, @CliOption(key = { "password" }, mandatory = true, help = "The password to hash") final String password) { String hashedString = getHashedString(password); final boolean returnValue; try { returnValue = credentialProperties.updateUser(username, hashedString); } catch (ConfigurationException e) { return "Error during saving of the configuration:" + e.getMessage(); } String returnString; if (returnValue) { returnString = "User " + username + " updated"; } else { returnString = "User " + username + " not existent"; } return returnString; }
From source file:it.geosolutions.opensdi2.configurations.dao.PropertiesDAO.java
@Override public void save(OSDIConfiguration newConfig) throws OSDIConfigurationDuplicatedIDException, OSDIConfigurationNotFoundException, OSDIConfigurationInternalErrorException { if (isThisConfigIsAlreadyPresent(newConfig.getScopeID(), newConfig.getInstanceID())) { throw new OSDIConfigurationDuplicatedIDException( "A configuration with scopeID '" + newConfig.getScopeID() + "' and instanceID '" + newConfig.getInstanceID() + "' is already present."); }/*from w w w . ja v a 2 s . co m*/ Object configAsParamsSet = configConverter.buildConfig(newConfig); PropertiesConfiguration propertiesConfig = (PropertiesConfiguration) configAsParamsSet; PropertiesDirFiltersFactory factory = new PropertiesDirFiltersFactory(); File[] moduleList = propertiesConfigDir .listFiles(factory.getFilter(FILTER_TYPE.MODULE, newConfig.getScopeID())); File instanceConfig = new File(moduleList[0], factory.INSTANCE_CONFIGNAME_PREFIX + newConfig.getInstanceID() + factory.INSTANCE_CONFIGNAME_EXTENSION); try { propertiesConfig.save(instanceConfig); } catch (ConfigurationException e) { throw new OSDIConfigurationInternalErrorException( "Error occurred while saving a new configuration, exception msg is: '" + e.getMessage() + "'"); } }
From source file:com.dcsquare.fileauthplugin.utility.Commands.java
/** * Add or Update User Command// w w w .j av a 2s. c o m * * @param username username * @param password plaintext password * @return message if creating/updating of the user was successful or not */ @CliCommand(value = "addOrUpdateUser", help = "changes the password of a user or create a new user in the credential file") public String addOrUpdateUser( @CliOption(key = { "username" }, mandatory = true, help = "The username") final String username, @CliOption(key = { "password" }, mandatory = true, help = "The password to hash") final String password) { String hashedString = getHashedString(password); final boolean returnValue; try { returnValue = credentialProperties.updateUser(username, hashedString); } catch (ConfigurationException e) { return "Error during saving of the configuration:" + e.getMessage(); } String returnString; if (returnValue) { returnString = "User " + username + " updated"; } else { final boolean returnValueNewUser; try { returnValueNewUser = credentialProperties.addUser(username, hashedString); } catch (ConfigurationException e) { return "Error during saving of the configuration:" + e.getMessage(); } if (!returnValueNewUser) { return "Could not save new user!"; } returnString = "User " + username + " added"; } return returnString; }