List of usage examples for org.apache.commons.configuration ConfigurationException printStackTrace
public void printStackTrace()
From source file:com.virtualparadigm.packman.processor.JPackageManagerBU.java
public static boolean installPackage(File packageFile, File targetRootDir, File packageManagerDataDir, File localConfigurationFile, boolean developmentMode) { logger.info("PackageManager::installPackage - installing package: " + packageFile.getAbsolutePath()); boolean status = false; if (packageFile != null) { File tempDir = JPackageManagerBU.prepare(packageFile, packageManagerDataDir); Properties packageProperties = JPackageManagerBU.validate(tempDir); if (packageProperties != null) { Configuration configuration = null; try { configuration = new PropertiesConfiguration(localConfigurationFile); } catch (ConfigurationException ce) { ce.printStackTrace(); }/*from w w w . j a v a2s. c o m*/ JPackageManagerBU.configure(tempDir, configuration); JPackageManagerBU.deploy(targetRootDir, tempDir); JPackageManagerBU.autorun( new File(tempDir.getAbsolutePath() + "/" + AUTORUN_DIR_NAME + "/" + INSTALL_DIR_NAME)); JPackageManagerBU.finalize(packageProperties.getProperty(PACKAGE_NAME_KEY), packageProperties.getProperty(PACKAGE_VERSION_KEY), packageManagerDataDir, targetRootDir); status = true; } if (!developmentMode) { JPackageManagerBU.cleanup(tempDir); } } return status; }
From source file:com.virtualparadigm.packman.processor.JPackageManager.java
public static boolean configure(File tempDir, File localConfigurationFile) { logger.info("PackageManager::configure()"); boolean status = true; if (tempDir != null && localConfigurationFile != null) { Configuration configuration = null; try {/*from ww w . j a v a 2 s . c om*/ configuration = new PropertiesConfiguration(localConfigurationFile); } catch (ConfigurationException ce) { //dont want to error out completely if config file is not loaded ce.printStackTrace(); } if (configuration != null && !configuration.isEmpty()) { Map<String, String> substitutionContext = JPackageManager.createSubstitutionContext(configuration); StrSubstitutor strSubstitutor = new StrSubstitutor(substitutionContext); String templateContent = null; long lastModified; Collection<File> patchFiles = FileUtils.listFiles( new File(tempDir.getAbsolutePath() + "/" + JPackageManager.PATCH_DIR_NAME + "/" + JPackageManager.PATCH_FILES_DIR_NAME), TEMPLATE_SUFFIX_FILE_FILTER, DirectoryFileFilter.DIRECTORY); if (patchFiles != null) { for (File pfile : patchFiles) { logger.debug(" processing patch fileset file: " + pfile.getAbsolutePath()); try { lastModified = pfile.lastModified(); templateContent = FileUtils.readFileToString(pfile); templateContent = strSubstitutor.replace(templateContent); FileUtils.writeStringToFile(pfile, templateContent); pfile.setLastModified(lastModified); } catch (Exception e) { e.printStackTrace(); } } } Collection<File> scriptFiles = FileUtils.listFiles( new File(tempDir.getAbsolutePath() + "/" + JPackageManager.AUTORUN_DIR_NAME), TEMPLATE_SUFFIX_FILE_FILTER, DirectoryFileFilter.DIRECTORY); if (scriptFiles != null) { for (File scriptfile : scriptFiles) { logger.debug(" processing script file: " + scriptfile.getAbsolutePath()); try { lastModified = scriptfile.lastModified(); templateContent = FileUtils.readFileToString(scriptfile); templateContent = strSubstitutor.replace(templateContent); FileUtils.writeStringToFile(scriptfile, templateContent); scriptfile.setLastModified(lastModified); } catch (Exception e) { e.printStackTrace(); } } } } } return status; }
From source file:com.kantenkugel.kanzebot.core.config.GlobalConfigImpl.java
private void read() { botOwner = getString("BotOwnerId", "", "The ID of the BotOwner (Access to all Commands)"); botAdmins = getSet("BotAdmins", new HashSet<>(0), "The Set of IDs of the BotAdmins (Access to (almost) all Commands)"); authMode = getBoolean("InAuthMode", false, "Determines whether or not the Bot runs in Auth-Mode (instantly leaves guilds not first accepted by a BotAdmin)"); authedGuilds = getSet("AuthedGuilds", new HashSet<>(0), "The set of authed guilds (is ignored if not in auth-mode)"); if (hasChanged()) { try {//from ww w. j av a 2 s .c o m save(); } catch (ConfigurationException e) { e.printStackTrace(); } } }
From source file:com.hipstogram.context.HipstogramContext.java
private HipstogramContext() { String configFile = System.getProperty("config"); if (configFile == null) configFile = getClass().getClassLoader().getResource("config/config.ini").getFile(); try {/*from ww w.j a v a 2 s.c o m*/ System.out.println("Expecting config file in: " + configFile); configuration = new Config(new File(configFile)); } catch (ConfigurationException e) { e.printStackTrace(); } }
From source file:com.keybox.service.mail.MailConfigLoader.java
/** * Constructor for MailConfigLoader//w w w . j a v a 2 s . c om * * @param mailfile Filename from the Mail-Properties in resources */ public MailConfigLoader(String mailfile) { try { mailprop = new PropertiesConfiguration( MailConfigLoader.class.getClassLoader().getResource(mailfile).getPath()); default_mailprop = new PropertiesConfiguration( MailConfigLoader.class.getClassLoader().getResource("mail.properties").getPath()); } catch (ConfigurationException e) { e.printStackTrace(); } }
From source file:com.virtualparadigm.packman.processor.JPackageManagerOld.java
public static boolean installPackage(File packageFile, File targetRootDir, File packageManagerDataDir, File localConfigurationFile, boolean developmentMode) { logger.info("PackageManager::installPackage - installing package: " + packageFile.getAbsolutePath()); boolean status = false; if (packageFile != null) { File tempDir = JPackageManagerOld.prepare(packageFile, packageManagerDataDir); Properties packageProperties = JPackageManagerOld.validate(tempDir); if (packageProperties != null) { Configuration configuration = null; try { configuration = new PropertiesConfiguration(localConfigurationFile); } catch (ConfigurationException ce) { ce.printStackTrace(); }//from w ww . j a va 2 s . com // JPackageManager.configure(tempDir, configuration); // JPackageManager.configureOld(tempDir, configuration); JPackageManagerOld.configureCommons(tempDir, configuration); JPackageManagerOld.deploy(targetRootDir, tempDir); JPackageManagerOld.autorun( new File(tempDir.getAbsolutePath() + "/" + AUTORUN_DIR_NAME + "/" + INSTALL_DIR_NAME)); JPackageManagerOld.finalize(packageProperties.getProperty(PACKAGE_NAME_KEY), packageProperties.getProperty(PACKAGE_VERSION_KEY), packageManagerDataDir, targetRootDir); status = true; } if (!developmentMode) { JPackageManagerOld.cleanup(tempDir); } } return status; }
From source file:com.github.mbredel.commons.configuration.YAMLConfigurationTest.java
@Test public void testSave() { try {/*from www . j ava 2s.c o m*/ yamlConfiguration.save(new StringWriter()); } catch (ConfigurationException e) { e.printStackTrace(); } }
From source file:com.parallax.server.blocklypropauth.config.SetupConfig.java
private void readConfiguration() { try {//w w w . jav a2 s . co m System.out.println("Looking for blocklypropauth.properties in: " + System.getProperty("user.home")); DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder( getClass().getResource("/config.xml")); configuration = configurationBuilder.getConfiguration(); } catch (ConfigurationException ce) { ce.printStackTrace(); } catch (Throwable t) { t.printStackTrace(); } }
From source file:eu.learnpad.ca.config.PropertyUtil.java
public PropertyUtil(String configFileLocation) { try {//from w w w .j a va 2s. c o m this.properties = new PropertiesConfiguration(configFileLocation); } catch (ConfigurationException e) { log.error("Cannot load application properties for dashboard component from : " + configFileLocation + "\n Loaded Default ConfFile Instead.", e); try { this.properties = new PropertiesConfiguration(DEFAULT_CONFIG_FILE_LOCATION); } catch (ConfigurationException e1) { e1.printStackTrace(); } } }
From source file:de.textmining.nerdle.database.DBSingleton.java
public DBSingleton(String path) { try {/*from w ww . ja v a2s.co m*/ config(path); } catch (ConfigurationException e) { e.printStackTrace(); } }