List of usage examples for org.apache.commons.jocl JOCLContentHandler getValue
public Object getValue(int i)
From source file:orca.util.db.MySqlPool.java
/** * Create the connection pool from the parameters found in the specified * JOCL file. If the JOCL file cannot be found, then the default * configuration is used.//from w w w. jav a2 s . c o m * @param loc location of the JOCL file (can be null) * @return The connection pool * @throws Exception */ private static GenericObjectPool createConnectionPool(String loc) { try { System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); InputStream is = null; if (loc == null) { is = getDefaultConfiguration(); } else { File f = new File(loc); if (!f.exists()) { is = getDefaultConfiguration(); } else { is = new FileInputStream(f); } } JOCLContentHandler handler = JOCLContentHandler.parse(is); return (GenericObjectPool) handler.getValue(0); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Failed to create connection pool", e); } }