if (document instanceof DBDocument) {
// FIXME: This is a shitty shitty hack... Kill immediately
DBDocument dbDoc = (DBDocument) document;
if (dbDoc.getSource() == null) {
dbDoc.setSource(new NodeSource(this, key));
}
}
/*
* The possibilities are restricted because only XML
* is handled by this method. There are only a few
* pieces of information that need to be constructed:
* 1) the xindice DOM document is needed for all XML objects, as
* it is handed to the IndexManager and the DBObserver.
* 2) the packed document, if this is a compressed XML object,
* is needed for the cache and the BTree (via the Value object).
* 3) the string-converted-to-utf-8 bytes, if this is a non-compressed
* XML object, is needed for the BTree (via the Value object).
* 4) A Value object, with a header if headers are enabled, and
* otherwise without headers, for the BTree.
*/
byte[] documentBytes = null;
if (compressed) {
try {
documentBytes = DOMCompressor.Compress(document, symbols);
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "length=" + documentBytes.length);
}
// Why must it be re-created?
document = new DocumentImpl(documentBytes, symbols, new NodeSource(this, key));
if (log.isTraceEnabled()) {
log.trace(localDebugHeader + "packedDocument: length=" + documentBytes.length +
" document=<" + TextWriter.toString(document) + ">");
}
} catch (Exception e) {