File df = new File(dataFiles); if ((!df.isAbsolute()) && dbHome != null) { dataFiles = dbHome + File.separatorChar + dataFiles; df = new File(dataFiles); }
File df = lookup(dataFiles);
    private void configureBackend(String dbHome, NodeList dbcon) throws DatabaseConfigurationException {        Element con = (Element) dbcon.item(0);        String cacheMem = con.getAttribute("cacheSize");        String pageSize = con.getAttribute("pageSize");        String dataFiles = con.getAttribute("files");        String buffers = con.getAttribute("buffers");        String collBuffers = con.getAttribute("collection_buffers");        String wordBuffers = con.getAttribute("words_buffers");        String elementBuffers = con.getAttribute("elements_buffers");        String freeMem = con.getAttribute("free_mem_min");        String mysql = con.getAttribute("database");        if (mysql != null)            config.put("database", mysql);        // directory for database files        if (dataFiles != null) {            File df = new File(dataFiles);            if ((!df.isAbsolute()) && dbHome != null) {                dataFiles = dbHome + File.separatorChar + dataFiles;                df = new File(dataFiles);            }            if (!df.canRead())                throw new DatabaseConfigurationException(                        "cannot read data directory: "                        + df.getAbsolutePath());                        config.put("db-connection.data-dir", df.getAbsolutePath());            LOG.info("data directory = " + df.getAbsolutePath());        }        if (cacheMem != null) {            if (cacheMem.endsWith("M") || cacheMem.endsWith("m"))                cacheMem = cacheMem.substring(0, cacheMem.length() - 1);            try {                config.put("db-connection.cache-size", new Integer(                        cacheMem));            } catch (NumberFormatException nfe) {            }        }        if (buffers != null)            try {                config.put("db-connection.buffers",                        new Integer(buffers));            } catch (NumberFormatException nfe) {            }        if (pageSize != null)            try {                config.put("db-connection.page-size", new Integer(                        pageSize));            } catch (NumberFormatException nfe) {            }        if (collBuffers != null)            try {                config.put("db-connection.collections.buffers",                        new Integer(collBuffers));            } catch (NumberFormatException nfe) {            }        if (wordBuffers != null)            try {                config.put("db-connection.words.buffers", new Integer(                        wordBuffers));            } catch (NumberFormatException nfe) {            }        if (elementBuffers != null)            try {                config.put("db-connection.elements.buffers",                        new Integer(elementBuffers));            } catch (NumberFormatException nfe) {            }        if (freeMem != null)            try {                config.put("db-connection.min_free_memory",                        new Integer(freeMem));            } catch (NumberFormatException nfe) {            }        NodeList securityConf = con.getElementsByTagName("security");        String securityManagerClassName = "org.exist.security.XMLSecurityManager";        if (securityConf.getLength()>0) {           securityManagerClassName = ((Element)securityConf.item(0)).getAttribute("class");        }        try {           config.put("db-connection.security.class",config.getClass().forName(securityManagerClassName));        } catch (Throwable ex) {           if (ex instanceof ClassNotFoundException) {              throw new DatabaseConfigurationException("Cannot find security manager class "+securityManagerClassName);           } else {              throw new DatabaseConfigurationException("Cannot load security manager class "+securityManagerClassName+" due to "+ex.getMessage());           }        }        NodeList poolConf = con.getElementsByTagName("pool");        if (poolConf.getLength() > 0) {            configurePool(poolConf);        }        NodeList queryPoolConf = con.getElementsByTagName("query-pool");        if (queryPoolConf.getLength() > 0) {            configureXQueryPool(queryPoolConf);        }        NodeList watchConf = con.getElementsByTagName("watchdog");        if (watchConf.getLength() > 0) {            configureWatchdog(watchConf);        }        NodeList sysTasks = con.getElementsByTagName("system-task");        if (sysTasks.getLength() > 0) {            configureSystemTasks(sysTasks);        }        NodeList recovery = con.getElementsByTagName("recovery");        if (recovery.getLength() > 0) {            configureRecovery(recovery);        }        configurePermissions(con.getElementsByTagName("default-permissions"));    }