From: Wolfgang M. M. <wol...@us...> - 2004-09-12 09:25:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21081/src/org/exist/xmldb Modified Files: LocalXMLResource.java LocalCollection.java LocalResourceSet.java LocalXPathQueryService.java Log Message: * Added support for XQuery pragmas to set serialization and watchdog settings. * org.exist.storage.serializers.Serializer now passes all output to an instance of the Receiver interface instead of a SAX ContentHandler. Receiver resembles SAX, but has methods that are closer to eXist's internal storage. For example, it directly accepts a QName in startElement to avoid unnecessary string allocations. * Fixed various performance leaks in cross-document joins. Index: LocalXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXPathQueryService.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** LocalXPathQueryService.java 2 Jul 2004 16:53:53 -0000 1.43 --- LocalXPathQueryService.java 12 Sep 2004 09:25:15 -0000 1.44 *************** *** 42,45 **** --- 42,46 ---- import org.exist.storage.XQueryPool; import org.exist.xquery.CompiledXQuery; + import org.exist.xquery.Pragma; import org.exist.xquery.XPathException; import org.exist.xquery.XQuery; *************** *** 259,262 **** --- 260,285 ---- } context.setBackwardsCompatibility(xpathCompatible); + checkPragmas(context); + } + + /** + * Check if the XQuery contains pragmas that define serialization settings. + * If yes, copy the corresponding settings to the current set of output properties. + * + * @param context + */ + protected void checkPragmas(XQueryContext context) throws XPathException { + Pragma pragma = context.getPragma(Pragma.SERIALIZE_QNAME); + if(pragma == null) + return; + String[] contents = pragma.tokenizeContents(); + for(int i = 0; i < contents.length; i++) { + String[] pair = Pragma.parseKeyValuePair(contents[i]); + if(pair == null) + throw new XPathException("Unknown parameter found in " + pragma.getQName().toString() + + ": '" + contents[i] + "'"); + LOG.debug("Setting serialization property from pragma: " + pair[0] + " = " + pair[1]); + properties.setProperty(pair[0], pair[1]); + } } Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** LocalCollection.java 16 Aug 2004 19:53:47 -0000 1.42 --- LocalCollection.java 12 Sep 2004 09:25:15 -0000 1.43 *************** *** 78,82 **** defaultProperties.setProperty(OutputKeys.ENCODING, "UTF-8"); defaultProperties.setProperty(OutputKeys.INDENT, "yes"); ! defaultProperties.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "yes"); defaultProperties.setProperty(EXistOutputKeys.PROCESS_XSL_PI, "no"); } --- 78,82 ---- defaultProperties.setProperty(OutputKeys.ENCODING, "UTF-8"); defaultProperties.setProperty(OutputKeys.INDENT, "yes"); ! defaultProperties.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "no"); defaultProperties.setProperty(EXistOutputKeys.PROCESS_XSL_PI, "no"); } Index: LocalResourceSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalResourceSet.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** LocalResourceSet.java 10 May 2004 11:22:51 -0000 1.19 --- LocalResourceSet.java 12 Sep 2004 09:25:15 -0000 1.20 *************** *** 156,162 **** LocalCollection coll = collection; if (coll == null ! || p.doc.getCollection() == null ! || coll.getCollection().getId() != p.doc.getCollection().getId()) { ! coll = new LocalCollection(user, brokerPool, null, p.doc.getCollection().getName()); coll.properties = outputProperties; } --- 156,162 ---- LocalCollection coll = collection; if (coll == null ! || p.getDocument().getCollection() == null ! || coll.getCollection().getId() != p.getDocument().getCollection().getId()) { ! coll = new LocalCollection(user, brokerPool, null, p.getDocument().getCollection().getName()); coll.properties = outputProperties; } Index: LocalXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXMLResource.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** LocalXMLResource.java 12 Aug 2004 16:07:17 -0000 1.40 --- LocalXMLResource.java 12 Sep 2004 09:25:15 -0000 1.41 *************** *** 64,68 **** public LocalXMLResource(User user, BrokerPool pool, LocalCollection parent, NodeProxy p) throws XMLDBException { ! this(user, pool, parent, p.doc.getFileName(), p.gid); this.proxy = p; } --- 64,68 ---- public LocalXMLResource(User user, BrokerPool pool, LocalCollection parent, NodeProxy p) throws XMLDBException { ! this(user, pool, parent, p.getDocument().getFileName(), p.gid); this.proxy = p; } |