if (log.isInfoEnabled()) {
log.info("Database points to " + dbrootDir.getAbsolutePath());
}
try {
Configuration queryCfg = config.getChild(QUERYENGINE);
if (queryCfg != null) {
this.engine.setConfig(queryCfg);
}
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("ignored exception", e);
}
}
if (!sysInit) {
this.systemCollection = new SystemCollection(this);
try {
this.systemCollection.init();
} catch (XindiceException e) {
if (log.isWarnEnabled()) {
log.warn("ignored exception", e);
}
}
super.addCollection(systemCollection);
this.sysInit = true;
}
try {
// Bootstrap from the database itself... This is accomplished
// by intercepting the setConfig call and using a Configuration
// retrieved from the database instead of the standard config
Document colDoc = systemCollection.getCollection(SystemCollection.CONFIGS).getDocument(COLKEY);
if (colDoc == null) {
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
colDoc = db.newDocument();
Element root = colDoc.createElement(DATABASE);
root.setAttribute(NAME, getName());
colDoc.appendChild(root);
systemCollection.getCollection(SystemCollection.CONFIGS).setDocument(COLKEY, colDoc);
}
super.setConfig(new Configuration(colDoc.getDocumentElement(), false));
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("ignored exception", e);
}
}