List of usage examples for org.apache.commons.configuration ConfigurationException ConfigurationException
public ConfigurationException(Throwable cause)
ConfigurationException
with specified nested Throwable
. From source file:sample.file.monitor.resource.Resource.java
public static void load(URL resourceFile) throws ConfigurationException { try {//from www .j a va 2s . co m configuration = new PropertiesConfiguration(resourceFile); } catch (ConfigurationException ex) { log.error("failde to load " + resourceFile.toString(), ex); throw new ConfigurationException(ex); } }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param file//from w ww . j a va2s . c o m * @return */ public static FileBasedConfigurationBuilder<PropertiesConfiguration> getConfigBuilder(File file) throws ConfigurationException { if (!file.exists()) { try { FileTools.touch(file); } catch (IOException e) { throw new ConfigurationException("Couldn't create the file: " + e.getMessage()); } } FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>( PropertiesConfiguration.class); builder.configure(new FileBasedBuilderParametersImpl().setFile(file)); return builder; }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param url/*from w w w . jav a 2 s.c om*/ * @return * @throws ConfigurationException */ public static FileBasedConfigurationBuilder<PropertiesConfiguration> getConfigBuilder(URL url) throws ConfigurationException { File file; try { file = new File(url.toURI()); return getConfigBuilder(file); } catch (URISyntaxException e) { throw new ConfigurationException("Couldn't map url to a uri: " + url); } }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param name the classpath location, such as "project.properties" in the base package, or * org/foo/project.properties./*from w w w . jav a 2 s .c o m*/ * @return * @throws ConfigurationException */ public static PropertiesConfiguration loadClasspathConfig(String name) throws ConfigurationException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(name); if (url == null) { throw new ConfigurationException("Couldn't locate: " + name); } PropertiesConfiguration pc = new PropertiesConfiguration(); FileHandler handler = new FileHandler(pc); handler.setURL(url); handler.load(); return pc; }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param file/*from w w w.jav a 2 s . c o m*/ * @return * @throws ConfigurationException */ public static PropertiesConfiguration loadConfig(File file) throws ConfigurationException { if (!file.exists()) { try { FileTools.touch(file); } catch (IOException e) { throw new ConfigurationException("Couldn't create the file: " + e.getMessage()); } } PropertiesConfiguration pc = new PropertiesConfiguration(); FileHandler handler = new FileHandler(pc); handler.setFile(file); handler.load(); return pc; }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param url/*from ww w . j av a 2 s. c om*/ * @return * @throws ConfigurationException */ public static PropertiesConfiguration loadConfig(URL url) throws ConfigurationException { try { File file = new File(url.toURI()); return loadConfig(file); } catch (Exception e) { throw new ConfigurationException("Couldn't map url to a uri: " + url); } }
From source file:ubic.basecode.util.ConfigUtils.java
/** * @param name/*from ww w.j a v a 2s . c o m*/ * @return * @throws ConfigurationException */ private static File locateConfig(String name) throws ConfigurationException { File f; FileLocator fl = FileLocatorUtils.fileLocator().fileName(name).create(); URL location = FileLocatorUtils.locate(fl); if (location == null) { f = new File(name); if (f.isAbsolute()) { return f; } return new File(FileUtils.getUserDirectory(), name); } try { return new File(location.toURI()); } catch (Exception e) { throw new ConfigurationException("Couldn't map url to a uri: " + name); } }
From source file:ubic.gemma.apps.Blat.java
/** * @throws ConfigurationException//w w w.j a v a 2 s . c o m */ private void init() throws ConfigurationException { log.debug("Reading global config"); this.humanServerPort = ConfigUtils.getInt("gfClient.humanServerPort"); this.mouseServerPort = ConfigUtils.getInt("gfClient.mouseServerPort"); this.ratServerPort = ConfigUtils.getInt("gfClient.ratServerPort"); this.humanSensitiveServerPort = ConfigUtils.getInt("gfClient.sensitive.humanServerPort"); this.mouseSensitiveServerPort = ConfigUtils.getInt("gfClient.sensitive.mouseServerPort"); this.ratSensitiveServerPort = ConfigUtils.getInt("gfClient.sensitive.ratServerPort"); // this.humanServerHost = ConfigUtils.getString( "gfClient.humanServerHost" ); // this.mouseServerHost = ConfigUtils.getString( "gfClient.mouseServerHost" ); // this.ratServerHost = ConfigUtils.getString( "gfClient.ratServerHost" ); this.host = ConfigUtils.getString("gfClient.host"); this.seqDir = ConfigUtils.getString("gfClient.seqDir"); this.mouseSeqFiles = ConfigUtils.getString("gfClient.mouse.seqFiles"); this.ratSeqFiles = ConfigUtils.getString("gfClient.rat.seqFiles"); this.humanSeqFiles = ConfigUtils.getString("gfClient.human.seqFiles"); this.gfClientExe = ConfigUtils.getString("gfClient.exe"); this.gfServerExe = ConfigUtils.getString("gfServer.exe"); if (gfServerExe == null) { /* * This won't ever really work -- it's left over from earlier iterations. */ log.warn("You will not be able to start the server: gfServer.exe is not set in config"); } if (gfClientExe == null && os.startsWith("windows")) { throw new ConfigurationException("BLAT client calls will not work under windows."); } }
From source file:ubic.gemma.core.apps.ShellDelegatingBlat.java
private void init() throws ConfigurationException { ShellDelegatingBlat.log.debug("Reading global config"); this.humanServerPort = Settings.getInt("gfClient.humanServerPort"); this.mouseServerPort = Settings.getInt("gfClient.mouseServerPort"); this.ratServerPort = Settings.getInt("gfClient.ratServerPort"); this.humanSensitiveServerPort = Settings.getInt("gfClient.sensitive.humanServerPort"); this.mouseSensitiveServerPort = Settings.getInt("gfClient.sensitive.mouseServerPort"); this.ratSensitiveServerPort = Settings.getInt("gfClient.sensitive.ratServerPort"); // this.humanServerHost = ConfigUtils.getString( "gfClient.humanServerHost" ); // this.mouseServerHost = ConfigUtils.getString( "gfClient.mouseServerHost" ); // this.ratServerHost = ConfigUtils.getString( "gfClient.ratServerHost" ); this.host = Settings.getString("gfClient.host"); this.seqDir = Settings.getString("gfClient.seqDir"); this.mouseSeqFiles = Settings.getString("gfClient.mouse.seqFiles"); this.ratSeqFiles = Settings.getString("gfClient.rat.seqFiles"); this.humanSeqFiles = Settings.getString("gfClient.human.seqFiles"); this.gfClientExe = Settings.getString("gfClient.exe"); this.gfServerExe = Settings.getString("gfServer.exe"); if (gfServerExe == null) { /*// w w w . j a va 2 s .co m * This won't ever really work -- it's left over from earlier iterations. */ ShellDelegatingBlat.log .warn("You will not be able to start the server: gfServer.exe is not set in config"); } if (gfClientExe == null && ShellDelegatingBlat.os.startsWith("windows")) { throw new ConfigurationException("BLAT client calls will not work under windows."); } }
From source file:ubic.gemma.core.loader.expression.arrayExpress.DataFileFetcher.java
@Override public void initConfig() { localBasePath = Settings.getString("arrayExpress.local.datafile.basepath"); remoteBaseDir = Settings.getString("arrayExpress.experiments.baseDir"); if (localBasePath == null || localBasePath.length() == 0) throw new RuntimeException(new ConfigurationException("localBasePath was null or empty")); if (remoteBaseDir == null || remoteBaseDir.length() == 0) throw new RuntimeException(new ConfigurationException("baseDir was null or empty")); }