Record record = filer.readRecord(key);
if (record == null) {
return null;
}
Value value;
InlineMetaMap metaMap = null;
if (inlineMetaService == null) {
value = record.getValue();
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "Type is not available, Length=" + value.getLength());
}
} else {
InlineMetaService.DatabaseEntry databaseEntry = inlineMetaService.readDatabaseEntry(record.getValue());
metaMap = databaseEntry.map;
value = databaseEntry.value;
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "Type=" + metaMap.get("type") + ", Length=" + value.getLength());
}
}
if (inlineMetaService == null || metaMap.get("type").equals(ResourceTypeReader.XML)) {
Document document;
if (compressed) {
document = new DocumentImpl(value.getData(), symbols, new NodeSource(this, key));
flushSymbolTable();
if (log.isTraceEnabled()) {
log.trace(localDebugHeader +
"Compressed XML document=<" + TextWriter.toString(document) + ">");
}
if (documentCache != null) {
documentCache.putDocument(this, key, value.getData());
}
} else {
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "Pre parseDocument(): value=<" + value + ">");
}
document = parseDocument(key, value.toString());
}
DBObserver.getInstance().loadDocument(this, record, document);
return document;
} else {
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "Binary document");
}
return value.getData();
}
}