You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(85) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:22
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/xupdate Modified Files: XUpdateProcessor.java Modification.java Update.java Append.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** XUpdateProcessor.java 30 Apr 2004 09:08:12 -0000 1.21 --- XUpdateProcessor.java 10 May 2004 11:22:38 -0000 1.22 *************** *** 92,95 **** --- 92,107 ---- } + public XUpdateProcessor() throws ParserConfigurationException { + this(null, null); + } + + public void setBroker(DBBroker broker) { + this.broker = broker; + } + + public void setDocumentSet(DocumentSet docs) { + this.documentSet = docs; + } + /** * Parse the input source into a set of modifications. *************** *** 391,397 **** throws SAXException { if (inModification) { ! if (inAttribute) ! ((Attr) currentNode).setValue(new String(ch, start, length)); ! else { charBuf.append(ch, start, length); } --- 403,415 ---- throws SAXException { if (inModification) { ! if (inAttribute) { ! Attr attr = (Attr)currentNode; ! String val = attr.getValue(); ! if(val == null) ! val = new String(ch, start, length); ! else ! val += new String(ch, start, length); ! attr.setValue(val); ! } else { charBuf.append(ch, start, length); } *************** *** 568,570 **** --- 586,604 ---- } + public void reset() { + inModification = false; + inAttribute = false; + modification = null; + doc = null; + fragment = null; + stack.clear(); + currentNode = null; + broker = null; + documentSet = null; + modifications.clear(); + charBuf.setLength(0); + variables.clear(); + namespaces.clear(); + namespaces.put("xml", "http://www.w3.org/XML/1998/namespace"); + } } Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Modification.java 23 Apr 2004 13:07:47 -0000 1.21 --- Modification.java 10 May 2004 11:22:38 -0000 1.22 *************** *** 86,90 **** throw new EXistException("select expression should evaluate to a" + "node-set"); NodeList set = (NodeList)resultSeq; ! LOG.info("found " + set.getLength() + " for select; retrieving nodes..."); ArrayList out = new ArrayList(set.getLength()); for (int i = 0; i < set.getLength(); i++) { --- 86,90 ---- throw new EXistException("select expression should evaluate to a" + "node-set"); NodeList set = (NodeList)resultSeq; ! LOG.info("found " + set.getLength() + " for select: " + selectStmt + "; retrieving nodes..."); ArrayList out = new ArrayList(set.getLength()); for (int i = 0; i < set.getLength(); i++) { Index: Update.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Update.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Update.java 29 Jan 2004 15:06:45 -0000 1.11 --- Update.java 10 May 2004 11:22:38 -0000 1.12 *************** *** 81,84 **** --- 81,88 ---- case Node.ATTRIBUTE_NODE : parent = (ElementImpl)node.getParentNode(); + if(parent == null) { + LOG.warn("parent node not found for " + node.getGID()); + break; + } AttrImpl attr = (AttrImpl)node; if (children.getLength() != 0) { Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Append.java 30 Apr 2004 09:08:12 -0000 1.13 --- Append.java 10 May 2004 11:22:38 -0000 1.14 *************** *** 41,49 **** if (qr == null || children.getLength() == 0) return 0; IndexListener listener = new IndexListener(qr); NodeImpl node; DocumentImpl doc = null; Collection collection = null, prevCollection = null; - int len = children.getLength(); for(int i = 0; i < qr.length; i++) { node = qr[i]; --- 41,49 ---- if (qr == null || children.getLength() == 0) return 0; + IndexListener listener = new IndexListener(qr); NodeImpl node; DocumentImpl doc = null; Collection collection = null, prevCollection = null; for(int i = 0; i < qr.length; i++) { node = qr[i]; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/collections Modified Files: Collection.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Collection.java 3 May 2004 13:08:44 -0000 1.21 --- Collection.java 10 May 2004 11:22:37 -0000 1.22 *************** *** 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(); --- 1074,1078 ---- // first pass: parse the document to determine tree structure LOG.debug("validating document " + name); ! streamer.serialize(node, true); document.setMaxDepth(document.getMaxDepth() + 1); document.calculateTreeLevelStartPoints(); *************** *** 1098,1102 **** // second pass: store the document LOG.debug("storing document ..."); ! streamer.serialize(node); try { --- 1098,1102 ---- // second pass: store the document LOG.debug("storing document ..."); ! streamer.serialize(node, true); try { *************** *** 1271,1275 **** return new CollectionConfiguration(broker, this, doc); } catch (CollectionConfigurationException e) { ! LOG.warn(e.getMessage(), e); } finally { triggersEnabled = true; --- 1271,1275 ---- return new CollectionConfiguration(broker, this, doc); } catch (CollectionConfigurationException e) { ! LOG.warn("Failed to load collection configuration " + e.getMessage()); } finally { triggersEnabled = true; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist Modified Files: Indexer.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: Indexer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/Indexer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Indexer.java 27 Apr 2004 15:47:01 -0000 1.7 --- Indexer.java 10 May 2004 11:22:52 -0000 1.8 *************** *** 43,46 **** --- 43,47 ---- import org.exist.dom.TextImpl; import org.exist.storage.DBBroker; + import org.exist.storage.NodePath; import org.exist.util.Configuration; import org.exist.util.FastStringBuffer; *************** *** 75,79 **** protected XMLString charBuf = new XMLString(); protected int currentLine = 0; ! protected StringBuffer currentPath = new StringBuffer(); protected DocumentImpl document = null; protected boolean insideDTD = false; --- 76,82 ---- protected XMLString charBuf = new XMLString(); protected int currentLine = 0; ! // protected StringBuffer currentPath = new StringBuffer(); ! protected NodePath currentPath = new NodePath(); ! protected DocumentImpl document = null; protected boolean insideDTD = false; *************** *** 147,151 **** // reset internal fields level = 0; ! currentPath.setLength(0); stack = new Stack(); nsMappings.clear(); --- 150,154 ---- // reset internal fields level = 0; ! currentPath.reset(); stack = new Stack(); nsMappings.clear(); *************** *** 170,174 **** if (stack.empty()) { if (!validate) ! broker.store(comment, currentPath.toString()); document.appendChild(comment); } else { --- 173,177 ---- if (stack.empty()) { if (!validate) ! broker.store(comment, currentPath); document.appendChild(comment); } else { *************** *** 183,187 **** last.appendChildInternal(text); if (!validate) ! broker.store(text, currentPath.toString()); } charBuf.reset(); --- 186,190 ---- last.appendChildInternal(text); if (!validate) ! broker.store(text, currentPath); } charBuf.reset(); *************** *** 189,193 **** last.appendChildInternal(comment); if (!validate) ! broker.store(comment, currentPath.toString()); } } --- 192,196 ---- last.appendChildInternal(comment); if (!validate) ! broker.store(comment, currentPath); } } *************** *** 232,236 **** stack.pop(); ! currentPath = removeLastPathComponent(currentPath); // currentPath.delete( // currentPath.lastIndexOf("/"), --- 235,240 ---- stack.pop(); ! // currentPath = removeLastPathComponent(currentPath); ! currentPath.removeLastComponent(); // currentPath.delete( // currentPath.lastIndexOf("/"), *************** *** 248,252 **** broker.update(last); } else ! broker.store(last, currentPath.toString()); } level--; --- 252,256 ---- broker.update(last); } else ! broker.store(last, currentPath); } level--; *************** *** 438,442 **** stack.push(node); ! currentPath.append('/').append(qname); if (!validate) { broker.store(node, currentPath); --- 442,447 ---- stack.push(node); ! currentPath.addComponent(qname); ! // currentPath.append('/').append(qname); if (!validate) { broker.store(node, currentPath); *************** *** 456,460 **** stack.push(node); ! currentPath.append('/').append(qname); if (!validate) { broker.store(node, currentPath); --- 461,466 ---- stack.push(node); ! currentPath.addComponent(qname); ! // currentPath.append('/').append(qname); if (!validate) { broker.store(node, currentPath); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:07
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/client Modified Files: InteractiveClient.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: InteractiveClient.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/InteractiveClient.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** InteractiveClient.java 3 May 2004 13:05:08 -0000 1.27 --- InteractiveClient.java 10 May 2004 11:22:51 -0000 1.28 *************** *** 69,73 **** import org.exist.security.Permission; import org.exist.security.User; - import org.exist.storage.serializers.EXistOutputKeys; import org.exist.util.CollectionScanner; import org.exist.util.DirectoryScanner; --- 69,72 ---- *************** *** 367,370 **** --- 366,377 ---- } + protected void setProperties() throws XMLDBException { + String key; + for(Iterator i = properties.keySet().iterator(); i.hasNext(); ) { + key = (String)i.next(); + current.setProperty(key, properties.getProperty(key)); + } + } + /** * Get list of resources contained in collection. *************** *** 376,379 **** --- 383,387 ---- if (current == null) return; + setProperties(); UserManagementService mgtService = (UserManagementService) current .getService("UserManagementService", "1.0"); *************** *** 1006,1009 **** --- 1014,1018 ---- System.out.println(key + " = " + val); properties.setProperty(key, val); + current.setProperty(key, val); getResources(); } catch (Exception e) { *************** *** 1145,1153 **** protected final Resource retrieve(String resource, String indent) throws XMLDBException { - current.setProperty(OutputKeys.INDENT, indent); - current.setProperty(OutputKeys.ENCODING, properties - .getProperty("encoding")); - current.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, properties - .getProperty("expand-xincludes")); Resource res = current.getResource(resource); if (res == null) { --- 1154,1157 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:07
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/xmldb Modified Files: LocalResourceSet.java LocalXUpdateQueryService.java LocalXPathQueryService.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: LocalXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXPathQueryService.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** LocalXPathQueryService.java 3 May 2004 12:58:11 -0000 1.38 --- LocalXPathQueryService.java 10 May 2004 11:22:51 -0000 1.39 *************** *** 161,165 **** context.setBackwardsCompatibility(xpathCompatible); context.setStaticallyKnownDocuments(docs); - LOG.debug("docs: " + docs.getLength()); Map.Entry entry; // declare namespace/prefix mappings --- 161,164 ---- Index: LocalXUpdateQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXUpdateQueryService.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LocalXUpdateQueryService.java 3 May 2004 12:58:11 -0000 1.12 --- LocalXUpdateQueryService.java 10 May 2004 11:22:51 -0000 1.13 *************** *** 36,40 **** private User user; private LocalCollection parent; ! /** * Constructor for LocalXUpdateQueryService. --- 36,40 ---- private User user; private LocalCollection parent; ! /** * Constructor for LocalXUpdateQueryService. Index: LocalResourceSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalResourceSet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** LocalResourceSet.java 3 May 2004 12:58:11 -0000 1.18 --- LocalResourceSet.java 10 May 2004 11:22:51 -0000 1.19 *************** *** 159,162 **** --- 159,163 ---- || coll.getCollection().getId() != p.doc.getCollection().getId()) { coll = new LocalCollection(user, brokerPool, null, p.doc.getCollection().getName()); + coll.properties = outputProperties; } res = new LocalXMLResource(user, brokerPool, coll, p); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:23:01
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/util/serializer Modified Files: DOMStreamer.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: DOMStreamer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/DOMStreamer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DOMStreamer.java 1 Dec 2003 08:22:54 -0000 1.3 --- DOMStreamer.java 10 May 2004 11:22:51 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- import java.util.Stack; + import org.exist.dom.QName; import org.w3c.dom.Attr; import org.w3c.dom.CharacterData; *************** *** 173,186 **** // output attributes AttributesImpl saxAttrs = new AttributesImpl(); for (int i = 0; i < attrs.getLength(); i++) { nextAttr = (Attr) attrs.item(i); saxAttrs.addAttribute( ! nextAttr.getNamespaceURI(), ! nextAttr.getLocalName(), nextAttr.getNodeName(), "CDATA", nextAttr.getValue()); } ! contentHandler.startElement(node.getNamespaceURI(), node.getLocalName(), node.getNodeName(), saxAttrs); break; --- 174,197 ---- // output attributes AttributesImpl saxAttrs = new AttributesImpl(); + String attrNS, attrLocalName; for (int i = 0; i < attrs.getLength(); i++) { nextAttr = (Attr) attrs.item(i); + attrNS = nextAttr.getNamespaceURI(); + if(attrNS == null) + attrNS = ""; + attrLocalName = nextAttr.getLocalName(); + if(attrLocalName == null) + attrLocalName = QName.extractLocalName(nextAttr.getNodeName()); saxAttrs.addAttribute( ! attrNS, ! attrLocalName, nextAttr.getNodeName(), "CDATA", nextAttr.getValue()); } ! String localName = node.getLocalName(); ! if(localName == null) ! localName = QName.extractLocalName(node.getNodeName()); ! contentHandler.startElement(node.getNamespaceURI(), localName, node.getNodeName(), saxAttrs); break; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-10 11:22:59
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/src/org/exist/storage/serializers Modified Files: Serializer.java Log Message: XUpdate: * Btree not correctly updated after node changes, leading to NullPointerException * Attribute values truncated * Page splitting error results in NullPointerException after a few hundred XUpdates * New configuration parameter to control XUpdate behaviour Other: * Properties passed to Collection, XPathQueryService, XQueryService had no effect. * Modified evaluation of index settings in conf.xml. Index: Serializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers/Serializer.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Serializer.java 3 May 2004 13:08:45 -0000 1.23 --- Serializer.java 10 May 2004 11:22:43 -0000 1.24 *************** *** 25,28 **** --- 25,29 ---- import java.io.IOException; import java.io.StringWriter; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; *************** *** 169,175 **** if (properties == null) return; ! for (Iterator i = properties.entrySet().iterator(); i.hasNext(); ) { ! Map.Entry entry = (Map.Entry) i.next(); ! setProperty((String)entry.getKey(), entry.getValue().toString()); } } --- 170,180 ---- if (properties == null) return; ! String key; ! for(Enumeration e = properties.propertyNames(); e.hasMoreElements(); ) { ! key = (String)e.nextElement(); ! if(key.equals("http://xml.org/sax/properties/lexical-handler")) ! lexicalHandler = (LexicalHandler)properties.get(key); ! else ! setProperty(key, properties.getProperty(key)); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-05 18:05:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11582/src/org/exist/xquery Modified Files: Variable.java LocationStep.java Expression.java VariableReference.java AbstractExpression.java ForExpr.java XQueryContext.java PathExpr.java Log Message: Some optimizations to speed up the evaluation of path expressions inside return clauses: the for expression now passes the current context document set to the bound variable, so path expressions accessing the variable can use this information to get a hint about the total set of documents to expect. This information is used by class LocationStep to pre-load matching element nodes - not only for the current document, but for all documents that might be required for subsequent iterations. Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LocationStep.java 3 May 2004 13:08:45 -0000 1.5 --- LocationStep.java 5 May 2004 18:05:41 -0000 1.6 *************** *** 196,200 **** ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 196,201 ---- ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! // DocumentSet docs = contextSet.getDocumentSet(); ! DocumentSet docs = getDocumentSet(contextSet); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 209,213 **** NodeSet.DESCENDANT, inPredicate); - } else { result = --- 210,213 ---- *************** *** 230,234 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 230,235 ---- return vset; } else { ! // DocumentSet docs = contextSet.getDocumentSet(); ! DocumentSet docs = getDocumentSet(contextSet); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 259,263 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 260,265 ---- return vset; } else { ! DocumentSet docs = getDocumentSet(contextSet); ! // DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 288,292 **** NodeSet result; if (!test.isWildcardTest()) { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 290,295 ---- NodeSet result; if (!test.isWildcardTest()) { ! DocumentSet docs = getDocumentSet(contextSet); ! // DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 334,338 **** NodeSet result = NodeSet.EMPTY_SET; if(!test.isWildcardTest()) { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 337,342 ---- NodeSet result = NodeSet.EMPTY_SET; if(!test.isWildcardTest()) { ! DocumentSet docs = getDocumentSet(contextSet); ! // DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 352,356 **** NodeSet result; if (!test.isWildcardTest()) { ! DocumentSet docs = contextSet.getDocumentSet(); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; --- 356,361 ---- NodeSet result; if (!test.isWildcardTest()) { ! // DocumentSet docs = contextSet.getDocumentSet(); ! DocumentSet docs = getDocumentSet(contextSet); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; *************** *** 390,393 **** --- 395,405 ---- } + protected DocumentSet getDocumentSet(NodeSet contextSet) { + DocumentSet ds = getContextDocSet(); + if(ds == null) + ds = contextSet.getDocumentSet(); + return ds; + } + /* (non-Javadoc) * @see org.exist.xpath.Step#resetState() Index: Variable.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/Variable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Variable.java 29 Jan 2004 15:06:41 -0000 1.1 --- Variable.java 5 May 2004 18:05:41 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery; + import org.exist.dom.DocumentSet; import org.exist.dom.QName; import org.exist.xquery.value.Sequence; *************** *** 37,41 **** private int positionInStack = 0; private int cardinality = Cardinality.ZERO_OR_MORE; ! /** * --- 38,42 ---- private int positionInStack = 0; private int cardinality = Cardinality.ZERO_OR_MORE; ! private DocumentSet contextDocs = null; /** * *************** *** 79,81 **** --- 80,90 ---- positionInStack = position; } + + public DocumentSet getContextDocs() { + return contextDocs; + } + + public void setContextDocs(DocumentSet docs) { + this.contextDocs = docs; + } } Index: AbstractExpression.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/AbstractExpression.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractExpression.java 21 Feb 2004 17:56:40 -0000 1.2 --- AbstractExpression.java 5 May 2004 18:05:41 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- package org.exist.xquery; + import org.exist.dom.DocumentSet; import org.exist.dom.NodeProxy; import org.exist.xquery.parser.XQueryAST; *************** *** 34,37 **** --- 35,40 ---- protected XQueryAST astNode = null; + protected DocumentSet contextDocSet = null; + public AbstractExpression(XQueryContext context) { this.context = context; *************** *** 88,91 **** --- 91,106 ---- } + + /* (non-Javadoc) + * @see org.exist.xquery.Expression#setContextDocSet(org.exist.dom.DocumentSet) + */ + public void setContextDocSet(DocumentSet contextSet) { + this.contextDocSet = contextSet; + } + + public DocumentSet getContextDocSet() { + return contextDocSet; + } + public void setASTNode(XQueryAST ast) { this.astNode = ast; Index: ForExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ForExpr.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForExpr.java 17 Feb 2004 15:04:58 -0000 1.2 --- ForExpr.java 5 May 2004 18:05:41 -0000 1.3 *************** *** 23,27 **** --- 23,29 ---- package org.exist.xquery; + import org.exist.dom.DocumentSet; import org.exist.dom.NodeProxy; + import org.exist.dom.NodeSet; import org.exist.dom.QName; import org.exist.xquery.value.IntegerValue; *************** *** 72,76 **** --- 74,83 ---- // evaluate the "in" expression Sequence in = inputSequence.eval(null, null); + // assign to the bound variable var.setValue(in); + if(in instanceof NodeSet) { + DocumentSet contextDocs = ((NodeSet)in).getDocumentSet(); + var.setContextDocs(contextDocs); + } if(whereExpr != null) { whereExpr.setInPredicate(true); *************** *** 86,90 **** in = applyWhereExpression(in); } ! if(resultSequence == null) { if(orderSpecs != null) --- 93,98 ---- in = applyWhereExpression(in); } ! // if there's an order by clause, wrap the result into ! // an OrderedValueSequence if(resultSequence == null) { if(orderSpecs != null) Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** XQueryContext.java 3 May 2004 12:51:53 -0000 1.12 --- XQueryContext.java 5 May 2004 18:05:41 -0000 1.13 *************** *** 100,104 **** */ private DocumentSet staticDocuments = null; ! private DBBroker broker; --- 100,104 ---- */ private DocumentSet staticDocuments = null; ! private DBBroker broker; *************** *** 306,310 **** return staticDocuments; } ! public void reset() { builder = null; --- 306,310 ---- return staticDocuments; } ! public void reset() { builder = null; Index: Expression.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/Expression.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Expression.java 21 Feb 2004 17:56:39 -0000 1.2 --- Expression.java 5 May 2004 18:05:41 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- package org.exist.xquery; + import org.exist.dom.DocumentSet; import org.exist.xquery.parser.XQueryAST; import org.exist.xquery.value.Item; *************** *** 128,131 **** --- 129,134 ---- public String pprint(); + public void setContextDocSet(DocumentSet contextSet); + public XQueryAST getASTNode(); Index: VariableReference.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/VariableReference.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VariableReference.java 21 Feb 2004 17:56:39 -0000 1.3 --- VariableReference.java 5 May 2004 18:05:41 -0000 1.4 *************** *** 116,119 **** --- 116,128 ---- } + public Variable getVariable() { + try { + Variable var = context.resolveVariable(qname); + return var; + } catch (XPathException e) { + return null; + } + } + /* (non-Javadoc) * @see org.exist.xpath.AbstractExpression#resetState() Index: PathExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/PathExpr.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PathExpr.java 16 Apr 2004 14:44:24 -0000 1.3 --- PathExpr.java 5 May 2004 18:05:41 -0000 1.4 *************** *** 26,30 **** import org.apache.log4j.Logger; - import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; import org.exist.dom.NodeSet; --- 26,29 ---- *************** *** 46,50 **** protected static Logger LOG = Logger.getLogger( PathExpr.class ); ! protected DocumentSet inputDocumentSet = new DocumentSet(); protected boolean keepVirtual = false; protected LinkedList steps = new LinkedList(); --- 45,49 ---- protected static Logger LOG = Logger.getLogger( PathExpr.class ); ! protected boolean keepVirtual = false; protected LinkedList steps = new LinkedList(); *************** *** 79,86 **** } - public void addDocument( DocumentImpl doc ) { - inputDocumentSet.add( doc ); - } - /** * Add another PathExpr to this object's expression list. --- 78,81 ---- *************** *** 113,127 **** r = Sequence.EMPTY_SEQUENCE; } NodeSet set; Item current; - Expression expr; Sequence values; for ( Iterator iter = steps.iterator(); iter.hasNext(); ) { expr = (Expression) iter.next(); if ((expr.getDependencies() & Dependency.CONTEXT_ITEM) != 0) { //LOG.debug("single step mode: " + expr.pprint()); ! if(r.getLength() == 0) r = expr.eval( null, null ); ! else { values = null; if(r.getLength() > 1) --- 108,130 ---- r = Sequence.EMPTY_SEQUENCE; } + DocumentSet contextDocs = null; + Expression expr = (Expression)steps.getFirst(); + if(expr instanceof VariableReference) { + Variable var = ((VariableReference)expr).getVariable(); + if(var != null) + contextDocs = var.getContextDocs(); + } NodeSet set; Item current; Sequence values; for ( Iterator iter = steps.iterator(); iter.hasNext(); ) { expr = (Expression) iter.next(); + if(contextDocs != null) + expr.setContextDocSet(contextDocs); if ((expr.getDependencies() & Dependency.CONTEXT_ITEM) != 0) { //LOG.debug("single step mode: " + expr.pprint()); ! if(r.getLength() == 0) { r = expr.eval( null, null ); ! } else { values = null; if(r.getLength() > 1) *************** *** 150,154 **** public DocumentSet getDocumentSet() { ! return inputDocumentSet; } --- 153,157 ---- public DocumentSet getDocumentSet() { ! return null; } *************** *** 200,207 **** return deps; } - - public void setDocumentSet( DocumentSet docs ) { - this.inputDocumentSet = docs; - } public void setFirstExpression( Expression s ) { --- 203,206 ---- |
From: Giulio V. <gva...@us...> - 2004-05-05 14:44:33
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31556/src/org/exist/xquery/functions/xmldb Modified Files: ModuleImpl.java Added Files: XMLDBGetChildCollections.java Log Message: Add get-child-collection to xmldb extensions --- NEW FILE: XMLDBGetChildCollections.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-03 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.exist.xquery.functions.xmldb; import org.exist.collections.Collection; import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; import org.exist.xquery.value.DateTimeValue; import org.exist.xquery.value.ValueSequence; import org.exist.xquery.value.StringValue; import java.util.Iterator; public class XMLDBGetChildCollections extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("get-child-collections", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), "Returns the subcolls of collection", new SequenceType[] { new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) }, new SequenceType(Type.STRING, Cardinality.ZERO_OR_MORE)); public XMLDBGetChildCollections(XQueryContext context) { super(context, signature); } /* (non-Javadoc) * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) * */ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { String collectionURI = args[0].getStringValue(); Collection collection = null; collection = context.getBroker().getCollection(collectionURI); ValueSequence r = new ValueSequence(); String child; for (Iterator i = collection.collectionIterator(); i.hasNext(); ) { child = (String) i.next(); r.add(new StringValue(child)); } return r; } } Index: ModuleImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb/ModuleImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ModuleImpl.java 26 Apr 2004 14:06:54 -0000 1.6 --- ModuleImpl.java 5 May 2004 14:44:25 -0000 1.7 *************** *** 49,53 **** new FunctionDef(XMLDBPermissions.signature, XMLDBPermissions.class), new FunctionDef(XMLDBGroup.signature, XMLDBGroup.class), ! new FunctionDef(XMLDBOwner.signature, XMLDBOwner.class) }; --- 49,54 ---- new FunctionDef(XMLDBPermissions.signature, XMLDBPermissions.class), new FunctionDef(XMLDBGroup.signature, XMLDBGroup.class), ! new FunctionDef(XMLDBOwner.signature, XMLDBOwner.class), ! new FunctionDef(XMLDBGetChildCollections.signature, XMLDBGetChildCollections.class) }; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-05 11:14:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16101/src/org/exist/xmldb Modified Files: RemoteCollectionManagementService.java LocalCollectionManagementService.java Log Message: Removed dependency on Xindice CollectionManager. I added this because Xincon (for webdav) used it. Index: LocalCollectionManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollectionManagementService.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LocalCollectionManagementService.java 5 Mar 2004 11:15:27 -0000 1.8 --- LocalCollectionManagementService.java 5 May 2004 11:14:46 -0000 1.9 *************** *** 2,6 **** package org.exist.xmldb; - import org.apache.xindice.client.xmldb.services.CollectionManager; import org.exist.EXistException; import org.exist.security.PermissionDeniedException; --- 2,5 ---- *************** *** 11,16 **** import org.apache.log4j.Category; import org.xmldb.api.base.*; ! public class LocalCollectionManagementService extends CollectionManager { protected BrokerPool brokerPool; --- 10,16 ---- import org.apache.log4j.Category; import org.xmldb.api.base.*; + import org.xmldb.api.modules.CollectionManagementService; ! public class LocalCollectionManagementService implements CollectionManagementService { protected BrokerPool brokerPool; Index: RemoteCollectionManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteCollectionManagementService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteCollectionManagementService.java 29 Jan 2004 15:06:43 -0000 1.1 --- RemoteCollectionManagementService.java 5 May 2004 11:14:46 -0000 1.2 *************** *** 3,7 **** import java.io.IOException; import java.util.Vector; - import org.apache.xindice.client.xmldb.services.CollectionManager; import org.apache.xmlrpc.*; import org.w3c.dom.Document; --- 3,6 ---- *************** *** 11,15 **** ! public class RemoteCollectionManagementService extends CollectionManager implements CollectionManagementService { protected XmlRpcClient client; --- 10,14 ---- ! public class RemoteCollectionManagementService implements CollectionManagementService { protected XmlRpcClient client; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:28
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/storage Modified Files: NativeTextEngine.java DBBroker.java NativeElementIndex.java NativeBroker.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** NativeBroker.java 27 Apr 2004 15:47:02 -0000 1.64 --- NativeBroker.java 3 May 2004 13:08:43 -0000 1.65 *************** *** 26,30 **** import java.io.File; import java.io.IOException; - import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; --- 26,29 ---- *************** *** 36,39 **** --- 35,39 ---- import java.util.TreeMap; + import org.apache.log4j.Logger; import org.apache.oro.text.regex.MalformedPatternException; import org.apache.oro.text.regex.Pattern; *************** *** 66,69 **** --- 66,72 ---- import org.exist.security.PermissionDeniedException; import org.exist.security.User; + import org.exist.storage.io.VariableByteArrayInput; + import org.exist.storage.io.VariableByteInput; + import org.exist.storage.io.VariableByteOutputStream; import org.exist.storage.serializers.NativeSerializer; import org.exist.storage.serializers.Serializer; *************** *** 82,87 **** import org.exist.util.Occurrences; import org.exist.util.ReadOnlyException; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; import org.exist.xquery.Constants; import org.exist.xquery.NodeSelector; --- 85,88 ---- *************** *** 101,104 **** --- 102,109 ---- */ public class NativeBroker extends DBBroker { + /** + * Log4J Logger for this class + */ + private static final Logger LOG = Logger.getLogger(NativeBroker.class); private static final String DATABASE_IS_READ_ONLY = "database is read-only"; *************** *** 306,310 **** collections.add(collection); TreeMap map = new TreeMap(); ! VariableByteInputStream is; int docId; int len; --- 311,315 ---- collections.add(collection); TreeMap map = new TreeMap(); ! VariableByteArrayInput is; int docId; int len; *************** *** 337,341 **** is = ! new VariableByteInputStream( val[1].data(), val[1].start(), --- 342,346 ---- is = ! new VariableByteArrayInput( val[1].data(), val[1].start(), *************** *** 385,391 **** short collectionId; long gid; ! VariableByteInputStream is; ElementValue ref; - InputStream dis = null; short sym, nsSym; Collection collection; --- 390,395 ---- short collectionId; long gid; ! VariableByteInput is = null; ElementValue ref; short sym, nsSym; Collection collection; *************** *** 407,417 **** try { lock.acquire(Lock.READ_LOCK); ! dis = elementsDb.getAsStream(ref); } catch (LockException e) { ! LOG.warn("failed to acquire lock", e); // jmv: dis = null; exceptionOcurred = true; } catch (IOException e) { ! LOG.warn("io exception while reading elements for " + qname, e); // jmv: dis = null; exceptionOcurred = true; --- 411,428 ---- try { lock.acquire(Lock.READ_LOCK); ! is = elementsDb.getAsStream(ref); } catch (LockException e) { ! LOG.warn( ! "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - " ! + "failed to acquire lock", ! e); // jmv: dis = null; exceptionOcurred = true; } catch (IOException e) { ! LOG.warn( ! "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - " ! + "io exception while reading elements for " ! + qname, ! e); // jmv: dis = null; exceptionOcurred = true; *************** *** 421,427 **** // jmv: if (dis == null) // wolf: dis == null if no matching element has been found in the index ! if (dis == null || exceptionOcurred) continue; - is = new VariableByteInputStream(dis); try { while (is.available() > 0) { --- 432,437 ---- // jmv: if (dis == null) // wolf: dis == null if no matching element has been found in the index ! if (is == null || exceptionOcurred) continue; try { while (is.available() > 0) { *************** *** 442,446 **** } catch (EOFException e) { } catch (IOException e) { ! LOG.warn("unexpected io error", e); } } --- 452,459 ---- } catch (EOFException e) { } catch (IOException e) { ! LOG.warn( ! "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - " ! + "unexpected io error", ! e); } } *************** *** 485,496 **** Collection root = getCollection(ROOT_COLLECTION); root.allDocs(this, docs, true); ! LOG.debug( ! "loading " ! + docs.getLength() ! + " documents from " ! + docs.getCollectionCount() ! + "collections took " ! + (System.currentTimeMillis() - start) ! + "ms."); return docs; } --- 498,511 ---- Collection root = getCollection(ROOT_COLLECTION); root.allDocs(this, docs, true); ! if (LOG.isDebugEnabled()) { ! LOG.debug("getAllDocuments(DocumentSet) - end - " ! + "loading " ! + docs.getLength() ! + " documents from " ! + docs.getCollectionCount() ! + "collections took " ! + (System.currentTimeMillis() - start) ! + "ms."); ! } return docs; } *************** *** 540,544 **** } Collection collection = null; ! InputStream dis = null; Lock lock = collectionsDb.getLock(); try { --- 555,559 ---- } Collection collection = null; ! VariableByteInput is = null; Lock lock = collectionsDb.getLock(); try { *************** *** 548,566 **** return collection; } collection = new Collection(collectionsDb, name); try { if (addr < 0) { ! dis = collectionsDb.getAsStream(key); } else { ! dis = collectionsDb.getAsStream(addr); } } catch (IOException ioe) { LOG.warn(ioe.getMessage(), ioe); } ! if (dis == null) return null; ! VariableByteInputStream istream = new VariableByteInputStream(dis); try { ! collection.read(this, istream); } catch (IOException ioe) { LOG.warn(ioe); --- 563,583 ---- return collection; } + if(name.equals("/db/collection-31/collection-31-1")) + LOG.debug("loading collection " + name); collection = new Collection(collectionsDb, name); try { if (addr < 0) { ! is = collectionsDb.getAsStream(key); } else { ! is = collectionsDb.getAsStream(addr); } } catch (IOException ioe) { LOG.warn(ioe.getMessage(), ioe); } ! if (is == null) return null; ! try { ! collection.read(this, is); } catch (IOException ioe) { LOG.warn(ioe); *************** *** 1434,1447 **** } else { NodeImpl node = (NodeImpl)doc.getFirstChild(); ! Iterator k = ! getDOMIterator( ! new NodeProxy( ! doc, ! node.getGID(), ! node.getInternalAddress())); ! while(k.hasNext()) { ! k.next(); ! k.remove(); ! } } return null; --- 1451,1465 ---- } else { NodeImpl node = (NodeImpl)doc.getFirstChild(); ! domDb.removeAll(node.getInternalAddress()); ! // Iterator k = ! // getDOMIterator( ! // new NodeProxy( ! // doc, ! // node.getGID(), ! // node.getInternalAddress())); ! // while(k.hasNext()) { ! // k.next(); ! // k.remove(); ! // } } return null; *************** *** 1489,1496 **** final DocumentImpl doc = (DocumentImpl) getDocument(docName); if (doc == null) { ! LOG.debug("document " + docName + " not found"); return; } ! LOG.info("removing document " + doc.getDocId() + " ..."); // drop element-index --- 1507,1524 ---- final DocumentImpl doc = (DocumentImpl) getDocument(docName); if (doc == null) { ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument(String) - end - " ! + "document " ! + docName ! + " not found"); ! } return; } ! if (LOG.isInfoEnabled()) { ! LOG.info("removeDocument() - " ! + "removing document " ! + doc.getDocId() ! + " ..."); ! } // drop element-index *************** *** 1502,1506 **** lock.acquire(Lock.WRITE_LOCK); ArrayList elements = elementsDb.findKeys(query); ! LOG.debug("found " + elements.size() + " elements."); Value key; --- 1530,1539 ---- lock.acquire(Lock.WRITE_LOCK); ArrayList elements = elementsDb.findKeys(query); ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + "found " ! + elements.size() ! + " elements."); ! } Value key; *************** *** 1508,1512 **** byte[] data; // byte[] ndata; ! VariableByteInputStream is; VariableByteOutputStream os; int len; --- 1541,1545 ---- byte[] data; // byte[] ndata; ! VariableByteArrayInput is; VariableByteOutputStream os; int len; *************** *** 1519,1523 **** value = elementsDb.get(key); data = value.getData(); ! is = new VariableByteInputStream(data); os = new VariableByteOutputStream(); changed = false; --- 1552,1556 ---- value = elementsDb.get(key); data = value.getData(); ! is = new VariableByteArrayInput(data); os = new VariableByteOutputStream(); changed = false; *************** *** 1543,1556 **** } } catch (EOFException e) { ! LOG.debug("eof: " + is.available()); } if (changed) { //ndata = os.toByteArray(); if (elementsDb.put(key, os.data()) < 0) ! LOG.debug("could not save element"); } } } catch (LockException e) { ! LOG.warn("could not acquire lock on elements", e); } finally { lock.release(); --- 1576,1597 ---- } } catch (EOFException e) { ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument(String) - " ! + "eof: " ! + is.available(), e); ! } } if (changed) { //ndata = os.toByteArray(); if (elementsDb.put(key, os.data()) < 0) ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + "could not save element"); ! } } } } catch (LockException e) { ! LOG.warn("removeDocument(String) - " ! + "could not acquire lock on elements", e); } finally { lock.release(); *************** *** 1559,1578 **** ((NativeTextEngine) textEngine).removeDocument(doc); ! LOG.debug("removing dom"); new DOMTransaction(this, domDb) { public Object start() { ! NodeList children = doc.getChildNodes(); ! NodeImpl node; ! for (int i = 0; i < children.getLength(); i++) { ! node = (NodeImpl) children.item(i); ! Iterator j = ! getDOMIterator( ! new NodeProxy( ! doc, ! node.getGID(), ! node.getInternalAddress())); ! removeNodes(j); ! } ! domDb.remove(doc.getAddress()); return null; } --- 1600,1623 ---- ((NativeTextEngine) textEngine).removeDocument(doc); ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " + "removing dom"); ! } new DOMTransaction(this, domDb) { public Object start() { ! NodeImpl node = (NodeImpl)doc.getFirstChild(); ! domDb.removeAll(node.getInternalAddress()); ! // NodeList children = doc.getChildNodes(); ! // NodeImpl node; ! // for (int i = 0; i < children.getLength(); i++) { ! // node = (NodeImpl) children.item(i); ! // Iterator j = ! // getDOMIterator( ! // new NodeProxy( ! // doc, ! // node.getGID(), ! // node.getInternalAddress())); ! // removeNodes(j); ! // } ! // domDb.remove(doc.getAddress()); return null; } *************** *** 1588,1596 **** domDb.flush(); } catch (BTreeException e) { ! LOG.warn("error while removing doc", e); } catch (DBException e) { ! LOG.warn("error while removing doc", e); } catch (IOException e) { ! LOG.warn("error while removing doc", e); } return null; --- 1633,1641 ---- domDb.flush(); } catch (BTreeException e) { ! LOG.warn("start() - " + "error while removing doc", e); } catch (DBException e) { ! LOG.warn("start() - " + "error while removing doc", e); } catch (IOException e) { ! LOG.warn("start() - " + "error while removing doc", e); } return null; *************** *** 1599,1611 **** .run(); freeDocument(doc.getDocId()); - LOG.info("removed document."); } catch (IOException ioe) { ioe.printStackTrace(); ! LOG.warn(ioe); } catch (BTreeException bte) { bte.printStackTrace(); ! LOG.warn(bte); } catch (ReadOnlyException e) { ! LOG.warn(DATABASE_IS_READ_ONLY); } } --- 1644,1655 ---- .run(); freeDocument(doc.getDocId()); } catch (IOException ioe) { ioe.printStackTrace(); ! LOG.warn("removeDocument(String) - " + ioe); } catch (BTreeException bte) { bte.printStackTrace(); ! LOG.warn("removeDocument(String) - " + bte); } catch (ReadOnlyException e) { ! LOG.warn("removeDocument(String) - " + DATABASE_IS_READ_ONLY); } } *************** *** 2139,2142 **** --- 2183,2190 ---- public final static class NodeRef extends Value { + /** + * Log4J Logger for this class + */ + private static final Logger LOG = Logger.getLogger(NodeRef.class); public NodeRef() { Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** NativeElementIndex.java 29 Jan 2004 15:06:48 -0000 1.23 --- NativeElementIndex.java 3 May 2004 13:08:43 -0000 1.24 *************** *** 23,27 **** import java.io.EOFException; import java.io.IOException; - import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; --- 23,26 ---- *************** *** 37,41 **** import org.exist.dom.QName; import org.exist.dom.XMLUtil; ! import org.exist.storage.store.*; import org.exist.util.Configuration; import org.exist.util.FastQSort; --- 36,44 ---- import org.exist.dom.QName; import org.exist.dom.XMLUtil; ! import org.exist.storage.io.VariableByteArrayInput; ! import org.exist.storage.io.VariableByteInput; ! import org.exist.storage.io.VariableByteOutputStream; ! import org.exist.storage.store.BFile; ! import org.exist.storage.store.StorageAddress; import org.exist.util.Configuration; import org.exist.util.FastQSort; *************** *** 45,50 **** import org.exist.util.ReadOnlyException; //import org.exist.util.StorageAddress; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; public class NativeElementIndex extends ElementIndex { --- 48,51 ---- *************** *** 83,88 **** List oldList = new ArrayList(), idList; NodeProxy p; ! VariableByteInputStream is = new VariableByteInputStream(); ! InputStream dis = null; int len, docId; byte[] data; --- 84,88 ---- List oldList = new ArrayList(), idList; NodeProxy p; ! VariableByteInput is = null; int len, docId; byte[] data; *************** *** 111,115 **** lock.acquire(Lock.READ_LOCK); //val = dbElement.get(ref); ! dis = dbElement.getAsStream(ref); } catch (LockException e) { LOG.error("could not acquire lock for index on " + qname); --- 111,115 ---- lock.acquire(Lock.READ_LOCK); //val = dbElement.get(ref); ! is = dbElement.getAsStream(ref); } catch (LockException e) { LOG.error("could not acquire lock for index on " + qname); *************** *** 117,121 **** } catch (IOException e) { LOG.error("io error while reindexing " + qname, e); ! dis = null; } finally { lock.release(); --- 117,121 ---- } catch (IOException e) { LOG.error("io error while reindexing " + qname, e); ! is = null; } finally { lock.release(); *************** *** 123,130 **** os.clear(); oldList.clear(); ! if (dis != null) { // add old entries to the new list //data = val.getData(); - is.setInputStream(dis); try { while (is.available() > 0) { --- 123,129 ---- os.clear(); oldList.clear(); ! if (is != null) { // add old entries to the new list //data = val.getData(); try { while (is.available() > 0) { *************** *** 184,191 **** try { lock.acquire(Lock.WRITE_LOCK); ! if (dis == null) dbElement.put(ref, os.data()); else { ! address = ((BFile.PageInputStream) dis).getAddress(); dbElement.update(address, ref, os.data()); //dbElement.update(val.getAddress(), ref, data); --- 183,190 ---- try { lock.acquire(Lock.WRITE_LOCK); ! if (is == null) dbElement.put(ref, os.data()); else { ! address = ((BFile.PageInputStream) is).getAddress(); dbElement.update(address, ref, os.data()); //dbElement.update(val.getAddress(), ref, data); *************** *** 211,215 **** List newList = new ArrayList(), idList; NodeProxy p; ! VariableByteInputStream is; int len, docId; byte[] data; --- 210,214 ---- List newList = new ArrayList(), idList; NodeProxy p; ! VariableByteArrayInput is; int len, docId; byte[] data; *************** *** 250,254 **** // add old entries to the new list data = val.getData(); ! is = new VariableByteInputStream(data); try { while (is.available() > 0) { --- 249,253 ---- // add old entries to the new list data = val.getData(); ! is = new VariableByteArrayInput(data); try { while (is.available() > 0) { Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** DBBroker.java 23 Apr 2004 13:07:44 -0000 1.24 --- DBBroker.java 3 May 2004 13:08:43 -0000 1.25 *************** *** 44,52 **** import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.serializers.Serializer; import org.exist.util.Configuration; import org.exist.util.Occurrences; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; import org.exist.xquery.NodeSelector; import org.w3c.dom.Document; --- 44,53 ---- import org.exist.security.PermissionDeniedException; import org.exist.security.User; + import org.exist.storage.io.VariableByteInput; + import org.exist.storage.io.VariableByteOutputStream; + import org.exist.storage.io.VariableByteInputStream; import org.exist.storage.serializers.Serializer; import org.exist.util.Configuration; import org.exist.util.Occurrences; import org.exist.xquery.NodeSelector; import org.w3c.dom.Document; *************** *** 108,112 **** try { FileInputStream fis = new FileInputStream(symbols.getFile()); ! VariableByteInputStream is = new VariableByteInputStream(fis); symbols.read(is); fis.close(); --- 109,113 ---- try { FileInputStream fis = new FileInputStream(symbols.getFile()); ! VariableByteInput is = new VariableByteInputStream(fis); symbols.read(is); fis.close(); Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** NativeTextEngine.java 23 Apr 2004 13:07:44 -0000 1.44 --- NativeTextEngine.java 3 May 2004 13:08:43 -0000 1.45 *************** *** 26,30 **** import java.io.File; import java.io.IOException; - import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; --- 26,29 ---- *************** *** 36,39 **** --- 35,39 ---- import java.util.TreeMap; import java.util.TreeSet; + import org.apache.oro.text.GlobCompiler; import org.apache.oro.text.regex.MalformedPatternException; *************** *** 65,68 **** --- 65,71 ---- import org.exist.security.User; import org.exist.storage.analysis.TextToken; + import org.exist.storage.io.VariableByteArrayInput; + import org.exist.storage.io.VariableByteInput; + import org.exist.storage.io.VariableByteOutputStream; import org.exist.storage.serializers.Serializer; import org.exist.storage.store.BFile; *************** *** 78,83 **** import org.exist.util.ReadOnlyException; import org.exist.util.UTF8; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; import org.w3c.dom.Node; import org.w3c.dom.NodeList; --- 81,84 ---- *************** *** 304,309 **** Collection collection; short collectionId; ! VariableByteInputStream is; ! InputStream dis = null; NodeProxy parent, current = new NodeProxy(); NodeSet result; --- 305,309 ---- Collection collection; short collectionId; ! VariableByteInput is = null; NodeProxy parent, current = new NodeProxy(); NodeSet result; *************** *** 322,330 **** try { lock.acquire(); ! dis = dbWords.getAsStream(ref); ! if (dis == null) { continue; } - is = new VariableByteInputStream(dis); while (is.available() > 0) { docId = is.readInt(); --- 322,329 ---- try { lock.acquire(); ! is = dbWords.getAsStream(ref); ! if (is == null) { continue; } while (is.available() > 0) { docId = is.readInt(); *************** *** 508,512 **** TreeMap map = new TreeMap(); Occurrences oc; ! VariableByteInputStream is; int docId; int len; --- 507,511 ---- TreeMap map = new TreeMap(); Occurrences oc; ! VariableByteArrayInput is; int docId; int len; *************** *** 528,532 **** map.put(term, oc); } ! is = new VariableByteInputStream(val[1].getData()); try { while (is.available() > 0) { --- 527,531 ---- map.put(term, oc); } ! is = new VariableByteArrayInput(val[1].getData()); try { while (is.available() > 0) { *************** *** 589,593 **** */ public void removeDocument(DocumentImpl doc) { - LOG.debug("removing text index ..."); try { TreeSet words = new TreeSet(); --- 588,591 ---- *************** *** 603,608 **** Value val; WordRef ref; ! VariableByteInputStream is; ! InputStream dis; VariableByteOutputStream os; int len; --- 601,605 ---- Value val; WordRef ref; ! VariableByteInput is = null; VariableByteOutputStream os; int len; *************** *** 618,634 **** try { lock.acquire(Lock.READ_LOCK); ! dis = dbWords.getAsStream(ref); } catch (LockException e) { ! LOG.warn("could not acquire lock on words db", e); ! dis = null; } catch (IOException e) { ! LOG.error("io error while reading words", e); ! dis = null; } finally { lock.release(); } ! if (dis == null) continue; - is = new VariableByteInputStream(dis); os = new VariableByteOutputStream(); changed = false; --- 615,632 ---- try { lock.acquire(Lock.READ_LOCK); ! is = dbWords.getAsStream(ref); } catch (LockException e) { ! LOG.warn("removeDocument(DocumentImpl) - " ! + "could not acquire lock on words db", e); ! is = null; } catch (IOException e) { ! LOG.error("removeDocument(DocumentImpl) - " ! + "io error while reading words", e); ! is = null; } finally { lock.release(); } ! if (is == null) continue; os = new VariableByteOutputStream(); changed = false; *************** *** 660,667 **** } else { if (dbWords.put(ref, os.data()) < 0) ! LOG.debug("could not remove index for " + word); } } catch (LockException e) { ! LOG.warn("could not acquire lock on words db", e); } finally { lock.release(); --- 658,670 ---- } else { if (dbWords.put(ref, os.data()) < 0) ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + "could not remove index for " ! + word); ! } } } catch (LockException e) { ! LOG.warn("removeDocument(DocumentImpl) - " ! + "could not acquire lock on words db", e); } finally { lock.release(); *************** *** 669,675 **** } } ! LOG.debug(words.size() + " words updated."); } catch (ReadOnlyException e) { ! LOG.warn("database is read-only"); } } --- 672,683 ---- } } ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + words.size() ! + " words updated."); ! } } catch (ReadOnlyException e) { ! LOG.warn("removeDocument(DocumentImpl) - " ! + "database is read-only"); } } *************** *** 814,817 **** --- 822,826 ---- public void remove() { + // TODO: use VariableInputStream if (doc == null) return; *************** *** 830,834 **** LongLinkedList newList; Value val = null; ! VariableByteInputStream is; Lock lock = dbWords.getLock(); for (int k = 0; k < 2; k++) { --- 839,843 ---- LongLinkedList newList; Value val = null; ! VariableByteArrayInput is; Lock lock = dbWords.getLock(); for (int k = 0; k < 2; k++) { *************** *** 852,856 **** // add old entries to the new list data = val.getData(); ! is = new VariableByteInputStream(data); try { while (is.available() > 0) { --- 861,865 ---- // add old entries to the new list data = val.getData(); ! is = new VariableByteArrayInput(data); try { while (is.available() > 0) { *************** *** 937,942 **** NodeProxy p; WordRef ref; ! VariableByteInputStream is = new VariableByteInputStream(); ! InputStream dis = null; Lock lock = dbWords.getLock(); for (int k = 0; k < 2; k++) { --- 946,950 ---- NodeProxy p; WordRef ref; ! VariableByteInput is = null; Lock lock = dbWords.getLock(); for (int k = 0; k < 2; k++) { *************** *** 948,969 **** try { lock.acquire(Lock.READ_LOCK); ! dis = dbWords.getAsStream(ref); } catch (LockException e) { LOG.error("could not acquire lock on index for '" + word + "'"); ! dis = null; } catch (IOException e) { LOG.error("io error while reindexing word '" + word + "'"); ! dis = null; } finally { lock.release(); } os.clear(); ! if (dis != null) { // add old entries to the new list - is.setInputStream(dis); try { ! while (dis.available() > 0) { docId = is.readInt(); section = is.readByte(); --- 956,976 ---- try { lock.acquire(Lock.READ_LOCK); ! is = dbWords.getAsStream(ref); } catch (LockException e) { LOG.error("could not acquire lock on index for '" + word + "'"); ! is = null; } catch (IOException e) { LOG.error("io error while reindexing word '" + word + "'"); ! is = null; } finally { lock.release(); } os.clear(); ! if (is != null) { // add old entries to the new list try { ! while (is.available() > 0) { docId = is.readInt(); section = is.readByte(); *************** *** 1024,1031 **** lock.acquire(Lock.WRITE_LOCK); try { ! if (dis == null) dbWords.put(ref, os.data()); else { ! dbWords.update(((BFile.PageInputStream) dis) .getAddress(), ref, os.data()); } --- 1031,1038 ---- lock.acquire(Lock.WRITE_LOCK); try { ! if (is == null) dbWords.put(ref, os.data()); else { ! dbWords.update(((BFile.PageInputStream) is) .getAddress(), ref, os.data()); } *************** *** 1174,1184 **** } if (matcher.matches(word)) { ! InputStream dis = null; try { ! dis = dbWords.getAsStream(pointer); } catch (IOException ioe) { LOG.warn(ioe.getMessage(), ioe); } ! if (dis == null) return true; int k = 0; --- 1181,1191 ---- } if (matcher.matches(word)) { ! VariableByteInput is = null; try { ! is = dbWords.getAsStream(pointer); } catch (IOException ioe) { LOG.warn(ioe.getMessage(), ioe); } ! if (is == null) return true; int k = 0; *************** *** 1192,1196 **** DocumentImpl doc; NodeProxy parent, proxy; - VariableByteInputStream is = new VariableByteInputStream(dis); try { while (is.available() > 0) { --- 1199,1202 ---- *************** *** 1231,1238 **** LOG.warn("io error while reading index", e); } - try { - dis.close(); - } catch (IOException e1) { - } } if (context != null) --- 1237,1240 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:26
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/storage/store Modified Files: BFile.java DOMFile.java ItemId.java StorageAddress.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** DOMFile.java 27 Apr 2004 15:46:57 -0000 1.23 --- DOMFile.java 3 May 2004 13:08:45 -0000 1.24 *************** *** 683,707 **** /** - * Retrieve a range of nodes, starting at first and including last. - * - * @param first - * the first node to retrieve - * @param last - * the last node to retrieve - * @return list of nodes - * @exception IOException - * Description of the Exception - * @exception BTreeException - * Description of the Exception - */ - public ArrayList findRange(Value first, Value last) throws IOException, - BTreeException { - final IndexQuery query = new IndexQuery(IndexQuery.BW, first, last); - final RangeCallback cb = new RangeCallback(); - query(query, cb); - return cb.getValues(); - } - - /** * Find a node by searching for a known ancestor in the index. If an * ancestor is found, it is traversed to locate the specified descendant --- 683,686 ---- *************** *** 1091,1095 **** dataCache.remove(page); DOMFilePageHeader ph = page.getPageHeader(); - LOG.debug("---------------------------\nFreeing page: " + page.getPageNum()); if (ph.getNextDataPage() > -1) { DOMPage next = getCurrentPage(ph.getNextDataPage()); --- 1070,1073 ---- *************** *** 1117,1120 **** --- 1095,1112 ---- } + public void removeAll(long p) { + long pnum = StorageAddress.pageFromPointer(p); + while(-1 < pnum) { + DOMPage page = getCurrentPage(pnum); + pnum = page.getPageHeader().getNextDataPage(); + dataCache.remove(page); + try { + unlinkPages(page.page); + } catch (IOException e) { + LOG.warn("Error while removing page: " + e.getMessage(), e); + } + } + } + /** * Set the last page in the sequence to which nodes are currently appended. *************** *** 1140,1153 **** /** - * Set the file location for this DOMFile. - * - * @param location - * The new location value - */ - public void setLocation(String location) { - setFile(new File(location + ".dbx")); - } - - /** * The current object owning this file. * --- 1132,1135 ---- *************** *** 1329,1395 **** } ! /** ! * Find a record within the page or the pages linked to it. ! * ! * @param p ! * @return ! */ ! protected RecordPos findRecord(long p, boolean skipLinks) { ! long pageNr = StorageAddress.pageFromPointer(p); ! short targetId = StorageAddress.tidFromPointer(p); ! DOMPage page; ! int pos; ! short currentId, vlen; ! int dlen; ! outerLoop: ! while (pageNr > -1) { ! page = getCurrentPage(pageNr); ! dataCache.add(page); ! dlen = page.getPageHeader().getDataLength(); ! for (pos = 0; pos < dlen;) { ! currentId = ByteConversion.byteToShort(page.data, pos); ! if (ItemId.isLink(currentId)) { ! if (ItemId.getId(currentId) == targetId) { ! if(!skipLinks) ! return new RecordPos(pos + 2, page, currentId); ! long forwardLink = ByteConversion.byteToLong(page.data, ! pos + 2); ! // load the link page ! pageNr = StorageAddress.pageFromPointer(forwardLink); ! targetId = StorageAddress.tidFromPointer(forwardLink); ! // LOG.debug("following link. page = " ! // + pageNr ! // + "; tid=" ! // + targetId); ! continue outerLoop; ! } else { ! pos += 10; } - } else if (ItemId.getId(currentId) == targetId) - return new RecordPos(pos + 2, page, currentId); - else { - vlen = ByteConversion.byteToShort(page.data, pos + 2); - if (ItemId.isRelocated(currentId)) { - pos += vlen == OVERFLOW ? 20 : vlen + 12; - } else - pos += vlen == OVERFLOW ? 12 : vlen + 4; } } ! pageNr = page.getPageHeader().getNextDataPage(); ! if (pageNr == page.getPageNum()) { ! LOG.debug("illegal link to next page"); ! return null; ! } ! // LOG.debug( ! // owner.toString() ! // + ": tid " ! // + targetId ! // + " not found on " ! // + page.page.getPageInfo() ! // + ". Loading " ! // + pageNr); } - return null; - } private final class DOMFileHeader extends BTreeFileHeader { --- 1311,1377 ---- } ! /** ! * Find a record within the page or the pages linked to it. ! * ! * @param p ! * @return ! */ ! protected RecordPos findRecord(long p, boolean skipLinks) { ! long pageNr = StorageAddress.pageFromPointer(p); ! short targetId = StorageAddress.tidFromPointer(p); ! DOMPage page; ! int pos; ! short currentId, vlen; ! int dlen; ! outerLoop: ! while (pageNr > -1) { ! page = getCurrentPage(pageNr); ! dataCache.add(page); ! dlen = page.getPageHeader().getDataLength(); ! for (pos = 0; pos < dlen;) { ! currentId = ByteConversion.byteToShort(page.data, pos); ! if (ItemId.isLink(currentId)) { ! if (ItemId.getId(currentId) == targetId) { ! if(!skipLinks) ! return new RecordPos(pos + 2, page, currentId); ! long forwardLink = ByteConversion.byteToLong(page.data, ! pos + 2); ! // load the link page ! pageNr = StorageAddress.pageFromPointer(forwardLink); ! targetId = StorageAddress.tidFromPointer(forwardLink); ! // LOG.debug("following link. page = " ! // + pageNr ! // + "; tid=" ! // + targetId); ! continue outerLoop; ! } else { ! pos += 10; ! } ! } else if (ItemId.getId(currentId) == targetId) ! return new RecordPos(pos + 2, page, currentId); ! else { ! vlen = ByteConversion.byteToShort(page.data, pos + 2); ! if (ItemId.isRelocated(currentId)) { ! pos += vlen == OVERFLOW ? 20 : vlen + 12; ! } else ! pos += vlen == OVERFLOW ? 12 : vlen + 4; } } + pageNr = page.getPageHeader().getNextDataPage(); + if (pageNr == page.getPageNum()) { + LOG.debug("illegal link to next page"); + return null; + } + // LOG.debug( + // owner.toString() + // + ": tid " + // + targetId + // + " not found on " + // + page.page.getPageInfo() + // + ". Loading " + // + pageNr); } ! return null; } private final class DOMFileHeader extends BTreeFileHeader { Index: StorageAddress.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/StorageAddress.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StorageAddress.java 14 Apr 2004 12:17:22 -0000 1.3 --- StorageAddress.java 3 May 2004 13:08:45 -0000 1.4 *************** *** 4,9 **** import java.io.IOException; ! import org.exist.util.VariableByteInputStream; ! import org.exist.util.VariableByteOutputStream; /** --- 4,9 ---- import java.io.IOException; ! import org.exist.storage.io.VariableByteInput; ! import org.exist.storage.io.VariableByteOutputStream; /** *************** *** 62,67 **** } ! public final static long read(VariableByteInputStream is) throws IOException, EOFException { ! return createPointer(is.readInt(), is.readShort(), is.readShort()); } --- 62,67 ---- } ! public final static long read(VariableByteInput is) throws IOException, EOFException { ! return createPointer(is.readInt(), is.readShort(), is.readShort()); } Index: BFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/BFile.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** BFile.java 27 Apr 2004 15:46:57 -0000 1.19 --- BFile.java 3 May 2004 13:08:45 -0000 1.20 *************** *** 1,31 **** /* ! * eXist Open Source Native XML Database ! * Copyright (C) 2001-03 Wolfgang M. Meier ! * wol...@ex... ! * http://exist.sourceforge.net ! * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. [...3532 lines suppressed...] ! public String getPageInfo() { ! return page.getPageInfo(); ! } ! ! public long getPageNum() { ! return page.getPageNum(); ! } ! ! public void setData(byte[] buf) { ! data = buf; ! } ! ! public void write() throws IOException { ! //LOG.debug(getFile().getName() + " writing page " + getPageNum()); ! writeValue(page, new Value(data)); ! setDirty(false); ! } ! } ! } \ No newline at end of file Index: ItemId.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/ItemId.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ItemId.java 14 Apr 2004 12:17:22 -0000 1.1 --- ItemId.java 3 May 2004 13:08:45 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- public static final short LINK_MASK = (short) 0x4000; public static final short ID_MASK = (short) 0x3FFF; + public static final short LINK_OR_RELOCATED_MASK = (short) 0xC000; public final static short getId(short id) { *************** *** 39,43 **** public final static boolean isLink(short id) { ! return (id & LINK_MASK) != 0; } --- 40,44 ---- public final static boolean isLink(short id) { ! return (id & LINK_MASK) == LINK_MASK; } *************** *** 47,51 **** public final static boolean isRelocated(short id) { ! return (id & RELOCATED_MASK) != 0; } } \ No newline at end of file --- 48,60 ---- public final static boolean isRelocated(short id) { ! return (id & RELOCATED_MASK) == RELOCATED_MASK; } + + public final static boolean isLinkOrRelocated(short id) { + return (id & LINK_OR_RELOCATED_MASK) != 0; + } + + public final static boolean isOrdinaryRecord(short id) { + return (id & LINK_OR_RELOCATED_MASK) == 0; + } } \ No newline at end of file |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/storage/serializers Modified Files: Serializer.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: Serializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers/Serializer.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Serializer.java 27 Apr 2004 15:46:58 -0000 1.22 --- Serializer.java 3 May 2004 13:08:45 -0000 1.23 *************** *** 542,546 **** DOMStreamer streamer = null; try { ! streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(); streamer.setContentHandler(contentHandler); streamer.setLexicalHandler(lexicalHandler); --- 542,546 ---- DOMStreamer streamer = null; try { ! streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(this); streamer.setContentHandler(contentHandler); streamer.setLexicalHandler(lexicalHandler); *************** *** 551,558 **** throw new SAXException(e.getMessage(), e); } finally { ! try { ! DOMStreamerPool.getInstance().returnDOMStreamer(streamer); ! } catch (Exception e1) { ! } } --- 551,555 ---- throw new SAXException(e.getMessage(), e); } finally { ! DOMStreamerPool.getInstance().returnDOMStreamer(streamer); } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/memtree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/memtree Modified Files: DocumentImpl.java NodeImpl.java ElementImpl.java Receiver.java MemTreeBuilder.java Added Files: ReferenceNode.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. --- NEW FILE: ReferenceNode.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ReferenceNode.java,v 1.1 2004/05/03 13:08:43 wolfgang_m Exp $ */ package org.exist.memtree; import org.exist.dom.NodeProxy; /** * @author wolf */ public class ReferenceNode extends NodeImpl { /** * @param doc * @param nodeNumber */ public ReferenceNode(DocumentImpl doc, int nodeNumber) { super(doc, nodeNumber); } public NodeProxy getReference() { int p = document.alpha[nodeNumber]; return document.references[p]; } } Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/DocumentImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DocumentImpl.java 2 Mar 2004 08:35:44 -0000 1.6 --- DocumentImpl.java 3 May 2004 13:08:43 -0000 1.7 *************** *** 1,23 **** /* ! * eXist Open Source Native XML Database ! * Copyright (C) 2001-03 Wolfgang M. Meier ! * wol...@ex... ! * http://exist.sourceforge.net ! * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! * ! * $Id$ */ package org.exist.memtree; --- 1,21 ---- /* ! * eXist Open Source Native XML Database Copyright (C) 2001-03 Wolfgang M. Meier ! * wol...@ex... http://exist.sourceforge.net ! * ! * This program is free software; you can redistribute it and/or modify it under ! * the terms of the GNU Lesser General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) any ! * later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ! * details. ! * ! * You should have received a copy of the GNU Lesser General Public License ! * along with this program; if not, write to the Free Software Foundation, Inc., ! * 675 Mass Ave, Cambridge, MA 02139, USA. ! * ! * $Id$ */ package org.exist.memtree; *************** *** 25,28 **** --- 23,27 ---- import java.util.Arrays; + import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.util.hashtable.NamePool; *************** *** 41,392 **** import org.w3c.dom.Text; import org.w3c.dom.Document; public class DocumentImpl extends NodeImpl implements Document { ! protected NamePool namePool = new NamePool(); ! ! protected short[] nodeKind; ! protected short[] treeLevel; ! protected int[] next; ! protected int[] nodeName; ! protected int[] alpha; ! protected int[] alphaLen; ! protected char[] characters; ! protected int nextChar = 0; ! protected int[] attrName; ! protected int[] attrParent; ! protected String[] attrValue; ! protected int nextAttr = 0; ! ! protected int size = 1; ! protected int documentRootNode = -1; ! public DocumentImpl(int nodeSize, int attrSize, int charBufSize) { ! super(null, 0); ! nodeKind = new short[nodeSize]; ! treeLevel = new short[nodeSize]; ! next = new int[nodeSize]; ! Arrays.fill(next, -1); ! nodeName = new int[nodeSize]; ! alpha = new int[nodeSize]; ! alphaLen = new int[nodeSize]; ! characters = new char[charBufSize]; ! attrName = new int[attrSize]; ! attrParent = new int[attrSize]; ! attrValue = new String[attrSize]; ! treeLevel[0] = 0; ! nodeKind[0] = Node.DOCUMENT_NODE; ! document = this; ! } ! public int addNode(short kind, short level, QName qname) { ! if (size == nodeKind.length) ! grow(); ! nodeKind[size] = kind; ! treeLevel[size] = level; ! nodeName[size] = (qname != null ? namePool.add(qname) : -1); ! alpha[size] = -1; // undefined ! next[size] = -1; ! return size++; ! } ! public void addChars(int nodeNr, char[] ch, int start, int len) { ! if (nextChar + len >= characters.length) { ! int newLen = (characters.length * 3) / 2; ! if(newLen < nextChar + len) ! newLen = nextChar + len; ! char[] nc = new char[newLen]; ! System.arraycopy(characters, 0, nc, 0, characters.length); ! characters = nc; ! } ! alpha[nodeNr] = nextChar; ! alphaLen[nodeNr] = len; ! System.arraycopy(ch, start, characters, nextChar, len); ! nextChar += len; ! } ! public void addChars(int nodeNr, CharSequence s) { ! int len = s.length(); ! if (nextChar + len >= characters.length) { ! int newLen = (characters.length * 3) / 2; ! if(newLen < nextChar + len) ! newLen = nextChar + len; ! char[] nc = new char[newLen]; ! System.arraycopy(characters, 0, nc, 0, characters.length); ! characters = nc; ! } ! alpha[nodeNr] = nextChar; ! alphaLen[nodeNr] = len; ! for(int i = 0; i < len; i++) { ! characters[nextChar++] = s.charAt(i); ! } ! } ! public int addAttribute(int nodeNr, QName qname, String value) throws DOMException { ! if (nextAttr == attrName.length) ! growAttributes(); ! attrParent[nextAttr] = nodeNr; ! attrName[nextAttr] = namePool.add(qname); ! attrValue[nextAttr] = value; ! if (alpha[nodeNr] < 0) ! alpha[nodeNr] = nextAttr; ! return nextAttr++; ! } ! ! public int getLastNode() { ! return size - 1; ! } ! ! private void grow() { ! int newSize = (size * 3) / 2; ! short[] newNodeKind = new short[newSize]; ! System.arraycopy(nodeKind, 0, newNodeKind, 0, size); ! nodeKind = newNodeKind; ! short[] newTreeLevel = new short[newSize]; ! System.arraycopy(treeLevel, 0, newTreeLevel, 0, size); ! treeLevel = newTreeLevel; ! int[] newNext = new int[newSize]; ! Arrays.fill(newNext, -1); ! System.arraycopy(next, 0, newNext, 0, size); ! next = newNext; ! int[] newNodeName = new int[newSize]; ! System.arraycopy(nodeName, 0, newNodeName, 0, size); ! nodeName = newNodeName; ! int[] newAlpha = new int[newSize]; ! System.arraycopy(alpha, 0, newAlpha, 0, size); ! alpha = newAlpha; ! int[] newAlphaLen = new int[newSize]; ! System.arraycopy(alphaLen, 0, newAlphaLen, 0, size); ! alphaLen = newAlphaLen; ! } ! private void growAttributes() { ! int size = attrName.length; ! int newSize = (size * 3) / 2; ! int[] newAttrName = new int[newSize]; ! System.arraycopy(attrName, 0, newAttrName, 0, size); ! attrName = newAttrName; ! int[] newAttrParent = new int[newSize]; ! System.arraycopy(attrParent, 0, newAttrParent, 0, size); ! attrParent = newAttrParent; ! String[] newAttrValue = new String[newSize]; ! System.arraycopy(attrValue, 0, newAttrValue, 0, size); ! attrValue = newAttrValue; ! } ! public NodeImpl getNode(int nodeNr) throws DOMException { ! if (nodeNr == 0) ! return this; ! if (nodeNr >= size) ! throw new DOMException( ! DOMException.HIERARCHY_REQUEST_ERR, ! "node not found"); ! NodeImpl node; ! switch (nodeKind[nodeNr]) { ! case Node.ELEMENT_NODE : ! node = new ElementImpl(this, nodeNr); ! break; ! case Node.TEXT_NODE : ! node = new TextImpl(this, nodeNr); ! break; ! case Node.COMMENT_NODE: ! node = new CommentImpl(this, nodeNr); ! break; ! case Node.PROCESSING_INSTRUCTION_NODE: ! node = new ProcessingInstructionImpl(this, nodeNr); ! break; ! default : ! throw new DOMException( ! DOMException.NOT_FOUND_ERR, ! "node not found"); ! } ! return node; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Node#getParentNode() ! */ ! public Node getParentNode() { ! return null; ! } ! ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getDoctype() ! */ ! public DocumentType getDoctype() { ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getImplementation() ! */ ! public DOMImplementation getImplementation() { ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getDocumentElement() ! */ ! public Element getDocumentElement() { ! if (size == 1) ! return null; ! int nodeNr = 1; ! while (nodeKind[nodeNr] != Node.ELEMENT_NODE) { ! if (next[nodeNr] < nodeNr) { ! return null; ! } else ! nodeNr = next[nodeNr]; ! } ! return (Element) getNode(nodeNr); ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Node#getFirstChild() ! */ ! public Node getFirstChild() { ! if (size > 1) ! return getNode(1); ! else ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createElement(java.lang.String) ! */ ! public Element createElement(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createDocumentFragment() ! */ ! public DocumentFragment createDocumentFragment() { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createTextNode(java.lang.String) ! */ ! public Text createTextNode(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createComment(java.lang.String) ! */ ! public Comment createComment(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createCDATASection(java.lang.String) ! */ ! public CDATASection createCDATASection(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createProcessingInstruction(java.lang.String, java.lang.String) ! */ ! public ProcessingInstruction createProcessingInstruction( ! String arg0, ! String arg1) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createAttribute(java.lang.String) ! */ ! public Attr createAttribute(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createEntityReference(java.lang.String) ! */ ! public EntityReference createEntityReference(String arg0) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getElementsByTagName(java.lang.String) ! */ ! public NodeList getElementsByTagName(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#importNode(org.w3c.dom.Node, boolean) ! */ ! public Node importNode(Node arg0, boolean arg1) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createElementNS(java.lang.String, java.lang.String) ! */ ! public Element createElementNS(String arg0, String arg1) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#createAttributeNS(java.lang.String, java.lang.String) ! */ ! public Attr createAttributeNS(String arg0, String arg1) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getElementsByTagNameNS(java.lang.String, java.lang.String) ! */ ! public NodeList getElementsByTagNameNS(String arg0, String arg1) { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Document#getElementById(java.lang.String) ! */ ! public Element getElementById(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.w3c.dom.Node#getOwnerDocument() ! */ ! public org.w3c.dom.Document getOwnerDocument() { ! return this; ! } ! } --- 40,543 ---- import org.w3c.dom.Text; import org.w3c.dom.Document; + import org.xml.sax.SAXException; + /** + * An in-memory implementation of Document. + * + * This implementation stores all node data in the document object. Nodes from + * another document, i.e. a persistent document in the database, can be stored + * as reference nodes, i.e. the nodes are not copied into this document object. + * Instead a reference is inserted which will only be expanded during + * serialization. + * + * @author wolf + */ public class DocumentImpl extends NodeImpl implements Document { ! protected NamePool namePool = new NamePool(); ! protected short[] nodeKind; ! protected short[] treeLevel; ! protected int[] next; ! protected int[] nodeName; ! protected int[] alpha; ! protected int[] alphaLen; ! protected char[] characters; ! protected int nextChar = 0; ! protected int[] attrName; ! protected int[] attrParent; ! protected String[] attrValue; ! protected int nextAttr = 0; ! protected int size = 1; ! protected int documentRootNode = -1; ! protected NodeProxy references[]; ! protected int nextRef = 0; ! public DocumentImpl(int nodeSize, int attrSize, int charBufSize, int refSize) { ! super(null, 0); ! nodeKind = new short[nodeSize]; ! treeLevel = new short[nodeSize]; ! next = new int[nodeSize]; ! Arrays.fill(next, -1); ! nodeName = new int[nodeSize]; ! alpha = new int[nodeSize]; ! alphaLen = new int[nodeSize]; ! characters = new char[charBufSize]; ! attrName = new int[attrSize]; ! attrParent = new int[attrSize]; ! attrValue = new String[attrSize]; ! references = new NodeProxy[refSize]; ! treeLevel[0] = 0; ! nodeKind[0] = Node.DOCUMENT_NODE; ! document = this; ! } ! public int addNode(short kind, short level, QName qname) { ! if (size == nodeKind.length) grow(); ! nodeKind[size] = kind; ! treeLevel[size] = level; ! nodeName[size] = (qname != null ? namePool.add(qname) : -1); ! alpha[size] = -1; // undefined ! next[size] = -1; ! return size++; ! } ! public void addChars(int nodeNr, char[] ch, int start, int len) { ! if (nextChar + len >= characters.length) { ! int newLen = (characters.length * 3) / 2; ! if (newLen < nextChar + len) newLen = nextChar + len; ! char[] nc = new char[newLen]; ! System.arraycopy(characters, 0, nc, 0, characters.length); ! characters = nc; ! } ! alpha[nodeNr] = nextChar; ! alphaLen[nodeNr] = len; ! System.arraycopy(ch, start, characters, nextChar, len); ! nextChar += len; ! } ! public void addChars(int nodeNr, CharSequence s) { ! int len = s.length(); ! if (nextChar + len >= characters.length) { ! int newLen = (characters.length * 3) / 2; ! if (newLen < nextChar + len) newLen = nextChar + len; ! char[] nc = new char[newLen]; ! System.arraycopy(characters, 0, nc, 0, characters.length); ! characters = nc; ! } ! alpha[nodeNr] = nextChar; ! alphaLen[nodeNr] = len; ! for (int i = 0; i < len; i++) { ! characters[nextChar++] = s.charAt(i); ! } ! } ! public void addReferenceNode(int nodeNr, NodeProxy proxy) { ! if (nextRef == references.length) growReferences(); ! references[nextRef] = proxy; ! alpha[nodeNr] = nextRef++; ! } ! public int addAttribute(int nodeNr, QName qname, String value) ! throws DOMException { ! if (nextAttr == attrName.length) growAttributes(); ! attrParent[nextAttr] = nodeNr; ! attrName[nextAttr] = namePool.add(qname); ! attrValue[nextAttr] = value; ! if (alpha[nodeNr] < 0) alpha[nodeNr] = nextAttr; ! return nextAttr++; ! } ! public int getLastNode() { ! return size - 1; ! } ! private void grow() { ! int newSize = (size * 3) / 2; ! short[] newNodeKind = new short[newSize]; ! System.arraycopy(nodeKind, 0, newNodeKind, 0, size); ! nodeKind = newNodeKind; ! short[] newTreeLevel = new short[newSize]; ! System.arraycopy(treeLevel, 0, newTreeLevel, 0, size); ! treeLevel = newTreeLevel; ! int[] newNext = new int[newSize]; ! Arrays.fill(newNext, -1); ! System.arraycopy(next, 0, newNext, 0, size); ! next = newNext; ! int[] newNodeName = new int[newSize]; ! System.arraycopy(nodeName, 0, newNodeName, 0, size); ! nodeName = newNodeName; ! int[] newAlpha = new int[newSize]; ! System.arraycopy(alpha, 0, newAlpha, 0, size); ! alpha = newAlpha; ! int[] newAlphaLen = new int[newSize]; ! System.arraycopy(alphaLen, 0, newAlphaLen, 0, size); ! alphaLen = newAlphaLen; ! } ! private void growAttributes() { ! int size = attrName.length; ! int newSize = (size * 3) / 2; ! int[] newAttrName = new int[newSize]; ! System.arraycopy(attrName, 0, newAttrName, 0, size); ! attrName = newAttrName; ! int[] newAttrParent = new int[newSize]; ! System.arraycopy(attrParent, 0, newAttrParent, 0, size); ! attrParent = newAttrParent; ! String[] newAttrValue = new String[newSize]; ! System.arraycopy(attrValue, 0, newAttrValue, 0, size); ! attrValue = newAttrValue; ! } ! private void growReferences() { ! int size = references.length; ! int newSize = (size * 3) / 2; ! NodeProxy newReferences[] = new NodeProxy[newSize]; ! System.arraycopy(references, 0, newReferences, 0, size); ! references = newReferences; ! } ! public NodeImpl getNode(int nodeNr) throws DOMException { ! if (nodeNr == 0) return this; ! if (nodeNr >= size) ! throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ! "node not found"); ! NodeImpl node; ! switch (nodeKind[nodeNr]) { ! case Node.ELEMENT_NODE: ! node = new ElementImpl(this, nodeNr); ! break; ! case Node.TEXT_NODE: ! node = new TextImpl(this, nodeNr); ! break; ! case Node.COMMENT_NODE: ! node = new CommentImpl(this, nodeNr); ! break; ! case Node.PROCESSING_INSTRUCTION_NODE: ! node = new ProcessingInstructionImpl(this, nodeNr); ! break; ! case NodeImpl.REFERENCE_NODE: ! node = new ReferenceNode(this, nodeNr); ! break; ! default: ! throw new DOMException(DOMException.NOT_FOUND_ERR, ! "node not found"); ! } ! return node; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Node#getParentNode() ! */ ! public Node getParentNode() { ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getDoctype() ! */ ! public DocumentType getDoctype() { ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getImplementation() ! */ ! public DOMImplementation getImplementation() { ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getDocumentElement() ! */ ! public Element getDocumentElement() { ! if (size == 1) return null; ! int nodeNr = 1; ! while (nodeKind[nodeNr] != Node.ELEMENT_NODE) { ! if (next[nodeNr] < nodeNr) { ! return null; ! } else ! nodeNr = next[nodeNr]; ! } ! return (Element) getNode(nodeNr); ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Node#getFirstChild() ! */ ! public Node getFirstChild() { ! if (size > 1) ! return getNode(1); ! else ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createElement(java.lang.String) ! */ ! public Element createElement(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createDocumentFragment() ! */ ! public DocumentFragment createDocumentFragment() { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createTextNode(java.lang.String) ! */ ! public Text createTextNode(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createComment(java.lang.String) ! */ ! public Comment createComment(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createCDATASection(java.lang.String) ! */ ! public CDATASection createCDATASection(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createProcessingInstruction(java.lang.String, ! * java.lang.String) ! */ ! public ProcessingInstruction createProcessingInstruction(String arg0, ! String arg1) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createAttribute(java.lang.String) ! */ ! public Attr createAttribute(String arg0) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createEntityReference(java.lang.String) ! */ ! public EntityReference createEntityReference(String arg0) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getElementsByTagName(java.lang.String) ! */ ! public NodeList getElementsByTagName(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#importNode(org.w3c.dom.Node, boolean) ! */ ! public Node importNode(Node arg0, boolean arg1) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createElementNS(java.lang.String, ! * java.lang.String) ! */ ! public Element createElementNS(String arg0, String arg1) ! throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#createAttributeNS(java.lang.String, ! * java.lang.String) ! */ ! public Attr createAttributeNS(String arg0, String arg1) throws DOMException { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getElementsByTagNameNS(java.lang.String, ! * java.lang.String) ! */ ! public NodeList getElementsByTagNameNS(String arg0, String arg1) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Document#getElementById(java.lang.String) ! */ ! public Element getElementById(String arg0) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* ! * (non-Javadoc) ! * ! * @see org.w3c.dom.Node#getOwnerDocument() ! */ ! public org.w3c.dom.Document getOwnerDocument() { ! return this; ! } ! ! /** ! * Copy the document fragment starting at the specified node to the given ! * receiver. ! * ! * @param node ! * @param receiver ! */ ! public void copyTo(NodeImpl node, Receiver receiver) throws SAXException { ! NodeImpl top = node; ! while (node != null) { ! startNode(node, receiver); ! NodeImpl nextNode = (NodeImpl) node.getFirstChild(); ! while (nextNode == null) { ! endNode(node, receiver); ! if (top != null && top.nodeNumber == node.nodeNumber) break; ! nextNode = (NodeImpl) node.getNextSibling(); ! if (nextNode == null) { ! node = (NodeImpl) node.getParentNode(); ! if (node == null || (top != null && top.nodeNumber == node.nodeNumber)) { ! endNode(node, receiver); ! nextNode = null; ! break; ! } ! } ! } ! node = nextNode; ! } ! } ! ! private void startNode(NodeImpl node, Receiver receiver) ! throws SAXException { ! int nr = node.nodeNumber; ! switch (nodeKind[nr]) { ! case Node.ELEMENT_NODE: ! QName nodeName = (QName) document.namePool ! .get(document.nodeName[nr]); ! receiver.startElement(nodeName); ! int attr = document.alpha[nr]; ! if (-1 < attr) { ! while (attr < document.nextAttr ! && document.attrParent[attr] == nr) { ! QName attrQName = (QName) document.namePool ! .get(document.attrName[attr]); ! receiver.attribute(attrQName, attrValue[attr]); ! ++attr; ! } ! } ! break; ! case Node.TEXT_NODE: ! receiver.characters(document.characters, document.alpha[nr], ! document.alphaLen[nr]); ! break; ! case Node.COMMENT_NODE: ! receiver.comment(document.characters, document.alpha[nr], ! document.alphaLen[nr]); ! break; ! case Node.PROCESSING_INSTRUCTION_NODE: ! QName qn = (QName) document.namePool.get(document.nodeName[nr]); ! String data = new String(document.characters, ! document.alpha[nr], document.alphaLen[nr]); ! receiver.processingInstruction(qn.getLocalName(), data); ! break; ! case NodeImpl.REFERENCE_NODE: ! receiver ! .addReferenceNode(document.references[document.alpha[nr]]); ! break; ! } ! } ! ! private void endNode(NodeImpl node, Receiver receiver) throws SAXException { ! if(node.getNodeType() == Node.ELEMENT_NODE) ! receiver.endElement(node.getQName()); ! } ! } \ No newline at end of file Index: Receiver.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/Receiver.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Receiver.java 27 Apr 2004 15:47:01 -0000 1.3 --- Receiver.java 3 May 2004 13:08:43 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- package org.exist.memtree; + import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.w3c.dom.Document; *************** *** 29,32 **** --- 30,34 ---- import org.xml.sax.Locator; import org.xml.sax.SAXException; + import org.xml.sax.ext.LexicalHandler; /** *************** *** 35,39 **** * @author Wolfgang <wol...@ex...> */ ! public class Receiver implements ContentHandler { private MemTreeBuilder builder = null; --- 37,41 ---- * @author Wolfgang <wol...@ex...> */ ! public class Receiver implements ContentHandler, LexicalHandler { private MemTreeBuilder builder = null; *************** *** 115,118 **** --- 117,124 ---- builder.endElement(); } + + public void addReferenceNode(NodeProxy proxy) throws SAXException { + builder.addReferenceNode(proxy); + } public void characters(CharSequence seq) throws SAXException { *************** *** 142,147 **** * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) */ ! public void processingInstruction(String arg0, String arg1) throws SAXException { } --- 148,154 ---- * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) */ ! public void processingInstruction(String target, String data) throws SAXException { + builder.processingInstruction(target, data); } *************** *** 152,154 **** --- 159,206 ---- } + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#endCDATA() + */ + public void endCDATA() throws SAXException { + // TODO ignored + + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#endDTD() + */ + public void endDTD() throws SAXException { + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#startCDATA() + */ + public void startCDATA() throws SAXException { + // TODO Ignored + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) + */ + public void comment(char[] ch, int start, int length) throws SAXException { + builder.comment(ch, start, length); + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#endEntity(java.lang.String) + */ + public void endEntity(String name) throws SAXException { + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#startEntity(java.lang.String) + */ + public void startEntity(String name) throws SAXException { + } + + /* (non-Javadoc) + * @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String, java.lang.String, java.lang.String) + */ + public void startDTD(String name, String publicId, String systemId) throws SAXException { + } } Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/NodeImpl.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NodeImpl.java 2 Mar 2004 08:35:44 -0000 1.12 --- NodeImpl.java 3 May 2004 13:08:43 -0000 1.13 *************** *** 26,29 **** --- 26,30 ---- import org.exist.dom.QName; import org.exist.storage.DBBroker; + import org.exist.storage.serializers.Serializer; import org.exist.util.serializer.DOMStreamer; import org.exist.util.serializer.DOMStreamerPool; *************** *** 47,50 **** --- 48,53 ---- public class NodeImpl implements Node, NodeValue { + public final static short REFERENCE_NODE = 100; + protected int nodeNumber; protected DocumentImpl document; *************** *** 93,96 **** --- 96,118 ---- } + public QName getQName() { + switch (getNodeType()) { + case Node.DOCUMENT_NODE : + return QName.DOCUMENT_QNAME; + case Node.ATTRIBUTE_NODE : + case Node.ELEMENT_NODE : + case Node.PROCESSING_INSTRUCTION_NODE : + QName qn = (QName) + document.namePool.get(document.nodeName[nodeNumber]); + return qn; + case Node.COMMENT_NODE: + return QName.COMMENT_QNAME; + case Node.TEXT_NODE : + return QName.TEXT_QNAME; + default : + return null; + } + } + /* (non-Javadoc) * @see org.w3c.dom.Node#getNodeValue() *************** *** 486,495 **** */ public void toSAX(DBBroker broker, ContentHandler handler) throws SAXException { try { ! DOMStreamer streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(); streamer.setContentHandler(handler); streamer.serialize(this, false); - DOMStreamerPool.getInstance().returnDOMStreamer(streamer); } catch (Exception e) { throw new SAXException(e); } --- 508,523 ---- */ public void toSAX(DBBroker broker, ContentHandler handler) throws SAXException { + DOMStreamer streamer = null; try { ! Serializer serializer = broker.getSerializer(); ! serializer.reset(); ! serializer.setProperty(Serializer.GENERATE_DOC_EVENTS, "false"); ! serializer.setContentHandler(handler); ! streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(serializer); streamer.setContentHandler(handler); streamer.serialize(this, false); } catch (Exception e) { + DOMStreamerPool.getInstance().returnDOMStreamer(streamer); + e.printStackTrace(); throw new SAXException(e); } *************** *** 497,501 **** public void copyTo(DBBroker broker, Receiver receiver) throws SAXException { ! toSAX(broker, receiver); } --- 525,530 ---- public void copyTo(DBBroker broker, Receiver receiver) throws SAXException { ! // toSAX(broker, receiver); ! document.copyTo(this, receiver); } Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/ElementImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ElementImpl.java 2 Mar 2004 15:30:43 -0000 1.3 --- ElementImpl.java 3 May 2004 13:08:43 -0000 1.4 *************** *** 49,52 **** --- 49,53 ---- document.namePool.get(document.nodeName[nodeNumber]); } + /* (non-Javadoc) * @see org.w3c.dom.Node#hasChildNodes() Index: MemTreeBuilder.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/MemTreeBuilder.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MemTreeBuilder.java 27 Apr 2004 15:47:02 -0000 1.7 --- MemTreeBuilder.java 3 May 2004 13:08:43 -0000 1.8 *************** *** 25,28 **** --- 25,29 ---- import java.util.Arrays; + import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.XQueryContext; *************** *** 68,72 **** */ public void startDocument() { ! this.doc = new DocumentImpl(500, 50, 1000); } --- 69,73 ---- */ public void startDocument() { ! this.doc = new DocumentImpl(500, 50, 1000, 50); } *************** *** 152,155 **** --- 153,167 ---- } + public int addReferenceNode(NodeProxy proxy) { + int nodeNr = doc.addNode(NodeImpl.REFERENCE_NODE, level, null); + doc.addReferenceNode(nodeNr, proxy); + int prevNr = prevNodeInLevel[level]; + if (prevNr > -1) + doc.next[prevNr] = nodeNr; + doc.next[nodeNr] = prevNodeInLevel[level - 1]; + prevNodeInLevel[level] = nodeNr; + return nodeNr; + } + public void addAttribute(QName qname, String value) { int lastNode = doc.getLastNode(); *************** *** 204,207 **** --- 216,230 ---- } + public int comment(char ch[], int start, int len) { + int nodeNr = doc.addNode(Node.COMMENT_NODE, level, null); + doc.addChars(nodeNr, ch, start, len); + int prevNr = prevNodeInLevel[level]; + if (prevNr > -1) + doc.next[prevNr] = nodeNr; + doc.next[nodeNr] = prevNodeInLevel[level - 1]; + prevNodeInLevel[level] = nodeNr; + return nodeNr; + } + public int processingInstruction(String target, String data) { QName qn = new QName(target, null, null); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/dom Modified Files: SymbolTable.java QName.java DocumentImpl.java BinaryDocument.java NodeProxy.java DocumentSet.java DocumentTypeImpl.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: BinaryDocument.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/BinaryDocument.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BinaryDocument.java 2 Feb 2004 15:30:39 -0000 1.2 --- BinaryDocument.java 3 May 2004 13:08:42 -0000 1.3 *************** *** 31,36 **** import org.exist.security.User; import org.exist.storage.DBBroker; ! import org.exist.util.VariableByteInputStream; ! import org.exist.util.VariableByteOutputStream; /** --- 31,36 ---- import org.exist.security.User; import org.exist.storage.DBBroker; ! import org.exist.storage.io.VariableByteArrayInput; ! import org.exist.storage.io.VariableByteOutputStream; /** *************** *** 96,100 **** } ! public void read(VariableByteInputStream istream) throws IOException, EOFException { docId = istream.readInt(); --- 96,100 ---- } ! public void read(VariableByteArrayInput istream) throws IOException, EOFException { docId = istream.readInt(); *************** *** 133,137 **** public void deserialize(byte[] data) { ! VariableByteInputStream istream = new VariableByteInputStream(data); try { created = istream.readLong(); --- 133,137 ---- public void deserialize(byte[] data) { ! VariableByteArrayInput istream = new VariableByteArrayInput(data); try { created = istream.readLong(); Index: NodeProxy.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeProxy.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** NodeProxy.java 27 Apr 2004 15:46:56 -0000 1.27 --- NodeProxy.java 3 May 2004 13:08:42 -0000 1.28 *************** *** 634,644 **** public void copyTo(DBBroker broker, Receiver receiver) throws SAXException { ! Serializer serializer = broker.getSerializer(); ! serializer.toReceiver(this, receiver); ! // if (nodeType == Node.ATTRIBUTE_NODE) { ! // AttrImpl attr = (AttrImpl) getNode(); ! // receiver.attribute(attr.getQName(), attr.getValue()); ! // } else ! // toSAX(broker, receiver); } --- 634,640 ---- public void copyTo(DBBroker broker, Receiver receiver) throws SAXException { ! receiver.addReferenceNode(this); ! // Serializer serializer = broker.getSerializer(); ! // serializer.toReceiver(this, receiver); } Index: SymbolTable.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/SymbolTable.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SymbolTable.java 27 Apr 2004 15:46:56 -0000 1.11 --- SymbolTable.java 3 May 2004 13:08:42 -0000 1.12 *************** *** 28,35 **** import org.apache.log4j.Logger; ! import org.exist.util.VariableByteInputStream; ! import org.exist.util.VariableByteOutputStream; import org.exist.util.hashtable.Int2ObjectHashMap; - import org.exist.util.hashtable.NamePool; import org.exist.util.hashtable.Object2IntHashMap; import org.w3c.dom.Attr; --- 28,34 ---- import org.apache.log4j.Logger; ! import org.exist.storage.io.VariableByteInput; ! import org.exist.storage.io.VariableByteOutputStream; import org.exist.util.hashtable.Int2ObjectHashMap; import org.exist.util.hashtable.Object2IntHashMap; import org.w3c.dom.Attr; *************** *** 198,202 **** } ! public synchronized void read(VariableByteInputStream istream) throws IOException { max = istream.readShort(); nsMax = istream.readShort(); --- 197,201 ---- } ! public synchronized void read(VariableByteInput istream) throws IOException { max = istream.readShort(); nsMax = istream.readShort(); Index: DocumentSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentSet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DocumentSet.java 1 Apr 2004 14:12:46 -0000 1.11 --- DocumentSet.java 3 May 2004 13:08:42 -0000 1.12 *************** *** 108,111 **** --- 108,113 ---- if((broker == null || doc.getPermissions().validate(broker.getUser(), Permission.READ)) && (!doc.isLockedForWrite())) put(doc.getDocId(), doc); + else + LOG.debug("document is locked"); } } Index: DocumentTypeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentTypeImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DocumentTypeImpl.java 9 Sep 2003 07:29:03 -0000 1.3 --- DocumentTypeImpl.java 3 May 2004 13:08:42 -0000 1.4 *************** *** 19,24 **** package org.exist.dom; ! import org.exist.util.VariableByteInputStream; ! import org.exist.util.VariableByteOutputStream; import org.w3c.dom.*; import java.io.DataInput; --- 19,24 ---- package org.exist.dom; ! import org.exist.storage.io.VariableByteArrayInput; ! import org.exist.storage.io.VariableByteOutputStream; import org.w3c.dom.*; import java.io.DataInput; *************** *** 102,106 **** } ! protected void read(VariableByteInputStream istream) throws IOException { name = istream.readUTF(); systemId = istream.readUTF(); --- 102,106 ---- } ! protected void read(VariableByteArrayInput istream) throws IOException { name = istream.readUTF(); systemId = istream.readUTF(); Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** DocumentImpl.java 23 Apr 2004 13:07:48 -0000 1.36 --- DocumentImpl.java 3 May 2004 13:08:42 -0000 1.37 *************** *** 22,26 **** */ package org.exist.dom; ! import java.io.*; import java.util.Iterator; import java.util.LinkedList; --- 22,27 ---- */ package org.exist.dom; ! import java.io.EOFException; ! import java.io.IOException; import java.util.Iterator; import java.util.LinkedList; *************** *** 29,46 **** import org.apache.log4j.Category; import org.exist.EXistException; ! import org.exist.collections.*; import org.exist.security.Group; import org.exist.security.Permission; import org.exist.security.SecurityManager; import org.exist.security.User; ! ! import org.exist.storage.*; import org.exist.storage.store.StorageAddress; - import org.w3c.dom.*; import org.exist.util.SyntaxException; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; import org.exist.xquery.DescendantSelector; import org.exist.xquery.NodeSelector; /** --- 30,60 ---- import org.apache.log4j.Category; import org.exist.EXistException; ! import org.exist.collections.Collection; import org.exist.security.Group; import org.exist.security.Permission; import org.exist.security.SecurityManager; import org.exist.security.User; ! import org.exist.storage.DBBroker; ! import org.exist.storage.ElementValue; ! import org.exist.storage.io.VariableByteArrayInput; ! import org.exist.storage.io.VariableByteInput; ! import org.exist.storage.io.VariableByteOutputStream; import org.exist.storage.store.StorageAddress; import org.exist.util.SyntaxException; import org.exist.xquery.DescendantSelector; import org.exist.xquery.NodeSelector; + import org.w3c.dom.Attr; + import org.w3c.dom.CDATASection; + import org.w3c.dom.Comment; + import org.w3c.dom.DOMException; + import org.w3c.dom.Document; + import org.w3c.dom.DocumentFragment; + import org.w3c.dom.DocumentType; + import org.w3c.dom.Element; + import org.w3c.dom.EntityReference; + import org.w3c.dom.Node; + import org.w3c.dom.NodeList; + import org.w3c.dom.ProcessingInstruction; + import org.w3c.dom.Text; /** *************** *** 486,490 **** } ! public void read(VariableByteInputStream istream) throws IOException, EOFException { docId = istream.readInt(); fileName = collection.getName() + '/' + istream.readUTF(); --- 500,504 ---- } ! public void read(VariableByteInput istream) throws IOException, EOFException { docId = istream.readInt(); fileName = collection.getName() + '/' + istream.readUTF(); *************** *** 652,656 **** public void deserialize(byte[] data) { ! VariableByteInputStream istream = new VariableByteInputStream(data); try { long address; --- 666,670 ---- public void deserialize(byte[] data) { ! VariableByteArrayInput istream = new VariableByteArrayInput(data); try { long address; Index: QName.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/QName.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** QName.java 27 Apr 2004 15:46:56 -0000 1.12 --- QName.java 3 May 2004 13:08:42 -0000 1.13 *************** *** 35,38 **** --- 35,39 ---- public class QName implements Comparable { + public final static QName DOCUMENT_QNAME = new QName("#document", "", null); public final static QName TEXT_QNAME = new QName("#text", "", null); public final static QName COMMENT_QNAME = new QName("#comment", "", null); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:09:24
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/util/serializer Modified Files: DOMStreamerObjectFactory.java SAXSerializer.java DOMStreamerPool.java XMLWriter.java Added Files: ExtendedDOMSerializer.java ExtendedDOMStreamer.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. --- NEW FILE: ExtendedDOMStreamer.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ExtendedDOMStreamer.java,v 1.1 2004/05/03 13:08:45 wolfgang_m Exp $ */ package org.exist.util.serializer; import org.exist.memtree.NodeImpl; import org.exist.memtree.ReferenceNode; import org.exist.storage.serializers.Serializer; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; /** * @author wolf */ public class ExtendedDOMStreamer extends DOMStreamer { private Serializer xmlSerializer; public ExtendedDOMStreamer() { super(); } /** * */ public ExtendedDOMStreamer(Serializer xmlSerializer) { super(); this.xmlSerializer = xmlSerializer; } /** * @param contentHandler * @param lexicalHandler */ public ExtendedDOMStreamer(Serializer xmlSerializer, ContentHandler contentHandler, LexicalHandler lexicalHandler) { super(contentHandler, lexicalHandler); this.xmlSerializer = xmlSerializer; } public void setSerializer(Serializer serializer) { this.xmlSerializer = serializer; } /* (non-Javadoc) * @see org.exist.util.serializer.DOMStreamer#startNode(org.w3c.dom.Node) */ protected void startNode(Node node) throws SAXException { if(node.getNodeType() == NodeImpl.REFERENCE_NODE) { if(xmlSerializer == null) throw new SAXException("Cannot serialize node reference. Serializer is undefined."); xmlSerializer.toSAX(((ReferenceNode)node).getReference()); } else super.startNode(node); } /* (non-Javadoc) * @see org.exist.util.serializer.DOMStreamer#reset() */ public void reset() { super.reset(); xmlSerializer = null; } } Index: DOMStreamerObjectFactory.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/DOMStreamerObjectFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DOMStreamerObjectFactory.java 22 Dec 2003 18:48:45 -0000 1.2 --- DOMStreamerObjectFactory.java 3 May 2004 13:08:44 -0000 1.3 *************** *** 38,42 **** */ public Object makeObject() throws Exception { ! return new DOMStreamer(); } --- 38,42 ---- */ public Object makeObject() throws Exception { ! return new ExtendedDOMStreamer(); } Index: XMLWriter.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/XMLWriter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLWriter.java 27 Apr 2004 15:47:00 -0000 1.7 --- XMLWriter.java 3 May 2004 13:08:45 -0000 1.8 *************** *** 22,25 **** --- 22,26 ---- import java.io.IOException; import java.io.Writer; + import java.util.Arrays; import java.util.Properties; import java.util.Stack; *************** *** 55,58 **** --- 56,81 ---- private char[] charref = new char[10]; + private static boolean[] textSpecialChars; + private static boolean[] attrSpecialChars; + + static { + textSpecialChars = new boolean[127]; + Arrays.fill(textSpecialChars, false); + textSpecialChars['<'] = true; + textSpecialChars['>'] = true; + textSpecialChars['\r'] = true; + textSpecialChars['&'] = true; + + attrSpecialChars = new boolean[127]; + Arrays.fill(attrSpecialChars, false); + attrSpecialChars['<'] = true; + attrSpecialChars['>'] = true; + attrSpecialChars['\r'] = true; + attrSpecialChars['\n'] = true; + attrSpecialChars['\t'] = true; + attrSpecialChars['&'] = true; + attrSpecialChars['"'] = true; + } + public XMLWriter() { } *************** *** 147,151 **** } writer.write("=\""); ! writeChars(nsURI); writer.write('"'); } catch (IOException e) { --- 170,174 ---- } writer.write("=\""); ! writeChars(nsURI, true); writer.write('"'); } catch (IOException e) { *************** *** 162,166 **** writer.write(qname); writer.write("=\""); ! writeAttrChars(value); writer.write('"'); } catch (IOException e) { --- 185,189 ---- writer.write(qname); writer.write("=\""); ! writeChars(value, true); writer.write('"'); } catch (IOException e) { *************** *** 175,179 **** if (tagIsOpen) closeStartTag(false); ! writeChars(chars); } catch (IOException e) { throw new TransformerException(e.getMessage(), e); --- 198,202 ---- if (tagIsOpen) closeStartTag(false); ! writeChars(chars, false); } catch (IOException e) { throw new TransformerException(e.getMessage(), e); *************** *** 201,205 **** if (data != null && data.length() > 0) { writer.write(' '); ! writeChars(data); } writer.write("?>"); --- 224,228 ---- if (data != null && data.length() > 0) { writer.write(' '); ! writeChars(data, false); } writer.write("?>"); *************** *** 216,220 **** closeStartTag(false); writer.write("<!--"); ! writeChars(data); writer.write("-->"); } catch (IOException e) { --- 239,243 ---- closeStartTag(false); writer.write("<!--"); ! writeChars(data, false); writer.write("-->"); } catch (IOException e) { *************** *** 269,304 **** } ! private final void writeChars(CharSequence s) throws IOException { ! char ch; ! for (int i = 0; i < s.length(); i++) { ! ch = s.charAt(i); ! switch (ch) { ! case '<' : ! writer.write("<"); ! break; ! case '>' : ! writer.write(">"); ! break; ! case '&' : ! writer.write("&"); ! break; ! case '\r' : ! writer.write("
"); ! break; ! default : ! if (charSet.inCharacterSet(ch)) ! writer.write(ch); ! else ! writeCharacterReference(ch); ! break; ! } ! } ! } ! ! protected void writeAttrChars(CharSequence s) throws IOException { ! char ch; ! for (int i = 0; i < s.length(); i++) { ! ch = s.charAt(i); ! switch (ch) { case '<' : writer.write("<"); --- 292,318 ---- } ! private final void writeChars(CharSequence s, boolean inAttribute) throws IOException { ! boolean[] specialChars = inAttribute ? attrSpecialChars : textSpecialChars; ! char ch = 0; ! final int len = s.length(); ! int pos = 0, i; ! while(pos < len) { ! i = pos; ! while(i < len) { ! ch = s.charAt(i); ! if(ch < 128) { ! if(specialChars[ch]) ! break; ! else ! i++; ! } else if(!charSet.inCharacterSet(ch)) ! break; ! else ! i++; ! } ! writer.write(s.subSequence(pos, i).toString()); ! if(i >= len) ! return; ! switch (ch) { case '<' : writer.write("<"); *************** *** 322,331 **** writer.write("""); break; ! default : ! if(charSet.inCharacterSet(ch)) ! writer.write(ch); ! else ! writeCharacterReference(ch); ! } } } --- 336,343 ---- writer.write("""); break; ! default: ! writeCharacterReference(ch); ! } ! pos = ++i; } } *************** *** 344,346 **** writer.write(charref, 0, o); } ! } \ No newline at end of file --- 356,358 ---- writer.write(charref, 0, o); } ! } --- NEW FILE: ExtendedDOMSerializer.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ExtendedDOMSerializer.java,v 1.1 2004/05/03 13:08:45 wolfgang_m Exp $ */ package org.exist.util.serializer; import java.io.Writer; import java.util.Properties; import javax.xml.transform.TransformerException; import org.exist.dom.NodeProxy; import org.exist.memtree.NodeImpl; import org.exist.memtree.ReferenceNode; import org.exist.storage.DBBroker; import org.exist.storage.serializers.Serializer; import org.w3c.dom.Node; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; /** * @author wolf */ public class ExtendedDOMSerializer extends DOMSerializer { private DBBroker broker; /** * */ public ExtendedDOMSerializer(DBBroker broker) { super(); this.broker = broker; } /** * @param writer * @param outputProperties */ public ExtendedDOMSerializer(DBBroker broker, Writer writer, Properties outputProperties) { super(writer, outputProperties); this.broker = broker; } /* (non-Javadoc) * @see org.exist.util.serializer.DOMSerializer#startNode(org.w3c.dom.Node) */ protected void startNode(Node node) throws TransformerException { if(node.getNodeType() == NodeImpl.REFERENCE_NODE) { SAXSerializer handler = SAXSerializerPool.getInstance().borrowSAXSerializer(); handler.setReceiver(receiver); Serializer serializer = broker.getSerializer(); serializer.setContentHandler(handler); try { serializer.setProperties(outputProperties); } catch (SAXNotRecognizedException e) { } catch (SAXNotSupportedException e) { } try { serializer.toSAX((NodeProxy)((ReferenceNode)node).getReference()); } catch (SAXException e) { throw new TransformerException(e.getMessage(), e); } } else super.startNode(node); } } Index: SAXSerializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/SAXSerializer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SAXSerializer.java 23 Apr 2004 13:07:46 -0000 1.6 --- SAXSerializer.java 3 May 2004 13:08:45 -0000 1.7 *************** *** 81,84 **** --- 81,88 ---- } + public void setReceiver(XMLWriter receiver) { + this.receiver = receiver; + } + public void reset() { nsSupport.reset(); Index: DOMStreamerPool.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/DOMStreamerPool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DOMStreamerPool.java 25 Feb 2004 15:31:58 -0000 1.4 --- DOMStreamerPool.java 3 May 2004 13:08:45 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- import org.apache.commons.pool.PoolableObjectFactory; import org.apache.commons.pool.impl.StackObjectPool; + import org.exist.storage.serializers.Serializer; /** *************** *** 50,53 **** --- 51,64 ---- } + public DOMStreamer borrowDOMStreamer(Serializer delegate) { + try { + ExtendedDOMStreamer serializer = (ExtendedDOMStreamer)borrowObject(); + serializer.setSerializer(delegate); + return serializer; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + public void returnDOMStreamer(DOMStreamer streamer) { if(streamer == null) |
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 { |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/util/test Removed Files: VariableByteStreamTest.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. --- VariableByteStreamTest.java DELETED --- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist Modified Files: JettyStart.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: JettyStart.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/JettyStart.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JettyStart.java 9 Sep 2003 07:29:05 -0000 1.3 --- JettyStart.java 3 May 2004 13:08:47 -0000 1.4 *************** *** 27,32 **** --- 27,35 ---- import org.exist.storage.BrokerPool; import org.exist.util.Configuration; + import org.exist.xmldb.DatabaseImpl; import org.exist.xmldb.ShutdownListener; import org.mortbay.jetty.Server; + import org.xmldb.api.DatabaseManager; + import org.xmldb.api.base.Database; /** *************** *** 52,55 **** --- 55,63 ---- Configuration config = new Configuration("conf.xml", home); BrokerPool.configure(1, 5, config); + + // register the XMLDB driver + Database xmldb = new DatabaseImpl(); + xmldb.setProperty("create-database", "false"); + DatabaseManager.registerDatabase(xmldb); } catch (Exception e) { System.err.println("configuration error: " + e.getMessage()); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/xmlrpc Modified Files: RpcConnection.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: RpcConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcConnection.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** RpcConnection.java 28 Apr 2004 14:20:22 -0000 1.52 --- RpcConnection.java 3 May 2004 13:08:47 -0000 1.53 *************** *** 1177,1196 **** throw new EXistException("index out of range"); ! if (item instanceof NodeProxy) { ! NodeProxy proxy = (NodeProxy) item; ! Serializer serializer = broker.getSerializer(); serializer.reset(); serializer.setProperties(parameters); ! return serializer.serialize(proxy); ! } else if (item instanceof Node) { ! StringWriter writer = new StringWriter(); ! Properties properties = getProperties(parameters); ! DOMSerializer serializer = DOMSerializerPool.getInstance() ! .borrowDOMSerializer(); ! serializer.setWriter(writer); ! serializer.setOutputProperties(properties); ! serializer.serialize((Node) item); ! DOMSerializerPool.getInstance().returnDOMSerializer(serializer); ! return writer.toString(); } else { return item.getStringValue(); --- 1177,1186 ---- throw new EXistException("index out of range"); ! if(Type.subTypeOf(item.getType(), Type.NODE)) { ! NodeValue nodeValue = (NodeValue)item; ! Serializer serializer = broker.getSerializer(); serializer.reset(); serializer.setProperties(parameters); ! return serializer.serialize(nodeValue); } else { return item.getStringValue(); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/xquery/functions/xmldb Modified Files: XMLDBCollection.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: XMLDBCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb/XMLDBCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLDBCollection.java 21 Feb 2004 17:56:51 -0000 1.2 --- XMLDBCollection.java 3 May 2004 13:08:46 -0000 1.3 *************** *** 78,81 **** --- 78,82 ---- collection = DatabaseManager.getCollection(collectionURI, user, passwd); } catch (XMLDBException e) { + LOG.debug(e.getMessage(), e); throw new XPathException(getASTNode(), "exception while retrieving collection: " + e.getMessage(), e); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/dbxml/core/filer Modified Files: BTree.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: BTree.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer/BTree.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** BTree.java 14 Apr 2004 12:17:23 -0000 1.23 --- BTree.java 3 May 2004 13:08:46 -0000 1.24 *************** *** 65,70 **** import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.LRDCache; import org.exist.util.ByteConversion; - import org.exist.util.VariableByteInputStream; /** --- 65,70 ---- import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.LRDCache; + import org.exist.storage.io.VariableByteArrayInput; import org.exist.util.ByteConversion; /** *************** *** 462,466 **** public void __read() throws IOException { byte[] data = page.read(); ! VariableByteInputStream is = new VariableByteInputStream(data); // Read in the Values --- 462,466 ---- public void __read() throws IOException { byte[] data = page.read(); ! VariableByteArrayInput is = new VariableByteArrayInput(data); // Read in the Values |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/security Modified Files: Permission.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: Permission.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/security/Permission.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Permission.java 18 Jun 2003 15:39:14 -0000 1.3 --- Permission.java 3 May 2004 13:08:46 -0000 1.4 *************** *** 7,13 **** import java.util.Properties; import java.util.StringTokenizer; import org.exist.util.SyntaxException; - import org.exist.util.VariableByteInputStream; - import org.exist.util.VariableByteOutputStream; /** --- 7,12 ---- import java.util.Properties; import java.util.StringTokenizer; + import org.exist.util.SyntaxException; /** *************** *** 163,172 **** permissions = istream.readByte(); } - - public void read( VariableByteInputStream istream ) throws IOException { - owner = istream.readUTF(); - ownerGroup = istream.readUTF(); - permissions = istream.readByte(); - } /** --- 162,165 ---- *************** *** 339,349 **** } - - /** - * Description of the Method - * - *@param perm Description of the Parameter - *@return Description of the Return Value - */ private final boolean validateGroup( int perm ) { perm = perm << 3; --- 332,335 ---- *************** *** 351,372 **** } - - /** - * Description of the Method - * - *@param perm Description of the Parameter - *@return Description of the Return Value - */ private final boolean validatePublic( int perm ) { return ( permissions & perm ) == perm; } - - /** - * Description of the Method - * - *@param perm Description of the Parameter - *@return Description of the Return Value - */ private final boolean validateUser( int perm ) { perm = perm << 6; --- 337,344 ---- *************** *** 374,384 **** } - - /** - * Description of the Method - * - *@param ostream Description of the Parameter - *@exception IOException Description of the Exception - */ public void write( DataOutput ostream ) throws IOException { ostream.writeUTF( owner ); --- 346,349 ---- *************** *** 387,397 **** } - public void write( VariableByteOutputStream ostream ) - throws IOException { - ostream.writeUTF( owner ); - ostream.writeUTF( ownerGroup ); - ostream.writeByte( (byte)permissions ); - } - public void store( String prefix, Properties props ) { props.setProperty( prefix + ".owner", owner ); --- 352,355 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/xquery Modified Files: RootNode.java LocationStep.java EnclosedExpr.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LocationStep.java 27 Apr 2004 15:46:58 -0000 1.4 --- LocationStep.java 3 May 2004 13:08:45 -0000 1.5 *************** *** 272,275 **** --- 272,282 ---- axis == Constants.DESCENDANT_SELF_AXIS, inPredicate); + // DocumentSet docs = contextSet.getDocumentSet(); + // NodeSelector selector = axis == Constants.DESCENDANT_SELF_AXIS ? + // new DescendantOrSelfSelector(contextSet, inPredicate) : + // new DescendantSelector(contextSet, inPredicate); + // NodeSet result = context.getBroker().findElementsByTagName( + // ElementValue.ELEMENT, docs, test.getName(), selector + // ); return result; } Index: EnclosedExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/EnclosedExpr.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EnclosedExpr.java 27 Apr 2004 15:46:59 -0000 1.3 --- EnclosedExpr.java 3 May 2004 13:08:45 -0000 1.4 *************** *** 53,59 **** --- 53,61 ---- throws XPathException { long start = System.currentTimeMillis(); + // evaluate the expression context.pushDocumentContext(); Sequence result = super.eval(null, null); context.popDocumentContext(); + // create the output MemTreeBuilder builder = context.getDocumentBuilder(); Receiver receiver = new Receiver(builder); *************** *** 74,77 **** --- 76,81 ---- buf.append(next.getStringValue()); next = i.nextItem(); + // if item is a node, flush any collected character data and + // copy the node to the target doc. } else if (Type.subTypeOf(next.getType(), Type.NODE)) { if (buf != null && buf.length() > 0) { *************** *** 83,89 **** --- 87,95 ---- } } + // flush remaining character data if (buf != null && buf.length() > 0) receiver.characters(buf); } catch (SAXException e) { + LOG.warn("SAXException during serialization: " + e.getMessage(), e); throw new XPathException(getASTNode(), "Encountered SAX exception while serializing enclosed expression: " Index: RootNode.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/RootNode.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RootNode.java 29 Jan 2004 15:06:42 -0000 1.1 --- RootNode.java 3 May 2004 13:08:45 -0000 1.2 *************** *** 23,29 **** import java.util.Iterator; import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; - import org.exist.dom.ExtArrayNodeSet; import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; --- 23,29 ---- import java.util.Iterator; + import org.exist.dom.ArraySet; import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; *************** *** 51,55 **** if(ds == null || ds.getLength() == 0) return Sequence.EMPTY_SEQUENCE; ! NodeSet result = new ExtArrayNodeSet(ds.getLength(), 1); for (Iterator i = ds.iterator(); i.hasNext();) { result.add(new NodeProxy((DocumentImpl) i.next(), -1)); --- 51,56 ---- if(ds == null || ds.getLength() == 0) return Sequence.EMPTY_SEQUENCE; ! //NodeSet result = new ExtArrayNodeSet(ds.getLength(), 1); ! NodeSet result = new ArraySet(ds.getLength()); for (Iterator i = ds.iterator(); i.hasNext();) { result.add(new NodeProxy((DocumentImpl) i.next(), -1)); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:08:52
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/src/org/exist/util Removed Files: DOMStreamer.java VariableByteOutputStream.java VariableByteInputStream.java VariableByteCoding.java Log Message: Implemented lazy evaluation for XQuery enclosed expressions. --- VariableByteOutputStream.java DELETED --- --- VariableByteCoding.java DELETED --- --- VariableByteInputStream.java DELETED --- --- DOMStreamer.java DELETED --- |