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
(86) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-06-17 13:27:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13279/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: Index configuration settings were not applied during xupdate:remove. Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** DocumentImpl.java 8 Jun 2004 08:16:07 -0000 1.41 --- DocumentImpl.java 17 Jun 2004 13:27:45 -0000 1.42 *************** *** 751,755 **** DOMException.INVALID_MODIFICATION_ERR, "a node replacing the document root needs to be an element"); ! broker.removeNode(old, "/"); broker.endRemove(); newNode.gid = old.gid; --- 751,755 ---- DOMException.INVALID_MODIFICATION_ERR, "a node replacing the document root needs to be an element"); ! broker.removeNode(old, old.getPath()); broker.endRemove(); newNode.gid = old.gid; *************** *** 758,762 **** broker.flush(); } else { ! broker.removeNode(old, "/"); broker.endRemove(); newNode.gid = 0; --- 758,762 ---- broker.flush(); } else { ! broker.removeNode(old, old.getPath()); broker.endRemove(); newNode.gid = 0; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-17 13:19:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5387/src/org/exist/xupdate Modified Files: Modification.java Log Message: Type.subTypeOf throws exception "java.lang.IllegalArgumentException: type 12 is not a valid type". Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Modification.java 16 Jun 2004 13:36:53 -0000 1.27 --- Modification.java 17 Jun 2004 13:19:31 -0000 1.28 *************** *** 143,147 **** Sequence resultSeq = expr.eval(null, null); ! if (!Type.subTypeOf(resultSeq.getItemType(), Type.NODE)) throw new EXistException("select expression should evaluate to a node-set; got " + Type.getTypeName(resultSeq.getItemType())); --- 143,147 ---- Sequence resultSeq = expr.eval(null, null); ! if (!(resultSeq.getLength() == 0 || Type.subTypeOf(resultSeq.getItemType(), Type.NODE))) throw new EXistException("select expression should evaluate to a node-set; got " + Type.getTypeName(resultSeq.getItemType())); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-17 13:18:48
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4738/src/org/exist/xquery/value Modified Files: Type.java Log Message: Type.subTypeOf throws exception "java.lang.IllegalArgumentException: type 12 is not a valid type". Index: Type.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/Type.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Type.java 29 Jan 2004 15:06:42 -0000 1.1 --- Type.java 17 Jun 2004 13:18:39 -0000 1.2 *************** *** 298,302 **** if (subtype == supertype) return true; ! if (supertype == ITEM) return true; if (subtype == ITEM || subtype == EMPTY) --- 298,302 ---- if (subtype == supertype) return true; ! if (supertype == ITEM || supertype == ANY_TYPE) return true; if (subtype == ITEM || subtype == EMPTY) |
From: Wolfgang M. M. <wol...@us...> - 2004-06-17 13:15:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1428/src/org/exist/storage Modified Files: DBBroker.java NativeBroker.java Log Message: Index configuration settings were not applied during xupdate:remove. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** NativeBroker.java 8 Jun 2004 08:16:11 -0000 1.80 --- NativeBroker.java 17 Jun 2004 13:14:58 -0000 1.81 *************** *** 1534,1538 **** } ! public void removeNode(final NodeImpl node, String currentPath) { final IndexPaths idx = (IndexPaths) idxPathMap.get(node.getOwnerDocument().getDoctype().getName()); --- 1534,1538 ---- } ! public void removeNode(final NodeImpl node, NodePath currentPath) { final IndexPaths idx = (IndexPaths) idxPathMap.get(node.getOwnerDocument().getDoctype().getName()); *************** *** 1573,1577 **** // check if attribute value should be fulltext-indexed // by calling IndexPaths.match(path) ! if (idx == null || idx.getIncludeAttributes()) textEngine.storeAttribute(idx, (AttrImpl) node); // if the attribute has type ID, store the ID-value --- 1573,1586 ---- // check if attribute value should be fulltext-indexed // by calling IndexPaths.match(path) ! boolean indexAttribs = true; ! if(idx != null) { ! if(idx.getIncludeAttributes()) { ! currentPath.addComponent('@' + ((AttrImpl)node).getName()); ! indexAttribs = idx.match(currentPath); ! currentPath.removeLastComponent(); ! } else ! indexAttribs = false; ! } ! if (indexAttribs) textEngine.storeAttribute(idx, (AttrImpl) node); // if the attribute has type ID, store the ID-value *************** *** 1586,1591 **** // check if this textual content should be fulltext-indexed // by calling IndexPaths.match(path) ! // if (idx == null || idx.match(currentPath)) ! textEngine.storeText(idx, (TextImpl) node, false); break; } --- 1595,1601 ---- // check if this textual content should be fulltext-indexed // by calling IndexPaths.match(path) ! if (idx == null || idx.match(currentPath)){ ! boolean valore = (idx == null ? false : idx.preserveContent(currentPath)); ! textEngine.storeText(idx, (TextImpl) node, valore);} break; } Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** DBBroker.java 8 Jun 2004 08:16:11 -0000 1.32 --- DBBroker.java 17 Jun 2004 13:14:58 -0000 1.33 *************** *** 40,55 **** import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; - import org.exist.dom.QName; import org.exist.dom.SymbolTable; 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.LockException; - import org.exist.util.Occurrences; - import org.exist.xquery.NodeSelector; import org.exist.xquery.XQuery; import org.w3c.dom.Document; --- 40,52 ---- import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; import org.exist.dom.SymbolTable; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.io.VariableByteInput; import org.exist.storage.io.VariableByteInputStream; + import org.exist.storage.io.VariableByteOutputStream; import org.exist.storage.serializers.Serializer; import org.exist.util.Configuration; import org.exist.util.LockException; import org.exist.xquery.XQuery; import org.w3c.dom.Document; *************** *** 487,491 **** } ! public void removeNode(final NodeImpl node, String currentPath) { throw new RuntimeException("not implemented"); } --- 484,488 ---- } ! public void removeNode(final NodeImpl node, NodePath currentPath) { throw new RuntimeException("not implemented"); } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-17 13:13:13
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32233/src/org/exist/dom Modified Files: ElementImpl.java Log Message: Index configuration settings were not applied during xupdate:remove. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ElementImpl.java 16 Jun 2004 13:36:54 -0000 1.38 --- ElementImpl.java 17 Jun 2004 13:13:03 -0000 1.39 *************** *** 1143,1147 **** */ public void update(NodeList newContent) throws DOMException { ! final String path = getPath().toString(); final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); // remove old child nodes --- 1143,1147 ---- */ public void update(NodeList newContent) throws DOMException { ! final NodePath path = getPath(); final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); // remove old child nodes *************** *** 1157,1165 **** break; } ! removeAll( ! child, ! child.getNodeType() == Node.ELEMENT_NODE ! ? path + '/' + child.getNodeName() ! : path); } ownerDocument.broker.endRemove(); --- 1157,1165 ---- break; } ! if(child.getNodeType() == Node.ELEMENT_NODE) ! path.addComponent(child.getNodeName()); ! removeAll(child, path); ! if(child.getNodeType() == Node.ELEMENT_NODE) ! path.removeLastComponent(); } ownerDocument.broker.endRemove(); *************** *** 1199,1204 **** else previous = getLastNode(previous); ! final String path = getPath().toString(); ! ownerDocument.broker.removeNode(old, path); ownerDocument.broker.endRemove(); newNode.gid = old.gid; --- 1199,1203 ---- else previous = getLastNode(previous); ! ownerDocument.broker.removeNode(old, old.getPath()); ownerDocument.broker.endRemove(); newNode.gid = old.gid; *************** *** 1222,1226 **** final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); final long lastChild = lastChildID(); ! removeAll(old, old.getPath().toString()); --children; ownerDocument.broker.endRemove(); --- 1221,1225 ---- final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); final long lastChild = lastChildID(); ! removeAll(old, old.getPath()); --children; ownerDocument.broker.endRemove(); *************** *** 1233,1237 **** } ! private void removeAll(NodeImpl node, String currentPath) { switch (node.getNodeType()) { case Node.ELEMENT_NODE : --- 1232,1236 ---- } ! private void removeAll(NodeImpl node, NodePath currentPath) { switch (node.getNodeType()) { case Node.ELEMENT_NODE : *************** *** 1240,1246 **** for (int i = children.getLength() - 1; i > -1; i--) { child = (NodeImpl) children.item(i); ! if (child.nodeType == Node.ELEMENT_NODE) ! removeAll(child, currentPath + '/' + ((ElementImpl)child).nodeName); ! else removeAll(child, currentPath); } --- 1239,1247 ---- for (int i = children.getLength() - 1; i > -1; i--) { child = (NodeImpl) children.item(i); ! if (child.nodeType == Node.ELEMENT_NODE) { ! currentPath.addComponent(((ElementImpl)child).getNodeName()); ! removeAll(child, currentPath); ! currentPath.removeLastComponent(); ! } else removeAll(child, currentPath); } *************** *** 1270,1275 **** else previous = getLastNode(previous); ! final String path = getPath().toString(); ! ownerDocument.broker.removeNode(old, path); ownerDocument.broker.endRemove(); appendChild(old.gid, previous, getPath(), newChild, true); --- 1271,1275 ---- else previous = getLastNode(previous); ! ownerDocument.broker.removeNode(old, old.getPath()); ownerDocument.broker.endRemove(); appendChild(old.gid, previous, getPath(), newChild, true); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 13:37:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12518/src/org/exist/xupdate Modified Files: Append.java Insert.java XUpdateProcessor.java Rename.java Modification.java Update.java Log Message: Adding an attribute through xupdate didn't work. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** XUpdateProcessor.java 18 May 2004 14:18:46 -0000 1.23 --- XUpdateProcessor.java 16 Jun 2004 13:36:53 -0000 1.24 *************** *** 19,22 **** --- 19,23 ---- import org.apache.log4j.Logger; import org.exist.dom.DocumentSet; + import org.exist.dom.NodeListImpl; import org.exist.dom.XMLUtil; import org.exist.xquery.parser.XQueryLexer; *************** *** 63,66 **** --- 64,69 ---- private final static Logger LOG = Logger.getLogger(XUpdateProcessor.class); + private NodeListImpl contents = null; + private boolean inModification = false; private boolean inAttribute = false; *************** *** 68,72 **** private DocumentBuilder builder; private Document doc; - private DocumentFragment fragment = null; private Stack stack = new Stack(); private Node currentNode = null; --- 71,74 ---- *************** *** 179,183 **** if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 181,185 ---- if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 229,233 **** localName + " requires a select attribute"); doc = builder.newDocument(); ! fragment = doc.createDocumentFragment(); inModification = true; } else if ( --- 231,235 ---- localName + " requires a select attribute"); doc = builder.newDocument(); ! contents = new NodeListImpl(); inModification = true; } else if ( *************** *** 282,286 **** elem.setPrefix(prefix); if (stack.isEmpty()) { ! fragment.appendChild(elem); } else { Element last = (Element) stack.peek(); --- 284,288 ---- elem.setPrefix(prefix); if (stack.isEmpty()) { ! contents.add(elem); } else { Element last = (Element) stack.peek(); *************** *** 307,311 **** Attr attrib = doc.createAttributeNS(namespace, name); if (stack.isEmpty()) ! fragment.appendChild(attrib); else { Element last = (Element) stack.peek(); --- 309,313 ---- Attr attrib = doc.createAttributeNS(namespace, name); if (stack.isEmpty()) ! contents.add(attrib); else { Element last = (Element) stack.peek(); *************** *** 333,337 **** node = XMLUtil.copyNode(doc, (Node) i.next()); if (stack.isEmpty()) ! fragment.appendChild(node); else { Element last = (Element) stack.peek(); --- 335,339 ---- node = XMLUtil.copyNode(doc, (Node) i.next()); if (stack.isEmpty()) ! contents.add(node); else { Element last = (Element) stack.peek(); *************** *** 349,353 **** } if (stack.isEmpty()) { ! fragment.appendChild(elem); } else { Element last = (Element) stack.peek(); --- 351,355 ---- } if (stack.isEmpty()) { ! contents.add(elem); } else { Element last = (Element) stack.peek(); *************** *** 369,373 **** Text text = doc.createTextNode(normalized); if (stack.isEmpty()) { ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 371,375 ---- Text text = doc.createTextNode(normalized); if (stack.isEmpty()) { ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 389,393 **** || localName.equals("insert-after")) { inModification = false; ! modification.setContent(fragment); modifications.add(modification); modification = null; --- 391,395 ---- || localName.equals("insert-after")) { inModification = false; ! modification.setContent(contents); modifications.add(modification); modification = null; *************** *** 436,440 **** if (stack.isEmpty()) { LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 438,442 ---- if (stack.isEmpty()) { LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 448,452 **** doc.createProcessingInstruction(target, data); if (stack.isEmpty()) { ! fragment.appendChild(pi); } else { Element last = (Element) stack.peek(); --- 450,454 ---- doc.createProcessingInstruction(target, data); if (stack.isEmpty()) { ! contents.add(pi); } else { Element last = (Element) stack.peek(); *************** *** 530,534 **** if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 532,536 ---- if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 541,545 **** Comment comment = doc.createComment(new String(ch, start, length)); if (stack.isEmpty()) { ! fragment.appendChild(comment); } else { Element last = (Element) stack.peek(); --- 543,547 ---- Comment comment = doc.createComment(new String(ch, start, length)); if (stack.isEmpty()) { ! contents.add(comment); } else { Element last = (Element) stack.peek(); *************** *** 591,595 **** modification = null; doc = null; ! fragment = null; stack.clear(); currentNode = null; --- 593,597 ---- modification = null; doc = null; ! contents = null; stack.clear(); currentNode = null; Index: Update.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Update.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Update.java 25 May 2004 09:26:03 -0000 1.14 --- Update.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 65,69 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; --- 65,69 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; Index: Insert.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Insert.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Insert.java 25 May 2004 09:26:03 -0000 1.14 --- Insert.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 71,75 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; try { --- 71,75 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; try { Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Modification.java 16 Jun 2004 09:21:32 -0000 1.26 --- Modification.java 16 Jun 2004 13:36:53 -0000 1.27 *************** *** 67,71 **** protected String selectStmt = null; ! protected DocumentFragment content = null; protected DBBroker broker; protected DocumentSet docs; --- 67,71 ---- protected String selectStmt = null; ! protected NodeList content = null; protected DBBroker broker; protected DocumentSet docs; *************** *** 99,104 **** public abstract String getName(); ! public void setContent(DocumentFragment node) { ! content = node; } --- 99,104 ---- public abstract String getName(); ! public void setContent(NodeList nodes) { ! content = nodes; } *************** *** 209,213 **** buf.append(selectStmt); buf.append("\">"); ! buf.append(XMLUtil.dump(content)); buf.append("</xu:"); buf.append(getName()); --- 209,213 ---- buf.append(selectStmt); buf.append("\">"); ! // buf.append(XMLUtil.dump(content)); buf.append("</xu:"); buf.append(getName()); Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Append.java 25 May 2004 09:26:03 -0000 1.16 --- Append.java 16 Jun 2004 13:36:53 -0000 1.17 *************** *** 64,68 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if(children.getLength() == 0) return 0; --- 64,68 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if(children.getLength() == 0) return 0; Index: Rename.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Rename.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Rename.java 25 May 2004 09:26:03 -0000 1.14 --- Rename.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 63,67 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; int modificationCount = 0; --- 63,67 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; int modificationCount = 0; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 13:37:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12518/src/org/exist/storage/store Modified Files: DOMFile.java Log Message: Adding an attribute through xupdate didn't work. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** DOMFile.java 16 Jun 2004 09:23:50 -0000 1.32 --- DOMFile.java 16 Jun 2004 13:36:54 -0000 1.33 *************** *** 346,350 **** // still not enough free space: create a new page DOMPage newPage = new DOMPage(); ! LOG.debug("creating additional page: " + newPage.getPageNum()); newPage.getPageHeader().setNextDataPage( rec.page.getPageHeader().getNextDataPage()); --- 346,350 ---- // still not enough free space: create a new page DOMPage newPage = new DOMPage(); ! // LOG.debug("creating additional page: " + newPage.getPageNum()); newPage.getPageHeader().setNextDataPage( rec.page.getPageHeader().getNextDataPage()); *************** *** 368,372 **** // does value fit into page? DOMPage newPage = new DOMPage(); ! LOG.debug("creating new page: " + newPage.getPageNum()); long next = rec.page.getPageHeader().getNextDataPage(); newPage.getPageHeader().setNextDataPage( --- 368,372 ---- // does value fit into page? DOMPage newPage = new DOMPage(); ! // LOG.debug("creating new page: " + newPage.getPageNum()); long next = rec.page.getPageHeader().getNextDataPage(); newPage.getPageHeader().setNextDataPage( *************** *** 447,453 **** long backLink; short splitRecordCount = 0; ! LOG.debug("splitting " + rec.page.getPageNum() + ": new: " ! + nextSplitPage.getPageNum() + "; next: " + ! rec.page.getPageHeader().getNextDataPage()); for (int pos = rec.offset; pos < oldDataLen; splitRecordCount++) { // read the current id --- 447,453 ---- long backLink; short splitRecordCount = 0; ! // LOG.debug("splitting " + rec.page.getPageNum() + ": new: " ! // + nextSplitPage.getPageNum() + "; next: " + ! // rec.page.getPageHeader().getNextDataPage()); for (int pos = rec.offset; pos < oldDataLen; splitRecordCount++) { // read the current id |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 13:37:04
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12518/src/org/exist/dom Modified Files: ElementImpl.java Log Message: Adding an attribute through xupdate didn't work. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ElementImpl.java 16 Jun 2004 09:23:48 -0000 1.37 --- ElementImpl.java 16 Jun 2004 13:36:54 -0000 1.38 *************** *** 273,277 **** --- 273,319 ---- } + public Node appendAttributes(NodeList attribs) throws DOMException { + DocumentImpl prevDoc = new DocumentImpl(ownerDocument); + Node node = null; + if (children == 0) { + // no children: append a new child + node = appendChildren(firstChildID(), this, getPath(), attribs, true); + } else { + NodeImpl lastAttrib = getLastAttribute(); + if(lastAttrib.gid == lastChildID()) + node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true); + else + node = insertAfter(attribs, lastAttrib); + } + ownerDocument.broker.update(this); + ownerDocument.broker.reindex(prevDoc, ownerDocument, null); + return node; + } + + private NodeList checkForAttributes(NodeList nodes) throws DOMException { + NodeListImpl attribs = null; + NodeListImpl rest = null; + for(int i = 0; i < nodes.getLength(); i++) { + Node next = nodes.item(i); + if(next.getNodeType() == Node.ATTRIBUTE_NODE) { + if(attribs == null) + attribs = new NodeListImpl(); + attribs.add(next); + } else if(attribs != null) { + if(rest == null) rest = new NodeListImpl(); + rest.add(next); + } + } + if(attribs != null) { + appendAttributes(attribs); + return rest; + } else + return nodes; + } + public Node appendChildren(NodeList nodes, int child) throws DOMException { + nodes = checkForAttributes(nodes); + if(nodes == null || nodes.getLength() == 0) + return null; DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; *************** *** 522,525 **** --- 564,579 ---- } + private AttrImpl getLastAttribute() { + long start = firstChildID(); + AttrImpl attr = null; + for (long i = start; i < start + children; i++) { + Node child = ownerDocument.getNode(i); + if (child != null + && child.getNodeType() == Node.ATTRIBUTE_NODE) + attr = (AttrImpl)child; + } + return attr; + } + /** * @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String) |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 13:37:04
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12518/src/org/exist/storage Modified Files: NativeTextEngine.java NativeElementIndex.java Log Message: Adding an attribute through xupdate didn't work. Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** NativeElementIndex.java 16 Jun 2004 09:23:49 -0000 1.29 --- NativeElementIndex.java 16 Jun 2004 13:36:54 -0000 1.30 *************** *** 413,486 **** // try to retrieve old index entry for the element try { ! lock.acquire(Lock.READ_LOCK); is = dbElement.getAsStream(ref); ! } catch (LockException e) { ! LOG.error("could not acquire lock for index on " + qname); ! return; ! } catch (IOException e) { ! LOG.error("io error while reindexing " + qname, e); ! is = null; ! } finally { ! lock.release(); ! } ! os.clear(); ! oldList.clear(); ! if (is != null) { ! // add old entries to the new list ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! len = is.readInt(); ! if (docId != oldDoc.getDocId()) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeInt(len); ! is.copyTo(os, len * 4); ! } else { ! // copy nodes to new list ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid = last + delta; ! last = gid; ! address = StorageAddress.read(is); ! if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc ! .reindexRequired()) { ! idList.add(new NodeProxy(oldDoc, gid, ! address)); ! } else if (node != null ! && (!XMLUtil.isDescendant(oldDoc, ! node.getGID(), gid))) { ! oldList.add(new NodeProxy(oldDoc, gid, ! address)); } } } } - } catch (EOFException e) { - } catch (IOException e) { - LOG.error("io-error while updating index for element " - + qname); } ! } ! if (node != null) idList.addAll(oldList); ! // write out the updated list ! FastQSort.sort(idList, 0, idList.size() - 1); ! len = idList.size(); ! os.writeInt(doc.getDocId()); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! p = (NodeProxy) idList.get(j); ! delta = p.gid - last; ! last = p.gid; ! os.writeLong(delta); ! StorageAddress.write(p.getInternalAddress(), os); ! } ! //data = os.toByteArray(); ! try { ! lock.acquire(Lock.WRITE_LOCK); if (is == null) dbElement.put(ref, os.data()); --- 413,475 ---- // try to retrieve old index entry for the element try { ! lock.acquire(Lock.WRITE_LOCK); is = dbElement.getAsStream(ref); ! os.clear(); ! oldList.clear(); ! if (is != null) { ! // add old entries to the new list ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! len = is.readInt(); ! if (docId != oldDoc.getDocId()) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeInt(len); ! is.copyTo(os, len * 4); ! } else { ! // copy nodes to new list ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid = last + delta; ! last = gid; ! address = StorageAddress.read(is); ! if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc ! .reindexRequired()) { ! idList.add(new NodeProxy(oldDoc, gid, ! address)); ! } else if (node != null ! && (!XMLUtil.isDescendant(oldDoc, ! node.getGID(), gid))) { ! oldList.add(new NodeProxy(oldDoc, gid, ! address)); ! } } } } + } catch (EOFException e) { + } catch (IOException e) { + LOG.error("io-error while updating index for element " + + qname); } } ! if (node != null) idList.addAll(oldList); ! // write out the updated list ! FastQSort.sort(idList, 0, idList.size() - 1); ! len = idList.size(); ! os.writeInt(doc.getDocId()); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! p = (NodeProxy) idList.get(j); ! delta = p.gid - last; ! last = p.gid; ! os.writeLong(delta); ! StorageAddress.write(p.getInternalAddress(), os); ! } ! //data = os.toByteArray(); if (is == null) dbElement.put(ref, os.data()); *************** *** 491,497 **** } } catch (LockException e) { ! LOG.error("could not acquire lock on elements", e); } finally { ! lock.release(); } } --- 480,490 ---- } } catch (LockException e) { ! LOG.error("could not acquire lock for index on " + qname); ! return; ! } catch (IOException e) { ! LOG.error("io error while reindexing " + qname, e); ! is = null; } finally { ! lock.release(Lock.WRITE_LOCK); } } Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** NativeTextEngine.java 16 Jun 2004 09:23:49 -0000 1.56 --- NativeTextEngine.java 16 Jun 2004 13:36:54 -0000 1.57 *************** *** 586,590 **** LOG.warn("Failed to acquire lock on collections.dbx", e); } finally { ! lock.release(); } } --- 586,590 ---- LOG.warn("Failed to acquire lock on collections.dbx", e); } finally { ! lock.release(Lock.WRITE_LOCK); } } *************** *** 947,1062 **** public void reindex(DocumentImpl oldDoc, NodeImpl node) { ! final short collectionId = oldDoc.getCollection().getId(); ! int len, docId; ! Map.Entry entry; ! String word; ! LongLinkedList idList; ! long[] ids; ! long last, gid; ! long delta; ! byte section; ! NodeProxy p; ! WordRef ref; ! VariableByteInput is = null; ! Lock lock = dbWords.getLock(); ! for (int k = 0; k < 2; k++) { ! for (Iterator i = words[k].entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! word = (String) entry.getKey(); ! idList = (LongLinkedList) entry.getValue(); ! ref = new WordRef(collectionId, word); ! 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(); ! len = is.readInt(); ! if (docId != oldDoc.getDocId() || section != k) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! is.copyTo(os, len); ! } else { ! // copy nodes to new list ! gid = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid += delta; ! if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc ! .reindexRequired()) { ! idList.add(gid); ! } else if (node != null ! && (!XMLUtil ! .isDescendantOrSelf( ! oldDoc, ! node.getGID(), ! gid))) { ! idList.add(gid); ! } ! } ! } ! } ! } catch (EOFException e) { ! //LOG.error("end-of-file while reading index entry ! // for " + word, e); ! } catch (IOException e) { ! LOG.error("io-error while reading index entry for " ! + word, e); ! } ! } ! ids = idList.getData(); ! Arrays.sort(ids); ! len = ids.length; ! os.writeInt(oldDoc.getDocId()); ! os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = ids[j] - last; ! if (delta < 0) { ! LOG.debug("neg. delta: " + delta + " for " + word); ! LOG.debug("id = " + ids[j] + "; prev = " + last); ! } ! os.writeLong(delta); ! last = ids[j]; ! } ! try { ! lock.acquire(Lock.WRITE_LOCK); ! try { ! if (is == null) ! dbWords.put(ref, os.data()); ! else { ! dbWords.update(((BFile.PageInputStream) is) ! .getAddress(), ref, os.data()); ! } ! } catch (ReadOnlyException e) { ! } ! } catch (LockException e) { ! LOG.warn("could not acquire lock", e); ! } finally { ! lock.release(); ! } ! } ! words[k].clear(); ! } } --- 947,1055 ---- public void reindex(DocumentImpl oldDoc, NodeImpl node) { ! final short collectionId = oldDoc.getCollection().getId(); ! int len, docId; ! Map.Entry entry; ! String word; ! LongLinkedList idList; ! long[] ids; ! long last, gid; ! long delta; ! byte section; ! NodeProxy p; ! WordRef ref; ! VariableByteInput is = null; ! Lock lock = dbWords.getLock(); ! for (int k = 0; k < 2; k++) { ! for (Iterator i = words[k].entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! word = (String) entry.getKey(); ! idList = (LongLinkedList) entry.getValue(); ! ref = new WordRef(collectionId, word); ! try { ! lock.acquire(Lock.WRITE_LOCK); ! is = dbWords.getAsStream(ref); ! os.clear(); ! if (is != null) { ! // add old entries to the new list ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! section = is.readByte(); ! len = is.readInt(); ! if (docId != oldDoc.getDocId() || section != k) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! is.copyTo(os, len); ! } else { ! // copy nodes to new list ! gid = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid += delta; ! if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc ! .reindexRequired()) { ! idList.add(gid); ! } else if (node != null ! && (!XMLUtil ! .isDescendantOrSelf( ! oldDoc, ! node.getGID(), ! gid))) { ! idList.add(gid); ! } ! } ! } ! } ! } catch (EOFException e) { ! //LOG.error("end-of-file while reading index entry ! // for " + word, e); ! } catch (IOException e) { ! LOG.error("io-error while reading index entry for " ! + word, e); ! } ! } ! ids = idList.getData(); ! Arrays.sort(ids); ! len = ids.length; ! os.writeInt(oldDoc.getDocId()); ! os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = ids[j] - last; ! if (delta < 0) { ! LOG.debug("neg. delta: " + delta + " for " + word); ! LOG.debug("id = " + ids[j] + "; prev = " + last); ! } ! os.writeLong(delta); ! last = ids[j]; ! } ! try { ! if (is == null) ! dbWords.put(ref, os.data()); ! else { ! dbWords.update(((BFile.PageInputStream) is) ! .getAddress(), ref, os.data()); ! } ! } catch (ReadOnlyException e) { ! } ! } 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(Lock.WRITE_LOCK); ! } ! } ! words[k].clear(); ! } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 11:47:07
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19166/src/org/exist/xquery/functions Modified Files: ExtNear.java Log Message: Included patch for near(). Index: ExtNear.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtNear.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtNear.java 25 Mar 2004 12:38:53 -0000 1.2 --- ExtNear.java 16 Jun 2004 11:46:57 -0000 1.3 *************** *** 118,122 **** distance = -1; ! } else if (word.equalsIgnoreCase(term)) { distance = 0; j++; --- 118,123 ---- distance = -1; ! } // that else would cause some words to be ignored in the matching ! if (word.equalsIgnoreCase(term)) { distance = 0; j++; *************** *** 134,138 **** distance = 0 ; continue; ! } else if (-1 < distance) ++distance; --- 135,140 ---- distance = 0 ; continue; ! } // that else MAY cause the distance count to be off by one but i'm not sure ! if (-1 < distance) ++distance; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:24:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3994/src/org/exist/storage Modified Files: NativeTextEngine.java NativeElementIndex.java Log Message: Wrong page links in dom.dbx: some pages got lost after a number of xupdate remove/append operations. Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** NativeElementIndex.java 8 Jun 2004 08:16:10 -0000 1.28 --- NativeElementIndex.java 16 Jun 2004 09:23:49 -0000 1.29 *************** *** 414,418 **** try { lock.acquire(Lock.READ_LOCK); - //val = dbElement.get(ref); is = dbElement.getAsStream(ref); } catch (LockException e) { --- 414,417 ---- *************** *** 429,433 **** if (is != null) { // add old entries to the new list - //data = val.getData(); try { while (is.available() > 0) { --- 428,431 ---- *************** *** 447,451 **** gid = last + delta; last = gid; - //address = is.readFixedLong(); address = StorageAddress.read(is); if (node == null --- 445,448 ---- *************** *** 523,610 **** // iterate through elements for (Iterator i = elementIds.entrySet().iterator(); i.hasNext();) { - entry = (Map.Entry) i.next(); - idList = (ArrayList) entry.getValue(); - qname = (QName) entry.getKey(); - if (qname.getNameType() != ElementValue.ATTRIBUTE_ID) { - sym = broker.getSymbols().getSymbol(qname.getLocalName()); - nsSym = broker.getSymbols().getNSSymbol( - qname.getNamespaceURI()); - ref = new ElementValue(qname.getNameType(), collectionId, - sym, nsSym); - } else { - ref = new ElementValue(qname.getNameType(), collectionId, - qname.getLocalName()); - } - // try to retrieve old index entry for the element try { ! lock.acquire(Lock.READ_LOCK); val = dbElement.get(ref); ! } catch (LockException e) { ! LOG.error("could not acquire lock for index on " + qname); ! return; ! } finally { ! lock.release(); ! } ! os.clear(); ! newList.clear(); ! if (val != null) { ! // add old entries to the new list ! data = val.getData(); ! is = new VariableByteArrayInput(data); ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! len = is.readInt(); ! if (docId != doc.getDocId()) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeInt(len); ! is.copyTo(os, len * 4); ! } else { ! // copy nodes to new list ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid = last + delta; ! last = gid; ! address = StorageAddress.read(is); ! //address = is.readFixedLong(); ! if (!containsNode(idList, gid)) { ! newList.add(new NodeProxy(doc, gid, ! address)); } } } } - } catch (EOFException e) { - LOG - .error("end-of-file while updating index for element " - + qname); - } catch (IOException e) { - LOG.error("io-error while updating index for element " - + qname); } ! } ! // write out the updated list ! FastQSort.sort(newList, 0, newList.size() - 1); ! len = newList.size(); ! os.writeInt(doc.getDocId()); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! p = (NodeProxy) newList.get(j); ! delta = p.gid - last; ! last = p.gid; ! os.writeLong(delta); ! StorageAddress.write(p.getInternalAddress(), os); ! } ! try { ! lock.acquire(Lock.WRITE_LOCK); ! if (val == null) { ! dbElement.put(ref, os.data()); ! } else { ! dbElement.update(val.getAddress(), ref, os.data()); } } catch (LockException e) { LOG.error("could not acquire lock on elements", e); --- 520,601 ---- // iterate through elements for (Iterator i = elementIds.entrySet().iterator(); i.hasNext();) { try { ! lock.acquire(Lock.WRITE_LOCK); ! entry = (Map.Entry) i.next(); ! idList = (ArrayList) entry.getValue(); ! qname = (QName) entry.getKey(); ! if (qname.getNameType() != ElementValue.ATTRIBUTE_ID) { ! sym = broker.getSymbols().getSymbol(qname.getLocalName()); ! nsSym = broker.getSymbols().getNSSymbol( ! qname.getNamespaceURI()); ! ref = new ElementValue(qname.getNameType(), collectionId, ! sym, nsSym); ! } else { ! ref = new ElementValue(qname.getNameType(), collectionId, ! qname.getLocalName()); ! } val = dbElement.get(ref); ! os.clear(); ! newList.clear(); ! if (val != null) { ! // add old entries to the new list ! data = val.getData(); ! is = new VariableByteArrayInput(data); ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! len = is.readInt(); ! if (docId != doc.getDocId()) { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeInt(len); ! try { ! is.copyTo(os, len * 4); ! } catch(EOFException e) { ! LOG.error("EOF while copying: expected: " + len); ! } ! } else { ! // copy nodes to new list ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! gid = last + delta; ! last = gid; ! address = StorageAddress.read(is); ! if (!containsNode(idList, gid)) { ! newList.add(new NodeProxy(doc, gid, ! address)); ! } } } } + } catch (EOFException e) { + LOG + .error("end-of-file while updating index for element " + + qname); + } catch (IOException e) { + LOG.error("io-error while updating index for element " + + qname); } } ! // write out the updated list ! FastQSort.sort(newList, 0, newList.size() - 1); ! len = newList.size(); ! os.writeInt(doc.getDocId()); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! p = (NodeProxy) newList.get(j); ! delta = p.gid - last; ! last = p.gid; ! os.writeLong(delta); ! StorageAddress.write(p.getInternalAddress(), os); } + if (val == null) { + dbElement.put(ref, os.data()); + } else { + dbElement.update(val.getAddress(), ref, os.data()); + } } catch (LockException e) { LOG.error("could not acquire lock on elements", e); Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** NativeTextEngine.java 4 Jun 2004 09:45:27 -0000 1.55 --- NativeTextEngine.java 16 Jun 2004 09:23:49 -0000 1.56 *************** *** 868,951 **** ref = new WordRef(collectionId, word); try { ! lock.acquire(Lock.READ_LOCK); ! val = dbWords.get(ref); ! } catch (LockException e) { ! LOG.error("could not acquire lock on index for '" ! + word + "'"); ! } finally { ! lock.release(); ! } ! os.clear(); ! newList = new LongLinkedList(); ! if (val != null) { ! // add old entries to the new list ! data = val.getData(); ! is = new VariableByteArrayInput(data); ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! section = is.readByte(); ! len = is.readInt(); ! if (docId == doc.getDocId() || section != k) { ! // copy data to new buffer; skip ! // removed nodes ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! last = last + delta; ! if (!idList.contains(last)) ! newList.add(last); ! } ! } else { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! for (int j = 0; j < len; j++) ! is.copyTo(os); ! } ! } ! } catch (EOFException e) { ! LOG ! .error("end-of-file while reading index entry for " ! + word); ! } catch (IOException e) { ! LOG.error("io-error while reading index entry for " ! + word); ! } ! } ! ids = newList.getData(); ! //i.remove(); ! Arrays.sort(ids); ! len = ids.length; ! os.writeInt(doc.getDocId()); ! os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = ids[j] - last; ! if (delta < 0) { ! LOG.debug("neg. delta: " + delta + " for " + word); ! LOG.debug("id = " + ids[j] + "; prev = " + last); ! } ! os.writeLong(delta); ! last = ids[j]; ! } ! try { ! lock.acquire(Lock.WRITE_LOCK); ! try { ! if (val == null) ! dbWords.put(ref, os.data()); ! else ! dbWords ! .update(val.getAddress(), ref, os ! .data()); ! } catch (ReadOnlyException e) { ! } } catch (LockException e) { ! LOG.warn("could not acquire lock", e); ! } finally { ! lock.release(); } } --- 868,943 ---- ref = new WordRef(collectionId, word); try { ! lock.acquire(Lock.WRITE_LOCK); ! val = dbWords.get(ref); ! os.clear(); ! newList = new LongLinkedList(); ! if (val != null) { ! // add old entries to the new list ! data = val.getData(); ! is = new VariableByteArrayInput(data); ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! section = is.readByte(); ! len = is.readInt(); ! if (docId == doc.getDocId() || section != k) { ! // copy data to new buffer; skip ! // removed nodes ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = is.readLong(); ! last = last + delta; ! if (!idList.contains(last)) ! newList.add(last); ! } ! } else { ! // section belongs to another document: ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! for (int j = 0; j < len; j++) ! is.copyTo(os); ! } ! } ! } catch (EOFException e) { ! LOG ! .error("end-of-file while reading index entry for " ! + word); ! } catch (IOException e) { ! LOG.error("io-error while reading index entry for " ! + word); ! } ! } ! ids = newList.getData(); ! //i.remove(); ! Arrays.sort(ids); ! len = ids.length; ! os.writeInt(doc.getDocId()); ! os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); ! os.writeInt(len); ! last = 0; ! for (int j = 0; j < len; j++) { ! delta = ids[j] - last; ! if (delta < 0) { ! LOG.debug("neg. delta: " + delta + " for " + word); ! LOG.debug("id = " + ids[j] + "; prev = " + last); ! } ! os.writeLong(delta); ! last = ids[j]; ! } ! try { ! if (val == null) ! dbWords.put(ref, os.data()); ! else ! dbWords ! .update(val.getAddress(), ref, os ! .data()); ! } catch (ReadOnlyException e) { ! } } catch (LockException e) { ! LOG.warn("could not acquire lock", e); ! } finally { ! lock.release(); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:24:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3994/src/org/exist/storage/store Modified Files: DOMFile.java NodeIterator.java Log Message: Wrong page links in dom.dbx: some pages got lost after a number of xupdate remove/append operations. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** DOMFile.java 8 Jun 2004 08:16:15 -0000 1.31 --- DOMFile.java 16 Jun 2004 09:23:50 -0000 1.32 *************** *** 369,376 **** DOMPage newPage = new DOMPage(); LOG.debug("creating new page: " + newPage.getPageNum()); newPage.getPageHeader().setNextDataPage( ! rec.page.getPageHeader().getNextDataPage()); newPage.getPageHeader().setPrevDataPage(rec.page.getPageNum()); rec.page.getPageHeader().setNextDataPage(newPage.getPageNum()); rec.page.setDirty(true); dataCache.add(rec.page); --- 369,383 ---- DOMPage newPage = new DOMPage(); LOG.debug("creating new page: " + newPage.getPageNum()); + long next = rec.page.getPageHeader().getNextDataPage(); newPage.getPageHeader().setNextDataPage( ! next); newPage.getPageHeader().setPrevDataPage(rec.page.getPageNum()); rec.page.getPageHeader().setNextDataPage(newPage.getPageNum()); + if(-1 < next) { + DOMPage nextPage = getCurrentPage(next); + nextPage.getPageHeader().setPrevDataPage(newPage.getPageNum()); + nextPage.setDirty(true); + dataCache.add(nextPage); + } rec.page.setDirty(true); dataCache.add(rec.page); *************** *** 411,414 **** --- 418,436 ---- */ private RecordPos splitDataPage(DocumentImpl doc, RecordPos rec) { + // check if a split is really required + boolean requireSplit = false; + for (int pos = rec.offset; pos < rec.page.len;) { + short currentId = ByteConversion.byteToShort(rec.page.data, pos); + if(!ItemId.isLink(currentId)) { + requireSplit = true; + break; + } + pos += 10; + } + if(!requireSplit) { + LOG.debug("page " + rec.page.getPageNum() + ": no split required"); + rec.offset = rec.page.len; + return rec; + } NodeIndexListener idx = doc.getIndexListener(); int oldDataLen = rec.page.getPageHeader().getDataLength(); *************** *** 426,430 **** short splitRecordCount = 0; LOG.debug("splitting " + rec.page.getPageNum() + ": new: " ! + nextSplitPage.getPageNum()); for (int pos = rec.offset; pos < oldDataLen; splitRecordCount++) { // read the current id --- 448,453 ---- short splitRecordCount = 0; LOG.debug("splitting " + rec.page.getPageNum() + ": new: " ! + nextSplitPage.getPageNum() + "; next: " + ! rec.page.getPageHeader().getNextDataPage()); for (int pos = rec.offset; pos < oldDataLen; splitRecordCount++) { // read the current id *************** *** 514,519 **** newPage.getPageHeader().setNextTID((short)(rec.page.getPageHeader().getNextTID() - 1)); newPage.getPageHeader().setPrevDataPage(rec.page.getPageNum()); ! LOG.debug("creating new: " + newPage.getPageNum()); ! long np = rec.page.getPageHeader().getNextDataPage(); rec.page.getPageHeader().setNextDataPage(newPage.getPageNum()); rec.page.getPageHeader().setDataLength(rec.page.len); --- 537,542 ---- newPage.getPageHeader().setNextTID((short)(rec.page.getPageHeader().getNextTID() - 1)); newPage.getPageHeader().setPrevDataPage(rec.page.getPageNum()); ! newPage.getPageHeader().setNextDataPage(rec.page.getPageHeader().getNextDataPage()); ! LOG.debug("creating new page after split: " + newPage.getPageNum()); rec.page.getPageHeader().setNextDataPage(newPage.getPageNum()); rec.page.getPageHeader().setDataLength(rec.page.len); *************** *** 522,526 **** dataCache.add(rec.page); dataCache.add(newPage); - newPage.getPageHeader().setNextDataPage(np); rec.page = newPage; rec.page.len = 0; --- 545,548 ---- *************** *** 536,539 **** --- 558,562 ---- } if(nextSplitPage.len == 0) { + LOG.warn("page " + nextSplitPage.getPageNum() + " is empty. Remove it"); // if nothing has been copied to the last split page, // remove it *************** *** 559,574 **** dataCache.add(firstSplitPage); } ! long next = nextSplitPage.getPageHeader().getNextDataPage(); ! if (-1 < next) { ! DOMPage nextPage = getCurrentPage(nextSplitPage.getPageHeader() ! .getNextDataPage()); ! nextPage.getPageHeader() ! .setPrevDataPage(nextSplitPage.getPageNum()); ! nextPage.setDirty(true); ! dataCache.add(nextPage); ! } } ! if(firstSplitPage != null) rec.page.getPageHeader().setNextDataPage(firstSplitPage.getPageNum()); rec.page.getPageHeader().setDataLength(rec.page.len); rec.page.getPageHeader().setRecordCount(countRecordsInPage(rec.page)); --- 582,605 ---- dataCache.add(firstSplitPage); } ! // long next = nextSplitPage.getPageHeader().getNextDataPage(); ! // if (-1 < next) { ! // DOMPage nextPage = getCurrentPage(nextSplitPage.getPageHeader() ! // .getNextDataPage()); ! // nextPage.getPageHeader() ! // .setPrevDataPage(nextSplitPage.getPageNum()); ! // nextPage.setDirty(true); ! // dataCache.add(nextPage); ! // } } ! long next = rec.page.getPageHeader().getNextDataPage(); ! if(-1 < next) { ! DOMPage nextPage = getCurrentPage(next); ! nextPage.getPageHeader().setPrevDataPage(nextSplitPage.getPageNum()); ! nextPage.setDirty(true); ! dataCache.add(nextPage); ! } ! if(firstSplitPage != null) { rec.page.getPageHeader().setNextDataPage(firstSplitPage.getPageNum()); + } rec.page.getPageHeader().setDataLength(rec.page.len); rec.page.getPageHeader().setRecordCount(countRecordsInPage(rec.page)); *************** *** 599,603 **** } } ! LOG.debug("page " + page.getPageNum() + " has " + count + " records."); return count; } --- 630,634 ---- } } ! // LOG.debug("page " + page.getPageNum() + " has " + count + " records."); return count; } *************** *** 1082,1085 **** --- 1113,1117 ---- ph.decRecordCount(); if (rec.page.len == 0) { + // LOG.debug("removing page " + rec.page.getPageNum()); removePage(rec.page); rec.page = null; *************** *** 1115,1118 **** --- 1147,1151 ---- DOMPage next = getCurrentPage(ph.getNextDataPage()); next.getPageHeader().setPrevDataPage(ph.getPrevDataPage()); + // LOG.debug(next.getPageNum() + ".prev = " + ph.getPrevDataPage()); next.setDirty(true); dataCache.add(next); *************** *** 1122,1125 **** --- 1155,1159 ---- DOMPage prev = getCurrentPage(ph.getPrevDataPage()); prev.getPageHeader().setNextDataPage(ph.getNextDataPage()); + // LOG.debug(prev.getPageNum() + ".next = " + ph.getNextDataPage()); prev.setDirty(true); dataCache.add(prev); *************** *** 1128,1131 **** --- 1162,1166 ---- try { ph.setNextDataPage(-1); + ph.setPrevDataPage(-1); ph.setDataLength(0); ph.setNextTID((short) -1); Index: NodeIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/NodeIterator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NodeIterator.java 18 May 2004 14:18:46 -0000 1.10 --- NodeIterator.java 16 Jun 2004 09:23:50 -0000 1.11 *************** *** 124,127 **** --- 124,128 ---- return null; } + // LOG.debug(page + " -> " + nextPage); page = nextPage; p = db.getCurrentPage(nextPage); *************** *** 163,166 **** --- 164,174 ---- offset += l; } + if(nextNode == null) { + LOG.warn("illegal node on page " + p.getPageNum() + "; tid = " + ItemId.getId(lastTID) + + "; next = " + p.getPageHeader().getNextDataPage() + "; prev = " + + p.getPageHeader().getPrevDataPage() + "; offset = " + (offset - l) + + "; len = " + p.getPageHeader().getDataLength()); + return null; + } nextNode.setInternalAddress( StorageAddress.createPointer((int) page, ItemId.getId(lastTID)) |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:24:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3994/src/org/exist/xquery/functions Modified Files: FunLast.java Log Message: Wrong page links in dom.dbx: some pages got lost after a number of xupdate remove/append operations. Index: FunLast.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunLast.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FunLast.java 28 May 2004 10:54:09 -0000 1.2 --- FunLast.java 16 Jun 2004 09:23:50 -0000 1.3 *************** *** 66,72 **** Item contextItem) throws XPathException { ! if(contextSequence == null || contextSequence.getLength() == 0) return Sequence.EMPTY_SEQUENCE; ! return new IntegerValue(contextSequence.getLength()); } --- 66,73 ---- Item contextItem) throws XPathException { ! final int len = contextSequence.getLength(); ! if(contextSequence == null || len == 0) return Sequence.EMPTY_SEQUENCE; ! return new IntegerValue(len); } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:24:07
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3994/src/org/exist/storage/io Modified Files: VariableByteArrayInput.java Log Message: Wrong page links in dom.dbx: some pages got lost after a number of xupdate remove/append operations. Index: VariableByteArrayInput.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/io/VariableByteArrayInput.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VariableByteArrayInput.java 10 May 2004 11:22:43 -0000 1.2 --- VariableByteArrayInput.java 16 Jun 2004 09:23:49 -0000 1.3 *************** *** 131,135 **** } } ! public void skip(int count) throws IOException { for (int i = 0; i < count; i++) { --- 131,135 ---- } } ! public void skip(int count) throws IOException { for (int i = 0; i < count; i++) { |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:23:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3994/src/org/exist/dom Modified Files: ElementImpl.java NodeImpl.java Log Message: Wrong page links in dom.dbx: some pages got lost after a number of xupdate remove/append operations. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ElementImpl.java 8 Jun 2004 08:16:07 -0000 1.36 --- ElementImpl.java 16 Jun 2004 09:23:48 -0000 1.37 *************** *** 276,282 **** DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; ! if (children == 0) ! node = appendChildren(firstChildID(), this, getPath(), nodes, true); ! else { if(child == 1) { Node firstChild = getFirstChild(); --- 276,283 ---- DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; ! if (children == 0) { ! // no children: append a new child ! node = appendChildren(firstChildID(), this, getPath(), nodes, true); ! } else { if(child == 1) { Node firstChild = getFirstChild(); *************** *** 1166,1175 **** final int level = ownerDocument.getTreeLevel(gid); final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); removeAll(old, old.getPath().toString()); --children; ownerDocument.broker.endRemove(); ownerDocument.broker.update(this); ! ownerDocument.reindex = level + 1; ! ownerDocument.broker.reindex(prevDoc, ownerDocument, this); return old; } --- 1167,1179 ---- final int level = ownerDocument.getTreeLevel(gid); final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); + final long lastChild = lastChildID(); removeAll(old, old.getPath().toString()); --children; ownerDocument.broker.endRemove(); ownerDocument.broker.update(this); ! if(old.gid < lastChild) { ! ownerDocument.reindex = level + 1; ! ownerDocument.broker.reindex(prevDoc, ownerDocument, this); ! } return old; } Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** NodeImpl.java 8 Jun 2004 08:16:07 -0000 1.23 --- NodeImpl.java 16 Jun 2004 09:23:48 -0000 1.24 *************** *** 102,106 **** return CommentImpl.deserialize(data, start, len, pooled); default : ! LOG.debug("not implemented"); return null; } --- 102,106 ---- return CommentImpl.deserialize(data, start, len, pooled); default : ! LOG.debug("Unknown node type: " + type); return null; } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:21:47
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1849/src/org/exist/xupdate Modified Files: Remove.java Modification.java Log Message: NullPointerException in Modification.unlockDocuments. Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Modification.java 2 Jun 2004 11:34:37 -0000 1.25 --- Modification.java 16 Jun 2004 09:21:32 -0000 1.26 *************** *** 143,150 **** Sequence resultSeq = expr.eval(null, null); ! if (resultSeq.getItemType() != Type.NODE) ! throw new EXistException("select expression should evaluate to a" + "node-set"); LOG.debug("found " + resultSeq.getLength() + " for select: " + selectStmt); ! return (NodeList)resultSeq; } catch (RecognitionException e) { LOG.warn("error while parsing select expression", e); --- 143,151 ---- Sequence resultSeq = expr.eval(null, null); ! if (!Type.subTypeOf(resultSeq.getItemType(), Type.NODE)) ! throw new EXistException("select expression should evaluate to a node-set; got " + ! Type.getTypeName(resultSeq.getItemType())); LOG.debug("found " + resultSeq.getLength() + " for select: " + selectStmt); ! return (NodeList)resultSeq.toNodeSet(); } catch (RecognitionException e) { LOG.warn("error while parsing select expression", e); *************** *** 196,199 **** --- 197,202 ---- */ protected void unlockDocuments() { + if(lockedDocuments == null) + return; lockedDocuments.unlock(true); } Index: Remove.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Remove.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Remove.java 25 May 2004 09:26:03 -0000 1.12 --- Remove.java 16 Jun 2004 09:21:32 -0000 1.13 *************** *** 79,82 **** --- 79,83 ---- parent = node.getParentNode(); if (parent.getNodeType() != Node.ELEMENT_NODE) { + LOG.debug("parent = " + parent.getNodeType() + "; " + parent.getNodeName()); throw new EXistException( "you cannot remove the document element. Use update " |
From: Wolfgang M. M. <wol...@us...> - 2004-06-16 09:19:35
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32310/src/org/exist/collections Modified Files: Collection.java Log Message: Lock not removed when updating an existing document if the new document has been invalid. Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Collection.java 8 Jun 2004 08:16:14 -0000 1.28 --- Collection.java 16 Jun 2004 09:19:26 -0000 1.29 *************** *** 719,722 **** --- 719,723 ---- throw new PermissionDeniedException("The document is locked by user " + lockUser.getName()); + // check if the document is currently being changed by someone else Lock oldLock = oldDoc.getUpdateLock(); *************** *** 835,838 **** --- 836,851 ---- if (trigger != null) trigger.setValidating(false); + } catch(EXistException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(SAXException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(PermissionDeniedException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(TriggerException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; } finally { lock.release(); *************** *** 842,846 **** // second pass: store the document ! LOG.debug("storing document ..."); try { try { --- 855,859 ---- // second pass: store the document ! LOG.debug("storing document " + document.getDocId() + " ..."); try { try { *************** *** 868,872 **** } broker.deleteObservers(); - System.out.println(this); return document; } --- 881,884 ---- *************** *** 884,888 **** if (broker.isReadOnly()) throw new PermissionDeniedException("Database is read-only"); ! DocumentImpl document, oldDoc = null; XMLReader reader; try { --- 896,900 ---- if (broker.isReadOnly()) throw new PermissionDeniedException("Database is read-only"); ! DocumentImpl document = null, oldDoc = null; XMLReader reader; try { *************** *** 913,916 **** --- 925,929 ---- throw new PermissionDeniedException( "Not allowed to write to collection " + getName()); + // if an old document exists, save the new document with a temporary // document name *************** *** 1010,1013 **** --- 1023,1038 ---- if (trigger != null) trigger.setValidating(false); + } catch(EXistException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(SAXException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(PermissionDeniedException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(TriggerException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; } finally { lock.release(); *************** *** 1182,1185 **** --- 1207,1222 ---- if (trigger != null) trigger.setValidating(false); + } catch(EXistException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(SAXException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(PermissionDeniedException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; + } catch(TriggerException e) { + if(oldDoc != null) oldDoc.getUpdateLock().release(Lock.WRITE_LOCK); + throw e; } finally { lock.release(); |
From: Pam J. K. <pki...@ma...> - 2004-06-08 12:58:24
|
Thanks. |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/xmldb Modified Files: LocalUserManagementService.java LocalXMLResource.java EXistResource.java RemoteCollection.java LocalXPathQueryService.java LocalIndexQueryService.java LocalCollection.java LocalXUpdateQueryService.java RemoteResourceSet.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: LocalIndexQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalIndexQueryService.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LocalIndexQueryService.java 2 Jun 2004 11:28:42 -0000 1.7 --- LocalIndexQueryService.java 8 Jun 2004 08:16:08 -0000 1.8 *************** *** 95,99 **** try { broker = pool.get(user); ! return broker.scanIndexedElements(parent.getCollection(), inclusive); } catch (EXistException e) { throw new XMLDBException( --- 95,99 ---- try { broker = pool.get(user); ! return broker.getElementIndex().scanIndexedElements(parent.getCollection(), inclusive); } catch (EXistException e) { throw new XMLDBException( Index: EXistResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/EXistResource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EXistResource.java 29 Jan 2004 15:06:43 -0000 1.1 --- EXistResource.java 8 Jun 2004 08:16:08 -0000 1.2 *************** *** 41,44 **** Date getLastModificationTime() throws XMLDBException; ! public Permission getPermissions(); } --- 41,44 ---- Date getLastModificationTime() throws XMLDBException; ! public Permission getPermissions() throws XMLDBException; } Index: LocalXUpdateQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXUpdateQueryService.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** LocalXUpdateQueryService.java 10 May 2004 11:22:51 -0000 1.13 --- LocalXUpdateQueryService.java 8 Jun 2004 08:16:09 -0000 1.14 *************** *** 63,68 **** docs = c.allDocs(broker, docs, true); } else { ! String id = parent.getName() + '/' + resource; ! DocumentImpl doc = c.getDocument(id); LOG.debug("updating resource " + doc.getFileName()); docs.add(doc); --- 63,67 ---- docs = c.allDocs(broker, docs, true); } else { ! DocumentImpl doc = c.getDocument(broker, resource); LOG.debug("updating resource " + doc.getFileName()); docs.add(doc); Index: RemoteCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteCollection.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RemoteCollection.java 21 May 2004 08:32:14 -0000 1.13 --- RemoteCollection.java 8 Jun 2004 08:16:08 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- import org.apache.xmlrpc.XmlRpcException; import org.exist.security.Permission; + import org.exist.xmlrpc.RpcServer; import org.xmldb.api.base.Collection; import org.xmldb.api.base.ErrorCodes; *************** *** 58,63 **** // if the resource exceeds this limit, the data is split into // junks and uploaded to the server via the update() call ! private static final int MAX_CHUNK_LENGTH = 1000000; ! protected Map childCollections = null; protected String name; --- 59,65 ---- // if the resource exceeds this limit, the data is split into // junks and uploaded to the server via the update() call ! private static final int MAX_CHUNK_LENGTH = 512 * 1024; ! private static final int MAX_UPLOAD_CHUNK = 1 * 1024 * 1024; ! protected Map childCollections = null; protected String name; *************** *** 264,273 **** throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "an io error occurred", ioe); } - // List resources = readResources(); - // int lsize = resources.size(); - // String[] list = new String[lsize]; - // for (int i = 0; i < lsize; i++) - // list[i] = ((DocumentProxy) resources.get(i)).getName(); - // return list; } --- 266,269 ---- *************** *** 481,485 **** private void uploadAndStore(Resource res) throws XMLDBException { File file = (File) res.getContent(); ! byte[] chunk = new byte[MAX_CHUNK_LENGTH]; try { FileInputStream is = new FileInputStream(file); --- 477,481 ---- private void uploadAndStore(Resource res) throws XMLDBException { File file = (File) res.getContent(); ! byte[] chunk = new byte[MAX_UPLOAD_CHUNK]; try { FileInputStream is = new FileInputStream(file); *************** *** 487,497 **** String fileName = null; Vector params; while ((len = is.read(chunk)) > -1) { params = new Vector(); if (fileName != null) params.addElement(fileName); ! params.addElement(chunk); params.addElement(new Integer(len)); ! fileName = (String) rpcClient.execute("upload", params); } params = new Vector(); --- 483,495 ---- String fileName = null; Vector params; + byte[] compressed; while ((len = is.read(chunk)) > -1) { + compressed = RpcServer.compress(chunk, len); params = new Vector(); if (fileName != null) params.addElement(fileName); ! params.addElement(compressed); params.addElement(new Integer(len)); ! fileName = (String) rpcClient.execute("uploadCompressed", params); } params = new Vector(); Index: LocalUserManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalUserManagementService.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** LocalUserManagementService.java 3 May 2004 12:58:11 -0000 1.15 --- LocalUserManagementService.java 8 Jun 2004 08:16:08 -0000 1.16 *************** *** 49,58 **** throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); DBBroker broker = null; try { broker = pool.get(user); - DocumentImpl document; if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(); else document = ((LocalBinaryResource) resource).getBlob(); --- 49,58 ---- throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); + DocumentImpl document = null; DBBroker broker = null; try { broker = pool.get(user); if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(broker, true); else document = ((LocalBinaryResource) resource).getBlob(); *************** *** 74,77 **** --- 74,78 ---- throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, e); } finally { + collection.getCollection().releaseDocument(document); pool.release(broker); } *************** *** 156,165 **** public void chmod(Resource resource, int mode) throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); DBBroker broker = null; try { broker = pool.get(user); - DocumentImpl document; if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(); else document = ((LocalBinaryResource) resource).getBlob(); --- 157,166 ---- public void chmod(Resource resource, int mode) throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); + DocumentImpl document = null; DBBroker broker = null; try { broker = pool.get(user); if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(broker, true); else document = ((LocalBinaryResource) resource).getBlob(); *************** *** 180,183 **** --- 181,185 ---- throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, e); } finally { + collection.getCollection().releaseDocument(document); pool.release(broker); } *************** *** 220,229 **** throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); DBBroker broker = null; try { broker = pool.get(user); - DocumentImpl document; if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(); else document = ((LocalBinaryResource) resource).getBlob(); --- 222,231 ---- throws XMLDBException { org.exist.security.SecurityManager manager = pool.getSecurityManager(); + DocumentImpl document = null; DBBroker broker = null; try { broker = pool.get(user); if (resource.getResourceType().equals("XMLResource")) ! document = ((LocalXMLResource) resource).getDocument(broker, true); else document = ((LocalBinaryResource) resource).getBlob(); *************** *** 249,252 **** --- 251,255 ---- throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, e); } finally { + collection.getCollection().releaseDocument(document); pool.release(broker); } *************** *** 291,304 **** ErrorCodes.PERMISSION_DENIED, "need admin privileges for chown"); ! Permission perm; ! if(res.getResourceType().equals("XMLResource")) ! perm = ((LocalXMLResource) res).getDocument().getPermissions(); ! else ! perm = ((LocalBinaryResource) res).getBlob().getPermissions(); ! perm.setOwner(u); ! perm.setGroup(group); DBBroker broker = null; try { broker = pool.get(user); broker.saveCollection(collection.getCollection()); broker.flush(); --- 294,309 ---- ErrorCodes.PERMISSION_DENIED, "need admin privileges for chown"); ! DocumentImpl document = null; DBBroker broker = null; try { broker = pool.get(user); + Permission perm; + if(res.getResourceType().equals("XMLResource")) { + document = ((LocalXMLResource) res).getDocument(broker, true); + perm = document.getPermissions(); + } else + perm = ((LocalBinaryResource) res).getBlob().getPermissions(); + perm.setOwner(u); + perm.setGroup(group); broker.saveCollection(collection.getCollection()); broker.flush(); *************** *** 314,317 **** --- 319,323 ---- e); } finally { + collection.getCollection().releaseDocument(document); pool.release(broker); } *************** *** 322,360 **** */ public String hasUserLock(Resource res) throws XMLDBException { ! DocumentImpl doc; ! if(res.getResourceType().equals("XMLResource")) ! doc = ((LocalXMLResource) res).getDocument(); ! else ! doc = ((LocalBinaryResource) res).getBlob(); ! User lockOwner = doc.getUserLock(); ! return lockOwner == null ? null : lockOwner.getName(); } public void lockResource(Resource res, User u) throws XMLDBException { ! DocumentImpl doc; ! if(res.getResourceType().equals("XMLResource")) ! doc = ((LocalXMLResource) res).getDocument(); ! else ! doc = ((LocalBinaryResource) res).getBlob(); ! if (!doc.getPermissions().validate(user, Permission.UPDATE)) ! throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, ! "User is not allowed to lock resource " + res.getId()); ! org.exist.security.SecurityManager manager = pool.getSecurityManager(); ! if(!(user.equals(u) || manager.hasAdminPrivileges(user))) { ! throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, ! "User " + user.getName() + " is not allowed to lock resource for " + ! "user " + u.getName()); ! } ! User lockOwner = doc.getUserLock(); ! if(lockOwner != null) { ! if(lockOwner.equals(u)) ! return; ! else if(!manager.hasAdminPrivileges(user)) ! throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, ! "Resource is already locked by user " + lockOwner.getName()); ! } DBBroker broker = null; try { broker = pool.get(user); doc.setUserLock(u); broker.saveCollection(doc.getCollection()); --- 328,378 ---- */ public String hasUserLock(Resource res) throws XMLDBException { ! DocumentImpl doc = null; ! DBBroker broker = null; ! try { ! broker = pool.get(user); ! if(res.getResourceType().equals("XMLResource")) ! doc = ((LocalXMLResource) res).getDocument(broker, true); ! else ! doc = ((LocalBinaryResource) res).getBlob(); ! User lockOwner = doc.getUserLock(); ! return lockOwner == null ? null : lockOwner.getName(); ! } catch (EXistException e) { ! throw new XMLDBException( ! ErrorCodes.VENDOR_ERROR, ! e.getMessage(), ! e); ! } finally { ! collection.getCollection().releaseDocument(doc); ! pool.release(broker); ! } } public void lockResource(Resource res, User u) throws XMLDBException { ! DocumentImpl doc = null; DBBroker broker = null; try { broker = pool.get(user); + if(res.getResourceType().equals("XMLResource")) + doc = ((LocalXMLResource) res).getDocument(broker, true); + else + doc = ((LocalBinaryResource) res).getBlob(); + if (!doc.getPermissions().validate(user, Permission.UPDATE)) + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "User is not allowed to lock resource " + res.getId()); + org.exist.security.SecurityManager manager = pool.getSecurityManager(); + if(!(user.equals(u) || manager.hasAdminPrivileges(user))) { + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "User " + user.getName() + " is not allowed to lock resource for " + + "user " + u.getName()); + } + User lockOwner = doc.getUserLock(); + if(lockOwner != null) { + if(lockOwner.equals(u)) + return; + else if(!manager.hasAdminPrivileges(user)) + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "Resource is already locked by user " + lockOwner.getName()); + } doc.setUserLock(u); broker.saveCollection(doc.getCollection()); *************** *** 366,369 **** --- 384,388 ---- e.getMessage(), e); } finally { + collection.getCollection().releaseDocument(doc); pool.release(broker); } *************** *** 371,391 **** public void unlockResource(Resource res) throws XMLDBException { ! DocumentImpl doc; ! if(res.getResourceType().equals("XMLResource")) ! doc = ((LocalXMLResource) res).getDocument(); ! else ! doc = ((LocalBinaryResource) res).getBlob(); ! if (!doc.getPermissions().validate(user, Permission.UPDATE)) ! throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, ! "User is not allowed to lock resource " + res.getId()); ! org.exist.security.SecurityManager manager = pool.getSecurityManager(); ! User lockOwner = doc.getUserLock(); ! if(lockOwner != null && !(lockOwner.equals(user) || manager.hasAdminPrivileges(user))) { ! throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, ! "Resource is already locked by user " + lockOwner.getName()); ! } DBBroker broker = null; try { broker = pool.get(user); doc.setUserLock(null); broker.saveCollection(doc.getCollection()); --- 390,410 ---- public void unlockResource(Resource res) throws XMLDBException { ! DocumentImpl doc = null; DBBroker broker = null; try { broker = pool.get(user); + if(res.getResourceType().equals("XMLResource")) + doc = ((LocalXMLResource) res).getDocument(broker, true); + else + doc = ((LocalBinaryResource) res).getBlob(); + if (!doc.getPermissions().validate(user, Permission.UPDATE)) + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "User is not allowed to lock resource " + res.getId()); + org.exist.security.SecurityManager manager = pool.getSecurityManager(); + User lockOwner = doc.getUserLock(); + if(lockOwner != null && !(lockOwner.equals(user) || manager.hasAdminPrivileges(user))) { + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "Resource is already locked by user " + lockOwner.getName()); + } doc.setUserLock(null); broker.saveCollection(doc.getCollection()); *************** *** 397,400 **** --- 416,420 ---- e.getMessage(), e); } finally { + collection.getCollection().releaseDocument(doc); pool.release(broker); } *************** *** 412,419 **** public Permission getPermissions(Resource resource) throws XMLDBException { ! if (resource.getResourceType().equals("XMLResource")) ! return ((LocalXMLResource) resource).getDocument().getPermissions(); ! else ! return ((LocalBinaryResource) resource).getBlob().getPermissions(); } --- 432,450 ---- public Permission getPermissions(Resource resource) throws XMLDBException { ! DBBroker broker = null; ! try { ! broker = pool.get(user); ! if (resource.getResourceType().equals("XMLResource")) ! return ((LocalXMLResource) resource).getDocument(broker, false).getPermissions(); ! else ! return ((LocalBinaryResource) resource).getBlob().getPermissions(); ! } catch (EXistException e) { ! throw new XMLDBException( ! ErrorCodes.VENDOR_ERROR, ! e.getMessage(), ! e); ! } finally { ! pool.release(broker); ! } } *************** *** 423,435 **** .validate(user, Permission.READ)) return new Permission[0]; ! Permission perms[] = ! new Permission[c.getDocumentCount()]; ! int j = 0; ! DocumentImpl doc; ! for (Iterator i = c.iterator(); i.hasNext(); j++) { ! doc = (DocumentImpl) i.next(); ! perms[j] = doc.getPermissions(); } - return perms; } --- 454,477 ---- .validate(user, Permission.READ)) return new Permission[0]; ! DBBroker broker = null; ! try { ! broker = pool.get(user); ! Permission perms[] = ! new Permission[c.getDocumentCount()]; ! int j = 0; ! DocumentImpl doc; ! for (Iterator i = c.iterator(broker); i.hasNext(); j++) { ! doc = (DocumentImpl) i.next(); ! perms[j] = doc.getPermissions(); ! } ! return perms; ! } catch (EXistException e) { ! throw new XMLDBException( ! ErrorCodes.VENDOR_ERROR, ! e.getMessage(), ! e); ! } finally { ! pool.release(broker); } } Index: LocalXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXPathQueryService.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** LocalXPathQueryService.java 17 May 2004 09:59:42 -0000 1.40 --- LocalXPathQueryService.java 8 Jun 2004 08:16:08 -0000 1.41 *************** *** 279,283 **** ErrorCodes.INVALID_RESOURCE, "resource " + resource + " not found"); ! docs.add(res.getDocument()); return doQuery(query, docs, null, null); } --- 279,291 ---- ErrorCodes.INVALID_RESOURCE, "resource " + resource + " not found"); ! DBBroker broker = null; ! try { ! broker = brokerPool.get(user); ! docs.add(res.getDocument(broker, false)); ! } catch (EXistException e) { ! throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, e.getMessage(), e); ! } finally { ! brokerPool.release(broker); ! } return doQuery(query, docs, null, null); } Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** LocalCollection.java 17 May 2004 09:59:42 -0000 1.32 --- LocalCollection.java 8 Jun 2004 08:16:08 -0000 1.33 *************** *** 265,282 **** ErrorCodes.PERMISSION_DENIED, "not allowed to read collection"); ! String name = collection.getName() + '/' + id; ! DocumentImpl document = collection.getDocument(name); ! if (document == null) ! return null; ! Resource r; ! if (document.getResourceType() == DocumentImpl.XML_FILE) ! r = new LocalXMLResource(user, brokerPool, this, document, -1); ! else if (document.getResourceType() == DocumentImpl.BINARY_FILE) ! r = new LocalBinaryResource(user, brokerPool, this, (BinaryDocument) document); ! else ! throw new XMLDBException( ! ErrorCodes.INVALID_RESOURCE, ! "unknown resource type"); ! return r; } --- 265,294 ---- ErrorCodes.PERMISSION_DENIED, "not allowed to read collection"); ! DBBroker broker = null; ! try { ! broker = brokerPool.get(user); ! DocumentImpl document = collection.getDocument(broker, id); ! if (document == null) { ! LOG.warn("Resource " + id + " not found"); ! return null; ! } ! Resource r; ! if (document.getResourceType() == DocumentImpl.XML_FILE) ! r = new LocalXMLResource(user, brokerPool, this, id, -1); ! else if (document.getResourceType() == DocumentImpl.BINARY_FILE) ! r = new LocalBinaryResource(user, brokerPool, this, (BinaryDocument) document); ! else ! throw new XMLDBException( ! ErrorCodes.INVALID_RESOURCE, ! "unknown resource type"); ! return r; ! } catch (EXistException e) { ! throw new XMLDBException( ! ErrorCodes.UNKNOWN_ERROR, ! "error while retrieving resource: " + e.getMessage(), ! e); ! } finally { ! brokerPool.release(broker); ! } } *************** *** 349,364 **** if (!collection.getPermissions().validate(user, Permission.READ)) return new String[0]; ! String[] resources = new String[collection.getDocumentCount()]; ! int j = 0; ! int p; ! DocumentImpl doc; ! String resource; ! for (Iterator i = collection.iterator(); i.hasNext(); j++) { ! doc = (DocumentImpl) i.next(); ! resource = doc.getFileName(); ! p = resource.lastIndexOf('/'); ! resources[j] = (p < 0 ? resource : resource.substring(p + 1)); } - return resources; } --- 361,385 ---- if (!collection.getPermissions().validate(user, Permission.READ)) return new String[0]; ! DBBroker broker = null; ! try { ! broker = brokerPool.get(user); ! String[] resources = new String[collection.getDocumentCount()]; ! int j = 0; ! int p; ! DocumentImpl doc; ! String resource; ! for (Iterator i = collection.iterator(broker); i.hasNext(); j++) { ! doc = (DocumentImpl) i.next(); ! resources[j] = doc.getFileName(); ! } ! return resources; ! } catch (EXistException e) { ! throw new XMLDBException( ! ErrorCodes.UNKNOWN_ERROR, ! "error while retrieving resource: " + e.getMessage(), ! e); ! } finally { ! brokerPool.release(broker); } } *************** *** 377,389 **** String name = res.getId(); LOG.debug("removing " + name); - String path = collection.getName() + '/' + name; - DocumentImpl doc = collection.getDocument(path); - if (doc == null) - throw new XMLDBException( - ErrorCodes.INVALID_RESOURCE, - "resource " + name + " not found"); DBBroker broker = null; try { broker = brokerPool.get(user); if (res.getResourceType().equals("XMLResource")) collection.removeDocument(broker, name); --- 398,409 ---- String name = res.getId(); LOG.debug("removing " + name); DBBroker broker = null; try { broker = brokerPool.get(user); + DocumentImpl doc = collection.getDocument(broker, name); + if (doc == null) + throw new XMLDBException( + ErrorCodes.INVALID_RESOURCE, + "resource " + name + " not found"); if (res.getResourceType().equals("XMLResource")) collection.removeDocument(broker, name); *************** *** 468,472 **** else newDoc = collection.addDocument(broker, name, res.content); - res.document = newDoc; //broker.flush(); } catch (Exception e) { --- 488,491 ---- Index: LocalXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXMLResource.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** LocalXMLResource.java 21 May 2004 08:32:14 -0000 1.34 --- LocalXMLResource.java 8 Jun 2004 08:16:08 -0000 1.35 *************** *** 15,23 **** import org.exist.dom.XMLUtil; import org.exist.security.Permission; - import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.storage.serializers.Serializer; import org.exist.util.serializer.DOMSerializer; import org.exist.util.serializer.DOMSerializerPool; --- 15,23 ---- import org.exist.dom.XMLUtil; import org.exist.security.Permission; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.storage.serializers.Serializer; + import org.exist.util.LockException; import org.exist.util.serializer.DOMSerializer; import org.exist.util.serializer.DOMSerializerPool; *************** *** 47,51 **** protected BrokerPool brokerPool; protected String docId = null; ! protected DocumentImpl document = null; protected LocalCollection parent; protected NodeProxy proxy = null; --- 47,51 ---- protected BrokerPool brokerPool; protected String docId = null; ! //protected DocumentImpl document = null; protected LocalCollection parent; protected NodeProxy proxy = null; *************** *** 74,91 **** public LocalXMLResource(User user, BrokerPool pool, LocalCollection parent, - DocumentImpl doc, long id) throws XMLDBException { - this.user = user; - this.brokerPool = pool; - this.parent = parent; - this.id = id; - this.document = doc; - this.docId = doc.getFileName(); - if (docId.indexOf('/') > -1) - docId = docId.substring(docId.lastIndexOf('/') + 1); - } - - public LocalXMLResource(User user, BrokerPool pool, LocalCollection parent, NodeProxy p) throws XMLDBException { ! this(user, pool, parent, p.doc, p.gid); this.proxy = p; } --- 74,79 ---- public LocalXMLResource(User user, BrokerPool pool, LocalCollection parent, NodeProxy p) throws XMLDBException { ! this(user, pool, parent, p.doc.getFileName(), p.gid); this.proxy = p; } *************** *** 134,137 **** --- 122,126 ---- // Case 4: content is a document or internal node } else { + DocumentImpl document = null; DBBroker broker = null; try { *************** *** 143,148 **** content = serializer.serialize((NodeValue) root); else { ! if (document == null) ! getDocument(broker); if (!document.getPermissions().validate(user, Permission.READ)) --- 132,136 ---- content = serializer.serialize((NodeValue) root); else { ! document = getDocument(broker, true); if (!document.getPermissions().validate(user, Permission.READ)) *************** *** 171,174 **** --- 159,163 ---- .getMessage(), e); } finally { + parent.getCollection().releaseDocument(document); brokerPool.release(broker); } *************** *** 183,191 **** "cannot return an atomic value as DOM node"); } else { DBBroker broker = null; try { broker = brokerPool.get(user); ! if (document == null) ! getDocument(broker); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, --- 172,180 ---- "cannot return an atomic value as DOM node"); } else { + DocumentImpl document = null; DBBroker broker = null; try { broker = brokerPool.get(user); ! document = getDocument(broker, true); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, *************** *** 201,204 **** --- 190,194 ---- .getMessage(), e); } finally { + parent.getCollection().releaseDocument(document); brokerPool.release(broker); } *************** *** 240,243 **** --- 230,234 ---- // case 3: content is an internal node or a document } else { + DocumentImpl document = null; try { broker = brokerPool.get(user); *************** *** 250,255 **** serializer.toSAX((NodeValue) root); else { ! if (document == null) ! getDocument(broker); if (!document.getPermissions().validate(user, Permission.READ)) --- 241,245 ---- serializer.toSAX((NodeValue) root); else { ! document = getDocument(broker, true); if (!document.getPermissions().validate(user, Permission.READ)) *************** *** 273,276 **** --- 263,267 ---- .getMessage(), e); } finally { + parent.getCollection().releaseDocument(document); brokerPool.release(broker); } *************** *** 278,310 **** } - protected DocumentImpl getDocument() { - if (document == null) - LOG.warn("document object is null"); - return document; - } - - protected void getDocument(DBBroker broker) throws XMLDBException { - if (document != null) - return; - try { - String path = (parent.getPath().equals("/") ? '/' + docId : parent - .getPath() - + '/' + docId); - document = (DocumentImpl) broker.getDocument(path); - if (document == null) - throw new XMLDBException(ErrorCodes.INVALID_RESOURCE); - } catch (PermissionDeniedException e) { - throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, e); - } - } - - protected NodeProxy getNode() { - getDocument(); - if (id < 0) - // this XMLResource represents a document - return new NodeProxy(document, 1); - return proxy == null ? new NodeProxy(document, id) : proxy; - } - public String getDocumentId() throws XMLDBException { return docId; --- 269,272 ---- *************** *** 330,335 **** try { broker = brokerPool.get(user); ! if (document == null) ! getDocument(broker); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, --- 292,296 ---- try { broker = brokerPool.get(user); ! DocumentImpl document = getDocument(broker, false); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, *************** *** 348,353 **** try { broker = brokerPool.get(user); ! if (document == null) ! getDocument(broker); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, --- 309,313 ---- try { broker = brokerPool.get(user); ! DocumentImpl document = getDocument(broker, false); if (!document.getPermissions().validate(user, Permission.READ)) throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, *************** *** 425,430 **** * @see org.exist.xmldb.EXistResource#getPermissions() */ ! public Permission getPermissions() { ! return document != null ? document.getPermissions() : null; } --- 385,399 ---- * @see org.exist.xmldb.EXistResource#getPermissions() */ ! public Permission getPermissions() throws XMLDBException { ! DBBroker broker = null; ! try { ! broker = brokerPool.get(user); ! DocumentImpl document = getDocument(broker, false); ! return document != null ? document.getPermissions() : null; ! } catch (EXistException e) { ! throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, e.getMessage(), e); ! } finally { ! brokerPool.release(broker); ! } } *************** *** 437,439 **** --- 406,441 ---- } + protected DocumentImpl getDocument(DBBroker broker, boolean lock) throws XMLDBException { + DocumentImpl document = null; + if(lock) + try { + document = parent.getCollection().getDocumentWithLock(broker, docId); + } catch (LockException e) { + throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, + "Failed to acquire lock on document " + docId); + } + else + document = parent.getCollection().getDocument(broker, docId); + if (document == null) + throw new XMLDBException(ErrorCodes.INVALID_RESOURCE); + return document; + } + + protected NodeProxy getNode() throws XMLDBException { + if(proxy != null) + return proxy; + DBBroker broker = null; + try { + broker = brokerPool.get(user); + DocumentImpl document = getDocument(broker, false); + if (id < 0) + // this XMLResource represents a document + return new NodeProxy(document, 1); + return new NodeProxy(document, id); + } catch (EXistException e) { + throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, e.getMessage(), e); + } finally { + brokerPool.release(broker); + } + } } Index: RemoteResourceSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteResourceSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RemoteResourceSet.java 21 May 2004 08:32:14 -0000 1.5 --- RemoteResourceSet.java 8 Jun 2004 08:16:09 -0000 1.6 *************** *** 84,88 **** String s_id = (String) v.elementAt( 1 ); String path = doc.substring(0, doc.lastIndexOf('/')); - System.out.println("Processing " + doc); RemoteCollection parent = new RemoteCollection(collection.getClient(), null, path); --- 84,87 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/storage Modified Files: NativeElementIndex.java NodePath.java NativeBroker.java DBBroker.java ElementIndex.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: NodePath.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NodePath.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NodePath.java 25 May 2004 09:26:10 -0000 1.2 --- NodePath.java 8 Jun 2004 08:16:11 -0000 1.3 *************** *** 83,91 **** public void reset() { ! for(int i = 0; i < components.length; i++) components[i] = null; pos = 0; } private void init( String path ) { StringTokenizer tokenizer = new StringTokenizer(path, "/"); --- 83,100 ---- public void reset() { ! for(int i = 0; i < pos; i++) components[i] = null; pos = 0; } + public String toString() { + StringBuffer buf = new StringBuffer(); + for(int i = 0; i < pos; i++) { + buf.append('/'); + buf.append(components[i]); + } + return buf.toString(); + } + private void init( String path ) { StringTokenizer tokenizer = new StringTokenizer(path, "/"); Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** NativeBroker.java 4 Jun 2004 09:47:26 -0000 1.79 --- NativeBroker.java 8 Jun 2004 08:16:11 -0000 1.80 *************** *** 23,27 **** package org.exist.storage; - import java.io.EOFException; import java.io.File; import java.io.IOException; --- 23,26 ---- *************** *** 29,37 **** import java.util.ArrayList; import java.util.Iterator; - import java.util.List; import java.util.Map; import java.util.Observer; import java.util.StringTokenizer; - import java.util.TreeMap; import org.apache.log4j.Logger; --- 28,34 ---- *************** *** 55,59 **** import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; - import org.exist.dom.ExtArrayNodeSet; import org.exist.dom.NodeImpl; import org.exist.dom.NodeIndexListener; --- 52,55 ---- *************** *** 67,71 **** 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; --- 63,66 ---- *************** *** 78,82 **** import org.exist.storage.store.DOMTransaction; import org.exist.storage.store.NodeIterator; - import org.exist.storage.store.StorageAddress; import org.exist.util.ByteArrayPool; import org.exist.util.ByteConversion; --- 73,76 ---- *************** *** 84,93 **** import org.exist.util.Lock; import org.exist.util.LockException; - import org.exist.util.Occurrences; import org.exist.util.ReadOnlyException; import org.exist.xquery.Constants; - import org.exist.xquery.NodeSelector; import org.exist.xquery.TerminatedException; - import org.exist.xquery.XQueryContext; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; --- 78,84 ---- *************** *** 313,486 **** } ! public Occurrences[] scanIndexedElements(Collection collection, boolean inclusive) ! throws PermissionDeniedException { ! if (!collection.getPermissions().validate(user, Permission.READ)) ! throw new PermissionDeniedException( ! "you don't have the permission" ! + " to read collection " ! + collection.getName()); ! List collections = ! inclusive ? collection.getDescendants(this, user) : new ArrayList(); ! collections.add(collection); ! TreeMap map = new TreeMap(); ! VariableByteArrayInput is; ! int docId; ! int len; ! // required for namespace lookups ! XQueryContext context = new XQueryContext(this); ! final Lock lock = elementsDb.getLock(); ! for (Iterator i = collections.iterator(); i.hasNext();) { ! Collection current = (Collection) i.next(); ! short collectionId = current.getId(); ! ! ElementValue ref = new ElementValue(ElementValue.ELEMENT, collectionId); ! IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, ref); ! try { ! lock.acquire(); ! ArrayList values = elementsDb.findEntries(query); ! for (Iterator j = values.iterator(); j.hasNext();) { ! Value val[] = (Value[]) j.next(); ! short elementId = ByteConversion.byteToShort(val[0].getData(), 3); ! short nsSymbol = ByteConversion.byteToShort(val[0].getData(), 5); ! ! String name = getSymbols().getName(elementId); ! String namespace = nsSymbol == 0 ? "" : getSymbols().getNamespace(nsSymbol); ! QName qname = new QName(name, namespace); ! Occurrences oc = (Occurrences) map.get(qname); ! if (oc == null) { ! qname.setPrefix(context.getPrefixForURI(namespace)); ! oc = new Occurrences(qname); ! map.put(qname, oc); ! } ! ! is = ! new VariableByteArrayInput( ! val[1].data(), ! val[1].start(), ! val[1].getLength()); ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! len = is.readInt(); ! oc.addOccurrences(len); ! is.skip(len * 4); ! } ! } catch (EOFException e) { ! } catch (IOException e) { ! LOG.warn("unexpected exception", e); ! } ! } ! } catch (BTreeException e) { ! LOG.warn("exception while reading element index", e); ! } catch (IOException e) { ! LOG.warn("exception while reading element index", e); ! } catch (LockException e) { ! LOG.warn("failed to acquire lock", e); ! } catch (TerminatedException e) { ! LOG.warn("Method terminated", e); ! } finally { ! lock.release(); ! } ! } ! Occurrences[] result = new Occurrences[map.size()]; ! return (Occurrences[]) map.values().toArray(result); ! } ! ! /** ! * Find elements by their tag name. This method is comparable to the DOM's ! * method call getElementsByTagName. All elements matching tagName and ! * belonging to one of the documents in the DocumentSet docs are returned. ! * ! *@param docs Description of the Parameter ! *@param tagName Description of the Parameter ! *@return ! */ ! public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname, ! NodeSelector selector) { ! // final long start = System.currentTimeMillis(); ! final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256); ! DocumentImpl doc; ! int docId; ! int len; ! short collectionId; ! long gid; ! VariableByteInput is = null; ! ElementValue ref; ! short sym, nsSym; ! Collection collection; ! NodeProxy p; ! final short nodeType = ! (type == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE : Node.ELEMENT_NODE); ! final Lock lock = elementsDb.getLock(); ! for (Iterator i = docs.getCollectionIterator(); i.hasNext();) { ! collection = (Collection) i.next(); ! collectionId = collection.getId(); ! if (type == ElementValue.ATTRIBUTE_ID) { ! ref = new ElementValue((byte) type, collectionId, qname.getLocalName()); ! } else { ! sym = getSymbols().getSymbol(qname.getLocalName()); ! nsSym = getSymbols().getNSSymbol(qname.getNamespaceURI()); ! ref = new ElementValue((byte) type, collectionId, sym, nsSym); ! } ! boolean exceptionOcurred = false; ! 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; ! } finally { ! lock.release(); ! } ! // 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) { ! docId = is.readInt(); ! len = is.readInt(); ! if ((doc = docs.getDoc(docId)) == null) { ! is.skip(len * 4); ! continue; ! } ! gid = 0; ! for (int k = 0; k < len; k++) { ! gid = gid + is.readLong(); ! p = new NodeProxy(doc, gid, nodeType, StorageAddress.read(is)); ! if(selector == null || selector.match(p)) ! result.add(p, len); ! } ! } ! } catch (EOFException e) { ! } catch (IOException e) { ! LOG.warn( ! "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - " ! + "unexpected io error", ! e); ! } ! } ! // result.sort(); ! // LOG.debug( ! // "found " ! // + qname ! // + ": " ! // + result.getLength() ! // + " in " ! // + (System.currentTimeMillis() - start) ! // + "ms."); ! return result; } --- 304,309 ---- } ! public ElementIndex getElementIndex() { ! return elementIndex; } *************** *** 526,543 **** } - /** - * Attributes are stored in the element-index (with a leading "@" in the - * name). So simply call findElementsByTagName() - * - *@param docs Description of the Parameter - *@param name Description of the Parameter - *@return The attributesByName value - */ - public NodeSet getAttributesByName(DocumentSet docs, QName qname) { - qname.setLocalName(qname.getLocalName()); - NodeSet result = findElementsByTagName(ElementValue.ATTRIBUTE, docs, qname, null); - return result; - } - public Collection getCollection(String name) { return getCollection(name, -1); --- 349,352 ---- *************** *** 613,616 **** --- 422,463 ---- } + public void reloadCollection(Collection collection) { + Value key = null; + if (collection.getAddress() == -1) + try { + key = new Value(collection.getName().getBytes("UTF-8")); + } catch (UnsupportedEncodingException uee) { + key = new Value(collection.getName().getBytes()); + } + VariableByteInput is = null; + Lock lock = collectionsDb.getLock(); + try { + lock.acquire(Lock.READ_LOCK); + try { + if (collection.getAddress() == -1) { + is = collectionsDb.getAsStream(key); + } else { + is = collectionsDb.getAsStream(collection.getAddress()); + } + } catch (IOException ioe) { + LOG.warn(ioe.getMessage(), ioe); + } + if (is == null) { + LOG.warn("Collection data not found for collection " + collection.getName()); + return; + } + + try { + collection.read(this, is); + } catch (IOException ioe) { + LOG.warn(ioe); + } + } catch (LockException e) { + LOG.warn("failed to acquire lock on collections.dbx"); + } finally { + lock.release(); + } + } + public Iterator getDOMIterator(NodeProxy proxy) { try { *************** *** 648,654 **** if (!fileName.startsWith("/")) fileName = '/' + fileName; int pos = fileName.lastIndexOf('/'); ! String collName = (pos > 0) ? fileName.substring(0, pos) : "/"; Collection collection = getCollection(collName); if (collection == null) { --- 495,505 ---- if (!fileName.startsWith("/")) fileName = '/' + fileName; + if (!fileName.startsWith("/db")) + fileName = "/db" + fileName; int pos = fileName.lastIndexOf('/'); ! String collName = fileName.substring(0, pos); ! String docName = fileName.substring(pos + 1); ! Collection collection = getCollection(collName); if (collection == null) { *************** *** 658,662 **** if (!collection.getPermissions().validate(user, Permission.READ)) throw new PermissionDeniedException("permission denied to read collection"); ! DocumentImpl doc = collection.getDocument(fileName); if (doc == null) { LOG.debug("document " + fileName + " not found!"); --- 509,513 ---- if (!collection.getPermissions().validate(user, Permission.READ)) throw new PermissionDeniedException("permission denied to read collection"); ! DocumentImpl doc = collection.getDocument(this, docName); if (doc == null) { LOG.debug("document " + fileName + " not found!"); *************** *** 1402,1406 **** Value val = domDb.get(new NodeProxy((DocumentImpl) doc, gid)); if (val == null) { ! LOG.debug("node " + gid + " not found!"); //throw new RuntimeException("node " + gid + " not found"); return null; --- 1253,1258 ---- Value val = domDb.get(new NodeProxy((DocumentImpl) doc, gid)); if (val == null) { ! if(LOG.isDebugEnabled()) ! LOG.debug("node " + gid + " not found in document " + ((DocumentImpl)doc).getDocId()); //throw new RuntimeException("node " + gid + " not found"); return null; *************** *** 1457,1461 **** elementIndex.dropIndex(collection); ! for (Iterator i = collection.iterator(); i.hasNext();) { final DocumentImpl doc = (DocumentImpl) i.next(); LOG.debug("Dropping index for document " + doc.getFileName()); --- 1309,1313 ---- elementIndex.dropIndex(collection); ! for (Iterator i = collection.iterator(this); i.hasNext();) { final DocumentImpl doc = (DocumentImpl) i.next(); LOG.debug("Dropping index for document " + doc.getFileName()); *************** *** 1489,1493 **** LOG.debug("Reindexing collection " + collection.getName()); dropIndex(collection); ! for(Iterator i = collection.iterator(); i.hasNext(); ) { DocumentImpl next = (DocumentImpl)i.next(); reindex(next); --- 1341,1345 ---- LOG.debug("Reindexing collection " + collection.getName()); dropIndex(collection); ! for(Iterator i = collection.iterator(this); i.hasNext(); ) { DocumentImpl next = (DocumentImpl)i.next(); reindex(next); *************** *** 1577,1581 **** LOG.debug("removing dom nodes ..."); ! for (Iterator i = collection.iterator(); i.hasNext();) { final DocumentImpl doc = (DocumentImpl) i.next(); LOG.debug("removing document " + doc.getFileName()); --- 1429,1433 ---- LOG.debug("removing dom nodes ..."); ! for (Iterator i = collection.iterator(this); i.hasNext();) { final DocumentImpl doc = (DocumentImpl) i.next(); LOG.debug("removing document " + doc.getFileName()); *************** *** 1619,1623 **** } ! public void removeDocument(String docName) throws PermissionDeniedException { if (readOnly) throw new PermissionDeniedException(DATABASE_IS_READ_ONLY); --- 1471,1475 ---- } ! public void removeDocument(String docName, boolean freeDocId) throws PermissionDeniedException { if (readOnly) throw new PermissionDeniedException(DATABASE_IS_READ_ONLY); *************** *** 1628,1633 **** if (doc == null) { if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument(String) - end - " ! + "document " + docName + " not found"); --- 1480,1484 ---- if (doc == null) { if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument(String) - end - document " + docName + " not found"); *************** *** 1645,1649 **** textEngine.removeDocument(doc); if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " + "removing dom"); } new DOMTransaction(this, domDb) { --- 1496,1500 ---- textEngine.removeDocument(doc); if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - removing dom"); } new DOMTransaction(this, domDb) { *************** *** 1676,1680 **** } .run(); ! freeDocument(doc.getDocId()); } catch (ReadOnlyException e) { LOG.warn("removeDocument(String) - " + DATABASE_IS_READ_ONLY); --- 1527,1532 ---- } .run(); ! if(freeDocId) ! freeDocument(doc.getDocId()); } catch (ReadOnlyException e) { LOG.warn("removeDocument(String) - " + DATABASE_IS_READ_ONLY); *************** *** 1835,1839 **** if(getCollection(destination.getName() + '/' + newName) != null) throw new PermissionDeniedException("A resource can not replace an existing collection"); ! DocumentImpl oldDoc = destination.getDocument(newName); if(oldDoc != null) { if(!destination.getPermissions().validate(user, Permission.UPDATE)) --- 1687,1691 ---- if(getCollection(destination.getName() + '/' + newName) != null) throw new PermissionDeniedException("A resource can not replace an existing collection"); ! DocumentImpl oldDoc = destination.getDocument(this, newName); if(oldDoc != null) { if(!destination.getPermissions().validate(user, Permission.UPDATE)) *************** *** 1853,1857 **** saveCollection(collection); ! doc.setFileName(destination.getName() + '/' + newName); destination.addDocument(this, doc); doc.setCollection(destination); --- 1705,1709 ---- saveCollection(collection); ! doc.setFileName(newName); destination.addDocument(this, doc); doc.setCollection(destination); *************** *** 1912,1916 **** collection.setName(destination.getName() + '/' + newName); collection.setCreationTime(System.currentTimeMillis()); - collection.correctResourcePaths(); destination.addCollection(collection); --- 1764,1767 ---- Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** NativeElementIndex.java 2 Jun 2004 11:34:35 -0000 1.27 --- NativeElementIndex.java 8 Jun 2004 08:16:10 -0000 1.28 *************** *** 1,21 **** /* ! * eXist Open Source Native XML Database ! * Copyright (C) 2001-03, Wolfgang M. Meier (wol...@ex...) ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Library General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, [...1192 lines suppressed...] ! elementIds.clear(); ! } ! ! public void sync() { ! Lock lock = dbElement.getLock(); ! try { ! lock.acquire(Lock.WRITE_LOCK); ! try { ! dbElement.flush(); ! } catch (DBException dbe) { ! LOG.warn(dbe); ! } ! } catch (LockException e) { ! LOG.warn("could not acquire lock for elements", e); ! } finally { ! lock.release(); ! } ! } ! } \ No newline at end of file Index: ElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/ElementIndex.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ElementIndex.java 21 Nov 2003 15:57:13 -0000 1.6 --- ElementIndex.java 8 Jun 2004 08:16:11 -0000 1.7 *************** *** 23,31 **** --- 23,37 ---- import org.apache.log4j.Category; + import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; + import org.exist.dom.DocumentSet; import org.exist.dom.NodeImpl; import org.exist.dom.NodeProxy; + import org.exist.dom.NodeSet; import org.exist.dom.QName; + import org.exist.security.PermissionDeniedException; import org.exist.util.Configuration; + import org.exist.util.Occurrences; + import org.exist.xquery.NodeSelector; public abstract class ElementIndex extends Observable { *************** *** 45,49 **** this.doc = doc; } ! public abstract void addRow(QName qname, NodeProxy proxy); --- 51,71 ---- this.doc = doc; } ! ! /** ! * Returns a node set containing all the attributes matching the given QName and ! * belonging to one of the documents in the DocumentSet. ! * ! */ ! public abstract NodeSet findElementsByTagName( ! byte type, ! DocumentSet docs, ! QName qname, ! NodeSelector selector); ! ! public abstract NodeSet getAttributesByName(DocumentSet docs, QName qname); ! ! public abstract Occurrences[] scanIndexedElements(Collection collection, ! boolean inclusive) throws PermissionDeniedException; ! public abstract void addRow(QName qname, NodeProxy proxy); Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** DBBroker.java 2 Jun 2004 11:34:35 -0000 1.31 --- DBBroker.java 8 Jun 2004 08:16:11 -0000 1.32 *************** *** 174,187 **** } ! /** ! * Returns a node set containing all the attributes matching the given QName and ! * belonging to one of the documents in the DocumentSet. ! * ! */ ! public abstract NodeSet findElementsByTagName( ! byte type, ! DocumentSet docs, ! QName qname, ! NodeSelector selector); /** Flush all data that has not been written before. */ --- 174,178 ---- } ! public abstract ElementIndex getElementIndex(); /** Flush all data that has not been written before. */ *************** *** 200,209 **** /** - * Returns a node set containing all the attributes matching the given QName and - * belonging to one of the documents in the DocumentSet. - */ - public abstract NodeSet getAttributesByName(DocumentSet docs, QName qname); - - /** * Returns the database collection identified by the specified path. * The path should be absolute, e.g. /db/system. --- 191,194 ---- *************** *** 232,239 **** * @return */ ! public Collection getCollection(String name, long address) { ! return null; ! } /** * Returns the configuration object used to initialize the --- 217,224 ---- * @return */ ! public abstract Collection getCollection(String name, long address); + public abstract void reloadCollection(Collection collection); + /** * Returns the configuration object used to initialize the *************** *** 382,386 **** * */ ! public abstract void removeDocument(String docName) throws PermissionDeniedException; --- 367,376 ---- * */ ! public void removeDocument(String docName) ! throws PermissionDeniedException { ! removeDocument(docName, true); ! } ! ! public abstract void removeDocument(String docName, boolean freeDocId) throws PermissionDeniedException; *************** *** 505,515 **** } - public Occurrences[] scanIndexedElements( - Collection collection, - boolean inclusive) - throws PermissionDeniedException { - throw new RuntimeException("not implemented"); - } - public void readDocumentMetadata(final DocumentImpl doc) { } --- 495,498 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/xmlrpc Modified Files: RpcConnection.java RpcAPI.java RpcServer.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: RpcServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcServer.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** RpcServer.java 2 Jun 2004 11:28:41 -0000 1.37 --- RpcServer.java 8 Jun 2004 08:16:13 -0000 1.38 *************** *** 1,6 **** /* - <<<<<<< RpcServer.java - ======= - <<<<<<< RpcServer.java * eXist Open Source Native XML Database Copyright (C) 2001-03, Wolfgang M. * Meier (me...@if...) --- 1,3 ---- *************** *** 21,49 **** * * $Id$ - ======= - >>>>>>> 1.36 - * eXist Open Source Native XML Database - * Copyright (C) 2001-03, Wolfgang M. Meier (me...@if...) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This library 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - <<<<<<< RpcServer.java - * $Id$ - ======= - * $Id$ - >>>>>>> 1.33 - >>>>>>> 1.36 */ package org.exist.xmlrpc; --- 18,21 ---- *************** *** 61,64 **** --- 33,38 ---- import java.util.Stack; import java.util.Vector; + import java.util.zip.GZIPInputStream; + import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; *************** *** 719,722 **** --- 693,717 ---- } + public String uploadCompressed(User user, byte[] data, int length) + throws EXistException, PermissionDeniedException { + return uploadCompressed(user, null, data, length); + } + + public String uploadCompressed(User user, String file, byte[] data, int length) + throws EXistException, PermissionDeniedException { + LOG.debug("Compressed upload: " + data.length); + RpcConnection con = pool.get(); + try { + data = uncompress(data); + return con.upload(user, data, data.length, file); + } catch (Exception e) { + handleException(e); + return null; + } finally { + con.synchronize(); + pool.release(con); + } + } + public String upload(User user, byte[] data, int length) throws EXistException, PermissionDeniedException { *************** *** 1553,1563 **** } ! private static byte[] compress(byte[] whatToCompress) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ! ZipOutputStream gzos = new ZipOutputStream(baos); ! gzos.setMethod(gzos.DEFLATED); ! gzos.putNextEntry(new ZipEntry(whatToCompress.length + "")); ! gzos.write(whatToCompress); ! gzos.closeEntry(); gzos.finish(); gzos.close(); --- 1548,1562 ---- } ! public static byte[] compress(byte[] whatToCompress) throws IOException { ! return compress(whatToCompress, whatToCompress.length); ! } ! ! public static byte[] compress(byte[] whatToCompress, int length) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ! GZIPOutputStream gzos = new GZIPOutputStream(baos); ! // gzos.setMethod(gzos.DEFLATED); ! // gzos.putNextEntry(new ZipEntry(length + "")); ! gzos.write(whatToCompress, 0, length); ! // gzos.closeEntry(); gzos.finish(); gzos.close(); *************** *** 1565,1580 **** } ! private static byte[] uncompress(byte[] whatToUncompress) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(whatToUncompress); ! ZipInputStream gzis = new ZipInputStream(bais); ! ZipEntry zipentry = gzis.getNextEntry(); ! int len = Integer.parseInt(zipentry.getName()); ! ByteArrayOutputStream baos = new ByteArrayOutputStream(len); byte[] buf = new byte[512]; int bread; while ((bread = gzis.read(buf)) != -1) baos.write(buf, 0, bread); ! gzis.closeEntry(); gzis.close(); return baos.toByteArray(); --- 1564,1579 ---- } ! public static byte[] uncompress(byte[] whatToUncompress) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(whatToUncompress); ! GZIPInputStream gzis = new GZIPInputStream(bais); ! // ZipEntry zipentry = gzis.getNextEntry(); ! // int len = Integer.parseInt(zipentry.getName()); ! ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buf = new byte[512]; int bread; while ((bread = gzis.read(buf)) != -1) baos.write(buf, 0, bread); ! // gzis.closeEntry(); gzis.close(); return baos.toByteArray(); Index: RpcAPI.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcAPI.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** RpcAPI.java 2 Jun 2004 11:28:41 -0000 1.29 --- RpcAPI.java 8 Jun 2004 08:16:13 -0000 1.30 *************** *** 435,438 **** --- 435,444 ---- throws EXistException, PermissionDeniedException; + String uploadCompressed(User user, byte[] data, int length) + throws EXistException, PermissionDeniedException; + + String uploadCompressed(User user, String file, byte[] data, int length) + throws EXistException, PermissionDeniedException; + /** * Parse a file previously uploaded with upload. Index: RpcConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcConnection.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** RpcConnection.java 2 Jun 2004 11:28:41 -0000 1.60 --- RpcConnection.java 8 Jun 2004 08:16:12 -0000 1.61 *************** *** 314,318 **** Hashtable hash; Permission perms; ! for (Iterator i = collection.iterator(); i.hasNext(); ) { doc = (DocumentImpl) i.next(); perms = doc.getPermissions(); --- 314,318 ---- Hashtable hash; Permission perms; ! for (Iterator i = collection.iterator(broker); i.hasNext(); ) { doc = (DocumentImpl) i.next(); perms = doc.getPermissions(); *************** *** 363,367 **** Permission perms = doc.getPermissions(); Hashtable hash = new Hashtable(5); ! hash.put("name", doc.getFileName()); hash.put("owner", perms.getOwner()); hash.put("group", perms.getOwnerGroup()); --- 363,367 ---- Permission perms = doc.getPermissions(); Hashtable hash = new Hashtable(5); ! hash.put("name", resourceName); hash.put("owner", perms.getOwner()); hash.put("group", perms.getOwnerGroup()); *************** *** 419,422 **** --- 419,424 ---- Hashtable styleparam = null; + Collection collection = null; + DocumentImpl doc = null; try { broker = brokerPool.get(user); *************** *** 427,431 **** .getProperty("serialization.indent"); ! DocumentImpl doc = (DocumentImpl) broker.getDocument(name); if (doc == null) { LOG.debug("document " + name + " not found!"); --- 429,442 ---- .getProperty("serialization.indent"); ! int pos = name.lastIndexOf('/'); ! String collName = name.substring(0, pos); ! String docName = name.substring(pos + 1); ! ! collection = broker.getCollection(collName); ! if (collection == null) { ! LOG.debug("collection " + collName + " not found!"); ! return null; ! } ! doc = collection.getDocumentWithLock(broker, docName); if (doc == null) { LOG.debug("document " + name + " not found!"); *************** *** 487,501 **** if (!stylesheet.startsWith("/")) { // make path relative to current collection ! String collection; ! if (doc.getCollection() != null) ! collection = doc.getCollection().getName(); ! else { ! int cp = doc.getFileName().lastIndexOf("/"); ! collection = (cp > 0) ? doc.getFileName() ! .substring(0, cp) : "/"; ! } ! stylesheet = (collection.equals("/") ! ? '/' + stylesheet ! : collection + '/' + stylesheet); } --- 498,502 ---- if (!stylesheet.startsWith("/")) { // make path relative to current collection ! stylesheet = collection.getName() + '/' + stylesheet; } *************** *** 522,525 **** --- 523,528 ---- return null; } finally { + if(collection != null) + collection.releaseDocument(doc); brokerPool.release(broker); } *************** *** 669,673 **** String resource; int p; ! for (Iterator i = collection.iterator(); i.hasNext(); ) { resource = ((DocumentImpl) i.next()).getFileName(); p = resource.lastIndexOf('/'); --- 672,676 ---- String resource; int p; ! for (Iterator i = collection.iterator(broker); i.hasNext(); ) { resource = ((DocumentImpl) i.next()).getFileName(); p = resource.lastIndexOf('/'); *************** *** 746,750 **** Vector tmp; String docName; ! for (Iterator i = collection.iterator(); i.hasNext(); ) { doc = (DocumentImpl) i.next(); perm = doc.getPermissions(); --- 749,753 ---- Vector tmp; String docName; ! for (Iterator i = collection.iterator(broker); i.hasNext(); ) { doc = (DocumentImpl) i.next(); perm = doc.getPermissions(); *************** *** 753,758 **** tmp.addElement(perm.getOwnerGroup()); tmp.addElement(new Integer(perm.getPermissions())); ! docName = doc.getFileName().substring( ! doc.getFileName().lastIndexOf('/') + 1); result.put(docName, tmp); } --- 756,760 ---- tmp.addElement(perm.getOwnerGroup()); tmp.addElement(new Integer(perm.getPermissions())); ! docName = doc.getFileName(); result.put(docName, tmp); } *************** *** 949,953 **** + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(path); if (old != null) throw new PermissionDeniedException( --- 951,955 ---- + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(broker, docName); if (old != null) throw new PermissionDeniedException( *************** *** 1000,1004 **** + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(docName); if (old != null) throw new PermissionDeniedException( --- 1002,1006 ---- + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(broker, docName); if (old != null) throw new PermissionDeniedException( *************** *** 1036,1040 **** + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(docName); if (old != null) throw new PermissionDeniedException( --- 1038,1042 ---- + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(broker, docName); if (old != null) throw new PermissionDeniedException( *************** *** 1187,1191 **** if (((NodeValue) next).getImplementationType() == NodeValue.PERSISTENT_NODE) { p = (NodeProxy) next; ! entry.addElement(p.doc.getFileName()); entry.addElement(Long.toString(p.getGID())); } else { --- 1189,1193 ---- if (((NodeValue) next).getImplementationType() == NodeValue.PERSISTENT_NODE) { p = (NodeProxy) next; ! entry.addElement(p.doc.getCollection().getName() + '/' + p.doc.getFileName()); entry.addElement(Long.toString(p.getGID())); } else { *************** *** 1222,1241 **** } ! public void remove(User user, String docName) throws Exception { DBBroker broker = null; try { broker = brokerPool.get(user); ! int p = docName.lastIndexOf('/'); ! if (p < 0 || p == docName.length() - 1) throw new EXistException("Illegal document path"); ! String collectionName = docName.substring(0, p); Collection collection = broker.getCollection(collectionName); if (collection == null) throw new EXistException("Collection " + collectionName + " not found"); ! DocumentImpl doc = collection.getDocument(docName); if(doc == null) ! throw new EXistException("Document " + docName + " not found"); ! docName = docName.substring(p + 1); if(doc.getResourceType() == DocumentImpl.BINARY_FILE) collection.removeBinaryResource(broker, doc); --- 1224,1243 ---- } ! public void remove(User user, String docPath) throws Exception { DBBroker broker = null; try { broker = brokerPool.get(user); ! int p = docPath.lastIndexOf('/'); ! if (p < 0 || p == docPath.length() - 1) throw new EXistException("Illegal document path"); ! String collectionName = docPath.substring(0, p); ! String docName = docPath.substring(p + 1); Collection collection = broker.getCollection(collectionName); if (collection == null) throw new EXistException("Collection " + collectionName + " not found"); ! DocumentImpl doc = collection.getDocument(broker, docName); if(doc == null) ! throw new EXistException("Document " + docPath + " not found"); if(doc.getResourceType() == DocumentImpl.BINARY_FILE) collection.removeBinaryResource(broker, doc); *************** *** 1622,1626 **** for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); ! docName = p.doc.getFileName(); doctype = p.doc.getDoctype(); if (map.containsKey(docName)) { --- 1624,1628 ---- for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); ! docName = p.doc.getCollection().getName() + '/' + p.doc.getFileName(); doctype = p.doc.getDoctype(); if (map.containsKey(docName)) { *************** *** 1709,1713 **** for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); ! docName = p.doc.getFileName(); doctype = p.doc.getDoctype(); if (map.containsKey(docName)) { --- 1711,1715 ---- for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext(); ) { p = (NodeProxy) i.next(); ! docName = p.doc.getCollection().getName() + '/' + p.doc.getFileName(); doctype = p.doc.getDoctype(); if (map.containsKey(docName)) { *************** *** 1767,1771 **** throw new EXistException("collection " + collectionName + " not found"); ! Occurrences occurrences[] = broker.scanIndexedElements(collection, inclusive); Vector result = new Vector(occurrences.length); --- 1769,1773 ---- throw new EXistException("collection " + collectionName + " not found"); ! Occurrences occurrences[] = broker.getElementIndex().scanIndexedElements(collection, inclusive); Vector result = new Vector(occurrences.length); *************** *** 1927,1935 **** throw new EXistException("Illegal document path"); String collectionName = docPath.substring(0, p); Collection collection = broker.getCollection(collectionName); if (collection == null) throw new EXistException("Collection " + collectionName + " not found"); ! DocumentImpl doc = collection.getDocument(docPath); if(doc == null) throw new EXistException("Document " + docPath + " not found"); --- 1929,1938 ---- throw new EXistException("Illegal document path"); String collectionName = docPath.substring(0, p); + String docName = docPath.substring(p + 1); Collection collection = broker.getCollection(collectionName); if (collection == null) throw new EXistException("Collection " + collectionName + " not found"); ! DocumentImpl doc = collection.getDocument(broker, docName); if(doc == null) throw new EXistException("Document " + docPath + " not found"); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/xquery Modified Files: LocationStep.java ChildSelector.java DescendantSelector.java NodeSelector.java Constants.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LocationStep.java 3 Jun 2004 10:31:36 -0000 1.12 --- LocationStep.java 8 Jun 2004 08:16:09 -0000 1.13 *************** *** 197,206 **** ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { - // DocumentSet docs = contextSet.getDocumentSet(); DocumentSet docs = getDocumentSet(contextSet); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getAttributesByName( currentDocs, test.getName()); } --- 197,205 ---- ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { DocumentSet docs = getDocumentSet(contextSet); if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getElementIndex().getAttributesByName( currentDocs, test.getName()); } *************** *** 231,251 **** return vset; } else { ! // DocumentSet docs = contextSet.getDocumentSet(); DocumentSet docs = getDocumentSet(contextSet); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, ! currentDocs, ! test.getName(), null); } - NodeSet result = - currentSet.selectParentChild(contextSet, NodeSet.DESCENDANT, inPredicate); - // DocumentSet docs = contextSet.getDocumentSet(); - // NodeSelector selector = new ChildSelector(contextSet, inPredicate); - // NodeSet result = context.getBroker().findElementsByTagName( - // ElementValue.ELEMENT, docs, test.getName(), selector - // ); return result; } --- 230,252 ---- return vset; } else { ! NodeSet result = null; DocumentSet docs = getDocumentSet(contextSet); ! if(cacheResults()) { ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().getElementIndex().findElementsByTagName( ! ElementValue.ELEMENT, ! currentDocs, ! test.getName(), null); ! } ! result = ! currentSet.selectParentChild(contextSet, NodeSet.DESCENDANT, inPredicate); ! } else { ! NodeSelector selector = new ChildSelector(contextSet, inPredicate); ! result = context.getBroker().getElementIndex().findElementsByTagName( ! ElementValue.ELEMENT, docs, test.getName(), selector ! ); } return result; } *************** *** 266,270 **** currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); --- 267,271 ---- currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getElementIndex().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); *************** *** 296,300 **** currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); --- 297,301 ---- currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getElementIndex().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); *************** *** 343,347 **** currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); --- 344,348 ---- currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getElementIndex().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); *************** *** 362,366 **** currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); --- 363,367 ---- currentDocs = docs; currentSet = ! (NodeSet) context.getBroker().getElementIndex().findElementsByTagName( ElementValue.ELEMENT, currentDocs, test.getName(), null); *************** *** 406,409 **** --- 407,415 ---- } + protected boolean cacheResults() { + //return getContextDocSet() != null; + return true; + } + /* (non-Javadoc) * @see org.exist.xquery.Step#resetState() Index: ChildSelector.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ChildSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ChildSelector.java 25 Mar 2004 12:50:50 -0000 1.1 --- ChildSelector.java 8 Jun 2004 08:16:09 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery; + import org.exist.dom.DocumentImpl; import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; *************** *** 44,57 **** * @see org.exist.xquery.NodeSelector#match(org.exist.dom.NodeProxy) */ ! public boolean match(NodeProxy node) { NodeProxy p; ! if((p = context.parentWithChild(node.doc, node.gid, true, false, -1)) != null) { if (rememberContext) ! node.addContextNode(p); else ! node.copyContext(p); ! return true; } ! return false; } } --- 45,59 ---- * @see org.exist.xquery.NodeSelector#match(org.exist.dom.NodeProxy) */ ! public NodeProxy match(DocumentImpl doc, long gid) { NodeProxy p; ! if((p = context.parentWithChild(doc, gid, true, false, -1)) != null) { ! NodeProxy newNode = new NodeProxy(doc, gid); if (rememberContext) ! newNode.addContextNode(p); else ! newNode.copyContext(p); ! return newNode; } ! return null; } } Index: Constants.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/Constants.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Constants.java 3 Jun 2004 10:31:36 -0000 1.2 --- Constants.java 8 Jun 2004 08:16:09 -0000 1.3 *************** *** 28,33 **** "ancestor", "ancestor-or-self", ! "attribute", "child", "descendant", "descendant-or-self", --- 28,36 ---- "ancestor", "ancestor-or-self", ! "parent", ! "preceding", ! "preceding-sibling", "child", + "attribute", "descendant", "descendant-or-self", *************** *** 35,41 **** "following-sibling", "namespace", - "parent", - "preceding", - "preceding-sibling", "self", "attribute-descendant" --- 38,41 ---- *************** *** 50,62 **** // Forward axes ! public final static int CHILD_AXIS = 10; ! public final static int ATTRIBUTE_AXIS = 11; ! public final static int DESCENDANT_AXIS = 12; ! public final static int DESCENDANT_SELF_AXIS = 13; ! public final static int FOLLOWING_AXIS = 14; ! public final static int FOLLOWING_SIBLING_AXIS = 15; ! public final static int NAMESPACE_AXIS = 16; ! public final static int SELF_AXIS = 17; ! public final static int DESCENDANT_ATTRIBUTE_AXIS = 18; /** --- 50,62 ---- // Forward axes ! public final static int CHILD_AXIS = 5; ! public final static int ATTRIBUTE_AXIS = 6; ! public final static int DESCENDANT_AXIS = 7; ! public final static int DESCENDANT_SELF_AXIS = 8; ! public final static int FOLLOWING_AXIS = 9; ! public final static int FOLLOWING_SIBLING_AXIS = 10; ! public final static int NAMESPACE_AXIS = 11; ! public final static int SELF_AXIS = 12; ! public final static int DESCENDANT_ATTRIBUTE_AXIS = 13; /** Index: NodeSelector.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/NodeSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeSelector.java 25 Mar 2004 12:50:50 -0000 1.1 --- NodeSelector.java 8 Jun 2004 08:16:09 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery; + import org.exist.dom.DocumentImpl; import org.exist.dom.NodeProxy; *************** *** 31,35 **** public interface NodeSelector { ! public boolean match(NodeProxy node); } --- 32,36 ---- public interface NodeSelector { ! public NodeProxy match(DocumentImpl doc, long gid); } Index: DescendantSelector.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/DescendantSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DescendantSelector.java 25 Mar 2004 12:50:50 -0000 1.1 --- DescendantSelector.java 8 Jun 2004 08:16:09 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery; + import org.exist.dom.DocumentImpl; import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; *************** *** 44,57 **** * @see org.exist.xquery.NodeSelector#match(org.exist.dom.NodeProxy) */ ! public boolean match(NodeProxy node) { NodeProxy p; ! if((p = context.parentWithChild(node.doc, node.gid, false, false, -1)) != null) { if (rememberContext) ! node.addContextNode(p); else ! node.copyContext(p); ! return true; } ! return false; } } --- 45,59 ---- * @see org.exist.xquery.NodeSelector#match(org.exist.dom.NodeProxy) */ ! public NodeProxy match(DocumentImpl doc, long gid) { NodeProxy p; ! if((p = context.parentWithChild(doc, gid, false, false, -1)) != null) { ! NodeProxy newNode = new NodeProxy(doc, gid); if (rememberContext) ! newNode.addContextNode(p); else ! newNode.copyContext(p); ! return newNode; } ! return null; } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/client Modified Files: InteractiveClient.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: InteractiveClient.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/InteractiveClient.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** InteractiveClient.java 28 May 2004 10:54:16 -0000 1.29 --- InteractiveClient.java 8 Jun 2004 08:16:12 -0000 1.30 *************** *** 514,517 **** --- 514,518 ---- if (args[0].equalsIgnoreCase("ls")) { // list collection contents + getResources(); if (properties.getProperty("permissions").equals("true")) { for (int i = 0; i < resources.length; i++) |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/http/webdav/methods Modified Files: Delete.java Move.java Propfind.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: Move.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods/Move.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Move.java 2 Jun 2004 11:31:20 -0000 1.2 --- Move.java 8 Jun 2004 08:16:07 -0000 1.3 *************** *** 162,166 **** return; } ! DocumentImpl oldDoc = destCollection.getDocument(newResourceName); if(oldDoc != null) { boolean overwrite = overwrite(request); --- 162,166 ---- return; } ! DocumentImpl oldDoc = destCollection.getDocument(broker, newResourceName); if(oldDoc != null) { boolean overwrite = overwrite(request); Index: Propfind.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods/Propfind.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Propfind.java 25 May 2004 09:26:04 -0000 1.3 --- Propfind.java 8 Jun 2004 08:16:07 -0000 1.4 *************** *** 202,206 **** if(type == FIND_ALL_PROPERTIES || type == FIND_BY_PROPERTY) { if(resource != null) ! writeResourceProperties(user, searchedProperties, type, resource, serializer, servletPath); else writeCollectionProperties(user, searchedProperties, type, collection, serializer, servletPath, depth, 0); --- 202,206 ---- if(type == FIND_ALL_PROPERTIES || type == FIND_BY_PROPERTY) { if(resource != null) ! writeResourceProperties(user, searchedProperties, type, collection, resource, serializer, servletPath); else writeCollectionProperties(user, searchedProperties, type, collection, serializer, servletPath, depth, 0); *************** *** 292,296 **** for(Iterator i = collection.iterator(broker); i.hasNext(); ) { DocumentImpl doc = (DocumentImpl)i.next(); ! writeResourceProperties(user, searchedProperties, type, doc, serializer, servletPath); } } catch (EXistException e) { --- 292,296 ---- for(Iterator i = collection.iterator(broker); i.hasNext(); ) { DocumentImpl doc = (DocumentImpl)i.next(); ! writeResourceProperties(user, searchedProperties, type, collection, doc, serializer, servletPath); } } catch (EXistException e) { *************** *** 319,323 **** private void writeResourceProperties(User user, DAVProperties searchedProperties, ! int type, DocumentImpl resource, SAXSerializer serializer, String servletPath) throws SAXException { if(!resource.getPermissions().validate(user, Permission.READ)) return; --- 319,323 ---- private void writeResourceProperties(User user, DAVProperties searchedProperties, ! int type, Collection collection, DocumentImpl resource, SAXSerializer serializer, String servletPath) throws SAXException { if(!resource.getPermissions().validate(user, Permission.READ)) return; *************** *** 327,331 **** // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); ! serializer.characters(servletPath + resource.getFileName()); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); --- 327,331 ---- // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); ! serializer.characters(servletPath + collection.getName() + '/' + resource.getFileName()); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); *************** *** 335,343 **** if(shouldIncludeProperty(type, searchedProperties, DISPLAY_NAME_PROP)) { // write D:displayname ! String displayName = resource.getFileName(); ! int p = displayName.lastIndexOf('/'); ! if(p > -1) ! displayName = displayName.substring(p + 1); ! writeSimpleElement(DISPLAY_NAME_PROP, displayName, serializer); } --- 335,339 ---- if(shouldIncludeProperty(type, searchedProperties, DISPLAY_NAME_PROP)) { // write D:displayname ! writeSimpleElement(DISPLAY_NAME_PROP, resource.getFileName(), serializer); } *************** *** 409,413 **** // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); ! String href = servletPath + (resource != null ? resource.getFileName() : collection.getName()); serializer.characters(href); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); --- 405,410 ---- // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); ! String href = servletPath + (resource != null ? collection.getName() + '/' + resource.getFileName() : ! collection.getName()); serializer.characters(href); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); Index: Delete.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods/Delete.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Delete.java 21 May 2004 08:35:42 -0000 1.2 --- Delete.java 8 Jun 2004 08:16:07 -0000 1.3 *************** *** 67,77 **** broker.removeCollection(collection.getName()); } else { - String path = resource.getFileName(); - int p = path.lastIndexOf('/'); - String docName = path.substring(p + 1); if(resource.getResourceType() == DocumentImpl.BINARY_FILE) ! resource.getCollection().removeBinaryResource(broker, docName); else ! resource.getCollection().removeDocument(broker, docName); } } catch (EXistException e) { --- 67,74 ---- broker.removeCollection(collection.getName()); } else { if(resource.getResourceType() == DocumentImpl.BINARY_FILE) ! resource.getCollection().removeBinaryResource(broker, resource.getFileName()); else ! resource.getCollection().removeDocument(broker, resource.getFileName()); } } catch (EXistException e) { |
From: Wolfgang M. M. <wol...@us...> - 2004-06-08 08:16:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29485/src/org/exist/xquery/functions/util Modified Files: DocumentName.java Log Message: * Resolved concurrency conflicts when accessing a collection: avoid dirty reads on the old document while it is being replaced. * The index settings specified in the configuration are now also applied to reindexed document fragments during an XUpdate. * Removed unnecessary data from org.exist.dom.DocumentImpl to reduce its in memory size. * Deferred addition of new documents to collection: when adding a large number of documents, keeping the actual document objects in memory slows down the indexing process. Class Collection now just remembers the document name, not the object itself. Index: DocumentName.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util/DocumentName.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocumentName.java 16 Feb 2004 15:59:37 -0000 1.2 --- DocumentName.java 8 Jun 2004 08:16:12 -0000 1.3 *************** *** 63,68 **** if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! String path = proxy.doc.getFileName(); ! return new StringValue(path.substring(proxy.doc.getCollection().getName().length() + 1)); } return Sequence.EMPTY_SEQUENCE; --- 63,67 ---- if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! return new StringValue(proxy.doc.getFileName()); } return Sequence.EMPTY_SEQUENCE; |