vgritsenko 2003/08/08 06:17:29
Modified: java/src/org/apache/xindice/core Collection.java Log: minor style changes, guard some debug logging, add FIXME comment Revision Changes Path 1.28 +26 -22 xml-xindice/java/src/org/apache/xindice/core/Collection.java Index: Collection.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/Collection.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Collection.java 7 Aug 2003 20:13:21 -0000 1.27 +++ Collection.java 8 Aug 2003 13:17:29 -0000 1.28 @@ -155,8 +155,7 @@ } public void commit() throws DBException { - putDocument(key, document /*, false */ - ); + putDocument(key, document /*, false */); } public void commit(Document doc) throws DBException { @@ -940,8 +939,7 @@ */ public final Key insertDocument(Document document) throws DBException { Key key = createNewOID(); - putDocument(key, document /*, true */ - ); + putDocument(key, document /*, true */); // update the meta information if necessary updateCollectionMeta(); return key; @@ -954,8 +952,7 @@ * @param document The document to insert */ public final void insertDocument(Object docKey, Document document) throws DBException { - putDocument(createNewKey(docKey), document /*, true */ - ); + putDocument(createNewKey(docKey), document /*, true */); // update the meta information if necessary updateCollectionMeta(); } @@ -1063,8 +1060,9 @@ byte[] b = DOMCompressor.Compress(doc, symbols); doc = new DocumentImpl(b, symbols, new NodeSource(this, key)); - if (documentCache != null) + if (documentCache != null) { documentCache.putDocument(this, key, b); + } } catch (Exception e) { throw new DBException(FaultCodes.COL_DOCUMENT_MALFORMED, "Unable to parse Document", e); } @@ -1106,16 +1104,18 @@ private void putDocument(Key key, Document document) throws DBException { String localDebugHeader = debugHeader() + "putDocument: docKey=<" + key.toString() + ">: "; - - log.debug(localDebugHeader + "document=<" + TextWriter.toString(document) + ">"); + if (log.isDebugEnabled()) { + log.debug(localDebugHeader + "document=<" + TextWriter.toString(document) + ">"); + } checkFiler(FaultCodes.COL_NO_FILER); if (document instanceof DBDocument) { - // This is a shitty shitty hack... Kill immediately + // FIXME: This is a shitty shitty hack... Kill immediately DBDocument dbDoc = (DBDocument) document; - if (dbDoc.getSource() == null) + if (dbDoc.getSource() == null) { dbDoc.setSource(new NodeSource(this, key)); + } } /* @@ -1192,10 +1192,11 @@ // Cache Stuff if (documentCache != null) { - if (compressed) + if (compressed) { documentCache.putDocument(this, key, packedDocument); - else + } else { documentCache.putDocument(this, key, document); + } } // update the meta for this document @@ -1211,10 +1212,11 @@ ProcessingInstruction pi = doc.createProcessingInstruction(CLASSNAME, obj.getClass().getName()); doc.appendChild(pi); Element elem = obj.streamToXML(doc); - log.debug(localDebugHeader + "elem=<" + TextWriter.toString(elem) + ">"); + if (log.isDebugEnabled()) { + log.debug(localDebugHeader + "elem=<" + TextWriter.toString(elem) + ">"); + } doc.appendChild(elem); - putDocument(key, doc /*, create */ - ); + putDocument(key, doc /*, create */); } /** @@ -1523,16 +1525,18 @@ */ protected void updateDocumentMeta(String id) throws DBException { // update the meta data if necessary - if (!isMetaEnabled()) + if (!isMetaEnabled()) { return; + } Document doc = getDocument(id); - if (null == doc) - throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND, "Document " + id + " does not exist"); + if (null == doc) { + throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND, + "Document " + id + " does not exist"); + } MetaSystemCollection metacol = getMetaSystemCollection(); MetaData meta = metacol.getDocumentMeta(this, id); - String path = getCanonicalDocumentName(id); /*