if (config.getBooleanAttribute(CACHE, true)) {
cache = getDatabase().getDocumentCache();
}
// If no Filer is defined, skip Symbols and Indexes
Configuration filerConfig = config.getChild(FILER);
if (filerConfig != null) {
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "Have filer config...");
}
// Symbol Table Setup
Configuration symConfig = config.getChild(SYMBOLS);
if (symConfig != null) {
if (log.isTraceEnabled()) {
log.trace(localDebugHeader +
"Internal symbols=<" + TextWriter.toString(symConfig.getElement()) + ">");
}
try {
symbols = new SymbolTable(symConfig.getElement(), true);
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn(localDebugHeader + "Error building symbol table from internal symbols", e);
}
}
} else {
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "No internal symbols...");
}
try {
symbols = getSystemCollection().loadSymbols(this);
if (log.isDebugEnabled()) {
log.debug(localDebugHeader + "Loaded symbols=<" +
TextWriter.toString(symbols.streamToXML(new DocumentImpl())) + ">");
}
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn(localDebugHeader + "Error loading symbol table from system collection", e);
}
}
}
String className = filerConfig.getAttribute(CLASS);
if (log.isDebugEnabled()) {
log.debug(localDebugHeader + "Filer class=<" + className + ">");
}
try {
filer = (Filer) Class.forName(className).newInstance();
filer.setLocation(getCollectionRoot(), getName());
filer.setConfig(filerConfig);
if (!filer.exists()) {
filer.create();
}
filer.open();
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("Filer '" + className + "' is not available", e);
}
}
// Index Manager
try {
indexManager = new IndexManager(this, getDatabase().getTimer());
Configuration idxConfig = config.getChild(INDEXES, true);
indexManager.setConfig(idxConfig);
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("Failed to initialize indexer", e);
}