DBDocument dbDoc = (DBDocument)document;
if ( dbDoc.getSource() == null )
dbDoc.setSource(new NodeSource(this, key));
}
Value value = null;
if ( compressed ) {
try {
byte[] b = DOMCompressor.Compress(document, symbols);
value = new Value(b);
document = new DocumentImpl(b, symbols, new NodeSource(this, key));
}
catch ( Exception e ) {
throw new DBException(FaultCodes.COL_CANNOT_STORE, "Error storing Document '"+key+"'", e);
}
} else {
value = new Value( TextWriter.toString( document ) );
}
flushSymbolTable();
// Temporary until insert and update are separate
Document oldDoc = getDocument(key);
if ( oldDoc != null )
indexManager.removeDocument(key, oldDoc);
indexManager.addDocument(key, document);
filer.writeRecord(key, value);
// Cache Stuff
if ( documentCache != null ) {
if ( compressed )
documentCache.putDocument(this, key, value.getData());
else
documentCache.putDocument(this, key, document);
}
DBObserver.getInstance().putDocument(this, key, document,