From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:23
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/collections Modified Files: Collection.java CollectionCache.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: CollectionCache.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/CollectionCache.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CollectionCache.java 2 Feb 2004 15:30:38 -0000 1.4 --- CollectionCache.java 3 May 2004 13:08:44 -0000 1.5 *************** *** 1,14 **** - /* - * CollectionCache.java - Mar 11, 2003 - * - * @author wolf - */ package org.exist.collections; import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.ClockCache; import org.exist.util.hashtable.Object2LongHashMap; ! public class CollectionCache extends ClockCache { private Object2LongHashMap names; --- 1,18 ---- package org.exist.collections; import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.ClockCache; + import org.exist.storage.cache.LRDCache; import org.exist.util.hashtable.Object2LongHashMap; ! /** ! * Global cache for {@link org.exist.collections.Collection} objects. The ! * cache is owned by {@link org.exist.storage.store.CollectionStore}. It is not ! * synchronized. Thus a lock should be obtained on the collection store before ! * accessing the cache. ! * ! * @author wolf ! */ ! public class CollectionCache extends LRDCache { private Object2LongHashMap names; *************** *** 47,54 **** } - public void remove(Cacheable item) { - super.remove(item); - names.remove(((Collection)item).getName()); - } - } --- 51,53 ---- Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Collection.java 1 Apr 2004 14:12:44 -0000 1.20 --- Collection.java 3 May 2004 13:08:44 -0000 1.21 *************** *** 41,45 **** import javax.xml.parsers.SAXParserFactory; ! import org.apache.log4j.Category; import org.apache.xml.resolver.tools.CatalogResolver; import org.exist.EXistException; --- 41,45 ---- import javax.xml.parsers.SAXParserFactory; ! import org.apache.log4j.Logger; import org.apache.xml.resolver.tools.CatalogResolver; import org.exist.EXistException; *************** *** 57,69 **** import org.exist.storage.DBBroker; import org.exist.storage.cache.Cacheable; import org.exist.storage.store.CollectionStore; import org.exist.util.Configuration; - import org.exist.util.DOMStreamer; import org.exist.util.Lock; import org.exist.util.LockException; import org.exist.util.SyntaxException; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; import org.exist.util.hashtable.ObjectHashSet; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; --- 57,69 ---- import org.exist.storage.DBBroker; import org.exist.storage.cache.Cacheable; + import org.exist.storage.io.VariableByteInput; + import org.exist.storage.io.VariableByteOutputStream; import org.exist.storage.store.CollectionStore; import org.exist.util.Configuration; import org.exist.util.Lock; import org.exist.util.LockException; import org.exist.util.SyntaxException; import org.exist.util.hashtable.ObjectHashSet; + import org.exist.util.serializer.DOMStreamer; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; *************** *** 85,90 **** implements Comparable, EntityResolver, Cacheable { ! private final static Category LOG = Category.getInstance(Collection.class ! .getName()); private final static String COLLECTION_CONFIG_FILE = "collection.xconf"; --- 85,89 ---- implements Comparable, EntityResolver, Cacheable { ! private final static Logger LOG = Logger.getLogger(Collection.class); private final static String COLLECTION_CONFIG_FILE = "collection.xconf"; *************** *** 128,132 **** // the collection store where this collections is stored. private CollectionStore db; ! public Collection(CollectionStore db, String name) { this.name = name; --- 127,131 ---- // the collection store where this collections is stored. private CollectionStore db; ! public Collection(CollectionStore db, String name) { this.name = name; *************** *** 144,147 **** --- 143,150 ---- if (!subcollections.contains(childName)) subcollections.add(childName); + if(name.equals("/db/collection-31/collection-31-1")) { + LOG.debug("adding collection " + childName + "; count = " + subcollections.size() + + "; id = " + this); + } } *************** *** 472,476 **** * @throws IOException */ ! public void read(DBBroker broker, VariableByteInputStream istream) throws IOException { collectionId = istream.readShort(); --- 475,479 ---- * @throws IOException */ ! public void read(DBBroker broker, VariableByteInput istream) throws IOException { collectionId = istream.readShort(); *************** *** 1071,1075 **** // first pass: parse the document to determine tree structure LOG.debug("validating document " + name); ! streamer.stream(node); document.setMaxDepth(document.getMaxDepth() + 1); document.calculateTreeLevelStartPoints(); --- 1074,1078 ---- // first pass: parse the document to determine tree structure LOG.debug("validating document " + name); ! streamer.serialize(node); document.setMaxDepth(document.getMaxDepth() + 1); document.calculateTreeLevelStartPoints(); *************** *** 1095,1099 **** // second pass: store the document LOG.debug("storing document ..."); ! streamer.stream(node); try { --- 1098,1102 ---- // second pass: store the document LOG.debug("storing document ..."); ! streamer.serialize(node); try { |