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-23 15:00:27
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19983 Modified Files: conf.xml Log Message: New option to configure allowed fragmentation during xupdate. Index: conf.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/conf.xml,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** conf.xml 23 Jun 2004 14:29:15 -0000 1.53 --- conf.xml 23 Jun 2004 15:00:19 -0000 1.54 *************** *** 90,94 **** be aware that leaving spare ids also limits the maximum size of a document that can be indexed. --> ! <xupdate growth-factor="20" allowed-fragmentation="10"/> <!-- --- 90,94 ---- be aware that leaving spare ids also limits the maximum size of a document that can be indexed. --> ! <xupdate growth-factor="20" allowed-fragmentation="20"/> <!-- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 14:29:24
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12887 Modified Files: conf.xml Log Message: New option to configure allowed fragmentation during xupdate. Index: conf.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/conf.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** conf.xml 25 May 2004 09:25:45 -0000 1.52 --- conf.xml 23 Jun 2004 14:29:15 -0000 1.53 *************** *** 36,41 **** buffer settings for elements_buffers and words_buffers if you have some more memory to waste. --> ! <db-connection database="native" files="webapp/WEB-INF/data" ! pageSize="4096" cacheSize="48M" free_mem_min="10"> <!-- Settings for the database connection pool: --- 36,41 ---- buffer settings for elements_buffers and words_buffers if you have some more memory to waste. --> ! <db-connection database="native" files="webapp/WEB-INF/data" ! pageSize="4096" cacheSize="48M" free_mem_min="5"> <!-- Settings for the database connection pool: *************** *** 50,54 **** <pool min="1" max="20" sync-period="300000"/> ! <watchdog query-timeout="30000" output-size-limit="10000"/> </db-connection> --- 50,54 ---- <pool min="1" max="20" sync-period="300000"/> ! <watchdog query-timeout="-1" output-size-limit="10000"/> </db-connection> *************** *** 90,94 **** be aware that leaving spare ids also limits the maximum size of a document that can be indexed. --> ! <xupdate growth-factor="20"/> <!-- --- 90,94 ---- be aware that leaving spare ids also limits the maximum size of a document that can be indexed. --> ! <xupdate growth-factor="20" allowed-fragmentation="10"/> <!-- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 14:05:58
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7342/src/org/exist/dom Modified Files: AVLTreeNodeSet.java Log Message: Added itemAt method to AVLTreeSet to avoid RuntimeException. Index: AVLTreeNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AVLTreeNodeSet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AVLTreeNodeSet.java 21 Jun 2004 15:27:36 -0000 1.7 --- AVLTreeNodeSet.java 23 Jun 2004 14:05:49 -0000 1.8 *************** *** 45,49 **** */ public org.w3c.dom.Node item(int pos) { ! // TODO Auto-generated method stub return null; } --- 45,54 ---- */ public org.w3c.dom.Node item(int pos) { ! int i = 0; ! for(Iterator it = iterator(); it.hasNext(); i++) { ! NodeProxy p = (NodeProxy) it.next(); ! if(i == pos) ! return p.getNode(); ! } return null; } *************** *** 53,58 **** */ public NodeProxy get(int pos) { ! // TODO Auto-generated method stub ! return null; } --- 58,62 ---- */ public NodeProxy get(int pos) { ! return (NodeProxy)itemAt(pos); } *************** *** 69,73 **** */ public Item itemAt(int pos) { ! throw new RuntimeException("unsupported method: itemAt"); } --- 73,83 ---- */ public Item itemAt(int pos) { ! int i = 0; ! for(Iterator it = iterator(); it.hasNext(); i++) { ! NodeProxy p = (NodeProxy) it.next(); ! if(i == pos) ! return p; ! } ! return null; } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:47:07
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22941/src/org/exist/xquery/functions Modified Files: FunDoc.java ExtDocument.java ExtCollection.java Log Message: Fixed some node kind tests. Index: ExtDocument.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtDocument.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExtDocument.java 2 Jun 2004 11:34:36 -0000 1.4 --- ExtDocument.java 23 Jun 2004 12:46:35 -0000 1.5 *************** *** 45,48 **** --- 45,49 ---- import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; + import org.w3c.dom.Node; /** *************** *** 139,143 **** result = new ExtArrayNodeSet(docs.getLength(), 1); for (Iterator i = docs.iterator(); i.hasNext();) { ! result.add(new NodeProxy((DocumentImpl) i.next(), -1)); } } --- 140,144 ---- result = new ExtArrayNodeSet(docs.getLength(), 1); for (Iterator i = docs.iterator(); i.hasNext();) { ! result.add(new NodeProxy((DocumentImpl) i.next(), -1, Node.DOCUMENT_NODE)); } } Index: FunDoc.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunDoc.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FunDoc.java 2 Jun 2004 11:34:36 -0000 1.4 --- FunDoc.java 23 Jun 2004 12:46:35 -0000 1.5 *************** *** 39,42 **** --- 39,43 ---- import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; + import org.w3c.dom.Node; /** *************** *** 114,118 **** dlock.acquire(Lock.READ_LOCK); cachedPath = path; ! cachedNode = new NodeProxy(doc, -1); return cachedNode; } catch (PermissionDeniedException e) { --- 115,119 ---- dlock.acquire(Lock.READ_LOCK); cachedPath = path; ! cachedNode = new NodeProxy(doc, -1, Node.DOCUMENT_NODE); return cachedNode; } catch (PermissionDeniedException e) { Index: ExtCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtCollection.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExtCollection.java 2 Jun 2004 11:34:36 -0000 1.4 --- ExtCollection.java 23 Jun 2004 12:46:35 -0000 1.5 *************** *** 46,49 **** --- 46,50 ---- import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; + import org.w3c.dom.Node; /** *************** *** 115,119 **** try { dlock.acquire(Lock.READ_LOCK); ! result.add(new NodeProxy(doc, -1)); } catch (LockException e) { LOG.info("Could not acquire read lock on document " + doc.getFileName()); --- 116,120 ---- try { dlock.acquire(Lock.READ_LOCK); ! result.add(new NodeProxy(doc, -1, Node.DOCUMENT_NODE)); } catch (LockException e) { LOG.info("Could not acquire read lock on document " + doc.getFileName()); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:46:59
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22941/src/org/exist/xquery Modified Files: XQuery.java Log Message: Fixed some node kind tests. Index: XQuery.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQuery.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XQuery.java 17 May 2004 09:55:48 -0000 1.1 --- XQuery.java 23 Jun 2004 12:46:35 -0000 1.2 *************** *** 84,87 **** --- 84,88 ---- AST ast = parser.getAST(); + // LOG.debug("Generated AST: " + ast.toStringTree()); PathExpr expr = new PathExpr(context); treeParser.xpath(ast, expr); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:46:43
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22941/src/org/exist Modified Files: Indexer.java Log Message: Fixed some node kind tests. Index: Indexer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/Indexer.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Indexer.java 8 Jun 2004 08:16:13 -0000 1.10 --- Indexer.java 23 Jun 2004 12:46:34 -0000 1.11 *************** *** 32,36 **** import javax.xml.parsers.SAXParserFactory; - import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.exist.dom.AttrImpl; --- 32,35 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:45:23
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22580/src/org/exist/storage/store Modified Files: DOMFile.java Log Message: Added an automatic defragmentation method to the XUpdate implementation. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** DOMFile.java 21 Jun 2004 15:27:35 -0000 1.34 --- DOMFile.java 23 Jun 2004 12:45:13 -0000 1.35 *************** *** 418,421 **** --- 418,423 ---- */ private RecordPos splitDataPage(DocumentImpl doc, RecordPos rec) { + if(currentDocument != null) + currentDocument.incSplitCount(); // check if a split is really required boolean requireSplit = false; *************** *** 596,603 **** rec.page.getPageHeader().setRecordCount(countRecordsInPage(rec.page)); rec.offset = rec.page.len; - // if(currentDocument != null) { - // currentDocument.incSplitCount(); - // System.out.println(currentDocument.getFileName() + " split: " + currentDocument.getSplitCount()); - // } return rec; } --- 598,601 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:45:23
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22580/src/org/exist/storage/serializers Modified Files: NativeSerializer.java Log Message: Added an automatic defragmentation method to the XUpdate implementation. Index: NativeSerializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers/NativeSerializer.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** NativeSerializer.java 21 Jun 2004 15:27:37 -0000 1.24 --- NativeSerializer.java 23 Jun 2004 12:45:12 -0000 1.25 *************** *** 110,114 **** throws SAXException { long start = System.currentTimeMillis(); ! setDocument((DocumentImpl) doc); NodeList children = doc.getChildNodes(); if (generateDocEvent) contentHandler.startDocument(); --- 110,114 ---- throws SAXException { long start = System.currentTimeMillis(); ! setDocument(doc); NodeList children = doc.getChildNodes(); if (generateDocEvent) contentHandler.startDocument(); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:45:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22580/src/org/exist/storage Modified Files: NativeElementIndex.java DBBroker.java NativeBroker.java Log Message: Added an automatic defragmentation method to the XUpdate implementation. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** NativeBroker.java 21 Jun 2004 15:27:34 -0000 1.82 --- NativeBroker.java 23 Jun 2004 12:45:12 -0000 1.83 *************** *** 579,582 **** --- 579,589 ---- } + /** + * Release the collection id assigned to a collection so it can be + * reused later. + * + * @param id + * @throws PermissionDeniedException + */ protected void freeCollection(short id) throws PermissionDeniedException { // LOG.debug("freeing collection " + id); *************** *** 606,609 **** --- 613,623 ---- } + /** + * Get the next free collection id. If a collection is removed, its collection id + * is released so it can be reused. + * + * @return + * @throws ReadOnlyException + */ protected short getFreeCollectionId() throws ReadOnlyException { short freeCollectionId = -1; *************** *** 633,636 **** --- 647,656 ---- } + /** + * Get the next available unique collection id. + * + * @return + * @throws ReadOnlyException + */ protected short getNextCollectionId() throws ReadOnlyException { short nextCollectionId = getFreeCollectionId(); *************** *** 658,661 **** --- 678,688 ---- } + /** + * Release the document id reserved for a document so it + * can be reused. + * + * @param id + * @throws PermissionDeniedException + */ protected void freeDocument(int id) throws PermissionDeniedException { // LOG.debug("freeing document " + id); *************** *** 685,688 **** --- 712,722 ---- } + /** + * Get the next unused document id. If a document is removed, its doc id is + * released, so it can be reused. + * + * @return + * @throws ReadOnlyException + */ protected int getFreeDocId() throws ReadOnlyException { int freeDocId = -1; *************** *** 1153,1157 **** new NodeProxy(oldDoc, n.getGID(), n.getInternalAddress())); iterator.next(); ! copyNodes(iterator, n, new NodePath(), newDoc); } flush(); --- 1187,1191 ---- new NodeProxy(oldDoc, n.getGID(), n.getInternalAddress())); iterator.next(); ! copyNodes(iterator, n, new NodePath(), newDoc, true); } flush(); *************** *** 1159,1163 **** } ! public void defrag(final DocumentImpl doc) throws PermissionDeniedException { LOG.debug("--------------------> Defragmenting document " + doc.getFileName()); final long start = System.currentTimeMillis(); --- 1193,1197 ---- } ! public void defrag(final DocumentImpl doc) { LOG.debug("--------------------> Defragmenting document " + doc.getFileName()); final long start = System.currentTimeMillis(); *************** *** 1165,1169 **** // dropping old index elementIndex.dropIndex(doc); - textEngine.dropIndex(doc); // dropping dom index NodeRef ref = new NodeRef(doc.getDocId()); --- 1199,1202 ---- *************** *** 1190,1193 **** --- 1223,1227 ---- DocumentImpl tempDoc = new DocumentImpl(this, doc.getFileName(), doc.getCollection()); tempDoc.copyOf(doc); + tempDoc.setDocId(doc.getDocId()); Iterator iterator; *************** *** 1200,1208 **** new NodeProxy(doc, n.getGID(), n.getInternalAddress())); iterator.next(); ! copyNodes(iterator, n, new NodePath(), tempDoc); } flush(); - LOG.debug("Removing old dom..."); new DOMTransaction(this, domDb) { public Object start() { --- 1234,1241 ---- new NodeProxy(doc, n.getGID(), n.getInternalAddress())); iterator.next(); ! copyNodes(iterator, n, new NodePath(), tempDoc, false); } flush(); new DOMTransaction(this, domDb) { public Object start() { *************** *** 1215,1226 **** doc.copyChildren(tempDoc); saveCollection(doc.getCollection()); LOG.debug("Defragmentation took " + (System.currentTimeMillis() - start) + "ms."); } catch (ReadOnlyException e) { ! throw new PermissionDeniedException(DATABASE_IS_READ_ONLY); ! } } ! private void copyNodes(Iterator iterator, NodeImpl node, NodePath currentPath, DocumentImpl newDoc) { if (node.getNodeType() == Node.ELEMENT_NODE) currentPath.addComponent(node.getNodeName()); --- 1248,1268 ---- doc.copyChildren(tempDoc); + doc.setSplitCount(0); + doc.setAddress(-1); + doc.setPageCount(tempDoc.getPageCount()); + LOG.debug("New doc size: " + doc.getContentLength()); + storeDocument(doc); + saveCollection(doc.getCollection()); LOG.debug("Defragmentation took " + (System.currentTimeMillis() - start) + "ms."); } catch (ReadOnlyException e) { ! LOG.warn(DATABASE_IS_READ_ONLY, e); ! } catch (PermissionDeniedException e) { ! LOG.warn(DATABASE_IS_READ_ONLY, e); ! } } ! private void copyNodes(Iterator iterator, NodeImpl node, NodePath currentPath, ! DocumentImpl newDoc, boolean index) { if (node.getNodeType() == Node.ELEMENT_NODE) currentPath.addComponent(node.getNodeName()); *************** *** 1228,1232 **** node.setOwnerDocument(newDoc); node.setInternalAddress(-1); ! store(node, currentPath); node.setOwnerDocument(doc); --- 1270,1276 ---- node.setOwnerDocument(newDoc); node.setInternalAddress(-1); ! store(node, currentPath, index); ! if(node.getGID() == 1) ! newDoc.appendChild(node); node.setOwnerDocument(doc); *************** *** 1251,1255 **** "; last = " + lastChildId + "; children = " + node.getChildCount()); child.setGID(gid); ! copyNodes(iterator, child, currentPath, newDoc); } } --- 1295,1299 ---- "; last = " + lastChildId + "; children = " + node.getChildCount()); child.setGID(gid); ! copyNodes(iterator, child, currentPath, newDoc, index); } } *************** *** 2067,2071 **** * fulltext-indexed). */ ! public void store(final NodeImpl node, NodePath currentPath) { // first, check available memory if (nodesCount > MEM_LIMIT_CHECK) { --- 2111,2115 ---- * fulltext-indexed). */ ! public void store(final NodeImpl node, NodePath currentPath, boolean index) { // first, check available memory if (nodesCount > MEM_LIMIT_CHECK) { *************** *** 2135,2144 **** // check if attribute value should be fulltext-indexed // by calling IndexPaths.match(path) ! boolean indexAttribs = true; ! if(idx != null) { if(idx.getIncludeAttributes()) { ! currentPath.addComponent('@' + nodeName); ! indexAttribs = idx.match(currentPath); ! currentPath.removeLastComponent(); } else indexAttribs = false; --- 2179,2188 ---- // check if attribute value should be fulltext-indexed // by calling IndexPaths.match(path) ! boolean indexAttribs = index; ! if(index && idx != null) { if(idx.getIncludeAttributes()) { ! currentPath.addComponent('@' + nodeName); ! indexAttribs = idx.match(currentPath); ! currentPath.removeLastComponent(); } else indexAttribs = false; *************** *** 2158,2162 **** // 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); --- 2202,2206 ---- // check if this textual content should be fulltext-indexed // by calling IndexPaths.match(path) ! if (index && (idx == null || idx.match(currentPath))){ boolean valore = (idx == null ? false : idx.preserveContent(currentPath)); textEngine.storeText(idx, (TextImpl) node, valore); Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NativeElementIndex.java 16 Jun 2004 13:36:54 -0000 1.30 --- NativeElementIndex.java 23 Jun 2004 12:45:12 -0000 1.31 *************** *** 110,114 **** public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname, NodeSelector selector) { ! // final long start = System.currentTimeMillis(); final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256); --- 110,114 ---- public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname, NodeSelector selector) { ! final long start = System.currentTimeMillis(); final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256); *************** *** 167,170 **** --- 167,171 ---- len = is.readInt(); if ((doc = docs.getDoc(docId)) == null) { + LOG.debug("skipping doc " + docId); is.skip(len * 4); continue; *************** *** 195,206 **** } // result.sort(); ! // LOG.debug( ! // "found " ! // + qname ! // + ": " ! // + result.getLength() ! // + " in " ! // + (System.currentTimeMillis() - start) ! // + "ms."); return result; } --- 196,207 ---- } // result.sort(); ! LOG.debug( ! "found " ! + qname ! + ": " ! + result.getLength() ! + " in " ! + (System.currentTimeMillis() - start) ! + "ms."); return result; } Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** DBBroker.java 21 Jun 2004 15:27:34 -0000 1.34 --- DBBroker.java 23 Jun 2004 12:45:12 -0000 1.35 *************** *** 55,60 **** /** ! * This is the base class for all database backends. All other components rely ! * on the methods defined here. * *@author Wolfgang Meier <wol...@ex...> --- 55,60 ---- /** ! * This is the base class for all database backends. All the basic database operations like storing, ! * removing or index access are provided by subclasses of this class. * *@author Wolfgang Meier <wol...@ex...> *************** *** 92,95 **** --- 92,103 ---- protected int xupdateGrowthFactor = 1; + protected int docFragmentationLimit = 25; + + /** + * Save the global symbol table. The global symbol table stores + * QNames and namespace/prefix mappings. + * + * @throws EXistException + */ protected void saveSymbols() throws EXistException { synchronized (symbols) { *************** *** 110,114 **** } } ! protected void loadSymbols() throws EXistException { try { --- 118,128 ---- } } ! ! /** ! * Read the global symbol table. The global symbol table stores ! * QNames and namespace/prefix mappings. ! * ! * @throws EXistException ! */ protected void loadSymbols() throws EXistException { try { *************** *** 155,170 **** --- 169,202 ---- if ((xupdateGrowthFactor = config.getInteger("xupdate.growth-factor")) < 0) xupdateGrowthFactor = 1; + if ((docFragmentationLimit = config.getInteger("xupdate.fragmentation")) < 0) + docFragmentationLimit = 50; + this.pool = pool; xqueryService = new XQuery(this); } + /** + * Set the user that is currently using this DBBroker object. + * + * @param user + */ public void setUser(User user) { this.user = user; } + /** + * Get the user that is currently using this DBBroker object. + * + * @return + */ public User getUser() { return user; } + /** + * Returns a reference to the global {@link XQuery} service. + * + * @return + */ public XQuery getXQueryService() { return xqueryService; *************** *** 372,375 **** --- 404,413 ---- throws PermissionDeniedException; + /** + * Reindex a collection. + * + * @param collectionName + * @throws PermissionDeniedException + */ public abstract void reindex(String collectionName) throws PermissionDeniedException; *************** *** 405,414 **** * fulltext-indexed). */ ! public abstract void store(NodeImpl node, NodePath currentPath); /** ! * Store a document into the database. * ! *@param doc Description of the Parameter */ public abstract void storeDocument(DocumentImpl doc); --- 443,457 ---- * fulltext-indexed). */ ! public abstract void store(NodeImpl node, NodePath currentPath, boolean index); + public void store(NodeImpl node, NodePath currentPath) { + store(node, currentPath, true); + } + /** ! * Store a document into the database. This method will save the document ! * metadata and add the document to the collection. * ! *@param doc */ public abstract void storeDocument(DocumentImpl doc); *************** *** 432,442 **** throws PermissionDeniedException, LockException; public abstract void moveResource(DocumentImpl doc, Collection destination, String newName) throws PermissionDeniedException, LockException; public abstract void copyResource(DocumentImpl doc, Collection destination, String newName) throws PermissionDeniedException, LockException; ! public abstract void defrag(DocumentImpl doc) throws PermissionDeniedException; public void sync() { --- 475,501 ---- throws PermissionDeniedException, LockException; + /** + * Move a resource to the destination collection and rename it. + * + * @param doc the resource to move + * @param destination the destination collection + * @param new Name the new name the resource should have in the destination collection + */ public abstract void moveResource(DocumentImpl doc, Collection destination, String newName) throws PermissionDeniedException, LockException; + /** + * Copy a resource to the destination collection and rename it. + * + * @param doc the resource to copy + * @param destination the destination collection + * @param newName the new name the resource should have in the destination collection + * @throws PermissionDeniedException + * @throws LockException + */ public abstract void copyResource(DocumentImpl doc, Collection destination, String newName) throws PermissionDeniedException, LockException; ! public abstract void defrag(DocumentImpl doc); public void sync() { *************** *** 447,454 **** /** ! * Update a node's data. This method is only used by the NativeBroker. To ! * keep nodes in a correct sequential order, it sometimes needs to update a ! * previous written node. Warning: don't use it for other purposes. ! * RelationalBroker does not implement this method. * *@param node Description of the Parameter --- 506,511 ---- /** ! * Update a node's data. To keep nodes in a correct sequential order, it is sometimes ! * necessary to update a previous written node. Warning: don't use it for other purposes. * *@param node Description of the Parameter *************** *** 501,505 **** /** ! * get all the documents in this database matching the given document-type's name.@param doctypeName Description of the Parameter@param user Description of the Parameter@return The documentsByDoctype value */ public abstract DocumentSet getDocumentsByDoctype( --- 558,562 ---- /** ! * */ public abstract DocumentSet getDocumentsByDoctype( *************** *** 523,526 **** --- 580,587 ---- } + public int getFragmentationLimit() { + return docFragmentationLimit; + } + public abstract int getPageSize(); } \ No newline at end of file |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:44:30
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22394/src/org/exist/dom Modified Files: AbstractNodeSet.java DocumentImpl.java NodeProxy.java Log Message: Added an automatic defragmentation method to the XUpdate implementation. Index: AbstractNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AbstractNodeSet.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AbstractNodeSet.java 22 Jun 2004 13:44:20 -0000 1.21 --- AbstractNodeSet.java 23 Jun 2004 12:44:09 -0000 1.22 *************** *** 442,446 **** final Iterator ia = al.iterator(); final Iterator ib = iterator(); ! final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); // check if one of the node sets is empty --- 442,446 ---- final Iterator ia = al.iterator(); final Iterator ib = iterator(); ! // final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); // check if one of the node sets is empty *************** *** 505,509 **** } } ! LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); return result; } --- 505,509 ---- } } ! // LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); return result; } *************** *** 513,517 **** final Iterator ia = al.iterator(); final Iterator ib = iterator(); ! final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); --- 513,517 ---- final Iterator ia = al.iterator(); final Iterator ib = iterator(); ! // final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); *************** *** 570,574 **** } } ! LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); return result; } --- 570,574 ---- } } ! // LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); return result; } Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** DocumentImpl.java 22 Jun 2004 10:31:38 -0000 1.44 --- DocumentImpl.java 23 Jun 2004 12:44:17 -0000 1.45 *************** *** 96,100 **** protected int pageCount = 0; ! // protected transient int splitCount = 0; // number of levels in this DOM tree --- 96,100 ---- protected int pageCount = 0; ! protected transient int splitCount = 0; // number of levels in this DOM tree *************** *** 107,113 **** protected Permission permissions = new Permission(0754); - // storage address for the document metadata - // protected long address = -1; - // arity of the tree at every level protected int treeLevelOrder[] = new int[15]; --- 107,110 ---- *************** *** 906,909 **** --- 903,914 ---- } + /** + * Returns the estimated size of the data in this document. + * + * As an estimation, the number of pages occupied by the document + * is multiplied with the current page size. + * + * @return + */ public int getContentLength() { checkAvail(); *************** *** 911,914 **** --- 916,933 ---- } + /** + * Returns the number of pages currently occupied by this document. + * + * @return + */ + public int getPageCount() { + checkAvail(); + return pageCount; + } + + public void setPageCount(int count) { + pageCount = count; + } + private void resizeChildList() { long[] newChildList = new long[children]; *************** *** 918,931 **** } ! // public void incSplitCount() { ! // splitCount++; ! // } ! // ! // public int getSplitCount() { ! // return splitCount; ! // } ! // ! // public void setSplitCount(int count) { ! // splitCount = count; ! // } } --- 937,950 ---- } ! public void incSplitCount() { ! splitCount++; ! } ! ! public int getSplitCount() { ! return splitCount; ! } ! ! public void setSplitCount(int count) { ! splitCount = count; ! } } Index: NodeProxy.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeProxy.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NodeProxy.java 8 Jun 2004 08:16:08 -0000 1.32 --- NodeProxy.java 23 Jun 2004 12:44:17 -0000 1.33 *************** *** 503,506 **** --- 503,508 ---- case Node.COMMENT_NODE : return Type.COMMENT; + case Node.DOCUMENT_NODE: + return Type.DOCUMENT; default : return Type.NODE; // unknown type |
From: Wolfgang M. M. <wol...@us...> - 2004-06-23 12:43:14
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22261/src/org/exist/xupdate Modified Files: Append.java Insert.java Rename.java Remove.java Modification.java Update.java Log Message: Added an automatic defragmentation method to the XUpdate implementation. Index: Update.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Update.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Update.java 16 Jun 2004 13:36:53 -0000 1.15 --- Update.java 23 Jun 2004 12:43:05 -0000 1.16 *************** *** 79,82 **** --- 79,83 ---- DocumentImpl doc = null; Collection collection = null, prevCollection = null; + DocumentSet modifiedDocs = new DocumentSet(); for (int i = 0; i < ql.length; i++) { node = ql[i]; *************** *** 87,90 **** --- 88,92 ---- doc = (DocumentImpl) node.getOwnerDocument(); doc.setIndexListener(listener); + modifiedDocs.add(doc); collection = doc.getCollection(); if (!doc.getPermissions().validate(broker.getUser(), *************** *** 137,140 **** --- 139,143 ---- } if (doc != null) doc.getBroker().saveCollection(collection); + checkFragmentation(modifiedDocs); } finally { unlockDocuments(); Index: Rename.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Rename.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Rename.java 16 Jun 2004 13:36:53 -0000 1.15 --- Rename.java 23 Jun 2004 12:43:05 -0000 1.16 *************** *** 70,73 **** --- 70,74 ---- DocumentImpl doc = null; Collection collection = null, prevCollection = null; + DocumentSet modifiedDocs = new DocumentSet(); NodeImpl node; NodeImpl parent; *************** *** 90,93 **** --- 91,95 ---- "permission denied to update document"); doc.setIndexListener(listener); + modifiedDocs.add(doc); parent = (NodeImpl) node.getParentNode(); switch (node.getNodeType()) { *************** *** 113,116 **** --- 115,119 ---- } if (doc != null) doc.getBroker().saveCollection(collection); + checkFragmentation(modifiedDocs); } finally { unlockDocuments(); Index: Insert.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Insert.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Insert.java 16 Jun 2004 13:36:53 -0000 1.15 --- Insert.java 23 Jun 2004 12:43:05 -0000 1.16 *************** *** 80,83 **** --- 80,84 ---- DocumentImpl doc = null; Collection collection = null, prevCollection = null; + DocumentSet modifiedDocs = new DocumentSet(); int len = children.getLength(); LOG.debug("found " + len + " nodes to insert"); *************** *** 93,96 **** --- 94,98 ---- throw new PermissionDeniedException( "permission to remove document denied"); + modifiedDocs.add(doc); parent = (NodeImpl) node.getParentNode(); switch (mode) { *************** *** 107,110 **** --- 109,113 ---- } if (doc != null) doc.getBroker().saveCollection(collection); + checkFragmentation(modifiedDocs); return ql.length; } finally { Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Modification.java 17 Jun 2004 13:19:31 -0000 1.28 --- Modification.java 23 Jun 2004 12:43:05 -0000 1.29 *************** *** 36,40 **** import org.exist.dom.NodeIndexListener; import org.exist.dom.NodeSet; - import org.exist.dom.XMLUtil; import org.exist.security.PermissionDeniedException; import org.exist.storage.DBBroker; --- 36,39 ---- *************** *** 50,54 **** import org.exist.xquery.value.Sequence; import org.exist.xquery.value.Type; - import org.w3c.dom.DocumentFragment; import org.w3c.dom.NodeList; --- 49,52 ---- *************** *** 202,205 **** --- 200,219 ---- } + /** + * Check if any of the modified documents needs defragmentation. + * + * Defragmentation will take place if the number of split pages in the + * document exceeds the limit defined in the configuration file. + * + * @param docs + */ + protected void checkFragmentation(DocumentSet docs) { + for(Iterator i = docs.iterator(); i.hasNext(); ) { + DocumentImpl next = (DocumentImpl) i.next(); + if(next.getSplitCount() > broker.getFragmentationLimit()) + broker.defrag(next); + } + } + public String toString() { StringBuffer buf = new StringBuffer(); Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Append.java 16 Jun 2004 13:36:53 -0000 1.17 --- Append.java 23 Jun 2004 12:43:05 -0000 1.18 *************** *** 72,76 **** IndexListener listener = new IndexListener(ql); Collection collection = null, prevCollection = null; ! DocumentImpl doc = null, prevDoc = null; NodeImpl node; for(int i = 0; i < ql.length; i++) { --- 72,77 ---- IndexListener listener = new IndexListener(ql); Collection collection = null, prevCollection = null; ! DocumentImpl doc = null; ! DocumentSet modifiedDocs = new DocumentSet(); NodeImpl node; for(int i = 0; i < ql.length; i++) { *************** *** 78,84 **** doc = (DocumentImpl) node.getOwnerDocument(); doc.setIndexListener(listener); collection = doc.getCollection(); ! if (prevCollection != null && collection != prevCollection) ! doc.getBroker().saveCollection(prevCollection); if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); --- 79,87 ---- doc = (DocumentImpl) node.getOwnerDocument(); doc.setIndexListener(listener); + modifiedDocs.add(doc); collection = doc.getCollection(); ! if (prevCollection != null && collection != prevCollection) { ! broker.saveCollection(prevCollection); ! } if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); *************** *** 89,93 **** } if (doc != null) ! doc.getBroker().saveCollection(collection); return ql.length; } finally { --- 92,97 ---- } if (doc != null) ! broker.saveCollection(collection); ! checkFragmentation(modifiedDocs); return ql.length; } finally { Index: Remove.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Remove.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Remove.java 16 Jun 2004 09:21:32 -0000 1.13 --- Remove.java 23 Jun 2004 12:43:05 -0000 1.14 *************** *** 66,69 **** --- 66,70 ---- DocumentImpl doc = null; Collection collection = null, prevCollection = null; + DocumentSet modifiedDocs = new DocumentSet(); for (int i = 0; i < ql.length; i++) { node = ql[i]; *************** *** 75,80 **** collection = doc.getCollection(); if (prevCollection != null && collection != prevCollection) ! doc.getBroker().saveCollection(prevCollection); doc.setIndexListener(listener); parent = node.getParentNode(); if (parent.getNodeType() != Node.ELEMENT_NODE) { --- 76,82 ---- collection = doc.getCollection(); if (prevCollection != null && collection != prevCollection) ! broker.saveCollection(prevCollection); doc.setIndexListener(listener); + modifiedDocs.add(doc); parent = node.getParentNode(); if (parent.getNodeType() != Node.ELEMENT_NODE) { *************** *** 89,93 **** prevCollection = collection; } ! if (doc != null) doc.getBroker().saveCollection(collection); return ql.length; } finally { --- 91,96 ---- prevCollection = collection; } ! if (doc != null) broker.saveCollection(collection); ! checkFragmentation(modifiedDocs); return ql.length; } finally { |
From: Giulio V. <gva...@us...> - 2004-06-22 14:46:34
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/backup In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20968/src/org/exist/backup Modified Files: Backup.java Log Message: store into backup the creation/modified date/time. For collection only the creation date/time Index: Backup.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/backup/Backup.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Backup.java 14 Apr 2004 12:17:24 -0000 1.13 --- Backup.java 22 Jun 2004 14:46:26 -0000 1.14 *************** *** 47,50 **** --- 47,52 ---- import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.XMLResource; + import org.exist.xmldb.EXistResource; + import org.exist.xmldb.CollectionImpl; public class Backup { *************** *** 142,145 **** --- 144,148 ---- serializer.startPrefixMapping("", NS); // write <collection> element + CollectionImpl cur = (CollectionImpl)current; AttributesImpl attr = new AttributesImpl(); attr.addAttribute(NS, "name", "name", "CDATA", current.getName()); *************** *** 152,155 **** --- 155,164 ---- "CDATA", Integer.toOctalString(currentPerms.getPermissions())); + attr.addAttribute( + NS, + "created", + "created", + "CDATA", + cur.getCreationTime().toString()); serializer.startElement(NS, "collection", "collection", attr); *************** *** 193,198 **** } } ! // store permissions attr.clear(); attr.addAttribute(NS, "type", "type", "CDATA", resource.getResourceType()); --- 202,208 ---- } } + EXistResource ris = (EXistResource)resource; ! //store permissions attr.clear(); attr.addAttribute(NS, "type", "type", "CDATA", resource.getResourceType()); *************** *** 206,209 **** --- 216,232 ---- "CDATA", Integer.toOctalString(perms[i].getPermissions())); + attr.addAttribute( + NS, + "created", + "created", + "CDATA", + ris.getCreationTime().toString() ); + attr.addAttribute( + NS, + "modified", + "modified", + "CDATA", + ris.getLastModificationTime().toString() ); + serializer.startElement(NS, "resource", "resource", attr); serializer.endElement(NS, "resource", "resource"); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 13:44:29
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27830/src/org/exist/dom Modified Files: AbstractNodeSet.java Log Message: Fixed NullPointerException in quickSelectParentChild Index: AbstractNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AbstractNodeSet.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AbstractNodeSet.java 22 Jun 2004 09:00:53 -0000 1.20 --- AbstractNodeSet.java 22 Jun 2004 13:44:20 -0000 1.21 *************** *** 375,379 **** boolean rememberContext) { if(!(al instanceof VirtualNodeSet)) ! return quickSelectAncestorDescendant(al, mode, rememberContext); NodeProxy n, p; // long start = System.currentTimeMillis(); --- 375,379 ---- boolean rememberContext) { if(!(al instanceof VirtualNodeSet)) ! return quickSelectAncestorDescendant(al, mode, includeSelf, rememberContext); NodeProxy n, p; // long start = System.currentTimeMillis(); *************** *** 438,442 **** * @return */ ! private NodeSet quickSelectAncestorDescendant(NodeSet al, int mode, boolean rememberContext) { final NodeSet result = new ExtArrayNodeSet(); final Iterator ia = al.iterator(); --- 438,442 ---- * @return */ ! private NodeSet quickSelectAncestorDescendant(NodeSet al, int mode, boolean includeSelf, boolean rememberContext) { final NodeSet result = new ExtArrayNodeSet(); final Iterator ia = al.iterator(); *************** *** 444,447 **** --- 444,451 ---- final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); + // check if one of the node sets is empty + if(na == null || nb == null) + return result; + long pa, pb; while (true) { *************** *** 463,466 **** --- 467,471 ---- int la = na.doc.getTreeLevel(pa); int lb = nb.doc.getTreeLevel(pb); + boolean foundSelf = la == lb; while (la < lb) { pb = XMLUtil.getParentId(nb.doc, pb, lb); *************** *** 478,493 **** break; } else { ! if(mode == NodeSet.DESCENDANT) { ! if (rememberContext) ! nb.addContextNode(na); ! else ! nb.copyContext(na); ! result.add(nb); ! } else { ! if (rememberContext) ! na.addContextNode(nb); ! else ! na.copyContext(nb); ! result.add(na); } if (ib.hasNext()) --- 483,500 ---- break; } else { ! if(!foundSelf || includeSelf) { ! if(mode == NodeSet.DESCENDANT) { ! if (rememberContext) ! nb.addContextNode(na); ! else ! nb.copyContext(na); ! result.add(nb); ! } else { ! if (rememberContext) ! na.addContextNode(nb); ! else ! na.copyContext(nb); ! result.add(na); ! } } if (ib.hasNext()) *************** *** 508,511 **** --- 515,522 ---- final long start = System.currentTimeMillis(); NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); + + // check if one of the node sets is empty + if(na == null || nb == null) + return result; long pa, pb; while (true) { |
From: Giulio V. <gva...@us...> - 2004-06-22 11:05:59
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31044/src/org/exist/xquery/value Modified Files: DateTimeValue.java Log Message: Index: DateTimeValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/DateTimeValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DateTimeValue.java 28 May 2004 10:54:10 -0000 1.2 --- DateTimeValue.java 22 Jun 2004 11:05:21 -0000 1.3 *************** *** 71,74 **** --- 71,83 ---- } + public DateTimeValue(long milliseconds) { + calendar = new GregorianCalendar(); + tzOffset = + (calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) + / 60000; + calendar.setTimeInMillis(milliseconds); + date = calendar.getTime(); + } + public DateTimeValue(String dateTime) throws XPathException { Perl5Util util = new Perl5Util(); |
From: Giulio V. <gva...@us...> - 2004-06-22 11:05:44
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31044/src/org/exist/xquery/functions/xmldb Modified Files: XMLDBCreated.java XMLDBLastModified.java Log Message: Index: XMLDBLastModified.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb/XMLDBLastModified.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLDBLastModified.java 16 Apr 2004 14:44:25 -0000 1.2 --- XMLDBLastModified.java 22 Jun 2004 11:05:20 -0000 1.3 *************** *** 65,69 **** if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! return new DateTimeValue(proxy.doc.getLastModified(),0); } return Sequence.EMPTY_SEQUENCE; --- 65,69 ---- if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! return new DateTimeValue(proxy.doc.getLastModified()); } return Sequence.EMPTY_SEQUENCE; Index: XMLDBCreated.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb/XMLDBCreated.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLDBCreated.java 26 Mar 2004 11:04:01 -0000 1.1 --- XMLDBCreated.java 22 Jun 2004 11:05:20 -0000 1.2 *************** *** 65,69 **** if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! return new DateTimeValue(proxy.doc.getCreated(),0); } return Sequence.EMPTY_SEQUENCE; --- 65,69 ---- if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; ! return new DateTimeValue(proxy.doc.getCreated()); } return Sequence.EMPTY_SEQUENCE; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 10:31:47
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5461/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: last modification date has been incorrect. Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** DocumentImpl.java 21 Jun 2004 15:27:36 -0000 1.43 --- DocumentImpl.java 22 Jun 2004 10:31:38 -0000 1.44 *************** *** 184,187 **** --- 184,188 ---- treeLevelStartPoints = other.treeLevelStartPoints; internalAddress = -1; + lastModified = other.lastModified; } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 10:10:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21766/src/org/exist/http/webdav Modified Files: WebDAVMethodFactory.java Log Message: Added support for WebDAV copy method, currently limited to copying resources. Index: WebDAVMethodFactory.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/WebDAVMethodFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WebDAVMethodFactory.java 25 May 2004 12:52:02 -0000 1.2 --- WebDAVMethodFactory.java 22 Jun 2004 10:10:18 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- package org.exist.http.webdav; + import org.exist.http.webdav.methods.Copy; import org.exist.http.webdav.methods.Delete; import org.exist.http.webdav.methods.Get; *************** *** 59,62 **** --- 60,65 ---- else if(method.equals("MOVE")) return new Move(pool); + else if(method.equals("COPY")) + return new Copy(pool); else return null; } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 10:10:26
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21766/src/org/exist/http/webdav/methods Added Files: Copy.java Log Message: Added support for WebDAV copy method, currently limited to copying resources. --- NEW FILE: Copy.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Copy.java,v 1.1 2004/06/22 10:10:17 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.util.LockException; /** * Implements the WebDAV COPY method. * * @author wolf */ public class Copy implements WebDAVMethod { private BrokerPool pool; /** * */ public Copy(BrokerPool pool) { super(); this.pool = pool; } /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(org.exist.security.User, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { if(collection == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Resource or collection not found"); return; } String destination = request.getHeader("Destination"); String path = null; try { URI uri = new URI(destination); String host = uri.getHost(); int port = uri.getPort(); if(!(host.equals(request.getServerName()) && port == request.getServerPort())) { response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, "Copying to a different server is not yet implemented"); return; } path = uri.getPath(); if(path.startsWith(request.getContextPath())) path = path.substring(request.getContextPath().length()); if(path.startsWith(request.getServletPath())) path = path.substring(request.getServletPath().length()); } catch (URISyntaxException e) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Malformed URL in destination header"); } if(resource != null) copyResource(user, request, response, resource, path); else response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, "Copying collections is not yet implemented"); } private void copyResource(User user, HttpServletRequest request, HttpServletResponse response, DocumentImpl resource, String destination) throws ServletException, IOException { int p = destination.lastIndexOf('/'); if(p < 0) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad destination: " + destination); return; } String newResourceName = destination.substring(p + 1); destination = destination.substring(0, p); boolean replaced = false; DBBroker broker = null; try { broker = pool.get(user); Collection destCollection = broker.getCollection(destination); if(destCollection == null) { response.sendError(HttpServletResponse.SC_CONFLICT, "Destination collection not found"); return; } DocumentImpl oldDoc = destCollection.getDocument(broker, newResourceName); if(oldDoc != null) { boolean overwrite = overwrite(request); if(!overwrite) { response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED, "Destination resource exists and overwrite is not allowed"); return; } replaced = true; } broker.copyResource(resource, destCollection, newResourceName); if(replaced) response.setStatus(HttpServletResponse.SC_NO_CONTENT); else response.setStatus(HttpServletResponse.SC_CREATED); } catch (EXistException e) { throw new ServletException(e.getMessage(), e); } catch (PermissionDeniedException e) { response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage()); } catch (LockException e) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } finally { pool.release(broker); } } private boolean overwrite(HttpServletRequest request) { String header = request.getHeader("Overwrite"); if(header == null) return false; return header.equals("T"); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 09:01:02
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5125/src/org/exist/dom Modified Files: AbstractNodeSet.java Log Message: Added alternative implementations for selectParentChild and selectAncestorDescendant methods. These are iterator based and should be faster in some cases. Index: AbstractNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AbstractNodeSet.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AbstractNodeSet.java 8 Jun 2004 08:16:08 -0000 1.19 --- AbstractNodeSet.java 22 Jun 2004 09:00:53 -0000 1.20 *************** *** 260,265 **** */ public NodeSet selectParentChild(NodeSet al, int mode, boolean rememberContext) { ! if (!(al instanceof VirtualNodeSet) && al.getLength() == 1) { ! return hasChildrenInSet(al.get(0), mode, rememberContext); } NodeProxy n, p; --- 260,268 ---- */ public NodeSet selectParentChild(NodeSet al, int mode, boolean rememberContext) { ! if (!(al instanceof VirtualNodeSet)) { ! if(al.getLength() == 1) ! return hasChildrenInSet(al.get(0), mode, rememberContext); ! // else ! // return quickSelectParentChild(al, mode, rememberContext); } NodeProxy n, p; *************** *** 312,316 **** return result; } ! /** * Check if any descendant nodes are found within this node set for a given --- 315,319 ---- return result; } ! /** * Check if any descendant nodes are found within this node set for a given *************** *** 371,374 **** --- 374,379 ---- boolean includeSelf, boolean rememberContext) { + if(!(al instanceof VirtualNodeSet)) + return quickSelectAncestorDescendant(al, mode, rememberContext); NodeProxy n, p; // long start = System.currentTimeMillis(); *************** *** 424,427 **** --- 429,567 ---- /** + * Fast ancestor descendant join based on two iterators. This method is + * selected if the ancestor set is fixed, i.e. the selection step did not contain + * any wildcards. + * + * @param al + * @param mode + * @param rememberContext + * @return + */ + private NodeSet quickSelectAncestorDescendant(NodeSet al, int mode, boolean rememberContext) { + final NodeSet result = new ExtArrayNodeSet(); + final Iterator ia = al.iterator(); + final Iterator ib = iterator(); + final long start = System.currentTimeMillis(); + NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); + long pa, pb; + while (true) { + // first, try to find nodes belonging to the same doc + if (na.doc.getDocId() < nb.doc.getDocId()) { + if (ia.hasNext()) + na = (NodeProxy) ia.next(); + else + break; + } else if (na.doc.getDocId() > nb.doc.getDocId()) { + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } else { + // same document + pa = na.gid; + pb = nb.gid; + int la = na.doc.getTreeLevel(pa); + int lb = nb.doc.getTreeLevel(pb); + while (la < lb) { + pb = XMLUtil.getParentId(nb.doc, pb, lb); + --lb; + } + if (pa < pb) { + if (ia.hasNext()) + na = (NodeProxy) ia.next(); + else + break; + } else if (pa > pb) { + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } else { + if(mode == NodeSet.DESCENDANT) { + if (rememberContext) + nb.addContextNode(na); + else + nb.copyContext(na); + result.add(nb); + } else { + if (rememberContext) + na.addContextNode(nb); + else + na.copyContext(nb); + result.add(na); + } + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } + } + } + LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); + return result; + } + + private NodeSet quickSelectParentChild(NodeSet al, int mode, boolean rememberContext) { + final NodeSet result = new ExtArrayNodeSet(); + final Iterator ia = al.iterator(); + final Iterator ib = iterator(); + final long start = System.currentTimeMillis(); + NodeProxy na = (NodeProxy) ia.next(), nb = (NodeProxy) ib.next(); + long pa, pb; + while (true) { + // first, try to find nodes belonging to the same doc + if (na.doc.getDocId() < nb.doc.getDocId()) { + if (ia.hasNext()) + na = (NodeProxy) ia.next(); + else + break; + } else if (na.doc.getDocId() > nb.doc.getDocId()) { + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } else { + // same document + pa = na.gid; + pb = nb.gid; + // System.out.println(pa + " -> " + pb); + pb = XMLUtil.getParentId(nb.doc, pb, nb.doc.getTreeLevel(pb)); + // System.out.println("comparing " + pa + " -> " + pb); + if(pa == pb) { + if(mode == NodeSet.DESCENDANT) { + if (rememberContext) + nb.addContextNode(na); + else + nb.copyContext(na); + result.add(nb); + } else { + if (rememberContext) + na.addContextNode(nb); + else + na.copyContext(nb); + result.add(na); + } + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } else if (pa < pb) { + if (ia.hasNext()) + na = (NodeProxy) ia.next(); + else + break; + } else { + if (ib.hasNext()) + nb = (NodeProxy) ib.next(); + else + break; + } + } + } + LOG.debug("quickSelect took " + (System.currentTimeMillis() - start)); + return result; + } + + /** * For a given set of potential ancestor nodes, return all ancestors * having descendants in this node set. |
From: Wolfgang M. M. <wol...@us...> - 2004-06-22 08:14:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3923/src/org/exist/xquery Modified Files: XQueryWatchDog.java Log Message: Assume query-timeout=Long.MAX_VALUE if the query-timeout specified in conf.xml is set to <= 0. Index: XQueryWatchDog.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryWatchDog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XQueryWatchDog.java 17 May 2004 09:57:55 -0000 1.1 --- XQueryWatchDog.java 22 Jun 2004 08:14:16 -0000 1.2 *************** *** 60,63 **** --- 60,65 ---- if(option != null) timeout = ((Long)option).longValue(); + if(timeout <= 0) + timeout = Long.MAX_VALUE; option = conf.getProperty("db-connection.watchdog.output-size-limit"); if(option != null) |
From: Wolfgang M. M. <wol...@us...> - 2004-06-21 15:46:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29152/src/org/exist/xmldb Modified Files: RemoteCollectionManagementService.java Log Message: Index: RemoteCollectionManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteCollectionManagementService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RemoteCollectionManagementService.java 2 Jun 2004 11:28:42 -0000 1.4 --- RemoteCollectionManagementService.java 21 Jun 2004 15:46:23 -0000 1.5 *************** *** 160,163 **** --- 160,172 ---- } + + /* (non-Javadoc) + * @see org.exist.xmldb.CollectionManagementServiceImpl#copyResource(java.lang.String, java.lang.String, java.lang.String) + */ + public void copyResource(String resourcePath, String destinationPath, + String newName) throws XMLDBException { + throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED, "copyResource is not yet implemented for " + + "remote resources"); + } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-21 15:30:41
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18824/src/org/exist/security Modified Files: security.properties Log Message: Index: security.properties =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/security/security.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** security.properties 21 Jun 2004 15:27:39 -0000 1.3 --- security.properties 21 Jun 2004 15:30:23 -0000 1.4 *************** *** 10,12 **** # the database will not recognize the old passwords. ! passwords.encoding=simple-md5 --- 10,12 ---- # the database will not recognize the old passwords. ! passwords.encoding=md5 |
From: Wolfgang M. M. <wol...@us...> - 2004-06-21 15:28:24
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16641/src/org/exist/storage Modified Files: NativeTextEngine.java DBBroker.java TextSearchEngine.java NativeBroker.java Log Message: Added copyResource method to DBBroker. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** NativeBroker.java 17 Jun 2004 13:14:58 -0000 1.81 --- NativeBroker.java 21 Jun 2004 15:27:34 -0000 1.82 *************** *** 1092,1095 **** --- 1092,1261 ---- } + public void copyResource(DocumentImpl doc, Collection destination, String newName) + throws PermissionDeniedException, LockException { + if (readOnly) + throw new PermissionDeniedException(DATABASE_IS_READ_ONLY); + Collection collection = doc.getCollection(); + if(!collection.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to copy resource " + + doc.getFileName()); + if(!doc.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to copy resource " + + doc.getFileName()); + if(newName == null) { + int p = doc.getFileName().lastIndexOf('/'); + newName = doc.getFileName().substring(p + 1); + } + Lock lock = null; + try { + lock = collectionsDb.getLock(); + lock.acquire(Lock.WRITE_LOCK); + // check if the move would overwrite a collection + 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)) + throw new PermissionDeniedException("Resource with same name exists in target " + + "collection and update is denied"); + if(!oldDoc.getPermissions().validate(user, Permission.UPDATE)) + throw new PermissionDeniedException("Resource with same name exists in target " + + "collection and update is denied"); + collection.removeDocument(this, oldDoc.getFileName()); + } else + if(!destination.getPermissions().validate(user, Permission.WRITE)) + throw new PermissionDeniedException("Insufficient privileges on target collection " + + destination.getName()); + + DocumentImpl newDoc = new DocumentImpl(this, newName, destination); + newDoc.copyOf(doc); + copyResource(doc, newDoc); + flush(); + destination.addDocument(this, doc); + saveCollection(destination); + } catch (TriggerException e) { + throw new PermissionDeniedException(e.getMessage()); + } finally { + lock.release(); + } + } + + private void copyResource(DocumentImpl oldDoc, DocumentImpl newDoc) { + LOG.debug("Copying document " + oldDoc.getFileName() + " to " + newDoc.getCollection().getName()); + final long start = System.currentTimeMillis(); + Iterator iterator; + NodeList nodes = oldDoc.getChildNodes(); + NodeImpl n; + for (int i = 0; i < nodes.getLength(); i++) { + n = (NodeImpl) nodes.item(i); + iterator = + getNodeIterator( + new NodeProxy(oldDoc, n.getGID(), n.getInternalAddress())); + iterator.next(); + copyNodes(iterator, n, new NodePath(), newDoc); + } + flush(); + LOG.debug("Copy took " + (System.currentTimeMillis() - start) + "ms."); + } + + public void defrag(final DocumentImpl doc) throws PermissionDeniedException { + LOG.debug("--------------------> Defragmenting document " + doc.getFileName()); + final long start = System.currentTimeMillis(); + try { + // dropping old index + elementIndex.dropIndex(doc); + textEngine.dropIndex(doc); + // dropping dom index + NodeRef ref = new NodeRef(doc.getDocId()); + final IndexQuery idx = new IndexQuery(IndexQuery.TRUNC_RIGHT, ref); + new DOMTransaction(this, domDb) { + public Object start() { + try { + domDb.remove(idx, null); + domDb.flush(); + } catch (BTreeException e) { + LOG.warn("start() - " + "error while removing doc", e); + } catch (DBException e) { + LOG.warn("start() - " + "error while removing doc", e); + } catch (IOException e) { + LOG.warn("start() - " + "error while removing doc", e); + } catch (TerminatedException e) { + LOG.warn("method terminated", e); + } + return null; + } + } + .run(); + + DocumentImpl tempDoc = new DocumentImpl(this, doc.getFileName(), doc.getCollection()); + tempDoc.copyOf(doc); + + Iterator iterator; + NodeList nodes = doc.getChildNodes(); + NodeImpl n; + for (int i = 0; i < nodes.getLength(); i++) { + n = (NodeImpl) nodes.item(i); + iterator = + getNodeIterator( + new NodeProxy(doc, n.getGID(), n.getInternalAddress())); + iterator.next(); + copyNodes(iterator, n, new NodePath(), tempDoc); + } + flush(); + + LOG.debug("Removing old dom..."); + new DOMTransaction(this, domDb) { + public Object start() { + NodeImpl node = (NodeImpl)doc.getFirstChild(); + domDb.removeAll(node.getInternalAddress()); + return null; + } + } + .run(); + + doc.copyChildren(tempDoc); + saveCollection(doc.getCollection()); + LOG.debug("Defragmentation took " + (System.currentTimeMillis() - start) + "ms."); + } catch (ReadOnlyException e) { + throw new PermissionDeniedException(DATABASE_IS_READ_ONLY); + } + } + + private void copyNodes(Iterator iterator, NodeImpl node, NodePath currentPath, DocumentImpl newDoc) { + if (node.getNodeType() == Node.ELEMENT_NODE) + currentPath.addComponent(node.getNodeName()); + final DocumentImpl doc = (DocumentImpl)node.getOwnerDocument(); + node.setOwnerDocument(newDoc); + node.setInternalAddress(-1); + store(node, currentPath); + node.setOwnerDocument(doc); + + if (node.hasChildNodes()) { + final long firstChildId = XMLUtil.getFirstChildId(doc, node.getGID()); + if (firstChildId < 0) { + LOG.fatal( + "no child found: expected = " + + node.getChildCount() + + "; node = " + + node.getNodeName() + + "; gid = " + + node.getGID()); + throw new IllegalStateException("wrong node id"); + } + final long lastChildId = firstChildId + node.getChildCount(); + NodeImpl child; + for (long gid = firstChildId; gid < lastChildId; gid++) { + child = (NodeImpl) iterator.next(); + if(child == null) + LOG.debug("child " + gid + " not found for node: " + node.getNodeName() + + "; last = " + lastChildId + "; children = " + node.getChildCount()); + child.setGID(gid); + copyNodes(iterator, child, currentPath, newDoc); + } + } + if(node.getNodeType() == Node.ELEMENT_NODE) + currentPath.removeLastComponent(); + } + public String getNodeValue(final NodeProxy proxy) { return (String) new DOMTransaction(this, domDb, Lock.READ_LOCK) { *************** *** 1494,1498 **** elementIndex.dropIndex(doc); ! textEngine.removeDocument(doc); if (LOG.isDebugEnabled()) { LOG.debug("removeDocument() - removing dom"); --- 1660,1664 ---- elementIndex.dropIndex(doc); ! textEngine.dropIndex(doc); if (LOG.isDebugEnabled()) { LOG.debug("removeDocument() - removing dom"); *************** *** 1712,1716 **** collection.unlinkDocument(doc); elementIndex.dropIndex(doc); ! textEngine.removeDocument(doc); saveCollection(collection); --- 1878,1882 ---- collection.unlinkDocument(doc); elementIndex.dropIndex(doc); ! textEngine.dropIndex(doc); saveCollection(collection); Index: TextSearchEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/TextSearchEngine.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TextSearchEngine.java 25 May 2004 09:26:10 -0000 1.11 --- TextSearchEngine.java 21 Jun 2004 15:27:34 -0000 1.12 *************** *** 63,67 **** protected Tokenizer tokenizer; protected Configuration config; ! protected boolean indexNumbers = false, stem = false; protected PorterStemmer stemmer = null; --- 63,68 ---- protected Tokenizer tokenizer; protected Configuration config; ! protected boolean indexNumbers = false ; ! protected boolean stem = false ; protected PorterStemmer stemmer = null; *************** *** 222,226 **** * @param doc */ ! public abstract void removeDocument(DocumentImpl doc); /** --- 223,227 ---- * @param doc */ ! public abstract void dropIndex(DocumentImpl doc); /** Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** DBBroker.java 17 Jun 2004 13:14:58 -0000 1.33 --- DBBroker.java 21 Jun 2004 15:27:34 -0000 1.34 *************** *** 435,438 **** --- 435,443 ---- throws PermissionDeniedException, LockException; + public abstract void copyResource(DocumentImpl doc, Collection destination, String newName) + throws PermissionDeniedException, LockException; + + public abstract void defrag(DocumentImpl doc) throws PermissionDeniedException; + public void sync() { /* Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** NativeTextEngine.java 16 Jun 2004 13:36:54 -0000 1.57 --- NativeTextEngine.java 21 Jun 2004 15:27:33 -0000 1.58 *************** *** 596,600 **** * The document */ ! public void removeDocument(DocumentImpl doc) { try { TreeSet words = new TreeSet(); --- 596,600 ---- * The document */ ! public void dropIndex(DocumentImpl doc) { try { TreeSet words = new TreeSet(); *************** *** 623,686 **** ref = new WordRef(collectionId, word); try { ! lock.acquire(Lock.READ_LOCK); is = dbWords.getAsStream(ref); ! } catch (LockException e) { ! LOG.warn("removeDocument(DocumentImpl) - " ! + "could not acquire lock on words db", e); ! is = null; ! } catch (IOException e) { ! LOG.error("removeDocument(DocumentImpl) - " ! + "io error while reading words", e); ! is = null; ! } finally { ! lock.release(); ! } ! if (is == null) { ! LOG.warn(word + " not found in the index. This should not happen!"); ! continue; ! } ! os = new VariableByteOutputStream(); ! changed = false; ! try { ! while (is.available() > 0) { ! docId = is.readInt(); ! section = is.readByte(); ! len = is.readInt(); ! if (docId != doc.getDocId()) { ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! is.copyTo(os, len); ! } else { ! changed = true; ! // skip ! is.skip(len); ! } } ! } catch (EOFException e) { ! // LOG.debug(e.getMessage(), e); ! } catch (IOException e) { ! // LOG.debug(e.getMessage(), e); ! } ! if (changed) { try { ! lock.acquire(Lock.WRITE_LOCK); if (os.data().size() == 0) { dbWords.remove(ref); } else { ! if (dbWords.put(ref, os.data()) < 0) ! if (LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + "could not remove index for " ! + word); ! } } - } catch (LockException e) { - LOG.warn("removeDocument(DocumentImpl) - " - + "could not acquire lock on words db", e); - } finally { - lock.release(); } } } --- 623,677 ---- ref = new WordRef(collectionId, word); try { ! lock.acquire(Lock.WRITE_LOCK); is = dbWords.getAsStream(ref); ! if (is == null) { ! LOG.warn(word + " not found in the index. This should not happen!"); ! continue; } ! os = new VariableByteOutputStream(); ! changed = false; try { ! while (is.available() > 0) { ! docId = is.readInt(); ! section = is.readByte(); ! len = is.readInt(); ! if (docId != doc.getDocId()) { ! // copy data to new buffer ! os.writeInt(docId); ! os.writeByte(section); ! os.writeInt(len); ! is.copyTo(os, len); ! } else { ! changed = true; ! // skip ! is.skip(len); ! } ! } ! } catch (EOFException e) { ! // LOG.debug(e.getMessage(), e); ! } catch (IOException e) { ! // LOG.debug(e.getMessage(), e); ! } ! if (changed) { if (os.data().size() == 0) { dbWords.remove(ref); } else { ! if (dbWords.put(ref, os.data()) < 0 && LOG.isDebugEnabled()) { ! LOG.debug("removeDocument() - " ! + "could not remove index for " ! + word); ! } } } + } catch (LockException e) { + LOG.warn("removeDocument(DocumentImpl) - " + + "could not acquire lock on words db", e); + is = null; + } catch (IOException e) { + LOG.error("removeDocument(DocumentImpl) - " + + "io error while reading words", e); + is = null; + } finally { + lock.release(); } } *************** *** 1171,1175 **** DocumentSet docs; TermMatcher matcher; ! NodeSet result, contextSet; XQueryContext context; --- 1162,1167 ---- DocumentSet docs; TermMatcher matcher; ! NodeSet result; ! NodeSet contextSet; XQueryContext context; |
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16641/src/org/exist/xmldb Modified Files: RemoteXMLResource.java LocalCollectionManagementService.java CollectionManagementServiceImpl.java RemoteBinaryResource.java RemoteResourceIterator.java Log Message: Added copyResource method to DBBroker. Index: LocalCollectionManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollectionManagementService.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** LocalCollectionManagementService.java 2 Jun 2004 11:28:42 -0000 1.10 --- LocalCollectionManagementService.java 21 Jun 2004 15:27:36 -0000 1.11 *************** *** 188,191 **** --- 188,226 ---- } } + + /* (non-Javadoc) + * @see org.exist.xmldb.CollectionManagementServiceImpl#copyResource(java.lang.String, java.lang.String, java.lang.String) + */ + public void copyResource(String resourcePath, String destinationPath, + String newName) throws XMLDBException { + if(!resourcePath.startsWith("/db")) + resourcePath = parent.getPath() + '/' + resourcePath; + if(!destinationPath.startsWith("/db")) + destinationPath = parent.getPath() + '/' + destinationPath; + DBBroker broker = null; + try { + broker = brokerPool.get(user); + DocumentImpl doc = (DocumentImpl)broker.getDocument(resourcePath); + if(doc == null) + throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, "Resource " + resourcePath + " not found"); + org.exist.collections.Collection destination = broker.getCollection(destinationPath); + if(destination == null) + throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection " + destinationPath + " not found"); + broker.copyResource(doc, destination, newName); + } catch ( EXistException e ) { + e.printStackTrace(); + throw new XMLDBException( ErrorCodes.VENDOR_ERROR, + "failed to move resource " + resourcePath, e ); + } catch ( PermissionDeniedException e ) { + throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, + e.getMessage(), e ); + } catch (LockException e) { + throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, + e.getMessage(), e ); + } finally { + brokerPool.release( broker ); + } + } + public void setCollection( Collection parent ) throws XMLDBException { this.parent = (LocalCollection) parent; Index: RemoteResourceIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteResourceIterator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteResourceIterator.java 29 Jan 2004 15:06:43 -0000 1.1 --- RemoteResourceIterator.java 21 Jun 2004 15:27:36 -0000 1.2 *************** *** 32,36 **** protected RemoteCollection collection; protected Vector resources; ! protected int pos = 0, indentXML; protected String encoding = "UTF-8"; --- 32,37 ---- protected RemoteCollection collection; protected Vector resources; ! protected int pos = 0 ; ! protected int indentXML; protected String encoding = "UTF-8"; Index: CollectionManagementServiceImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/CollectionManagementServiceImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CollectionManagementServiceImpl.java 2 Jun 2004 11:28:42 -0000 1.5 --- CollectionManagementServiceImpl.java 21 Jun 2004 15:27:36 -0000 1.6 *************** *** 42,44 **** --- 42,47 ---- public void moveResource(String resourcePath, String destinationPath, String newName) throws XMLDBException; + + public void copyResource(String resourcePath, String destinationPath, String newName) + throws XMLDBException; } Index: RemoteBinaryResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteBinaryResource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteBinaryResource.java 29 Jan 2004 15:06:43 -0000 1.1 --- RemoteBinaryResource.java 21 Jun 2004 15:27:36 -0000 1.2 *************** *** 45,49 **** public class RemoteBinaryResource implements BinaryResource, EXistResource { ! private String documentName, path; private RemoteCollection parent; private byte[] data = null; --- 45,50 ---- public class RemoteBinaryResource implements BinaryResource, EXistResource { ! private String documentName; ! private String path; private RemoteCollection parent; private byte[] data = null; Index: RemoteXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteXMLResource.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RemoteXMLResource.java 21 May 2004 08:32:14 -0000 1.13 --- RemoteXMLResource.java 21 Jun 2004 15:27:36 -0000 1.14 *************** *** 50,54 **** private org.apache.excalibur.xml.sax.SAXParser cocoonParser = null; ! protected String id, documentName, path = null; protected int handle = -1; protected int pos = -1; --- 50,56 ---- private org.apache.excalibur.xml.sax.SAXParser cocoonParser = null; ! protected String id; ! protected String documentName; ! protected String path = null ; protected int handle = -1; protected int pos = -1; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-21 15:28:23
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16641/src/org/exist/client Modified Files: UserDialog.java InteractiveClient.java ClientFrame.java Log Message: Added copyResource method to DBBroker. Index: ClientFrame.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/ClientFrame.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ClientFrame.java 2 Jun 2004 11:30:24 -0000 1.19 --- ClientFrame.java 21 Jun 2004 15:27:33 -0000 1.20 *************** *** 338,342 **** fileMenu.add(item); ! item = new JMenuItem("Create collection", KeyEvent.VK_C); item.setAccelerator(KeyStroke.getKeyStroke("control N")); item.addActionListener(new ActionListener() { --- 338,342 ---- fileMenu.add(item); ! item = new JMenuItem("Create collection", KeyEvent.VK_N); item.setAccelerator(KeyStroke.getKeyStroke("control N")); item.addActionListener(new ActionListener() { *************** *** 356,359 **** --- 356,368 ---- fileMenu.add(item); + item = new JMenuItem("Copy", KeyEvent.VK_C); + item.setAccelerator(KeyStroke.getKeyStroke("control C")); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + copyAction(e); + } + }); + fileMenu.add(item); + item = new JMenuItem("Move", KeyEvent.VK_M); item.setAccelerator(KeyStroke.getKeyStroke("control M")); *************** *** 803,806 **** --- 812,859 ---- } + private void copyAction(ActionEvent ev) { + final int[] rows = fileman.getSelectedRows(); + final Object[] res = new Object[rows.length]; + for (int i = 0; i < rows.length; i++) { + res[i] = resources.getValueAt(rows[i], 3); + } + String[] collections = null; + try { + Collection root = client.getCollection("/db"); + Vector collectionsVec = getCollections(root, new Vector()); + collections = new String[collectionsVec.size()]; + collectionsVec.toArray(collections); + } catch (XMLDBException e) { + showErrorMessage(e.getMessage(), e); + return; + } + Object val = JOptionPane.showInputDialog(this, "Select target collection", "Move", JOptionPane.QUESTION_MESSAGE, + null, collections, collections[0]); + if(val == null) + return; + final String destinationPath = (String)val; + Runnable moveTask = new Runnable() { + public void run() { + try { + CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) + client.current.getService("CollectionManagementService", "1.0"); + for(int i = 0; i < res.length; i++) { + setStatus("Copying " + res[i].toString() + " to " + destinationPath + "..."); + if(res[i] instanceof InteractiveClient.CollectionName) + //service.move(res[i].toString(), destinationPath, null); + showErrorMessage("Copy is not yet implemented for collections", null); + else + service.copyResource(res[i].toString(), destinationPath, null); + } + client.reloadCollection(); + } catch (XMLDBException e) { + showErrorMessage(e.getMessage(), e); + } + setStatus("Move completed."); + } + }; + new Thread(moveTask).start(); + } + private Vector getCollections(Collection root, Vector collectionsList) throws XMLDBException { Index: InteractiveClient.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/InteractiveClient.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** InteractiveClient.java 8 Jun 2004 08:16:12 -0000 1.30 --- InteractiveClient.java 21 Jun 2004 15:27:33 -0000 1.31 *************** *** 254,258 **** protected TreeSet completitions = new TreeSet(); protected LinkedList queryHistory = new LinkedList(); ! protected File queryHistoryFile, historyFile; protected Collection current = null; --- 254,259 ---- protected TreeSet completitions = new TreeSet(); protected LinkedList queryHistory = new LinkedList(); ! protected File queryHistoryFile; ! protected File historyFile; protected Collection current = null; Index: UserDialog.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/UserDialog.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UserDialog.java 23 Apr 2004 13:07:44 -0000 1.7 --- UserDialog.java 21 Jun 2004 15:27:33 -0000 1.8 *************** *** 50,54 **** JList groups; JList allGroups; ! DefaultListModel groupsModel, allGroupsModel; JTable users; UserTableModel userModel; --- 50,55 ---- JList groups; JList allGroups; ! DefaultListModel groupsModel; ! DefaultListModel allGroupsModel; JTable users; UserTableModel userModel; |