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
(24) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:32
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/xquery Modified Files: DynamicAttributeConstructor.java Removed Files: SystemFunctions.java Log Message: Fixed resource read/write permissions check. --- SystemFunctions.java DELETED --- Index: DynamicAttributeConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/DynamicAttributeConstructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DynamicAttributeConstructor.java 27 Jun 2004 21:10:06 -0000 1.1 --- DynamicAttributeConstructor.java 2 Jul 2004 16:53:53 -0000 1.2 *************** *** 55,59 **** } ! public void setValueExpr(Expression expr) { this.valueExpr = new Atomize(context, expr); } --- 55,59 ---- } ! public void setContentExpr(Expression expr) { this.valueExpr = new Atomize(context, expr); } *************** *** 64,67 **** --- 64,68 ---- public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { + System.out.println(pprint()); MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/storage Modified Files: NativeBroker.java Log Message: Fixed resource read/write permissions check. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** NativeBroker.java 29 Jun 2004 14:26:48 -0000 1.84 --- NativeBroker.java 2 Jul 2004 16:53:57 -0000 1.85 *************** *** 335,339 **** long start = System.currentTimeMillis(); Collection root = getCollection(ROOT_COLLECTION); ! root.allDocs(this, docs, true); if (LOG.isDebugEnabled()) { LOG.debug("getAllDocuments(DocumentSet) - end - " --- 335,339 ---- long start = System.currentTimeMillis(); Collection root = getCollection(ROOT_COLLECTION); ! root.allDocs(this, docs, true, false); if (LOG.isDebugEnabled()) { LOG.debug("getAllDocuments(DocumentSet) - end - " *************** *** 514,519 **** return null; } ! if (!doc.getPermissions().validate(user, Permission.READ)) ! throw new PermissionDeniedException("not allowed to read document"); return doc; } --- 514,519 ---- return null; } ! // if (!doc.getPermissions().validate(user, Permission.READ)) ! // throw new PermissionDeniedException("not allowed to read document"); return doc; } *************** *** 541,545 **** return docs; } ! docs = root.allDocs(this, docs, inclusive); LOG.debug( "loading " --- 541,545 ---- return docs; } ! docs = root.allDocs(this, docs, inclusive, false); LOG.debug( "loading " *************** *** 1905,1908 **** --- 1905,1911 ---- throw new PermissionDeniedException("Insufficient privileges to move resource " + doc.getFileName()); + if(!doc.getPermissions().validate(user, Permission.WRITE)) + throw new PermissionDeniedException("Insufficient privileges to move resource " + + doc.getFileName()); if(newName == null) { int p = doc.getFileName().lastIndexOf('/'); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/dom Modified Files: DocumentSet.java Log Message: Fixed resource read/write permissions check. Index: DocumentSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentSet.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DocumentSet.java 8 Jun 2004 08:16:08 -0000 1.16 --- DocumentSet.java 2 Jul 2004 16:53:57 -0000 1.17 *************** *** 108,120 **** * @param docs */ ! public void addAll(DBBroker broker, java.util.Collection docs) { DocumentImpl doc; for(Iterator i = docs.iterator(); i.hasNext(); ) { doc = (DocumentImpl)i.next(); - if(broker == null || doc.getPermissions().validate(broker.getUser(), Permission.READ)) { // if(doc.isLockedForWrite()) // continue; ! put(doc.getDocId(), doc); ! } } } --- 108,121 ---- * @param docs */ ! public void addAll(DBBroker broker, java.util.Collection docs, boolean checkPermissions) { DocumentImpl doc; for(Iterator i = docs.iterator(); i.hasNext(); ) { doc = (DocumentImpl)i.next(); // if(doc.isLockedForWrite()) // continue; ! if(broker == null || !checkPermissions || ! doc.getPermissions().validate(broker.getUser(), Permission.READ)) { ! put(doc.getDocId(), doc); ! } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/xmlrpc Modified Files: RpcConnection.java Log Message: Fixed resource read/write permissions check. Index: RpcConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcConnection.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** RpcConnection.java 8 Jun 2004 08:16:12 -0000 1.61 --- RpcConnection.java 2 Jul 2004 16:53:56 -0000 1.62 *************** *** 221,225 **** docs = new DocumentSet(); Collection root = broker.getCollection(baseURI); ! root.allDocs(broker, docs, true); } } --- 221,225 ---- docs = new DocumentSet(); Collection root = broker.getCollection(baseURI); ! root.allDocs(broker, docs, true, true); } } *************** *** 438,441 **** --- 438,443 ---- return null; } + if(!collection.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to read resource"); doc = collection.getDocumentWithLock(broker, docName); if (doc == null) { *************** *** 443,446 **** --- 445,450 ---- throw new EXistException("document not found"); } + if(!doc.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to read resource " + docName); Serializer serializer = broker.getSerializer(); *************** *** 540,543 **** --- 544,549 ---- throw new EXistException("Document " + name + " is not a binary resource"); + if(!doc.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to read resource"); return broker.getBinaryResourceData((BinaryDocument) doc); } finally { *************** *** 557,561 **** + " not found"); DocumentSet docs = collection.allDocs(broker, new DocumentSet(), ! true); XUpdateProcessor processor = new XUpdateProcessor(broker, docs); Modification modifications[] = processor.parse(new InputSource( --- 563,567 ---- + " not found"); DocumentSet docs = collection.allDocs(broker, new DocumentSet(), ! true, true); XUpdateProcessor processor = new XUpdateProcessor(broker, docs); Modification modifications[] = processor.parse(new InputSource( *************** *** 582,588 **** try { broker = brokerPool.get(user); ! Document doc = broker.getDocument(resource); if (doc == null) throw new EXistException("document " + resource + " not found"); DocumentSet docs = new DocumentSet(); docs.add(doc); --- 588,596 ---- try { broker = brokerPool.get(user); ! DocumentImpl doc = (DocumentImpl)broker.getDocument(resource); if (doc == null) throw new EXistException("document " + resource + " not found"); + if(!doc.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to read resource"); DocumentSet docs = new DocumentSet(); docs.add(doc); *************** *** 1574,1577 **** --- 1582,1587 ---- broker = brokerPool.get(user); DocumentImpl doc = (DocumentImpl) broker.getDocument(path); + if(!doc.getPermissions().validate(user, Permission.READ)) + throw new PermissionDeniedException("Insufficient privileges to read resource"); if (doc == null) throw new EXistException("Resource " + path + " not found"); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/http Modified Files: RESTServer.java Log Message: Fixed resource read/write permissions check. Index: RESTServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/RESTServer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RESTServer.java 21 Jun 2004 15:27:38 -0000 1.13 --- RESTServer.java 2 Jul 2004 16:53:56 -0000 1.14 *************** *** 164,173 **** if(!collection.getPermissions().validate(broker.getUser(), Permission.READ)) throw new PermissionDeniedException("Not allowed to read collection"); ! else ! response = new Response(printCollection(broker, collection)); } else { throw new NotFoundException("Document " + path + " not found"); } } else { if(d.getResourceType() == DocumentImpl.BINARY_FILE) { response.setContent(broker.getBinaryResourceData((BinaryDocument)d)); --- 164,174 ---- if(!collection.getPermissions().validate(broker.getUser(), Permission.READ)) throw new PermissionDeniedException("Not allowed to read collection"); ! response = new Response(printCollection(broker, collection)); } else { throw new NotFoundException("Document " + path + " not found"); } } else { + if(!d.getPermissions().validate(broker.getUser(), Permission.READ)) + throw new PermissionDeniedException("Not allowed to read resource"); if(d.getResourceType() == DocumentImpl.BINARY_FILE) { response.setContent(broker.getBinaryResourceData((BinaryDocument)d)); *************** *** 277,286 **** Collection collection = broker.getCollection(path); if(collection != null) { ! collection.allDocs(broker, docs, true); } else { DocumentImpl xupdateDoc = (DocumentImpl)broker.getDocument(path); ! if(doc != null) ! docs.add(doc); ! else broker.getAllDocuments(docs); } --- 278,289 ---- Collection collection = broker.getCollection(path); if(collection != null) { ! collection.allDocs(broker, docs, true, true); } else { DocumentImpl xupdateDoc = (DocumentImpl)broker.getDocument(path); ! if(xupdateDoc != null) { ! if(!xupdateDoc.getPermissions().validate(broker.getUser(), Permission.READ)) ! throw new PermissionDeniedException("Not allowed to read collection"); ! docs.add(xupdateDoc); ! } else broker.getAllDocuments(docs); } *************** *** 432,441 **** Collection collection = broker.getCollection(path); if (collection != null) { ! collection.allDocs(broker, docs, true); } else { DocumentImpl doc = (DocumentImpl) broker.getDocument(path); ! if (doc != null) docs.add(doc); ! else broker.getAllDocuments(docs); } --- 435,446 ---- Collection collection = broker.getCollection(path); if (collection != null) { ! collection.allDocs(broker, docs, true, true); } else { DocumentImpl doc = (DocumentImpl) broker.getDocument(path); ! if (doc != null) { ! if(!doc.getPermissions().validate(broker.getUser(), Permission.READ)) ! throw new PermissionDeniedException("Not allowed to read collection"); docs.add(doc); ! } else broker.getAllDocuments(docs); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/soap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/soap Modified Files: AdminSoapBindingImpl.java QuerySoapBindingImpl.java Log Message: Fixed resource read/write permissions check. Index: QuerySoapBindingImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/soap/QuerySoapBindingImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** QuerySoapBindingImpl.java 8 Jun 2004 08:16:10 -0000 1.21 --- QuerySoapBindingImpl.java 2 Jul 2004 16:53:55 -0000 1.22 *************** *** 165,168 **** --- 165,170 ---- if (document == null) throw new RemoteException("resource " + name + " not found"); + if(!document.getPermissions().validate(broker.getUser(), Permission.READ)) + throw new PermissionDeniedException("Not allowed to read resource"); Serializer serializer = broker.getSerializer(); serializer.reset(); Index: AdminSoapBindingImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/soap/AdminSoapBindingImpl.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AdminSoapBindingImpl.java 8 Jun 2004 08:16:10 -0000 1.14 --- AdminSoapBindingImpl.java 2 Jul 2004 16:53:55 -0000 1.15 *************** *** 12,15 **** --- 12,16 ---- import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; + import org.exist.security.Permission; import org.exist.security.PermissionDeniedException; import org.exist.security.User; *************** *** 20,24 **** import org.exist.xupdate.Modification; import org.exist.xupdate.XUpdateProcessor; - import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; --- 21,24 ---- *************** *** 204,208 **** "collection " + collectionName + " not found"); DocumentSet docs = ! collection.allDocs(broker, new DocumentSet(), true); XUpdateProcessor processor = new XUpdateProcessor(broker, docs); --- 204,208 ---- "collection " + collectionName + " not found"); DocumentSet docs = ! collection.allDocs(broker, new DocumentSet(), true, true); XUpdateProcessor processor = new XUpdateProcessor(broker, docs); *************** *** 246,253 **** try { broker = pool.get(session.getUser()); ! Document doc = broker.getDocument(documentName); if (doc == null) throw new RemoteException( "document " + documentName + " not found"); DocumentSet docs = new DocumentSet(); docs.add(doc); --- 246,255 ---- try { broker = pool.get(session.getUser()); ! DocumentImpl doc = (DocumentImpl)broker.getDocument(documentName); if (doc == null) throw new RemoteException( "document " + documentName + " not found"); + if(!doc.getPermissions().validate(broker.getUser(), Permission.READ)) + throw new RemoteException("Not allowed to read resource"); DocumentSet docs = new DocumentSet(); docs.add(doc); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/client Modified Files: InteractiveClient.java Log Message: Fixed resource read/write permissions check. Index: InteractiveClient.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/client/InteractiveClient.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** InteractiveClient.java 21 Jun 2004 15:27:33 -0000 1.31 --- InteractiveClient.java 2 Jul 2004 16:53:56 -0000 1.32 *************** *** 421,424 **** --- 421,425 ---- Resource res; for (int j = 0; j < childResources.length; i++, j++) { + System.out.println("Loading " + childResources[j]); res = current.getResource(childResources[j]); perm = mgtService.getPermissions(res); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:54:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/transform In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15785/src/org/exist/xquery/functions/transform Modified Files: Transform.java Log Message: Fixed resource read/write permissions check. Index: Transform.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/transform/Transform.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Transform.java 28 May 2004 10:54:23 -0000 1.7 --- Transform.java 2 Jul 2004 16:53:55 -0000 1.8 *************** *** 52,55 **** --- 52,56 ---- import org.exist.memtree.MemTreeBuilder; import org.exist.memtree.Receiver; + import org.exist.security.Permission; import org.exist.security.PermissionDeniedException; import org.exist.xquery.BasicFunction; *************** *** 296,299 **** --- 297,302 ---- xslDoc = (DocumentImpl) context.getBroker().getDocument(path); + if(!xslDoc.getPermissions().validate(context.getUser(), Permission.READ)) + throw new TransformerException("Insufficient privileges to read resource " + path); } catch (PermissionDeniedException e) { throw new TransformerException(e.getMessage(), e); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-02 16:51:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15222/src/org/exist/xquery/parser Modified Files: XQueryTreeParser.java XQuery.g Log Message: Fixed processing of computed constructors. Index: XQueryTreeParser.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryTreeParser.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** XQueryTreeParser.java 29 Jun 2004 14:23:26 -0000 1.12 --- XQueryTreeParser.java 2 Jul 2004 16:50:57 -0000 1.13 *************** *** 4561,4568 **** c.setContent(elementContent); PathExpr qnamePathExpr = new PathExpr(context); qnameExpr=expr(_t,qnamePathExpr); _t = _retTree; - c.setNameExpr(qnameExpr); contentExpr=expr(_t,elementContent); _t = _retTree; --- 4561,4568 ---- c.setContent(elementContent); PathExpr qnamePathExpr = new PathExpr(context); + c.setNameExpr(qnamePathExpr); qnameExpr=expr(_t,qnamePathExpr); _t = _retTree; contentExpr=expr(_t,elementContent); _t = _retTree; *************** *** 4582,4594 **** step = a; PathExpr qnamePathExpr = new PathExpr(context); elementContent = new PathExpr(context); ! a.setValueExpr(elementContent); qnameExpr=expr(_t,qnamePathExpr); _t = _retTree; - a.setNameExpr(qnameExpr); contentExpr=expr(_t,elementContent); _t = _retTree; - elementContent.add(contentExpr); _t = __t435; _t = _t.getNextSibling(); --- 4582,4593 ---- step = a; PathExpr qnamePathExpr = new PathExpr(context); + a.setNameExpr(qnamePathExpr); elementContent = new PathExpr(context); ! a.setContentExpr(elementContent); qnameExpr=expr(_t,qnamePathExpr); _t = _retTree; contentExpr=expr(_t,elementContent); _t = _retTree; _t = __t435; _t = _t.getNextSibling(); *************** *** 4606,4609 **** --- 4605,4609 ---- step = pd; PathExpr qnamePathExpr = new PathExpr(context); + pd.setNameExpr(qnamePathExpr); elementContent = new PathExpr(context); pd.setContentExpr(elementContent); *************** *** 4611,4618 **** qnameExpr=expr(_t,qnamePathExpr); _t = _retTree; - pd.setNameExpr(qnameExpr); contentExpr=expr(_t,elementContent); _t = _retTree; - elementContent.add(contentExpr); _t = __t436; _t = _t.getNextSibling(); --- 4611,4616 ---- *************** *** 4735,4745 **** match(_t,COMP_TEXT_CONSTRUCTOR); _t = _t.getFirstChild(); - contentExpr=expr(_t,new PathExpr(context)); - _t = _retTree; ! DynamicTextConstructor text = new DynamicTextConstructor(context, contentExpr); text.setASTNode(t); step= text; _t = __t447; _t = _t.getNextSibling(); --- 4733,4744 ---- match(_t,COMP_TEXT_CONSTRUCTOR); _t = _t.getFirstChild(); ! elementContent = new PathExpr(context); ! DynamicTextConstructor text = new DynamicTextConstructor(context, elementContent); text.setASTNode(t); step= text; + contentExpr=expr(_t,elementContent); + _t = _retTree; _t = __t447; _t = _t.getNextSibling(); *************** *** 4752,4762 **** match(_t,COMP_COMMENT_CONSTRUCTOR); _t = _t.getFirstChild(); - contentExpr=expr(_t,new PathExpr(context)); - _t = _retTree; ! DynamicCommentConstructor comment = new DynamicCommentConstructor(context, contentExpr); comment.setASTNode(t); step= comment; _t = __t448; _t = _t.getNextSibling(); --- 4751,4762 ---- match(_t,COMP_COMMENT_CONSTRUCTOR); _t = _t.getFirstChild(); ! elementContent = new PathExpr(context); ! DynamicCommentConstructor comment = new DynamicCommentConstructor(context, elementContent); comment.setASTNode(t); step= comment; + contentExpr=expr(_t,elementContent); + _t = _retTree; _t = __t448; _t = _t.getNextSibling(); *************** *** 4769,4780 **** match(_t,COMP_NS_CONSTRUCTOR); _t = _t.getFirstChild(); - contentExpr=expr(_t,new PathExpr(context)); - _t = _retTree; NamespaceConstructor ns = new NamespaceConstructor(context, prefix.getText()); ! ns.setURIExpression(contentExpr); ns.setASTNode(t); step= ns; _t = __t449; _t = _t.getNextSibling(); --- 4769,4781 ---- match(_t,COMP_NS_CONSTRUCTOR); _t = _t.getFirstChild(); + elementContent = new PathExpr(context); NamespaceConstructor ns = new NamespaceConstructor(context, prefix.getText()); ! ns.setURIExpression(elementContent); ns.setASTNode(t); step= ns; + contentExpr=expr(_t,elementContent); + _t = _retTree; _t = __t449; _t = _t.getNextSibling(); *************** *** 4787,4797 **** match(_t,COMP_DOC_CONSTRUCTOR); _t = _t.getFirstChild(); - contentExpr=expr(_t,new PathExpr(context)); - _t = _retTree; ! DocumentConstructor doc = new DocumentConstructor(context, contentExpr); doc.setASTNode(d); step= doc; _t = __t450; _t = _t.getNextSibling(); --- 4788,4799 ---- match(_t,COMP_DOC_CONSTRUCTOR); _t = _t.getFirstChild(); ! elementContent = new PathExpr(context); ! DocumentConstructor doc = new DocumentConstructor(context, elementContent); doc.setASTNode(d); step= doc; + contentExpr=expr(_t,elementContent); + _t = _retTree; _t = __t450; _t = _t.getNextSibling(); Index: XQuery.g =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQuery.g,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** XQuery.g 29 Jun 2004 14:23:26 -0000 1.15 --- XQuery.g 2 Jul 2004 16:50:57 -0000 1.16 *************** *** 2414,2421 **** c.setContent(elementContent); PathExpr qnamePathExpr = new PathExpr(context); } qnameExpr=expr [qnamePathExpr] - { c.setNameExpr(qnameExpr); } contentExpr=expr [elementContent] ) --- 2414,2421 ---- c.setContent(elementContent); PathExpr qnamePathExpr = new PathExpr(context); + c.setNameExpr(qnamePathExpr); } qnameExpr=expr [qnamePathExpr] contentExpr=expr [elementContent] ) *************** *** 2428,2438 **** step = a; PathExpr qnamePathExpr = new PathExpr(context); elementContent = new PathExpr(context); ! a.setValueExpr(elementContent); } qnameExpr=expr [qnamePathExpr] - { a.setNameExpr(qnameExpr); } contentExpr=expr [elementContent] - { elementContent.add(contentExpr); } ) | --- 2428,2437 ---- step = a; PathExpr qnamePathExpr = new PathExpr(context); + a.setNameExpr(qnamePathExpr); elementContent = new PathExpr(context); ! a.setContentExpr(elementContent); } qnameExpr=expr [qnamePathExpr] contentExpr=expr [elementContent] ) | *************** *** 2444,2454 **** step = pd; PathExpr qnamePathExpr = new PathExpr(context); elementContent = new PathExpr(context); pd.setContentExpr(elementContent); } qnameExpr=expr [qnamePathExpr] - { pd.setNameExpr(qnameExpr); } contentExpr=expr [elementContent] - { elementContent.add(contentExpr); } ) | --- 2443,2452 ---- step = pd; PathExpr qnamePathExpr = new PathExpr(context); + pd.setNameExpr(qnamePathExpr); elementContent = new PathExpr(context); pd.setContentExpr(elementContent); } qnameExpr=expr [qnamePathExpr] contentExpr=expr [elementContent] ) | *************** *** 2504,2544 **** #( t:COMP_TEXT_CONSTRUCTOR ! contentExpr=expr [new PathExpr(context)] ! { ! DynamicTextConstructor text = new DynamicTextConstructor(context, contentExpr); text.setASTNode(t); step= text; } ) | #( tc:COMP_COMMENT_CONSTRUCTOR - contentExpr=expr [new PathExpr(context)] { ! DynamicCommentConstructor comment = new DynamicCommentConstructor(context, contentExpr); comment.setASTNode(t); step= comment; } ) | #( prefix:COMP_NS_CONSTRUCTOR - contentExpr=expr [new PathExpr(context)] { NamespaceConstructor ns = new NamespaceConstructor(context, prefix.getText()); ! ns.setURIExpression(contentExpr); ns.setASTNode(t); step= ns; } ) | #( d:COMP_DOC_CONSTRUCTOR - contentExpr=expr [new PathExpr(context)] { ! DocumentConstructor doc = new DocumentConstructor(context, contentExpr); doc.setASTNode(d); step= doc; } ) | --- 2502,2546 ---- #( t:COMP_TEXT_CONSTRUCTOR ! { ! elementContent = new PathExpr(context); ! DynamicTextConstructor text = new DynamicTextConstructor(context, elementContent); text.setASTNode(t); step= text; } + contentExpr=expr [elementContent] ) | #( tc:COMP_COMMENT_CONSTRUCTOR { ! elementContent = new PathExpr(context); ! DynamicCommentConstructor comment = new DynamicCommentConstructor(context, elementContent); comment.setASTNode(t); step= comment; } + contentExpr=expr [elementContent] ) | #( prefix:COMP_NS_CONSTRUCTOR { + elementContent = new PathExpr(context); NamespaceConstructor ns = new NamespaceConstructor(context, prefix.getText()); ! ns.setURIExpression(elementContent); ns.setASTNode(t); step= ns; } + contentExpr=expr [elementContent] ) | #( d:COMP_DOC_CONSTRUCTOR { ! elementContent = new PathExpr(context); ! DocumentConstructor doc = new DocumentConstructor(context, elementContent); doc.setASTNode(d); step= doc; } + contentExpr=expr [elementContent] ) | |
From: Wolfgang M. M. <wol...@us...> - 2004-06-30 15:57:39
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21812/src/org/exist/xquery Modified Files: OrderSpec.java BindingExpression.java DynamicCardinalityCheck.java Log Message: Fixed xquery caching bug in "order by" clause, which leads to a NullPointerException in DOMFile.getNodeValue. Index: OrderSpec.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/OrderSpec.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrderSpec.java 29 Jan 2004 15:06:42 -0000 1.1 --- OrderSpec.java 30 Jun 2004 15:56:59 -0000 1.2 *************** *** 65,67 **** --- 65,71 ---- return buf.toString(); } + + public void resetState() { + expression.resetState(); + } } Index: BindingExpression.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/BindingExpression.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BindingExpression.java 28 May 2004 10:54:12 -0000 1.3 --- BindingExpression.java 30 Jun 2004 15:56:59 -0000 1.4 *************** *** 191,194 **** --- 191,199 ---- if(whereExpr != null) whereExpr.resetState(); returnExpr.resetState(); + if(orderSpecs != null) { + for(int i = 0; i < orderSpecs.length; i++) { + orderSpecs[i].resetState(); + } + } } } Index: DynamicCardinalityCheck.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/DynamicCardinalityCheck.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DynamicCardinalityCheck.java 28 May 2004 10:54:12 -0000 1.2 --- DynamicCardinalityCheck.java 30 Jun 2004 15:56:59 -0000 1.3 *************** *** 52,60 **** int items = seq.getLength(); if(items > 0 && requiredCardinality == Cardinality.EMPTY) ! throw new XPathException("Empty sequence expected; got " + items); if(items == 0 && (requiredCardinality & Cardinality.ZERO) == 0) ! throw new XPathException("Empty sequence is not allowed here"); else if(items > 1 && (requiredCardinality & Cardinality.MANY) == 0) ! throw new XPathException("Sequence with more than one item is not allowed here"); return seq; } --- 52,60 ---- int items = seq.getLength(); if(items > 0 && requiredCardinality == Cardinality.EMPTY) ! throw new XPathException(getASTNode(), "Empty sequence expected; got " + items); if(items == 0 && (requiredCardinality & Cardinality.ZERO) == 0) ! throw new XPathException(getASTNode(), "Empty sequence is not allowed here"); else if(items > 1 && (requiredCardinality & Cardinality.MANY) == 0) ! throw new XPathException(getASTNode(), "Sequence with more than one item is not allowed here"); return seq; } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-30 15:57:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21812/src/org/exist/dom Modified Files: ElementImpl.java AbstractNodeSet.java Log Message: Fixed xquery caching bug in "order by" clause, which leads to a NullPointerException in DOMFile.getNodeValue. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ElementImpl.java 21 Jun 2004 15:27:36 -0000 1.40 --- ElementImpl.java 30 Jun 2004 15:56:59 -0000 1.41 *************** *** 449,454 **** if ((ownerDocument.reindex < 0 || ownerDocument.reindex > ownerDocument.getTreeLevel(gid)) ! && index) ownerDocument.broker.index(attrib, lastPath); return attrib; case Node.COMMENT_NODE : --- 449,455 ---- if ((ownerDocument.reindex < 0 || ownerDocument.reindex > ownerDocument.getTreeLevel(gid)) ! && index) { ownerDocument.broker.index(attrib, lastPath); + } return attrib; case Node.COMMENT_NODE : Index: AbstractNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AbstractNodeSet.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractNodeSet.java 23 Jun 2004 12:44:09 -0000 1.22 --- AbstractNodeSet.java 30 Jun 2004 15:56:59 -0000 1.23 *************** *** 263,268 **** if(al.getLength() == 1) return hasChildrenInSet(al.get(0), mode, rememberContext); ! // else ! // return quickSelectParentChild(al, mode, rememberContext); } NodeProxy n, p; --- 263,268 ---- if(al.getLength() == 1) return hasChildrenInSet(al.get(0), mode, rememberContext); ! else ! return quickSelectParentChild(al, mode, rememberContext); } NodeProxy n, p; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-30 15:57:26
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21812/src/org/exist/xquery/functions Modified Files: FunRoot.java Log Message: Fixed xquery caching bug in "order by" clause, which leads to a NullPointerException in DOMFile.getNodeValue. Index: FunRoot.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunRoot.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FunRoot.java 29 Jun 2004 14:21:23 -0000 1.3 --- FunRoot.java 30 Jun 2004 15:57:17 -0000 1.4 *************** *** 73,79 **** if (!Type.subTypeOf(item.getType(), Type.NODE)) throw new XPathException("Context item is not a node; got " + Type.getTypeName(item.getType())); ! if (item instanceof NodeProxy) ! return new NodeProxy(((NodeProxy) item).doc, 1, Node.ELEMENT_NODE); ! else return (NodeImpl) ((NodeImpl) item).getOwnerDocument().getDocumentElement(); } --- 73,79 ---- if (!Type.subTypeOf(item.getType(), Type.NODE)) throw new XPathException("Context item is not a node; got " + Type.getTypeName(item.getType())); ! if (item instanceof NodeProxy) { ! return new NodeProxy(((NodeProxy) item).doc, 1, Node.ELEMENT_NODE); ! } else return (NodeImpl) ((NodeImpl) item).getOwnerDocument().getDocumentElement(); } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-30 15:57:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21812/src/org/exist/storage/store Modified Files: DOMFile.java Log Message: Fixed xquery caching bug in "order by" clause, which leads to a NullPointerException in DOMFile.getNodeValue. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** DOMFile.java 23 Jun 2004 12:45:13 -0000 1.35 --- DOMFile.java 30 Jun 2004 15:57:16 -0000 1.36 *************** *** 391,397 **** } // write the data - // LOG.debug("inserting " + new String(value) + " to " + rec.page.page.getPageInfo() + "; " + - // rec.page.page.hashCode()); short tid = rec.page.getPageHeader().getNextTID(); ByteConversion.shortToByte((short) tid, rec.page.data, rec.offset); rec.offset += 2; --- 391,397 ---- } // write the data short tid = rec.page.getPageHeader().getNextTID(); + // LOG.debug("inserting " + new String(value) + " to " + rec.page.page.getPageInfo() + "; " + + // tid); ByteConversion.shortToByte((short) tid, rec.page.data, rec.offset); rec.offset += 2; *************** *** 431,435 **** } if(!requireSplit) { ! LOG.debug("page " + rec.page.getPageNum() + ": no split required"); rec.offset = rec.page.len; return rec; --- 431,435 ---- } if(!requireSplit) { ! // LOG.debug("page " + rec.page.getPageNum() + ": no split required"); rec.offset = rec.page.len; return rec; *************** *** 540,544 **** 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); --- 540,544 ---- 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); *************** *** 1290,1293 **** --- 1290,1298 ---- if (address == BTree.KEY_NOT_FOUND) return null; final RecordPos rec = findRecord(address); + if(rec == null) { + LOG.warn("Node data could not be found! Page: " + StorageAddress.pageFromPointer(address) + + "; tid: " + StorageAddress.tidFromPointer(address)); + throw new RuntimeException("Node data could not be found for node " + proxy.gid); + } final ByteArrayOutputStream os = new ByteArrayOutputStream(); getNodeValue(os, rec, true); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-30 15:57:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21812/src/org/exist/storage Modified Files: NativeElementIndex.java Log Message: Fixed xquery caching bug in "order by" clause, which leads to a NullPointerException in DOMFile.getNodeValue. Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NativeElementIndex.java 27 Jun 2004 21:10:07 -0000 1.32 --- NativeElementIndex.java 30 Jun 2004 15:56:59 -0000 1.33 *************** *** 557,564 **** last = gid; address = StorageAddress.read(is); ! if (!containsNode(idList, gid)) { newList.add(new NodeProxy(doc, gid, address)); - } } } --- 557,563 ---- last = gid; address = StorageAddress.read(is); ! if (!containsNode(idList, gid)) newList.add(new NodeProxy(doc, gid, address)); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 15:14:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8960/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: Removed extra byte stored for debugging. Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** DocumentImpl.java 29 Jun 2004 14:45:52 -0000 1.47 --- DocumentImpl.java 29 Jun 2004 15:13:55 -0000 1.48 *************** *** 694,698 **** VariableByteArrayInput istream = new VariableByteArrayInput(data); try { ! byte signature = istream.readByte(); // if(signature != DOCUMENT_NODE_SIGNATURE) { // LOG.error("Could not read document metadata for document " + fileName + --- 694,698 ---- VariableByteArrayInput istream = new VariableByteArrayInput(data); try { ! // byte signature = istream.readByte(); // if(signature != DOCUMENT_NODE_SIGNATURE) { // LOG.error("Could not read document metadata for document " + fileName + |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:46:03
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2192/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: Removed extra byte stored for debugging. Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** DocumentImpl.java 29 Jun 2004 14:26:48 -0000 1.46 --- DocumentImpl.java 29 Jun 2004 14:45:52 -0000 1.47 *************** *** 672,676 **** final VariableByteOutputStream ostream = new VariableByteOutputStream(7); try { - ostream.writeByte(DOCUMENT_NODE_SIGNATURE); if(children > 0) { for(int i = 0; i < children; i++) { --- 672,675 ---- *************** *** 696,704 **** try { byte signature = istream.readByte(); ! if(signature != DOCUMENT_NODE_SIGNATURE) { ! LOG.error("Could not read document metadata for document " + fileName + ! " ( " + docId + "): not a metadata node."); ! return; ! } childList = new long[children]; for (int i = 0; i < children; i++) { --- 695,703 ---- try { byte signature = istream.readByte(); ! // if(signature != DOCUMENT_NODE_SIGNATURE) { ! // LOG.error("Could not read document metadata for document " + fileName + ! // " ( " + docId + "): not a metadata node."); ! // return; ! // } childList = new long[children]; for (int i = 0; i < children; i++) { |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:36:02
|
Update of /cvsroot/exist/eXist-1.0/samples/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32348/samples/xquery Added Files: dynamic.xq Log Message: Added example for dynamic constructors. --- NEW FILE: dynamic.xq --- declare namespace x="http://www.x.de"; declare namespace f="urn:test"; declare function f:copyChildren($node as node()) as node()+ { ($node/@*, for $n in $node/* return f:copy($n)) }; declare function f:copy($node as node()) as node()+ { if($node instance of element()) then ( if(local-name($node) eq "para") then element p { f:copyChildren($node) } else element { node-name($node) } { f:copyChildren($node) } ) else $node }; <html> {f:copy(root(doc("/db/test/test.xml")))} </html> |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:26:59
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30306/src/org/exist/storage Modified Files: NativeBroker.java Log Message: Fixed bug in automatic defragmentation method leading to random exceptions (like "node not found", "not implemented" etc.). Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** NativeBroker.java 23 Jun 2004 12:45:12 -0000 1.83 --- NativeBroker.java 29 Jun 2004 14:26:48 -0000 1.84 *************** *** 1190,1202 **** } flush(); LOG.debug("Copy took " + (System.currentTimeMillis() - start) + "ms."); } public void defrag(final DocumentImpl doc) { ! LOG.debug("--------------------> Defragmenting document " + doc.getFileName()); final long start = System.currentTimeMillis(); try { ! // dropping old index elementIndex.dropIndex(doc); // dropping dom index NodeRef ref = new NodeRef(doc.getDocId()); --- 1190,1207 ---- } flush(); + closeDocument(); LOG.debug("Copy took " + (System.currentTimeMillis() - start) + "ms."); } public void defrag(final DocumentImpl doc) { ! LOG.debug("============> Defragmenting document " + ! doc.getCollection().getName() + '/' + doc.getFileName()); final long start = System.currentTimeMillis(); try { ! final NodeImpl firstChild = (NodeImpl)doc.getFirstChild(); ! ! // dropping old structure index elementIndex.dropIndex(doc); + // dropping dom index NodeRef ref = new NodeRef(doc.getDocId()); *************** *** 1221,1228 **** --- 1226,1235 ---- .run(); + // create a copy of the old doc to copy the nodes into it DocumentImpl tempDoc = new DocumentImpl(this, doc.getFileName(), doc.getCollection()); tempDoc.copyOf(doc); tempDoc.setDocId(doc.getDocId()); + // copy the nodes Iterator iterator; NodeList nodes = doc.getChildNodes(); *************** *** 1238,1245 **** flush(); new DOMTransaction(this, domDb) { public Object start() { ! NodeImpl node = (NodeImpl)doc.getFirstChild(); ! domDb.removeAll(node.getInternalAddress()); return null; } --- 1245,1253 ---- flush(); + // remove the old nodes new DOMTransaction(this, domDb) { public Object start() { ! domDb.remove(doc.getAddress()); ! domDb.removeAll(firstChild.getInternalAddress()); return null; } *************** *** 1251,1256 **** doc.setAddress(-1); doc.setPageCount(tempDoc.getPageCount()); - LOG.debug("New doc size: " + doc.getContentLength()); storeDocument(doc); saveCollection(doc.getCollection()); --- 1259,1264 ---- doc.setAddress(-1); doc.setPageCount(tempDoc.getPageCount()); storeDocument(doc); + closeDocument(); saveCollection(doc.getCollection()); *************** *** 1490,1494 **** Value val = domDb.get(p.getInternalAddress()); if (val == null) { ! LOG.debug("node " + p.gid + " not found!"); Thread.dumpStack(); return null; --- 1498,1503 ---- Value val = domDb.get(p.getInternalAddress()); if (val == null) { ! LOG.debug("node " + p.gid + " not found in document " + ! p.doc.getCollection().getName() + '/' + p.doc.getFileName()); Thread.dumpStack(); return null; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:26:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30306/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: Fixed bug in automatic defragmentation method leading to random exceptions (like "node not found", "not implemented" etc.). Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** DocumentImpl.java 23 Jun 2004 12:44:17 -0000 1.45 --- DocumentImpl.java 29 Jun 2004 14:26:48 -0000 1.46 *************** *** 66,69 **** --- 66,71 ---- public final static byte BINARY_FILE = 1; + public final static byte DOCUMENT_NODE_SIGNATURE = 0x0F; + private transient NodeIndexListener listener = NullNodeIndexListener.INSTANCE; *************** *** 670,673 **** --- 672,676 ---- final VariableByteOutputStream ostream = new VariableByteOutputStream(7); try { + ostream.writeByte(DOCUMENT_NODE_SIGNATURE); if(children > 0) { for(int i = 0; i < children; i++) { *************** *** 692,695 **** --- 695,704 ---- VariableByteArrayInput istream = new VariableByteArrayInput(data); try { + byte signature = istream.readByte(); + if(signature != DOCUMENT_NODE_SIGNATURE) { + LOG.error("Could not read document metadata for document " + fileName + + " ( " + docId + "): not a metadata node."); + return; + } childList = new long[children]; for (int i = 0; i < children; i++) { *************** *** 703,707 **** pageCount = istream.readInt(); } catch (IOException e) { ! LOG.warn("io error while reading document data", e); } } --- 712,716 ---- pageCount = istream.readInt(); } catch (IOException e) { ! LOG.warn("io error while reading document data for document " + fileName, e); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:25:23
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/memtree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29938/src/org/exist/memtree Modified Files: DocumentImpl.java NodeImpl.java Receiver.java MemTreeBuilder.java Added Files: NamespaceNode.java Log Message: Added dynamic namespace constructor. Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/NodeImpl.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NodeImpl.java 2 Jun 2004 11:34:34 -0000 1.15 --- NodeImpl.java 29 Jun 2004 14:25:12 -0000 1.16 *************** *** 50,53 **** --- 50,54 ---- public final static short REFERENCE_NODE = 100; + public final static short NAMESPACE_NODE = 101; protected int nodeNumber; --- NEW FILE: NamespaceNode.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: NamespaceNode.java,v 1.1 2004/06/29 14:25:12 wolfgang_m Exp $ */ package org.exist.memtree; import org.exist.dom.QName; import org.exist.xquery.value.Type; /** * A dynamically constructed namespace node. * * @author wolf */ public class NamespaceNode extends NodeImpl { /** * @param doc * @param nodeNumber */ public NamespaceNode(DocumentImpl doc, int nodeNumber) { super(doc, nodeNumber); } /* (non-Javadoc) * @see org.exist.memtree.NodeImpl#getNodeType() */ public short getNodeType() { return NodeImpl.NAMESPACE_NODE; } /* (non-Javadoc) * @see org.exist.memtree.NodeImpl#getType() */ public int getType() { return Type.NAMESPACE; } public String getPrefix() { QName qn = (QName)document.namePool.get(document.nodeName[nodeNumber]); return qn != null ? qn.getLocalName() : null; } public String getNamespaceURI() { return new String(document.characters, document.alpha[nodeNumber], document.alphaLen[nodeNumber]); } } Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/DocumentImpl.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DocumentImpl.java 27 Jun 2004 21:10:06 -0000 1.10 --- DocumentImpl.java 29 Jun 2004 14:25:12 -0000 1.11 *************** *** 27,30 **** --- 27,32 ---- import org.exist.dom.QName; import org.exist.util.hashtable.NamePool; + import org.exist.xquery.XQueryContext; + import org.exist.xquery.value.Type; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; *************** *** 278,281 **** --- 280,286 ---- node = new ReferenceNode(this, nodeNr); break; + case NodeImpl.NAMESPACE_NODE: + node = new NamespaceNode(this, nodeNr); + break; default: throw new DOMException(DOMException.NOT_FOUND_ERR, *************** *** 567,570 **** --- 572,582 ---- .addReferenceNode(document.references[document.alpha[nr]]); break; + case NodeImpl.NAMESPACE_NODE: + XQueryContext context = receiver.getContext(); + QName prefix = (QName) document.namePool.get(document.nodeName[nr]); + String uri = new String(document.characters, + document.alpha[nr], document.alphaLen[nr]); + context.declareInScopeNamespace(prefix.getLocalName(), uri); + break; } } Index: Receiver.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/Receiver.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Receiver.java 3 May 2004 13:08:43 -0000 1.4 --- Receiver.java 29 Jun 2004 14:25:12 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- import org.exist.dom.NodeProxy; import org.exist.dom.QName; + import org.exist.xquery.XQueryContext; import org.w3c.dom.Document; import org.xml.sax.Attributes; *************** *** 54,57 **** --- 55,62 ---- } + public XQueryContext getContext() { + return builder.getContext(); + } + /* (non-Javadoc) * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) Index: MemTreeBuilder.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/MemTreeBuilder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MemTreeBuilder.java 27 Jun 2004 21:10:06 -0000 1.11 --- MemTreeBuilder.java 29 Jun 2004 14:25:12 -0000 1.12 *************** *** 28,31 **** --- 28,32 ---- import org.exist.dom.QName; import org.exist.xquery.XQueryContext; + import org.exist.xquery.value.Type; import org.w3c.dom.Node; import org.xml.sax.Attributes; *************** *** 64,67 **** --- 65,72 ---- } + public XQueryContext getContext() { + return context; + } + public int getSize() { return doc.getSize(); *************** *** 242,244 **** --- 247,261 ---- return nodeNr; } + + public int namespaceNode(String prefix, String uri) { + QName qn = new QName(prefix, null, null); + int nodeNr = doc.addNode(NodeImpl.NAMESPACE_NODE, level, qn); + doc.addChars(nodeNr, uri); + int prevNr = prevNodeInLevel[level]; + if (prevNr > -1) + doc.next[prevNr] = nodeNr; + doc.next[nodeNr] = prevNodeInLevel[level - 1]; + prevNodeInLevel[level] = nodeNr; + return nodeNr; + } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:23:35
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/src/org/exist/xquery/value Modified Files: QNameValue.java Type.java Log Message: Added dynamic namespace constructor. Index: QNameValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/QNameValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QNameValue.java 28 May 2004 10:54:10 -0000 1.2 --- QNameValue.java 29 Jun 2004 14:23:26 -0000 1.3 *************** *** 52,59 **** */ public String getStringValue() throws XPathException { ! String prefix = context.getPrefixForURI(qname.getNamespaceURI()); ! if (prefix == null) ! throw new XPathException( ! "namespace " + qname.getNamespaceURI() + " is not defined"); return qname.toString(); } --- 52,61 ---- */ public String getStringValue() throws XPathException { ! if(qname.needsNamespaceDecl()) { ! String prefix = context.getPrefixForURI(qname.getNamespaceURI()); ! if (prefix == null) ! throw new XPathException( ! "namespace " + qname.getNamespaceURI() + " is not defined"); ! } return qname.toString(); } Index: Type.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/Type.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Type.java 17 Jun 2004 13:18:39 -0000 1.2 --- Type.java 29 Jun 2004 14:23:26 -0000 1.3 *************** *** 53,57 **** public final static int COMMENT = 5; public final static int DOCUMENT = 6; ! public final static int NAMESPACE = 7; public final static int EMPTY = 10; --- 53,57 ---- public final static int COMMENT = 5; public final static int DOCUMENT = 6; ! public final static int NAMESPACE = 500; public final static int EMPTY = 10; |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:23:33
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/src/org/exist/xquery Added Files: NamespaceConstructor.java Log Message: Added dynamic namespace constructor. --- NEW FILE: NamespaceConstructor.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: NamespaceConstructor.java,v 1.1 2004/06/29 14:23:24 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.memtree.DocumentImpl; import org.exist.memtree.MemTreeBuilder; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; /** * Implements a dynamic namespace constructor. * * @author wolf */ public class NamespaceConstructor extends NodeConstructor { private String prefix = null; private Expression uri = null; /** * @param context */ public NamespaceConstructor(XQueryContext context, String prefix) { super(context); this.prefix = prefix; } public void setURIExpression(Expression uriExpr) { this.uri = new Atomize(context, uriExpr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); Sequence uriSeq = uri.eval(contextSequence, contextItem); String value = null; if(uriSeq.getLength() == 0) value = ""; else { StringBuffer buf = new StringBuffer(); for(SequenceIterator i = uriSeq.iterate(); i.hasNext(); ) { context.proceed(this, builder); Item next = i.nextItem(); if(buf.length() > 0) buf.append(' '); buf.append(next.toString()); } value = buf.toString(); } context.declareInScopeNamespace(prefix, value); int nodeNr = builder.namespaceNode(prefix, value); return ((DocumentImpl)builder.getDocument()).getNode(nodeNr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("namespace ").append(prefix); buf.append("{ ").append(uri.pprint()).append(" }"); return buf.toString(); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-06-29 14:21:33
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29067/src/org/exist/xquery/functions Modified Files: ModuleImpl.java FunName.java FunRoot.java Added Files: FunNodeName.java Log Message: Added missing XQuery standard function fn:node-name(). Index: FunName.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunName.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FunName.java 29 Jan 2004 15:06:41 -0000 1.1 --- FunName.java 29 Jun 2004 14:21:23 -0000 1.2 *************** *** 45,48 **** --- 45,50 ---- new FunctionSignature( new QName("name", BUILTIN_FUNCTION_NS), + "Returns the name of a node, as an xs:string that is " + + "either the zero-length string, or has the lexical form of an xs:QName", new SequenceType[] { new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) }, new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE), Index: FunRoot.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunRoot.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FunRoot.java 28 May 2004 10:54:09 -0000 1.2 --- FunRoot.java 29 Jun 2004 14:21:23 -0000 1.3 *************** *** 35,38 **** --- 35,39 ---- import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; + import org.w3c.dom.Node; /** *************** *** 73,77 **** throw new XPathException("Context item is not a node; got " + Type.getTypeName(item.getType())); if (item instanceof NodeProxy) ! return new NodeProxy(((NodeProxy) item).doc, 1); else return (NodeImpl) ((NodeImpl) item).getOwnerDocument().getDocumentElement(); --- 74,78 ---- throw new XPathException("Context item is not a node; got " + Type.getTypeName(item.getType())); if (item instanceof NodeProxy) ! return new NodeProxy(((NodeProxy) item).doc, 1, Node.ELEMENT_NODE); else return (NodeImpl) ((NodeImpl) item).getOwnerDocument().getDocumentElement(); --- NEW FILE: FunNodeName.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: FunNodeName.java,v 1.1 2004/06/29 14:21:23 wolfgang_m Exp $ */ package org.exist.xquery.functions; import org.exist.dom.QName; import org.exist.memtree.NodeImpl; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.QNameValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; import org.w3c.dom.Node; /** * @author wolf * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class FunNodeName extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("node-name", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), " Returns an expanded-QName for node kinds that can have names. For other kinds " + "of nodes it returns the empty sequence. If $a is the empty sequence, the " + "empty sequence is returned.", new SequenceType[] { new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) }, new SequenceType(Type.QNAME, Cardinality.ZERO_OR_ONE), true); /** * @param context * @param signature */ public FunNodeName(XQueryContext context) { super(context, signature); } /* (non-Javadoc) * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) */ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { if(args[0].getLength() == 0) return Sequence.EMPTY_SEQUENCE; NodeValue val = (NodeValue)args[0]; Node node = val.getNode(); if(node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.ATTRIBUTE_NODE) { if(val.getImplementationType() == NodeValue.IN_MEMORY_NODE) return new QNameValue(context, ((NodeImpl)val).getQName()); else return new QNameValue(context, ((org.exist.dom.NodeImpl)node).getQName()); } return Sequence.EMPTY_SEQUENCE; } } Index: ModuleImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ModuleImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ModuleImpl.java 3 Jun 2004 10:27:05 -0000 1.3 --- ModuleImpl.java 29 Jun 2004 14:21:23 -0000 1.4 *************** *** 74,77 **** --- 74,78 ---- new FunctionDef(FunMax.signature, FunMax.class), new FunctionDef(FunMin.signature, FunMin.class), + new FunctionDef(FunNodeName.signature, FunNodeName.class), new FunctionDef(FunName.signature, FunName.class), new FunctionDef(FunNamespaceURI.signature, FunNamespaceURI.class), |
From: Wolfgang M. M. <wol...@us...> - 2004-06-27 21:10:48
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8241/src/org/exist/xquery Modified Files: XQueryContext.java ElementConstructor.java TextConstructor.java Added Files: DynamicAttributeConstructor.java DynamicTextConstructor.java DocumentConstructor.java DynamicPIConstructor.java DynamicCommentConstructor.java Log Message: Added support for dynamic node constructors in XQuery. --- NEW FILE: DynamicAttributeConstructor.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: DynamicAttributeConstructor.java,v 1.1 2004/06/27 21:10:06 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.dom.QName; import org.exist.memtree.DocumentImpl; import org.exist.memtree.MemTreeBuilder; import org.exist.memtree.NodeImpl; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; /** * Represents a dynamic attribute constructor. The implementation differs from * AttributeConstructor as the evaluation is not controlled by the surrounding * element. The attribute name as well as its value are only determined at evaluation time, * not at compile time. * * @author wolf */ public class DynamicAttributeConstructor extends NodeConstructor { private Expression qnameExpr; private Expression valueExpr; /** * @param context */ public DynamicAttributeConstructor(XQueryContext context) { super(context); } public void setNameExpr(Expression expr) { this.qnameExpr = new Atomize(context, expr); } public void setValueExpr(Expression expr) { this.valueExpr = new Atomize(context, expr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); Sequence nameSeq = qnameExpr.eval(contextSequence, contextItem); if(nameSeq.getLength() != 1) throw new XPathException(getASTNode(), "The name expression should evaluate to a single value"); QName qn = QName.parse(context, nameSeq.getStringValue()); String value; Sequence valueSeq = valueExpr.eval(contextSequence, contextItem); if(valueSeq.getLength() == 0) value = ""; else { StringBuffer buf = new StringBuffer(); for(SequenceIterator i = valueSeq.iterate(); i.hasNext(); ) { Item next = i.nextItem(); buf.append(next.getStringValue()); if(i.hasNext()) buf.append(' '); } value = buf.toString(); } int nodeNr = builder.addAttribute(qn, value); NodeImpl node = ((DocumentImpl)builder.getDocument()).getAttribute(nodeNr); return node; } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("attribute { "); buf.append(qnameExpr.pprint()); buf.append(" } { "); buf.append(valueExpr.pprint()); buf.append(" }"); return buf.toString(); } } Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** XQueryContext.java 2 Jun 2004 11:34:36 -0000 1.17 --- XQueryContext.java 27 Jun 2004 21:10:06 -0000 1.18 *************** *** 657,662 **** public void popDocumentContext() { ! if (!fragmentStack.isEmpty()) builder = (MemTreeBuilder) fragmentStack.pop(); } --- 657,663 ---- public void popDocumentContext() { ! if (!fragmentStack.isEmpty()) { builder = (MemTreeBuilder) fragmentStack.pop(); + } } --- NEW FILE: DocumentConstructor.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: DocumentConstructor.java,v 1.1 2004/06/27 21:10:06 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.memtree.MemTreeBuilder; import org.exist.memtree.NodeImpl; import org.exist.memtree.Receiver; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; import org.exist.xquery.value.Type; import org.xml.sax.SAXException; /** * Implements a dynamic document constructor. Creates a new * document node with its own node identity. * * @author wolf */ public class DocumentConstructor extends NodeConstructor { private Expression content; /** * @param context */ public DocumentConstructor(XQueryContext context, Expression contentExpr) { super(context); this.content = contentExpr; } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { System.out.println(content.pprint()); Sequence contentSeq = content.eval(contextSequence, contextItem); context.pushDocumentContext(); MemTreeBuilder builder = context.getDocumentBuilder(); Receiver receiver = new Receiver(builder); if(contentSeq.getLength() == 0) return builder.getDocument(); try { StringBuffer buf = null; SequenceIterator i = contentSeq.iterate(); Item next = i.nextItem(); while(next != null) { context.proceed(this, builder); if(next.getType() == Type.ATTRIBUTE || next.getType() == Type.NAMESPACE || next.getType() == Type.DOCUMENT) throw new XPathException(getASTNode(), "Found a node of type " + Type.getTypeName(next.getType()) + " inside a document constructor"); // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. if (Type.subTypeOf(next.getType(), Type.ATOMIC)) { if(buf == null) buf = new StringBuffer(); else if (buf.length() > 0) buf.append(' '); buf.append(next.getStringValue()); next = i.nextItem(); // if item is a node, flush any collected character data and // copy the node to the target doc. } else if (Type.subTypeOf(next.getType(), Type.NODE)) { if (buf != null && buf.length() > 0) { receiver.characters(buf); buf.setLength(0); } next.copyTo(context.getBroker(), receiver); next = i.nextItem(); } } // flush remaining character data if (buf != null && buf.length() > 0) receiver.characters(buf); } catch(SAXException e) { throw new XPathException(getASTNode(), "Encountered SAX exception while processing document constructor: " + pprint()); } NodeImpl node = builder.getDocument(); context.popDocumentContext(); return node; } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("document { ").append(content.pprint()).append(" }"); return buf.toString(); } } Index: TextConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/TextConstructor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TextConstructor.java 28 May 2004 10:54:12 -0000 1.3 --- TextConstructor.java 27 Jun 2004 21:10:06 -0000 1.4 *************** *** 31,35 **** /** ! * Constructor for text nodes. * * @author wolf --- 31,35 ---- /** ! * Direct constructor for text nodes. * * @author wolf --- NEW FILE: DynamicCommentConstructor.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: DynamicCommentConstructor.java,v 1.1 2004/06/27 21:10:06 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.memtree.DocumentImpl; import org.exist.memtree.MemTreeBuilder; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; /** * Implements a dynamic comment constructor. Contrary to {@link org.exist.xquery.CommentConstructor}, * the character content of a DynamicCommentConstructor is determined only at evaluation time. * * @author wolf */ public class DynamicCommentConstructor extends NodeConstructor { private Expression content; /** * @param context */ public DynamicCommentConstructor(XQueryContext context, Expression contentExpr) { super(context); this.content = new Atomize(context, contentExpr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { Sequence contentSeq = content.eval(contextSequence, contextItem); if(contentSeq.getLength() == 0) return Sequence.EMPTY_SEQUENCE; MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); StringBuffer buf = new StringBuffer(); for(SequenceIterator i = contentSeq.iterate(); i.hasNext(); ) { context.proceed(this, builder); Item next = i.nextItem(); if(buf.length() > 0) buf.append(' '); buf.append(next.toString()); } int nodeNr = builder.comment(buf.toString()); return ((DocumentImpl)builder.getDocument()).getNode(nodeNr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("comment { ").append(content.pprint()).append(" }"); return buf.toString(); } } --- NEW FILE: DynamicTextConstructor.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: DynamicTextConstructor.java,v 1.1 2004/06/27 21:10:06 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.memtree.DocumentImpl; import org.exist.memtree.MemTreeBuilder; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; /** * Implements a dynamic text constructor. Contrary to {@link org.exist.xquery.TextConstructor}, * the character content of a DynamicTextConstructor is determined only at evaluation time. * * @author wolf */ public class DynamicTextConstructor extends NodeConstructor { private Expression content; /** * @param context */ public DynamicTextConstructor(XQueryContext context, Expression contentExpr) { super(context); this.content = new Atomize(context, contentExpr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { Sequence contentSeq = content.eval(contextSequence, contextItem); if(contentSeq.getLength() == 0) return Sequence.EMPTY_SEQUENCE; MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); StringBuffer buf = new StringBuffer(); for(SequenceIterator i = contentSeq.iterate(); i.hasNext(); ) { context.proceed(this, builder); Item next = i.nextItem(); if(buf.length() > 0) buf.append(' '); buf.append(next.toString()); } int nodeNr = builder.characters(buf); return ((DocumentImpl)builder.getDocument()).getNode(nodeNr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("text { ").append(content.pprint()).append(" }"); return buf.toString(); } } --- NEW FILE: DynamicPIConstructor.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: DynamicPIConstructor.java,v 1.1 2004/06/27 21:10:06 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.dom.QName; import org.exist.memtree.DocumentImpl; import org.exist.memtree.MemTreeBuilder; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; import org.exist.xquery.value.Type; /** * Dynamic constructor for processing instruction nodes. * * @author wolf */ public class DynamicPIConstructor extends NodeConstructor { private Expression name; private Expression content; /** * @param context */ public DynamicPIConstructor(XQueryContext context) { super(context); } public void setNameExpr(Expression nameExpr) { this.name = nameExpr; } public void setContentExpr(Expression contentExpr) { this.content = contentExpr; } /* (non-Javadoc) * @see org.exist.xquery.Expression#eval(org.exist.xquery.value.Sequence, org.exist.xquery.value.Item) */ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { MemTreeBuilder builder = context.getDocumentBuilder(); context.proceed(this, builder); Sequence nameSeq = name.eval(contextSequence, contextItem); if(nameSeq.getLength() != 1) throw new XPathException(getASTNode(), "The name expression should evaluate to a single value"); Item nameItem = nameSeq.itemAt(0); if(!(nameItem.getType() == Type.STRING || nameItem.getType() == Type.QNAME)) throw new XPathException(getASTNode(), "The name expression should evaluate to a string or qname"); QName qn = QName.parse(context, nameSeq.getStringValue()); String value; Sequence contentSeq = content.eval(contextSequence, contextItem); if(contentSeq.getLength() == 0) value = ""; else { StringBuffer buf = new StringBuffer(); for(SequenceIterator i = contentSeq.iterate(); i.hasNext(); ) { context.proceed(this, builder); Item next = i.nextItem(); if(buf.length() > 0) buf.append(' '); buf.append(next.toString()); } value = buf.toString(); } int nodeNr = builder.processingInstruction(qn.getLocalName(), value); return ((DocumentImpl)builder.getDocument()).getNode(nodeNr); } /* (non-Javadoc) * @see org.exist.xquery.Expression#pprint() */ public String pprint() { StringBuffer buf = new StringBuffer(); buf.append("processing-instruction { ").append(name.pprint()); buf.append(" } { ").append(content.pprint()).append(" }"); return buf.toString(); } } Index: ElementConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ElementConstructor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ElementConstructor.java 28 May 2004 10:54:12 -0000 1.4 --- ElementConstructor.java 27 Jun 2004 21:10:06 -0000 1.5 *************** *** 29,36 **** import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.xml.sax.helpers.AttributesImpl; /** ! * Constructor for element nodes. * * @author wolf --- 29,38 ---- import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; + import org.exist.xquery.value.StringValue; import org.xml.sax.helpers.AttributesImpl; /** ! * Constructor for element nodes. This class handles both, direct and dynamic ! * element constructors. * * @author wolf *************** *** 38,48 **** public class ElementConstructor extends NodeConstructor { ! private String qname; private PathExpr content = null; private AttributeConstructor attributes[] = null; public ElementConstructor(XQueryContext context, String qname) { super(context); ! this.qname = qname; } --- 40,54 ---- public class ElementConstructor extends NodeConstructor { ! private Expression qnameExpr; private PathExpr content = null; private AttributeConstructor attributes[] = null; + public ElementConstructor(XQueryContext context) { + super(context); + } + public ElementConstructor(XQueryContext context, String qname) { super(context); ! this.qnameExpr = new LiteralValue(context, new StringValue(qname)); } *************** *** 51,54 **** --- 57,64 ---- } + public void setNameExpr(Expression expr) { + this.qnameExpr = new Atomize(context, expr); + } + public void addAttribute(AttributeConstructor attr) { if(attributes == null) { *************** *** 106,110 **** // create the element ! QName qn = QName.parse(context, qname); int nodeNr = builder.startElement(qn, attrs); // process element contents --- 116,124 ---- // create the element ! Sequence qnameSeq = qnameExpr.eval(contextSequence, contextItem); ! if(qnameSeq.getLength() != 1) ! throw new XPathException("Type error: the node name should evaluate to a single string"); ! QName qn = QName.parse(context, qnameSeq.getStringValue()); ! int nodeNr = builder.startElement(qn, attrs); // process element contents *************** *** 123,127 **** public String pprint() { StringBuffer buf = new StringBuffer(); ! buf.append('<').append(qname); if(attributes != null) { AttributeConstructor attr; --- 137,141 ---- public String pprint() { StringBuffer buf = new StringBuffer(); ! buf.append('<').append(qnameExpr.pprint()); if(attributes != null) { AttributeConstructor attr; *************** *** 136,140 **** buf.append('>'); buf.append(content.pprint()); ! buf.append("</").append(qname.toString()).append('>'); } return buf.toString(); --- 150,154 ---- buf.append('>'); buf.append(content.pprint()); ! buf.append("</").append(qnameExpr.pprint()).append('>'); } return buf.toString(); |
From: Wolfgang M. M. <wol...@us...> - 2004-06-27 21:10:47
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/memtree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8241/src/org/exist/memtree Modified Files: DocumentImpl.java AttributeImpl.java MemTreeBuilder.java Log Message: Added support for dynamic node constructors in XQuery. Index: MemTreeBuilder.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/MemTreeBuilder.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MemTreeBuilder.java 28 May 2004 10:54:11 -0000 1.10 --- MemTreeBuilder.java 27 Jun 2004 21:10:06 -0000 1.11 *************** *** 167,177 **** } ! public void addAttribute(QName qname, String value) { int lastNode = doc.getLastNode(); ! if(doc.nodeKind[lastNode] != Node.ELEMENT_NODE) { ! characters(value); } else { ! doc.addAttribute(lastNode, qname, value); } } --- 167,178 ---- } ! public int addAttribute(QName qname, String value) { int lastNode = doc.getLastNode(); ! if(0 < lastNode && doc.nodeKind[lastNode] != Node.ELEMENT_NODE) { ! lastNode = characters(value); } else { ! lastNode = doc.addAttribute(lastNode, qname, value); } + return lastNode; } Index: AttributeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/AttributeImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeImpl.java 2 Mar 2004 08:35:44 -0000 1.3 --- AttributeImpl.java 27 Jun 2004 21:10:06 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- import org.exist.dom.QName; + import org.exist.xquery.value.Type; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; *************** *** 56,60 **** --- 57,77 ---- return getQName().toString(); } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeType() + */ + public short getNodeType() { + return Node.ATTRIBUTE_NODE; + } + + + /* (non-Javadoc) + * @see org.exist.memtree.NodeImpl#getType() + */ + public int getType() { + return Type.ATTRIBUTE; + } + /* (non-Javadoc) * @see org.w3c.dom.Node#getLocalName() Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/DocumentImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DocumentImpl.java 28 May 2004 10:54:11 -0000 1.9 --- DocumentImpl.java 27 Jun 2004 21:10:06 -0000 1.10 *************** *** 23,26 **** --- 23,27 ---- import java.util.Arrays; + import org.apache.xerces.dom.AttrNSImpl; import org.exist.dom.NodeProxy; import org.exist.dom.QName; *************** *** 251,254 **** --- 252,259 ---- } + public NodeImpl getAttribute(int nodeNr) throws DOMException { + return new AttributeImpl(this, nodeNr); + } + public NodeImpl getNode(int nodeNr) throws DOMException { if (nodeNr == 0) return this; *************** *** 520,528 **** } } ! private void startNode(NodeImpl node, Receiver receiver) throws SAXException { int nr = node.nodeNumber; ! switch (nodeKind[nr]) { case Node.ELEMENT_NODE: QName nodeName = (QName) document.namePool --- 525,533 ---- } } ! private void startNode(NodeImpl node, Receiver receiver) throws SAXException { int nr = node.nodeNumber; ! switch (node.getNodeType()) { case Node.ELEMENT_NODE: QName nodeName = (QName) document.namePool *************** *** 544,547 **** --- 549,556 ---- document.alphaLen[nr]); break; + case Node.ATTRIBUTE_NODE: + QName attrQName = (QName) document.namePool.get(document.attrName[nr]); + receiver.attribute(attrQName, attrValue[nr]); + break; case Node.COMMENT_NODE: receiver.comment(document.characters, document.alpha[nr], |