Author: vgritsenko Date: Tue Nov 13 06:50:11 2007 New Revision: 594554 URL: http://svn.apache.org/viewvc?rev=594554&view=rev Log: reducing API
Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCache.java xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java?rev=594554&r1=594553&r2=594554&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java Tue Nov 13 06:50:11 2007 @@ -892,7 +892,7 @@ } if (cache != null) { - cache.putDocumentEntry(this, key, value.getData(), entryMeta); + cache.putEntry(this, key, DocumentCache.COMPRESSED, value, entryMeta); } } else { String documentChars = value.toString(); @@ -905,7 +905,7 @@ flushSymbolTable(); if (cache != null) { - cache.putDocumentEntry(this, key, documentChars, entryMeta); + cache.putEntry(this, key, DocumentCache.UNCOMPRESSED, value, entryMeta); } } @@ -917,7 +917,7 @@ } if (cache != null) { - cache.putBinaryEntry(this, key, value.getData(), entryMeta); + cache.putEntry(this, key, DocumentCache.BINARY, value, entryMeta); } return new Entry(key, value.getData(), entryMeta); @@ -1331,9 +1331,9 @@ // Cache Stuff if (cache != null) { if (compressed) { - cache.putDocumentEntry(this, key, documentBytes, Entry.createMetaMap(record)); + cache.putEntry(this, key, DocumentCache.COMPRESSED, new Value(documentBytes), Entry.createMetaMap(record)); } else { - cache.putDocumentEntry(this, key, documentChars, Entry.createMetaMap(record)); + cache.putEntry(this, key, DocumentCache.UNCOMPRESSED, new Value(documentBytes), Entry.createMetaMap(record)); } } @@ -1403,7 +1403,7 @@ Record record = filer.writeRecord(key, value); if (cache != null) { - cache.putBinaryEntry(this, key, bytes, Entry.createMetaMap(record)); + cache.putEntry(this, key, DocumentCache.BINARY, new Value(bytes), Entry.createMetaMap(record)); } // update the meta for this document Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCache.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCache.java?rev=594554&r1=594553&r2=594554&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCache.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCache.java Tue Nov 13 06:50:11 2007 @@ -22,6 +22,7 @@ import org.apache.xindice.core.Collection; import org.apache.xindice.core.data.Entry; import org.apache.xindice.core.data.Key; +import org.apache.xindice.core.data.Value; import java.util.Map; @@ -107,34 +108,15 @@ Entry getEntryMeta(Collection col, Key key); /** - * Stores compressed document's bytes in the cache + * Stores entry value in the cache * * @param col document entry collection * @param key document entry key - * @param bytes compressed document bytes + * @param type entry type: COMPRESSED, UNCOMPRESSED, BINARY + * @param value entry value * @param meta document meta attributes map */ - void putDocumentEntry(Collection col, Key key, byte[] bytes, Map meta); - - /** - * Stores serialized document's text in the cache - * - * @param col document entry collection - * @param key document entry key - * @param chars uncompressed document text - * @param meta document meta attributes map - */ - void putDocumentEntry(Collection col, Key key, String chars, Map meta); - - /** - * Stores binary data bytes in the cache - * - * @param col binary entry collection - * @param key binary entry key - * @param bytes binary entry data - * @param meta entry meta attributes map - */ - void putBinaryEntry(Collection col, Key key, byte[] bytes, Map meta); + void putEntry(Collection col, Key key, int type, Value value, Map meta); /** * Remove entry from the cache Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java?rev=594554&r1=594553&r2=594554&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java Tue Nov 13 06:50:11 2007 @@ -133,19 +133,9 @@ return new Entry(key, e.getMeta()); } - public void putDocumentEntry(Collection col, Key key, byte[] bytes, Map meta) { + public void putEntry(Collection col, Key key, int type, Value value, Map meta) { CacheKey ckey = new CacheKey(col, key); - table.put(ckey, new CacheEntry(DocumentCache.COMPRESSED, key, new Value(bytes), meta)); - } - - public void putDocumentEntry(Collection col, Key key, String chars, Map meta) { - CacheKey ckey = new CacheKey(col, key); - table.put(ckey, new CacheEntry(DocumentCache.UNCOMPRESSED, key, new Value(chars), meta)); - } - - public void putBinaryEntry(Collection col, Key key, byte[] bytes, Map meta) { - CacheKey ckey = new CacheKey(col, key); - table.put(ckey, new CacheEntry(DocumentCache.BINARY, key, new Value(bytes), meta)); + table.put(ckey, new CacheEntry(type, key, value, meta)); } public void removeEntry(Collection col, Key key) {