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
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-05-18 08:23:54
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv703/src/org/exist/dom Modified Files: NodeImpl.java Log Message: Fixed NullPointerException when serializing node with namespace and null prefix. Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeImpl.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NodeImpl.java 10 May 2004 11:22:39 -0000 1.19 --- NodeImpl.java 18 May 2004 08:23:45 -0000 1.20 *************** *** 344,349 **** */ public String getPrefix() { ! if (nodeName != null) ! return nodeName.getPrefix(); // if (nodeName != null && nodeName.indexOf(':') > -1) // return nodeName.substring(0, nodeName.indexOf(':')); --- 344,351 ---- */ public String getPrefix() { ! if (nodeName != null) { ! final String prefix = nodeName.getPrefix(); ! return prefix == null ? "" : prefix; ! } // if (nodeName != null && nodeName.indexOf(':') > -1) // return nodeName.substring(0, nodeName.indexOf(':')); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 12:17:42
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7339/src/org/exist/xquery/functions/text Modified Files: TextModule.java Added Files: MatchCount.java Log Message: Added new function: text:match-count. --- NEW FILE: MatchCount.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: MatchCount.java,v 1.1 2004/05/17 12:17:32 wolfgang_m Exp $ */ package org.exist.xquery.functions.text; import org.exist.dom.Match; import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.IntegerValue; import org.exist.xquery.value.Item; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceIterator; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.Type; /** * @author wolf */ public class MatchCount extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("match-count", TextModule.NAMESPACE_URI, TextModule.PREFIX), "Counts the number of fulltext matches within the nodes and subnodes in $a.", new SequenceType[]{ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)}, new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE)); /** * @param context * @param signature */ public MatchCount(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 { // return 0.0 if the argument sequence is empty if(args[0].getLength() == 0) return IntegerValue.ZERO; int count = 0; for(SequenceIterator i = args[0].iterate(); i.hasNext(); ) { Item next = i.nextItem(); if(Type.subTypeOf(next.getType(), Type.NODE)) { NodeValue nv = (NodeValue)next; if(nv.getImplementationType() != NodeValue.PERSISTENT_NODE) throw new XPathException(getName() + " cannot be applied to XQuery-constructed nodes."); NodeProxy np = (NodeProxy)nv; for(Match nextMatch = np.match; nextMatch != null; count++) { nextMatch = nextMatch.getNextMatch(); } } } return new IntegerValue(count); } } Index: TextModule.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text/TextModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TextModule.java 30 Mar 2004 16:56:31 -0000 1.2 --- TextModule.java 17 May 2004 12:17:33 -0000 1.3 *************** *** 40,44 **** new FunctionDef(FuzzyMatchAny.signature, FuzzyMatchAny.class), new FunctionDef(FuzzyIndexTerms.signature, FuzzyIndexTerms.class), ! new FunctionDef(TextRank.signature, TextRank.class) }; --- 40,45 ---- new FunctionDef(FuzzyMatchAny.signature, FuzzyMatchAny.class), new FunctionDef(FuzzyIndexTerms.signature, FuzzyIndexTerms.class), ! new FunctionDef(TextRank.signature, TextRank.class), ! new FunctionDef(MatchCount.signature, MatchCount.class) }; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 11:30:02
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996/src/org/exist/http Modified Files: RESTServer.java Log Message: REST interface now also uses the global XQuery cache. Index: RESTServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/RESTServer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RESTServer.java 27 Apr 2004 15:46:59 -0000 1.9 --- RESTServer.java 17 May 2004 11:29:50 -0000 1.10 *************** *** 31,35 **** import java.net.URI; import java.net.URISyntaxException; - import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; --- 31,34 ---- *************** *** 51,60 **** import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; - import org.exist.xquery.parser.XQueryLexer; - import org.exist.xquery.parser.XQueryParser; - import org.exist.xquery.parser.XQueryTreeParser; import org.exist.security.Permission; import org.exist.security.PermissionDeniedException; import org.exist.storage.DBBroker; import org.exist.storage.serializers.EXistOutputKeys; import org.exist.storage.serializers.Serializer; --- 50,59 ---- import org.exist.dom.DocumentImpl; import org.exist.dom.DocumentSet; import org.exist.security.Permission; import org.exist.security.PermissionDeniedException; + import org.exist.source.Source; + import org.exist.source.StringSource; import org.exist.storage.DBBroker; + import org.exist.storage.XQueryPool; import org.exist.storage.serializers.EXistOutputKeys; import org.exist.storage.serializers.Serializer; *************** *** 62,67 **** import org.exist.util.serializer.SAXSerializer; import org.exist.util.serializer.SAXSerializerPool; ! import org.exist.xquery.PathExpr; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.Item; --- 61,67 ---- import org.exist.util.serializer.SAXSerializer; import org.exist.util.serializer.SAXSerializerPool; ! import org.exist.xquery.CompiledXQuery; import org.exist.xquery.XPathException; + import org.exist.xquery.XQuery; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.Item; *************** *** 80,87 **** import org.xml.sax.helpers.AttributesImpl; - import antlr.RecognitionException; - import antlr.TokenStreamException; - import antlr.collections.AST; - /** * --- 80,83 ---- *************** *** 431,435 **** String result = null; try { - XQueryContext context = new XQueryContext(broker); DocumentSet docs = new DocumentSet(); Collection collection = broker.getCollection(path); --- 427,430 ---- *************** *** 443,476 **** broker.getAllDocuments(docs); } context.setStaticallyKnownDocuments(docs); ! XQueryLexer lexer = new XQueryLexer(new StringReader(query)); ! XQueryParser parser = new XQueryParser(lexer); ! XQueryTreeParser treeParser = new XQueryTreeParser(context); ! parser.xpath(); ! if (parser.foundErrors()) { ! throw new BadRequestException(parser.getErrorMessage()); ! } ! AST ast = parser.getAST(); ! PathExpr expr = new PathExpr(context); ! treeParser.xpath(ast, expr); ! if (treeParser.foundErrors()) { ! throw new BadRequestException(treeParser.getErrorMessage()); } - LOG.info("query: " + expr.pprint()); - if (parser.foundErrors()) - throw new BadRequestException(parser.getErrorMessage()); - long startTime = System.currentTimeMillis(); - Sequence resultSequence = expr.eval(null, null); - long queryTime = System.currentTimeMillis() - startTime; - LOG.debug("Found " + resultSequence.getLength() + " in " + queryTime + "ms."); - return printResults(broker, resultSequence, howmany, start, - queryTime, outputProperties); - } catch (RecognitionException e) { - throw new BadRequestException(e.getMessage(), e); - } catch (TokenStreamException e) { - throw new BadRequestException(e.getMessage(), e); } catch (XPathException e) { throw new BadRequestException(e.getMessage(), e); ! } } --- 438,469 ---- broker.getAllDocuments(docs); } + Source source = new StringSource(query); + XQuery xquery = broker.getXQueryService(); + XQueryPool pool = xquery.getXQueryPool(); + CompiledXQuery compiled = pool.borrowCompiledXQuery(source); + XQueryContext context; + if(compiled == null) + context = xquery.newContext(); + else + context = compiled.getContext(); context.setStaticallyKnownDocuments(docs); ! ! if(compiled == null) ! compiled = xquery.compile(context, source); ! try { ! long startTime = System.currentTimeMillis(); ! Sequence resultSequence = xquery.execute(compiled, null); ! long queryTime = System.currentTimeMillis() - startTime; ! LOG.debug("Found " + resultSequence.getLength() + " in " + queryTime + "ms."); ! return printResults(broker, resultSequence, howmany, start, ! queryTime, outputProperties); ! } finally { ! pool.returnCompiledXQuery(source, compiled); } } catch (XPathException e) { throw new BadRequestException(e.getMessage(), e); ! } catch (IOException e) { ! throw new BadRequestException(e.getMessage(), e); ! } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 11:29:00
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27796/src/org/exist/xquery/functions/util Modified Files: CatchFunction.java Log Message: Update documentation string in util:catch Index: CatchFunction.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util/CatchFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CatchFunction.java 17 May 2004 09:52:00 -0000 1.1 --- CatchFunction.java 17 May 2004 11:28:47 -0000 1.2 *************** *** 45,49 **** new FunctionSignature( new QName("catch", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), ! "Catches the specified exceptions.", new SequenceType[] { new SequenceType(Type.STRING, Cardinality.ONE_OR_MORE), --- 45,52 ---- new FunctionSignature( new QName("catch", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), ! "This function corresponds to a try-catch statement in Java. The code block " + ! "in $b will be put inside a try-catch statement. If an exception is thrown while executing " + ! "$b, the function checks the name of the exception and calls $c if it matches one of " + ! "the fully qualified Java class names specified in $a", new SequenceType[] { new SequenceType(Type.STRING, Cardinality.ONE_OR_MORE), |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:48
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xquery Modified Files: ForExpr.java PathExpr.java LocationStep.java XPathUtil.java ElementConstructor.java EnclosedExpr.java XQueryContext.java TextConstructor.java Added Files: CompiledXQuery.java Log Message: WatchDog + XQuery cache integration Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LocationStep.java 5 May 2004 18:05:41 -0000 1.6 --- LocationStep.java 17 May 2004 09:59:42 -0000 1.7 *************** *** 407,410 **** --- 407,411 ---- public void resetState() { super.resetState(); + // System.out.println(pprint() + ": reset!!!!"); currentSet = null; currentDocs = null; Index: XPathUtil.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XPathUtil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XPathUtil.java 13 May 2004 12:31:32 -0000 1.2 --- XPathUtil.java 17 May 2004 09:59:42 -0000 1.3 *************** *** 28,31 **** --- 28,36 ---- import org.exist.dom.AVLTreeNodeSet; import org.exist.dom.NodeProxy; + import org.exist.memtree.MemTreeBuilder; + import org.exist.memtree.NodeImpl; + import org.exist.memtree.Receiver; + import org.exist.util.serializer.DOMStreamer; + import org.exist.util.serializer.DOMStreamerPool; import org.exist.xquery.value.BooleanValue; import org.exist.xquery.value.DoubleValue; *************** *** 39,45 **** --- 44,61 ---- import org.exist.xquery.value.ValueSequence; import org.w3c.dom.Node; + import org.w3c.dom.NodeList; + import org.xml.sax.SAXException; public class XPathUtil { + /** + * Convert Java object to an XQuery sequence. Objects of type Sequence + * are directly returned, other objects are converted into the corresponding + * internal types. + * + * @param obj + * @return + * @throws XPathException + */ public final static Sequence javaObjectToXPath(Object obj) throws XPathException { if (obj == null) *************** *** 78,81 **** --- 94,134 ---- } return seq; + } else if (obj instanceof NodeList) { + DOMStreamer streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(); + try { + MemTreeBuilder builder = new MemTreeBuilder(); + builder.startDocument(); + Receiver receiver = new Receiver(builder); + streamer.setContentHandler(receiver); + ValueSequence seq = new ValueSequence(); + NodeList nl = (NodeList)obj; + int last = builder.getDocument().getLastNode(); + for(int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + streamer.serialize(n, false); + NodeImpl created = builder.getDocument().getNode(last + 1); + seq.add(created); + last = builder.getDocument().getLastNode(); + } + return seq; + } catch (SAXException e) { + throw new XPathException("Failed to transform node into internal model: " + e.getMessage()); + } finally { + DOMStreamerPool.getInstance().returnDOMStreamer(streamer); + } + } else if (obj instanceof Node) { + DOMStreamer streamer = DOMStreamerPool.getInstance().borrowDOMStreamer(); + try { + MemTreeBuilder builder = new MemTreeBuilder(); + builder.startDocument(); + Receiver receiver = new Receiver(builder); + streamer.setContentHandler(receiver); + streamer.serialize((Node)obj, false); + return builder.getDocument().getNode(1); + } catch (SAXException e) { + throw new XPathException("Failed to transform node into internal model: " + e.getMessage()); + } finally { + DOMStreamerPool.getInstance().returnDOMStreamer(streamer); + } } else if (obj instanceof Object[]) { boolean createNodeSequence = true; Index: ForExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ForExpr.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForExpr.java 5 May 2004 18:05:41 -0000 1.3 --- ForExpr.java 17 May 2004 09:59:42 -0000 1.4 *************** *** 110,113 **** --- 110,114 ---- // loop through each variable binding for (SequenceIterator i = in.iterate(); i.hasNext(); p++) { + context.proceed(this); contextItem = i.nextItem(); context.setContextPosition(p); Index: TextConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/TextConstructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TextConstructor.java 29 Jan 2004 15:06:42 -0000 1.1 --- TextConstructor.java 17 May 2004 09:59:42 -0000 1.2 *************** *** 60,63 **** --- 60,64 ---- return Sequence.EMPTY_SEQUENCE; MemTreeBuilder builder = context.getDocumentBuilder(); + context.proceed(this, builder); int nodeNr = builder.characters(text); NodeImpl node = ((DocumentImpl)builder.getDocument()).getNode(nodeNr); Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** XQueryContext.java 10 May 2004 11:22:43 -0000 1.14 --- XQueryContext.java 17 May 2004 09:59:42 -0000 1.15 *************** *** 41,51 **** import org.exist.dom.SymbolTable; import org.exist.memtree.MemTreeBuilder; - import org.exist.xquery.parser.XQueryLexer; - import org.exist.xquery.parser.XQueryParser; - import org.exist.xquery.parser.XQueryTreeParser; import org.exist.security.User; import org.exist.storage.DBBroker; import org.exist.xquery.functions.text.TextModule; import org.exist.xquery.functions.transform.ModuleImpl; import org.exist.xquery.value.Sequence; --- 41,51 ---- import org.exist.dom.SymbolTable; import org.exist.memtree.MemTreeBuilder; import org.exist.security.User; import org.exist.storage.DBBroker; import org.exist.xquery.functions.text.TextModule; import org.exist.xquery.functions.transform.ModuleImpl; + import org.exist.xquery.parser.XQueryLexer; + import org.exist.xquery.parser.XQueryParser; + import org.exist.xquery.parser.XQueryTreeParser; import org.exist.xquery.value.Sequence; *************** *** 91,94 **** --- 91,96 ---- private Stack forwardReferences = new Stack(); + private XQueryWatchDog watchdog; + /** * Loaded modules. *************** *** 135,141 **** public XQueryContext(DBBroker broker) { this.broker = broker; loadDefaults(); } ! public void setRootExpression(Expression expr) { this.rootExpression = expr; --- 137,146 ---- public XQueryContext(DBBroker broker) { this.broker = broker; + this.watchdog = new XQueryWatchDog(this); loadDefaults(); + builder = new MemTreeBuilder(this); + builder.startDocument(); } ! public void setRootExpression(Expression expr) { this.rootExpression = expr; *************** *** 308,315 **** public void reset() { ! builder = null; staticDocuments = null; variableStack.clear(); ! fragmentStack.clear(); } --- 313,322 ---- public void reset() { ! builder = new MemTreeBuilder(this); ! builder.startDocument(); staticDocuments = null; variableStack.clear(); ! fragmentStack = new Stack(); ! watchdog.reset(); } *************** *** 574,577 **** --- 581,611 ---- } + /* Methods delegated to the watchdog */ + + public void proceed() throws TerminatedException { + proceed(null); + } + + public void proceed(Expression expr) throws TerminatedException { + watchdog.proceed(expr); + } + + public void proceed(Expression expr, MemTreeBuilder builder) throws TerminatedException { + watchdog.proceed(expr, builder); + } + + public void recover() { + watchdog.reset(); + builder = null; + } + + public XQueryWatchDog getWatchDog() { + return watchdog; + } + + protected void setWatchDog(XQueryWatchDog watchdog) { + this.watchdog = watchdog; + } + /** * Push any document fragment created within the current *************** *** 579,584 **** */ public void pushDocumentContext() { ! if (builder != null) ! fragmentStack.push(builder); builder = null; } --- 613,617 ---- */ public void pushDocumentContext() { ! fragmentStack.push(builder); builder = null; } *************** *** 731,734 **** --- 764,768 ---- context.setStaticallyKnownDocuments(getStaticallyKnownDocuments()); context.setBaseURI(baseURI); + context.setWatchDog(watchdog); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); Index: EnclosedExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/EnclosedExpr.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EnclosedExpr.java 3 May 2004 13:08:45 -0000 1.4 --- EnclosedExpr.java 17 May 2004 09:59:42 -0000 1.5 *************** *** 67,70 **** --- 67,71 ---- StringBuffer buf = null; while (next != null) { + context.proceed(this, builder); // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. Index: ElementConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ElementConstructor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ElementConstructor.java 27 Apr 2004 15:46:58 -0000 1.2 --- ElementConstructor.java 17 May 2004 09:59:42 -0000 1.3 *************** *** 23,30 **** package org.exist.xquery; - import java.util.ArrayList; - import java.util.Iterator; - import java.util.List; - import org.exist.dom.QName; import org.exist.memtree.DocumentImpl; --- 23,26 ---- *************** *** 44,48 **** private String qname; private PathExpr content = null; ! private List attributes = null; public ElementConstructor(XQueryContext context, String qname) { --- 40,44 ---- private String qname; private PathExpr content = null; ! private AttributeConstructor attributes[] = null; public ElementConstructor(XQueryContext context, String qname) { *************** *** 56,62 **** public void addAttribute(AttributeConstructor attr) { ! if(attributes == null) ! attributes = new ArrayList(); ! attributes.add(attr); } --- 52,64 ---- public void addAttribute(AttributeConstructor attr) { ! if(attributes == null) { ! attributes = new AttributeConstructor[1]; ! attributes[0] = attr; ! } else { ! AttributeConstructor natts[] = new AttributeConstructor[attributes.length + 1]; ! System.arraycopy(attributes, 0, natts, 0, attributes.length); ! natts[attributes.length] = attr; ! attributes = natts; ! } } *************** *** 77,82 **** QName attrQName; // first, search for xmlns attributes and declare in-scope namespaces ! for(Iterator i = attributes.iterator(); i.hasNext(); ) { ! constructor = (AttributeConstructor)i.next(); if(constructor.isNamespaceDeclaration()) { int p = constructor.getQName().indexOf(':'); --- 79,84 ---- QName attrQName; // first, search for xmlns attributes and declare in-scope namespaces ! for(int i = 0; i < attributes.length; i++) { ! constructor = (AttributeConstructor)attributes[i]; if(constructor.isNamespaceDeclaration()) { int p = constructor.getQName().indexOf(':'); *************** *** 90,95 **** } // process the remaining attributesCharArr ! for(Iterator i = attributes.iterator(); i.hasNext(); ) { ! constructor = (AttributeConstructor)i.next(); if(!constructor.isNamespaceDeclaration()) { attrValues = constructor.eval(contextSequence, contextItem); --- 92,98 ---- } // process the remaining attributesCharArr ! for(int i = 0; i < attributes.length; i++) { ! context.proceed(this, builder); ! constructor = (AttributeConstructor)attributes[i]; if(!constructor.isNamespaceDeclaration()) { attrValues = constructor.eval(contextSequence, contextItem); *************** *** 100,103 **** --- 103,108 ---- } } + context.proceed(this, builder); + // create the element QName qn = QName.parse(context, qname); *************** *** 121,126 **** if(attributes != null) { AttributeConstructor attr; ! for(Iterator i = attributes.iterator(); i.hasNext(); ) { ! attr = (AttributeConstructor)i.next(); buf.append(' ').append(attr.pprint()); } --- 126,131 ---- if(attributes != null) { AttributeConstructor attr; ! for(int i = 0; i < attributes.length; i++) { ! attr = (AttributeConstructor)attributes[i]; buf.append(' ').append(attr.pprint()); } *************** *** 151,156 **** content.resetState(); if(attributes != null) ! for(Iterator i = attributes.iterator(); i.hasNext(); ) { ! Expression next = (Expression)i.next(); next.resetState(); } --- 156,161 ---- content.resetState(); if(attributes != null) ! for(int i = 0; i < attributes.length; i++) { ! Expression next = (Expression)attributes[i]; next.resetState(); } --- NEW FILE: CompiledXQuery.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: CompiledXQuery.java,v 1.1 2004/05/17 09:59:42 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.xmldb.CompiledExpression; import org.exist.xquery.value.Sequence; /** * @author wolf */ public interface CompiledXQuery extends CompiledExpression { public void setCreationTime(long created); public long getCreationTime(); public void reset(); public XQueryContext getContext(); public Sequence eval(Sequence contextSequence) throws XPathException; } Index: PathExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/PathExpr.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PathExpr.java 5 May 2004 18:05:41 -0000 1.4 --- PathExpr.java 17 May 2004 09:59:42 -0000 1.5 *************** *** 42,46 **** * @author Wolfgang Meier (wol...@ex...) */ ! public class PathExpr extends AbstractExpression implements CompiledExpression { protected static Logger LOG = Logger.getLogger( PathExpr.class ); --- 42,46 ---- * @author Wolfgang Meier (wol...@ex...) */ ! public class PathExpr extends AbstractExpression implements CompiledXQuery, CompiledExpression { protected static Logger LOG = Logger.getLogger( PathExpr.class ); *************** *** 50,53 **** --- 50,55 ---- protected boolean inPredicate = false; + private long creationTime = 0; + public PathExpr(XQueryContext context) { super(context); *************** *** 275,277 **** --- 277,295 ---- resetState(); } + + + /* (non-Javadoc) + * @see org.exist.xquery.CompiledXQuery#setCreationTime(long) + */ + public void setCreationTime(long created) { + creationTime = created; + } + + + /* (non-Javadoc) + * @see org.exist.xquery.CompiledXQuery#getCreationTime() + */ + public long getCreationTime() { + return creationTime; + } } \ No newline at end of file |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:45
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xmldb Modified Files: LocalXMLResource.java LocalXPathQueryService.java XQueryService.java LocalCollection.java RemoteXPathQueryService.java Log Message: WatchDog + XQuery cache integration Index: RemoteXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteXPathQueryService.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RemoteXPathQueryService.java 30 Mar 2004 16:56:32 -0000 1.15 --- RemoteXPathQueryService.java 17 May 2004 09:59:43 -0000 1.16 *************** *** 9,12 **** --- 9,13 ---- import org.apache.xmlrpc.XmlRpcException; + import org.exist.source.Source; import org.exist.xmlrpc.RpcAPI; import org.xmldb.api.base.Collection; *************** *** 59,62 **** --- 60,75 ---- } + /* (non-Javadoc) + * @see org.exist.xmldb.XQueryService#execute(org.exist.source.Source) + */ + public ResourceSet execute(Source source) throws XMLDBException { + try { + String xq = source.getContent(); + return query(xq, null); + } catch (IOException e) { + throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage(), e ); + } + } + public ResourceSet query( XMLResource res, String query ) throws XMLDBException { *************** *** 153,157 **** return new RemoteCompiledExpression(query); } ! /* (non-Javadoc) * @see org.exist.xmldb.XQueryService#execute(org.exist.xmldb.CompiledExpression) --- 166,170 ---- return new RemoteCompiledExpression(query); } ! /* (non-Javadoc) * @see org.exist.xmldb.XQueryService#execute(org.exist.xmldb.CompiledExpression) Index: LocalXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXPathQueryService.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** LocalXPathQueryService.java 10 May 2004 11:22:51 -0000 1.39 --- LocalXPathQueryService.java 17 May 2004 09:59:42 -0000 1.40 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xmldb; + import java.io.IOException; import java.io.StringReader; import java.util.Iterator; *************** *** 35,47 **** import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; - import org.exist.xquery.parser.XQueryLexer; - import org.exist.xquery.parser.XQueryParser; - import org.exist.xquery.parser.XQueryTreeParser; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; ! import org.exist.xquery.PathExpr; ! import org.exist.xquery.XQueryContext; import org.exist.xquery.XPathException; import org.exist.xquery.value.Sequence; import org.xmldb.api.base.Collection; --- 36,48 ---- import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; import org.exist.security.User; + import org.exist.source.Source; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; ! import org.exist.storage.XQueryPool; ! import org.exist.xquery.CompiledXQuery; import org.exist.xquery.XPathException; + import org.exist.xquery.XQuery; + import org.exist.xquery.XQueryContext; import org.exist.xquery.value.Sequence; import org.xmldb.api.base.Collection; *************** *** 51,58 **** import org.xmldb.api.modules.XMLResource; - import antlr.RecognitionException; - import antlr.TokenStreamException; - import antlr.collections.AST; - public class LocalXPathQueryService implements XPathQueryServiceImpl, XQueryService { --- 52,55 ---- *************** *** 148,151 **** --- 145,149 ---- throws XMLDBException { long start = System.currentTimeMillis(); + CompiledXQuery expr = (CompiledXQuery)expression; DBBroker broker = null; Sequence result; *************** *** 155,182 **** docs = collection.getCollection().allDocs(broker, new DocumentSet(), true); } ! ! expression.reset(); ! XQueryContext context = ((PathExpr)expression).getContext(); ! context.setBroker(broker); context.setBackwardsCompatibility(xpathCompatible); context.setStaticallyKnownDocuments(docs); ! Map.Entry entry; ! // declare namespace/prefix mappings ! for (Iterator i = namespaceDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! context.declareNamespace((String) entry.getKey(), (String) entry.getValue()); ! } ! // declare static variables ! for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! try { ! context.declareVariable((String) entry.getKey(), entry.getValue()); ! } catch (XPathException e) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); ! } ! } ! result = ((PathExpr)expression).eval(contextSet, null); ! expression.reset(); ! context.reset(); } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); --- 153,163 ---- docs = collection.getCollection().allDocs(broker, new DocumentSet(), true); } ! ! XQueryContext context = expr.getContext(); context.setBackwardsCompatibility(xpathCompatible); context.setStaticallyKnownDocuments(docs); ! setupContext(context); ! XQuery xquery = broker.getXQueryService(); ! result = xquery.execute(expr, contextSet); } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); *************** *** 193,196 **** --- 174,221 ---- } + public ResourceSet execute(Source source) + throws XMLDBException { + long start = System.currentTimeMillis(); + DBBroker broker = null; + Sequence result; + try { + broker = brokerPool.get(user); + DocumentSet docs = collection.getCollection().allDocs(broker, new DocumentSet(), true); + + XQuery xquery = broker.getXQueryService(); + XQueryPool pool = xquery.getXQueryPool(); + XQueryContext context; + CompiledXQuery compiled = pool.borrowCompiledXQuery(source); + if(compiled == null) + context = xquery.newContext(); + else + context = compiled.getContext(); + context.setBackwardsCompatibility(xpathCompatible); + context.setStaticallyKnownDocuments(docs); + setupContext(context); + + if(compiled == null) + compiled = xquery.compile(context, source); + try { + result = xquery.execute(compiled, null); + } finally { + pool.returnCompiledXQuery(source, compiled); + } + } catch (EXistException e) { + throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); + } catch (XPathException e) { + throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); + } catch (IOException e) { + throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); + } finally { + brokerPool.release(broker); + } + LOG.debug("query took " + (System.currentTimeMillis() - start) + " ms."); + if(result != null) + return new LocalResourceSet(user, brokerPool, collection, properties, result, null); + else + return null; + } + public CompiledExpression compile(String query) throws XMLDBException { DBBroker broker = null; *************** *** 198,249 **** long start = System.currentTimeMillis(); broker = brokerPool.get(user); ! XQueryContext context = new XQueryContext(broker); ! context.setBaseURI(properties.getProperty("base-uri", collection.getPath())); ! if(moduleLoadPath != null) ! context.setModuleLoadPath(moduleLoadPath); ! Map.Entry entry; ! // declare namespace/prefix mappings ! for (Iterator i = namespaceDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! context.declareNamespace( ! (String) entry.getKey(), ! (String) entry.getValue()); ! } ! // declare static variables ! for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! context.declareVariable((String) entry.getKey(), entry.getValue()); ! } ! context.setBackwardsCompatibility(xpathCompatible); ! XQueryLexer lexer = new XQueryLexer(new StringReader(query)); ! XQueryParser parser = new XQueryParser(lexer); ! XQueryTreeParser treeParser = new XQueryTreeParser(context); ! parser.xpath(); ! if (parser.foundErrors()) { ! LOG.debug(parser.getErrorMessage()); ! throw new XMLDBException( ! ErrorCodes.UNKNOWN_ERROR, ! parser.getErrorMessage()); ! } - AST ast = parser.getAST(); - //LOG.debug("AST: " + ast.toStringTree()); - PathExpr expr = new PathExpr(context); - treeParser.xpath(ast, expr); - if (treeParser.foundErrors()) { - throw new XMLDBException( - ErrorCodes.UNKNOWN_ERROR, - treeParser.getErrorMessage(), - treeParser.getLastException()); - } LOG.debug("compilation took " + (System.currentTimeMillis() - start)); - //LOG.debug("query:\n " + expr.pprint()); return expr; } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); - } catch (RecognitionException e) { - throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); - } catch (TokenStreamException e) { - throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); } catch (XPathException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); --- 223,235 ---- long start = System.currentTimeMillis(); broker = brokerPool.get(user); ! XQuery xquery = broker.getXQueryService(); ! XQueryContext context = xquery.newContext(); ! setupContext(context); ! CompiledXQuery expr = xquery.compile(context, new StringReader(query)); LOG.debug("compilation took " + (System.currentTimeMillis() - start)); return expr; } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); } catch (XPathException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); *************** *** 254,258 **** } } ! protected ResourceSet doQuery( String query, --- 240,264 ---- } } ! ! protected void setupContext(XQueryContext context) throws XMLDBException, XPathException { ! context.setBaseURI(properties.getProperty("base-uri", collection.getPath())); ! if(moduleLoadPath != null) ! context.setModuleLoadPath(moduleLoadPath); ! Map.Entry entry; ! // declare namespace/prefix mappings ! for (Iterator i = namespaceDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! context.declareNamespace( ! (String) entry.getKey(), ! (String) entry.getValue()); ! } ! // declare static variables ! for (Iterator i = variableDecls.entrySet().iterator(); i.hasNext();) { ! entry = (Map.Entry) i.next(); ! context.declareVariable((String) entry.getKey(), entry.getValue()); ! } ! context.setBackwardsCompatibility(xpathCompatible); ! } ! protected ResourceSet doQuery( String query, *************** *** 265,295 **** } - /* protected ResourceSet doQuery( - CompiledExpression compiled, - DocumentSet docs, - NodeSet contextSet, - String sortExpr) - throws XMLDBException { - long start = System.currentTimeMillis(); - PathExpr expr = ((PathExpr) compiled); - expr.getContext().setStaticallyKnownDocuments(docs); - try { - Sequence result = expr.eval(contextSet, null); - LOG.info( - expr.pprint() - + " found: " - + result.getLength() - + " in " - + (System.currentTimeMillis() - start) - + "ms."); - LocalResourceSet resultSet = - new LocalResourceSet(user, brokerPool, collection, properties, result, sortExpr); - expr.reset(); - return resultSet; - } catch (XPathException e) { - throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); - } - } */ - public ResourceSet queryResource(String resource, String query) throws XMLDBException { --- 271,274 ---- Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** LocalCollection.java 3 May 2004 12:58:11 -0000 1.31 --- LocalCollection.java 17 May 2004 09:59:42 -0000 1.32 *************** *** 377,381 **** String name = res.getId(); LOG.debug("removing " + name); ! String path = getPath() + '/' + name; DocumentImpl doc = collection.getDocument(path); if (doc == null) --- 377,381 ---- String name = res.getId(); LOG.debug("removing " + name); ! String path = collection.getName() + '/' + name; DocumentImpl doc = collection.getDocument(path); if (doc == null) Index: XQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/XQueryService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XQueryService.java 8 Feb 2004 09:11:54 -0000 1.3 --- XQueryService.java 17 May 2004 09:59:42 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xmldb; + import org.exist.source.Source; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.Service; *************** *** 70,73 **** --- 71,76 ---- public CompiledExpression compile(String query) throws XMLDBException; + public ResourceSet execute(Source source) throws XMLDBException; + /** * Execute a compiled XQuery. Index: LocalXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXMLResource.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** LocalXMLResource.java 3 May 2004 12:58:11 -0000 1.31 --- LocalXMLResource.java 17 May 2004 09:59:42 -0000 1.32 *************** *** 81,84 **** --- 81,85 ---- this.document = doc; this.docId = doc.getFileName(); + System.out.println(docId); if (docId.indexOf('/') > -1) docId = docId.substring(docId.lastIndexOf('/') + 1); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:28
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/memtree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/memtree Modified Files: DocumentImpl.java MemTreeBuilder.java Log Message: WatchDog + XQuery cache integration Index: MemTreeBuilder.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/MemTreeBuilder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MemTreeBuilder.java 3 May 2004 13:08:43 -0000 1.8 --- MemTreeBuilder.java 17 May 2004 09:59:41 -0000 1.9 *************** *** 61,73 **** * @return */ ! public Document getDocument() { return doc; } /** * Start building the document. */ public void startDocument() { ! this.doc = new DocumentImpl(500, 50, 1000, 50); } --- 61,77 ---- * @return */ ! public DocumentImpl getDocument() { return doc; } + public int getSize() { + return doc.getSize(); + } + /** * Start building the document. */ public void startDocument() { ! this.doc = new DocumentImpl(); } Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/DocumentImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DocumentImpl.java 3 May 2004 13:08:43 -0000 1.7 --- DocumentImpl.java 17 May 2004 09:59:41 -0000 1.8 *************** *** 57,61 **** protected NamePool namePool = new NamePool(); ! protected short[] nodeKind; protected short[] treeLevel; --- 57,61 ---- protected NamePool namePool = new NamePool(); ! protected short[] nodeKind = null; protected short[] treeLevel; *************** *** 89,109 **** protected int nextRef = 0; ! public DocumentImpl(int nodeSize, int attrSize, int charBufSize, int refSize) { super(null, 0); ! nodeKind = new short[nodeSize]; ! treeLevel = new short[nodeSize]; ! next = new int[nodeSize]; Arrays.fill(next, -1); ! nodeName = new int[nodeSize]; ! alpha = new int[nodeSize]; ! alphaLen = new int[nodeSize]; ! characters = new char[charBufSize]; ! attrName = new int[attrSize]; ! attrParent = new int[attrSize]; ! attrValue = new String[attrSize]; ! references = new NodeProxy[refSize]; treeLevel[0] = 0; --- 89,117 ---- protected int nextRef = 0; ! private final static int NODE_SIZE = 128; ! private final static int ATTR_SIZE = 64; ! private final static int CHAR_BUF_SIZE = 1024; ! private final static int REF_SIZE = 128; ! ! public DocumentImpl() { super(null, 0); ! } ! ! private void init() { ! nodeKind = new short[NODE_SIZE]; ! treeLevel = new short[NODE_SIZE]; ! next = new int[NODE_SIZE]; Arrays.fill(next, -1); ! nodeName = new int[NODE_SIZE]; ! alpha = new int[NODE_SIZE]; ! alphaLen = new int[NODE_SIZE]; ! characters = new char[CHAR_BUF_SIZE]; ! attrName = new int[ATTR_SIZE]; ! attrParent = new int[ATTR_SIZE]; ! attrValue = new String[ATTR_SIZE]; ! references = new NodeProxy[REF_SIZE]; treeLevel[0] = 0; *************** *** 112,116 **** --- 120,136 ---- } + public void reset() { + size = 0; + nextChar = 0; + nextAttr = 0; + nextRef = 0; + } + + public int getSize() { + return size; + } + public int addNode(short kind, short level, QName qname) { + if (nodeKind == null) init(); if (size == nodeKind.length) grow(); nodeKind[size] = kind; *************** *** 123,126 **** --- 143,147 ---- public void addChars(int nodeNr, char[] ch, int start, int len) { + if (nodeKind == null) init(); if (nextChar + len >= characters.length) { int newLen = (characters.length * 3) / 2; *************** *** 137,140 **** --- 158,162 ---- public void addChars(int nodeNr, CharSequence s) { + if (nodeKind == null) init(); int len = s.length(); if (nextChar + len >= characters.length) { *************** *** 153,156 **** --- 175,179 ---- public void addReferenceNode(int nodeNr, NodeProxy proxy) { + if (nodeKind == null) init(); if (nextRef == references.length) growReferences(); references[nextRef] = proxy; *************** *** 160,163 **** --- 183,187 ---- public int addAttribute(int nodeNr, QName qname, String value) throws DOMException { + if (nodeKind == null) init(); if (nextAttr == attrName.length) growAttributes(); attrParent[nextAttr] = nodeNr; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:28
|
Update of /cvsroot/exist/eXist-1.0/Jetty-4.1.4/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/Jetty-4.1.4/etc Modified Files: jetty.xml Log Message: WatchDog + XQuery cache integration Index: jetty.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/Jetty-4.1.4/etc/jetty.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** jetty.xml 29 Jan 2004 15:06:44 -0000 1.2 --- jetty.xml 17 May 2004 09:59:41 -0000 1.3 *************** *** 75,77 **** </Arg> </Call> ! </Configure> \ No newline at end of file --- 75,77 ---- </Arg> </Call> ! </Configure> |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xquery/functions Modified Files: ExtRegexp.java FunDistinctValues.java ExtFulltext.java Log Message: WatchDog + XQuery cache integration Index: ExtFulltext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtFulltext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtFulltext.java 4 Mar 2004 10:09:34 -0000 1.3 --- ExtFulltext.java 17 May 2004 09:59:43 -0000 1.4 *************** *** 202,206 **** protected NodeSet processQuery( XQueryContext context, ! NodeSet contextSet) { if (terms == null) throw new RuntimeException("no search terms"); --- 202,206 ---- protected NodeSet processQuery( XQueryContext context, ! NodeSet contextSet) throws XPathException { if (terms == null) throw new RuntimeException("no search terms"); *************** *** 209,212 **** --- 209,213 ---- hits[k] = context.getBroker().getTextEngine().getNodesContaining( + context, contextSet.getDocumentSet(), contextSet, Index: ExtRegexp.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtRegexp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtRegexp.java 11 May 2004 08:24:28 -0000 1.3 --- ExtRegexp.java 17 May 2004 09:59:43 -0000 1.4 *************** *** 154,157 **** --- 154,158 ---- hits[k] = context.getBroker().getTextEngine().getNodesContaining( + context, nodes.getDocumentSet(), nodes, Index: FunDistinctValues.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunDistinctValues.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FunDistinctValues.java 17 Feb 2004 15:04:59 -0000 1.2 --- FunDistinctValues.java 17 May 2004 09:59:43 -0000 1.3 *************** *** 94,102 **** } } ! LOG.debug( ! "distinct-values found " ! + result.getLength() ! + " in " ! + (System.currentTimeMillis() - start)); return result; } --- 94,102 ---- } } ! // LOG.debug( ! // "distinct-values found " ! // + result.getLength() ! // + " in " ! // + (System.currentTimeMillis() - start)); return result; } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:27
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035 Modified Files: .classpath build.xml conf.xml build.properties Log Message: WatchDog + XQuery cache integration Index: build.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.xml,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** build.xml 24 Apr 2004 13:45:53 -0000 1.47 --- build.xml 17 May 2004 09:59:42 -0000 1.48 *************** *** 204,208 **** <exclude name="org/exist/http/servlets/**"/> <exclude name="org/exist/xquery/functions/request/**"/> ! <exclude name="org/exist/cocoon/**"/> <exclude name="org/exist/*.xsl"/> </jar> --- 204,209 ---- <exclude name="org/exist/http/servlets/**"/> <exclude name="org/exist/xquery/functions/request/**"/> ! <exclude name="org/exist/cocoon/**"/> ! <exclude name="org/exist/source/CocoonSource.java"/> <exclude name="org/exist/*.xsl"/> </jar> *************** *** 220,224 **** <include name="org/exist/http/servlets/**"/> <include name="org/exist/xquery/functions/request/**"/> ! <include name="org/exist/cocoon/**"/> <include name="org/exist/*.xsl"/> </jar> --- 221,226 ---- <include name="org/exist/http/servlets/**"/> <include name="org/exist/xquery/functions/request/**"/> ! <include name="org/exist/cocoon/**"/> ! <include name="org/exist/source/CocoonSource.java"/> <include name="org/exist/*.xsl"/> </jar> Index: conf.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/conf.xml,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** conf.xml 10 May 2004 12:07:24 -0000 1.50 --- conf.xml 17 May 2004 09:59:42 -0000 1.51 *************** *** 49,52 **** --- 49,54 ---- --> <pool min="1" max="20" sync-period="300000"/> + + <watchdog query-timeout="30000" output-size-limit="5000"/> </db-connection> Index: build.properties =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.properties,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** build.properties 24 Apr 2004 13:45:53 -0000 1.19 --- build.properties 17 May 2004 09:59:42 -0000 1.20 *************** *** 1,4 **** project.name = eXist ! project.version = 1.0b1 # build settings --- 1,4 ---- project.name = eXist ! project.version = 20040510 # build settings Index: .classpath =================================================================== RCS file: /cvsroot/exist/eXist-1.0/.classpath,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** .classpath 24 Apr 2004 13:45:53 -0000 1.19 --- .classpath 17 May 2004 09:59:42 -0000 1.20 *************** *** 17,31 **** <classpathentry kind="lib" path="lib/optional/axis-jaxrpc-1.1.jar"/> <classpathentry kind="lib" path="lib/optional/axis-saaj-1.1.jar"/> - <classpathentry kind="lib" path="lib/optional/cocoon.jar"/> <classpathentry kind="lib" path="lib/optional/cocoon-deprecated.jar"/> - <classpathentry kind="lib" path="lib/optional/commons-collections-2.1.jar"/> <classpathentry kind="lib" path="lib/optional/commons-discovery-0.2.jar"/> - <classpathentry kind="lib" path="lib/optional/commons-httpclient-2.0-rc1.jar"/> - <classpathentry kind="lib" path="lib/optional/commons-jexl-1.0-beta-1.jar"/> <classpathentry kind="lib" path="lib/optional/commons-jxpath-20030909.jar"/> <classpathentry kind="lib" path="lib/optional/commons-lang-2.0.jar"/> <classpathentry kind="lib" path="lib/optional/commons-logging-1.0.3.jar"/> - <classpathentry kind="lib" path="lib/optional/databases-block.jar"/> - <classpathentry kind="lib" path="lib/optional/excalibur-component-1.2-dev.jar"/> <classpathentry kind="lib" path="lib/optional/excalibur-datasource-1.1.1.jar"/> <classpathentry kind="lib" path="lib/optional/excalibur-event-api-1.0.4-dev.jar"/> --- 17,25 ---- *************** *** 41,45 **** <classpathentry kind="lib" path="lib/optional/excalibur-pool-1.2.jar"/> <classpathentry kind="lib" path="lib/optional/excalibur-sourceresolve-1.0.2-dev.jar"/> - <classpathentry kind="lib" path="lib/optional/excalibur-store-1.0-dev.jar"/> <classpathentry kind="lib" path="lib/optional/excalibur-util-1.0.jar"/> <classpathentry kind="lib" path="lib/optional/excalibur-xmlutil-1.0-dev.jar"/> --- 35,38 ---- *************** *** 47,54 **** <classpathentry kind="lib" path="lib/optional/jisp-2.5.1.jar"/> <classpathentry kind="lib" path="lib/optional/logkit-1.2.jar"/> - <classpathentry kind="lib" path="lib/optional/pizza-1.1.jar"/> <classpathentry kind="lib" path="lib/optional/util.concurrent-1.3.2.jar"/> <classpathentry kind="lib" path="lib/optional/wsdl4j-1.4.jar"/> - <classpathentry kind="lib" path="lib/optional/xmldb-block.jar"/> <classpathentry kind="lib" path="lib/endorsed/xml-apis.jar"/> <classpathentry kind="lib" path="lib/core/commons-pool-1.1.jar"/> --- 40,45 ---- *************** *** 60,64 **** <classpathentry kind="lib" path="lib/core/javax.servlet.jar"/> <classpathentry kind="lib" path="lib/endorsed/xerces-2.6.1.jar"/> ! <classpathentry kind="lib" path="/home/wolf/Java/jakarta-tomcat-5.0.19/server/lib/catalina.jar"/> <classpathentry kind="output" path="build/classes"/> </classpath> --- 51,66 ---- <classpathentry kind="lib" path="lib/core/javax.servlet.jar"/> <classpathentry kind="lib" path="lib/endorsed/xerces-2.6.1.jar"/> ! <classpathentry kind="lib" path="lib/optional/cocoon-2.1.4.jar"/> ! <classpathentry kind="lib" path="lib/optional/cocoon-databases-block.jar"/> ! <classpathentry kind="lib" path="lib/optional/cocoon-xmldb-block.jar"/> ! <classpathentry kind="lib" path="lib/optional/commons-collections-3.0.jar"/> ! <classpathentry kind="lib" path="lib/optional/commons-httpclient-2.0-rc3.jar"/> ! <classpathentry kind="lib" path="lib/optional/commons-jexl-1.0-beta-1-20040113.jar"/> ! <classpathentry kind="lib" path="lib/optional/excalibur-component-20040122.jar"/> ! <classpathentry kind="lib" path="lib/optional/excalibur-store-1.0-dev-20040206.jar"/> ! <classpathentry kind="lib" path="lib/optional/javacApi-0.9.jar"/> ! <classpathentry kind="lib" path="lib/optional/javacImpl-0.9.jar"/> ! <classpathentry kind="lib" path="lib/optional/jdtcore-2.1.0.jar"/> ! <classpathentry kind="lib" path="lib/optional/xml-commons-resolver-1.1.jar"/> <classpathentry kind="output" path="build/classes"/> </classpath> |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:26
|
Update of /cvsroot/exist/eXist-1.0/samples/org/exist/examples/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/samples/org/exist/examples/xmlrpc Modified Files: Store.java Log Message: WatchDog + XQuery cache integration Index: Store.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/samples/org/exist/examples/xmlrpc/Store.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Store.java 6 Jan 2004 14:10:13 -0000 1.3 --- Store.java 17 May 2004 09:59:42 -0000 1.4 *************** *** 39,43 **** params.addElement(xml.toString()); params.addElement(args[1]); ! params.addElement(new Integer(1)); // execute the call --- 39,43 ---- params.addElement(xml.toString()); params.addElement(args[1]); ! params.addElement(new Integer(0)); // execute the call |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/dbxml/core/filer Modified Files: BTree.java BTreeCallback.java Log Message: WatchDog + XQuery cache integration Index: BTreeCallback.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer/BTreeCallback.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BTreeCallback.java 21 Jan 2003 13:28:47 -0000 1.1 --- BTreeCallback.java 17 May 2004 09:59:43 -0000 1.2 *************** *** 53,56 **** --- 53,57 ---- import org.dbxml.core.data.*; + import org.exist.xquery.TerminatedException; /** *************** *** 66,70 **** * @return false to cancel the enumeration */ ! boolean indexInfo(Value value, long pointer); } --- 67,71 ---- * @return false to cancel the enumeration */ ! boolean indexInfo(Value value, long pointer) throws TerminatedException; } Index: BTree.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer/BTree.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** BTree.java 3 May 2004 13:08:46 -0000 1.24 --- BTree.java 17 May 2004 09:59:43 -0000 1.25 *************** *** 67,70 **** --- 67,71 ---- import org.exist.storage.io.VariableByteArrayInput; import org.exist.util.ByteConversion; + import org.exist.xquery.TerminatedException; /** *************** *** 222,226 **** */ public void query(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException { if (query != null && query.getOperator() == IndexQuery.TRUNC_RIGHT) { Value val1 = query.getValue(0); --- 223,227 ---- */ public void query(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException, TerminatedException { if (query != null && query.getOperator() == IndexQuery.TRUNC_RIGHT) { Value val1 = query.getValue(0); *************** *** 235,239 **** public void remove(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException { if (query != null && query.getOperator() == IndexQuery.TRUNC_RIGHT) { Value val1 = query.getValue(0); --- 236,240 ---- public void remove(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException, TerminatedException { if (query != null && query.getOperator() == IndexQuery.TRUNC_RIGHT) { Value val1 = query.getValue(0); *************** *** 785,789 **** // --- added support for right truncated search terms (wolf) public void query(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException { if (query != null && query.getOperator() != IndexQuery.ANY --- 786,790 ---- // --- added support for right truncated search terms (wolf) public void query(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException, TerminatedException { if (query != null && query.getOperator() != IndexQuery.ANY *************** *** 947,951 **** // --- added support for right truncated search terms (wolf) public void remove(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException { if (query != null && query.getOperator() != IndexQuery.ANY --- 948,952 ---- // --- added support for right truncated search terms (wolf) public void remove(IndexQuery query, BTreeCallback callback) ! throws IOException, BTreeException, TerminatedException { if (query != null && query.getOperator() != IndexQuery.ANY |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xquery/value Modified Files: AbstractSequence.java Log Message: WatchDog + XQuery cache integration Index: AbstractSequence.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/AbstractSequence.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractSequence.java 17 Feb 2004 15:04:54 -0000 1.2 --- AbstractSequence.java 17 May 2004 09:59:43 -0000 1.3 *************** *** 71,74 **** --- 71,82 ---- } + public String toString() { + try { + return getStringValue(); + } catch (XPathException e) { + return super.toString(); + } + } + /* (non-Javadoc) * @see org.exist.xpath.value.Sequence#add(org.exist.xpath.value.Item) |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:12
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/dom Modified Files: DocumentSet.java ExtArrayNodeSet.java AttrImpl.java Log Message: WatchDog + XQuery cache integration Index: DocumentSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentSet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DocumentSet.java 3 May 2004 13:08:42 -0000 1.12 --- DocumentSet.java 17 May 2004 09:59:45 -0000 1.13 *************** *** 52,56 **** public DocumentSet() { ! super(); } --- 52,56 ---- public DocumentSet() { ! super(29); } Index: AttrImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AttrImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AttrImpl.java 10 May 2004 11:22:39 -0000 1.13 --- AttrImpl.java 17 May 2004 09:59:45 -0000 1.14 *************** *** 171,175 **** public void setValue( String value ) throws DOMException { ! this.value = XMLUtil.encodeAttrMarkup( value ); } --- 171,175 ---- public void setValue( String value ) throws DOMException { ! this.value = value; } Index: ExtArrayNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ExtArrayNodeSet.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ExtArrayNodeSet.java 10 May 2004 11:22:39 -0000 1.15 --- ExtArrayNodeSet.java 17 May 2004 09:59:45 -0000 1.16 *************** *** 62,66 **** public ExtArrayNodeSet() { ! this.map = new Int2ObjectHashMap(512); } --- 62,66 ---- public ExtArrayNodeSet() { ! this.map = new Int2ObjectHashMap(17); } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:12
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/util Modified Files: Configuration.java Log Message: WatchDog + XQuery cache integration Index: Configuration.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/Configuration.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Configuration.java 10 May 2004 11:22:40 -0000 1.16 --- Configuration.java 17 May 2004 09:59:46 -0000 1.17 *************** *** 355,358 **** --- 355,376 ---- } } + NodeList watchConf = con.getElementsByTagName("watchdog"); + if(watchConf.getLength() > 0) { + Element watchDog = (Element)watchConf.item(0); + String timeout = watchDog.getAttribute("query-timeout"); + String maxOutput = watchDog.getAttribute("output-size-limit"); + if(timeout != null) { + try { + config.put("db-connection.watchdog.query-timeout", new Long(timeout)); + } catch(NumberFormatException e) { + } + } + if(maxOutput != null) { + try { + config.put("db-connection.watchdog.output-size-limit", new Integer(maxOutput)); + } catch(NumberFormatException e) { + } + } + } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xmlrpc Modified Files: RpcConnection.java Log Message: WatchDog + XQuery cache integration Index: RpcConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcConnection.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** RpcConnection.java 3 May 2004 13:08:47 -0000 1.53 --- RpcConnection.java 17 May 2004 09:59:44 -0000 1.54 *************** *** 42,47 **** --- 42,50 ---- import org.exist.security.PermissionDeniedException; import org.exist.security.User; + import org.exist.source.Source; + import org.exist.source.StringSource; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; + import org.exist.storage.XQueryPool; import org.exist.storage.serializers.EXistOutputKeys; import org.exist.storage.serializers.Serializer; *************** *** 54,59 **** --- 57,64 ---- import org.exist.util.serializer.SAXSerializer; import org.exist.util.serializer.SAXSerializerPool; + import org.exist.xquery.CompiledXQuery; import org.exist.xquery.PathExpr; import org.exist.xquery.XPathException; + import org.exist.xquery.XQuery; import org.exist.xquery.XQueryContext; import org.exist.xquery.parser.XQueryLexer; *************** *** 200,214 **** } } ! CachedQuery cached = getCachedQuery(xpath); ! PathExpr expr = null; ! if (cached == null) { ! expr = compile(user, broker, xpath, parameters); ! cached = new CachedQuery(expr, xpath); ! cachedExpressions.add(cached); ! } else { ! LOG.debug("reusing compiled expression"); ! expr = cached.expression; ! } ! XQueryContext context = expr.getContext(); context.setBaseURI(baseURI); context.setStaticallyKnownDocuments(docs); --- 205,217 ---- } } ! Source source = new StringSource(xpath); ! XQuery xquery = broker.getXQueryService(); ! XQueryPool pool = xquery.getXQueryPool(); ! CompiledXQuery compiled = pool.borrowCompiledXQuery(source); ! XQueryContext context; ! if(compiled == null) ! context = xquery.newContext(); ! else ! context = compiled.getContext(); context.setBaseURI(baseURI); context.setStaticallyKnownDocuments(docs); *************** *** 226,237 **** } } ! // set the current broker object when reusing a compiled query: ! context.setBroker(broker); ! long start = System.currentTimeMillis(); ! Sequence result = expr.eval(contextSet, null); ! LOG.info("query took " + (System.currentTimeMillis() - start) + "ms."); ! expr.reset(); ! context.reset(); ! return result; } --- 229,242 ---- } } ! if(compiled == null) ! compiled = xquery.compile(context, source); ! try { ! long start = System.currentTimeMillis(); ! Sequence result = xquery.execute(compiled, null); ! LOG.info("query took " + (System.currentTimeMillis() - start) + "ms."); ! return result; ! } finally { ! pool.returnCompiledXQuery(source, compiled); ! } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/http/servlets Modified Files: HttpRequestWrapper.java XQueryServlet.java RequestWrapper.java Log Message: WatchDog + XQuery cache integration Index: XQueryServlet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets/XQueryServlet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XQueryServlet.java 14 Apr 2004 12:17:24 -0000 1.7 --- XQueryServlet.java 17 May 2004 09:59:44 -0000 1.8 *************** *** 30,35 **** import java.io.PrintWriter; import java.io.Reader; - import java.util.HashMap; - import java.util.Map; import javax.servlet.ServletConfig; --- 30,33 ---- *************** *** 41,44 **** --- 39,44 ---- import javax.servlet.http.HttpSession; + import org.exist.source.FileSource; + import org.exist.source.Source; import org.exist.xmldb.CompiledExpression; import org.exist.xmldb.XQueryService; *************** *** 99,112 **** private String encoding = null; - private ThreadLocal cache = new ThreadLocal() { - - /* (non-Javadoc) - * @see java.lang.ThreadLocal#initialValue() - */ - protected Object initialValue() { - return new HashMap(); - } - }; - /* (non-Javadoc) * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig) --- 99,102 ---- *************** *** 217,231 **** service.declareVariable(prefix + ":session", new HttpSessionWrapper(session)); ! CompiledExpression compiled; ! CachedQuery cached = (CachedQuery)((Map)cache.get()).get(path); ! if(cached == null || (!cached.isValid())) { ! String xquery = readQuery(f); ! compiled = service.compile(xquery); ! cached = new CachedQuery(f, compiled); ! ((Map)cache.get()).put(path, cached); ! } else { ! compiled = cached.getExpression(); ! } ! ResourceSet result = service.execute(compiled); for(ResourceIterator i = result.getIterator(); i.hasMoreResources(); ) { Resource res = i.nextResource(); --- 207,212 ---- service.declareVariable(prefix + ":session", new HttpSessionWrapper(session)); ! Source source = new FileSource(f, encoding); ! ResourceSet result = service.execute(source); for(ResourceIterator i = result.getIterator(); i.hasMoreResources(); ) { Resource res = i.nextResource(); Index: RequestWrapper.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets/RequestWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RequestWrapper.java 21 Feb 2004 17:56:53 -0000 1.2 --- RequestWrapper.java 17 May 2004 09:59:44 -0000 1.3 *************** *** 35,44 **** public interface RequestWrapper { - public Object getAttribute(String arg0); - - public Enumeration getAttributeNames(); - - public String getAuthType(); - public String getCharacterEncoding(); --- 35,38 ---- Index: HttpRequestWrapper.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets/HttpRequestWrapper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HttpRequestWrapper.java 21 Feb 2004 17:56:53 -0000 1.3 --- HttpRequestWrapper.java 17 May 2004 09:59:44 -0000 1.4 *************** *** 58,83 **** return request.getInputStream(); } - - /** - * @param arg0 - * @return - */ - public Object getAttribute(String arg0) { - return request.getAttribute(arg0); - } - - /** - * @return - */ - public Enumeration getAttributeNames() { - return request.getAttributeNames(); - } - - /** - * @return - */ - public String getAuthType() { - return request.getAuthType(); - } /** --- 58,61 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:11
|
Update of /cvsroot/exist/eXist-1.0/samples/org/exist/examples/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/samples/org/exist/examples/xmldb Modified Files: XQueryExample.java Log Message: WatchDog + XQuery cache integration Index: XQueryExample.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/samples/org/exist/examples/xmldb/XQueryExample.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XQueryExample.java 8 Mar 2004 11:21:22 -0000 1.4 --- XQueryExample.java 17 May 2004 09:59:45 -0000 1.5 *************** *** 4,7 **** --- 4,9 ---- import java.io.FileReader; import java.io.IOException; + import java.io.OutputStreamWriter; + import java.util.Properties; import javax.xml.transform.OutputKeys; *************** *** 13,16 **** --- 15,20 ---- import org.xmldb.api.modules.XMLResource; + import org.exist.util.serializer.SAXSerializer; + import org.exist.util.serializer.SAXSerializerPool; import org.exist.xmldb.XQueryService; import org.exist.xmldb.CompiledExpression; *************** *** 28,32 **** public class XQueryExample { ! protected static String URI = "xmldb:exist://localhost:8080/exist/xmlrpc"; protected static String driver = "org.exist.xmldb.DatabaseImpl"; --- 32,36 ---- public class XQueryExample { ! protected static String URI = "xmldb:exist://"; protected static String driver = "org.exist.xmldb.DatabaseImpl"; *************** *** 77,86 **** long qtime = System.currentTimeMillis() - start; start = System.currentTimeMillis(); ! ! System.out.println(result.getMembersAsResource().getContent()); ! // for ( int i = 0; i < (int) result.getSize(); i++ ) { ! // XMLResource resource = (XMLResource) result.getResource( (long) i ); ! // System.out.println( resource.getContent().toString() ); ! // } long rtime = System.currentTimeMillis() - start; System.out.println("hits: " + result.getSize()); --- 81,95 ---- long qtime = System.currentTimeMillis() - start; start = System.currentTimeMillis(); ! ! Properties outputProperties = new Properties(); ! outputProperties.setProperty(OutputKeys.INDENT, "yes"); ! SAXSerializer serializer = SAXSerializerPool.getInstance().borrowSAXSerializer(); ! serializer.setOutputProperties(outputProperties); ! serializer.setWriter(new OutputStreamWriter(System.out)); ! ! for ( int i = 0; i < (int) result.getSize(); i++ ) { ! XMLResource resource = (XMLResource) result.getResource( (long) i ); ! resource.getContentAsSAX(serializer); ! } long rtime = System.currentTimeMillis() - start; System.out.println("hits: " + result.getSize()); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:09
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/util/hashtable Added Files: Object2ObjectHashMap.java Log Message: WatchDog + XQuery cache integration --- NEW FILE: Object2ObjectHashMap.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: Object2ObjectHashMap.java,v 1.1 2004/05/17 09:59:46 wolfgang_m Exp $ */ package org.exist.util.hashtable; import java.util.Iterator; /** * @author wolf */ public class Object2ObjectHashMap extends AbstractHashtable { protected Object[] keys; protected Object[] values; /** * */ public Object2ObjectHashMap() { super(); keys = new Object[tabSize]; values = new Object[tabSize]; } /** * @param iSize */ public Object2ObjectHashMap(int iSize) { super(iSize); keys = new Object[tabSize]; values = new Object[tabSize]; } /** * Puts a new key/value pair into the hashtable. * * If the key does already exist, just the value is updated. * * @param key * @param value */ public void put(Object key, Object value) { try { insert(key, value); } catch (HashtableOverflowException e) { Object[] copyKeys = keys; Object[] copyValues = values; // enlarge the table with a prime value tabSize = (int) nextPrime(tabSize + tabSize / 2); keys = new Object[tabSize]; values = new Object[tabSize]; items = 0; for (int k = 0; k < copyValues.length; k++) { if (copyKeys[k] != null && copyKeys[k] != REMOVED) put(copyKeys[k], copyValues[k]); } put(key, value); } } public Object get(Object key) { int idx = hash(key) % tabSize; if (idx < 0) idx *= -1; if (keys[idx] == null) return null; // key does not exist else if (keys[idx].equals(key)) { return values[idx]; } int rehashVal = rehash(idx); for (int i = 0; i < tabSize; i++) { idx = (idx + rehashVal) % tabSize; if (keys[idx] == null) { return null; // key not found } else if (keys[idx].equals(key)) { return values[idx]; } } return null; } public int getIndex(Object key) { int idx = hash(key) % tabSize; if (idx < 0) idx *= -1; if (keys[idx] == null) return -1; // key does not exist else if (keys[idx].equals(key)) { return idx; } int rehashVal = rehash(idx); for (int i = 0; i < tabSize; i++) { idx = (idx + rehashVal) % tabSize; if (keys[idx] == null) { return -1; // key not found } else if (keys[idx].equals(key)) { return idx; } } return -1; } public Object remove(Object key) { int idx = hash(key) % tabSize; if (idx < 0) idx *= -1; if (keys[idx] == null) { return null; // key does not exist } else if (keys[idx].equals(key)) { keys[idx] = REMOVED; --items; Object oldVal = values[idx]; values[idx] = null; return oldVal; } int rehashVal = rehash(idx); for (int i = 0; i < tabSize; i++) { idx = (idx + rehashVal) % tabSize; if (keys[idx] == null) { return null; // key not found } else if (keys[idx].equals(key)) { keys[idx] = REMOVED; --items; Object oldVal = values[idx]; values[idx] = null; return oldVal; } } return null; } protected void insert(Object key, Object value) throws HashtableOverflowException { if (key == null) throw new IllegalArgumentException("Illegal value: null"); int idx = hash(key) % tabSize; if (idx < 0) idx *= -1; int bucket = -1; // look for an empty bucket if (keys[idx] == null) { keys[idx] = key; values[idx] = value; ++items; return; } else if (keys[idx] == REMOVED) { // remember the bucket, but continue to check // for duplicate keys bucket = idx; } else if (keys[idx].equals(key)) { // duplicate value values[idx] = value; return; } int rehashVal = rehash(idx); int rehashCnt = 1; for (int i = 0; i < tabSize; i++) { idx = (idx + rehashVal) % tabSize; if (keys[idx] == REMOVED) { bucket = idx; } else if (keys[idx] == null) { if (bucket > -1) { // store key into the empty bucket first found idx = bucket; } keys[idx] = key; values[idx] = value; ++items; return; } else if (keys[idx].equals(key)) { // duplicate value values[idx] = value; return; } ++rehashCnt; } // should never happen, but just to be sure: // if the key has not been inserted yet, do it now if (bucket > -1) { keys[bucket] = key; values[bucket] = value; ++items; return; } throw new HashtableOverflowException(); } protected int rehash(int iVal) { int retVal = (iVal + iVal / 2) % tabSize; if (retVal == 0) retVal = 1; return retVal; } protected final static int hash(Object o) { return o.hashCode(); } /* (non-Javadoc) * @see org.exist.util.hashtable.AbstractHashtable#iterator() */ public Iterator iterator() { return new Object2ObjectIterator(HashtableIterator.KEYS); } /* (non-Javadoc) * @see org.exist.util.hashtable.AbstractHashtable#valueIterator() */ public Iterator valueIterator() { return new Object2ObjectIterator(HashtableIterator.VALUES); } protected class Object2ObjectIterator extends HashtableIterator { int idx = 0; public Object2ObjectIterator(int type) { super(type); } /* (non-Javadoc) * @see java.util.Iterator#hasNext() */ public boolean hasNext() { if (idx == tabSize) return false; while (keys[idx] == null || keys[idx] == REMOVED) { ++idx; if (idx == tabSize) return false; } return true; } /* (non-Javadoc) * @see java.util.Iterator#next() */ public Object next() { if (idx == tabSize) return null; while (keys[idx] == null || keys[idx] == REMOVED) { ++idx; if (idx == tabSize) return null; } if (returnType == VALUES) return values[idx++]; else return keys[idx++]; } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:09
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/cocoon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/cocoon Modified Files: XQueryGenerator.java CocoonRequestWrapper.java Log Message: WatchDog + XQuery cache integration Index: CocoonRequestWrapper.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/cocoon/CocoonRequestWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CocoonRequestWrapper.java 21 Feb 2004 17:56:52 -0000 1.2 --- CocoonRequestWrapper.java 17 May 2004 09:59:44 -0000 1.3 *************** *** 76,101 **** /** - * @param arg0 - * @return - */ - public Object getAttribute(String arg0) { - return request.getAttribute(arg0); - } - - /** - * @return - */ - public Enumeration getAttributeNames() { - return request.getAttributeNames(); - } - - /** - * @return - */ - public String getAuthType() { - return request.getAuthType(); - } - - /** * @return */ --- 76,79 ---- Index: XQueryGenerator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/cocoon/XQueryGenerator.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** XQueryGenerator.java 13 May 2004 12:30:13 -0000 1.16 --- XQueryGenerator.java 17 May 2004 09:59:44 -0000 1.17 *************** *** 43,51 **** import org.apache.cocoon.generation.ServiceableGenerator; import org.apache.excalibur.source.Source; ! import org.apache.excalibur.source.SourceValidity; import org.exist.storage.serializers.EXistOutputKeys; import org.exist.storage.serializers.Serializer; import org.exist.xmldb.CollectionImpl; - import org.exist.xmldb.CompiledExpression; import org.exist.xmldb.XQueryService; import org.exist.xquery.functions.request.RequestModule; --- 43,50 ---- import org.apache.cocoon.generation.ServiceableGenerator; import org.apache.excalibur.source.Source; ! import org.exist.source.CocoonSource; import org.exist.storage.serializers.EXistOutputKeys; import org.exist.storage.serializers.Serializer; import org.exist.xmldb.CollectionImpl; import org.exist.xmldb.XQueryService; import org.exist.xquery.functions.request.RequestModule; *************** *** 90,114 **** private String defaultPassword = null; private Map optionalParameters; - - private ThreadLocal cache = new ThreadLocal() { - - /* (non-Javadoc) - * @see java.lang.ThreadLocal#initialValue() - */ - protected Object initialValue() { - return new HashMap(); - } - }; - - private class CachedExpression { - - SourceValidity validity; - CompiledExpression expr; - - public CachedExpression(SourceValidity validity, CompiledExpression expr) { - this.validity = validity; - this.expr = expr; - } - } /* --- 89,92 ---- *************** *** 230,257 **** String uri = inputSource.getURI(); ! CompiledExpression expr; ! CachedExpression cached; ! cached = (CachedExpression) ((Map)cache.get()).get(uri); ! if (cached != null) { ! // check if source is valid or should be reloaded ! int valid = cached.validity.isValid(); ! if (valid == SourceValidity.UNKNOWN) ! valid = cached.validity.isValid(inputSource ! .getValidity()); ! if (valid != SourceValidity.VALID) { ! ((Map)cache.get()).remove(uri); ! cached = null; ! } ! } ! if (cached == null) { ! String xquery = readQuery(); ! expr = service.compile(xquery); ! cached = new CachedExpression(inputSource.getValidity(), ! expr); ! ((Map)cache.get()).put(uri, cached); ! } else { ! expr = cached.expr; ! } ! ResourceSet result = service.execute(expr); XMLResource resource; this.contentHandler.startDocument(); --- 208,212 ---- String uri = inputSource.getURI(); ! ResourceSet result = service.execute(new CocoonSource(inputSource)); XMLResource resource; this.contentHandler.startDocument(); *************** *** 266,281 **** } } - - private String readQuery() throws IOException { - ByteArrayOutputStream os = new ByteArrayOutputStream((int) inputSource - .getContentLength()); - byte[] t = new byte[512]; - InputStream is = inputSource.getInputStream(); - int count = 0; - while ((count = is.read(t)) != -1) { - os.write(t, 0, count); - } - return os.toString("UTF-8"); - } private void declareParameters(XQueryService service) throws XMLDBException { --- 221,224 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:09
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/src/org/exist/xquery/functions/text Modified Files: FuzzyMatchAll.java Log Message: WatchDog + XQuery cache integration Index: FuzzyMatchAll.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text/FuzzyMatchAll.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FuzzyMatchAll.java 1 Mar 2004 13:20:35 -0000 1.1 --- FuzzyMatchAll.java 17 May 2004 09:59:46 -0000 1.2 *************** *** 82,85 **** --- 82,86 ---- hits[k] = context.getBroker().getTextEngine().getNodes( + context, nodes.getDocumentSet(), nodes, |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 10:00:09
|
Update of /cvsroot/exist/eXist-1.0/samples/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/samples/xquery Modified Files: display-collections.xq Log Message: WatchDog + XQuery cache integration Index: display-collections.xq =================================================================== RCS file: /cvsroot/exist/eXist-1.0/samples/xquery/display-collections.xq,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** display-collections.xq 5 Mar 2004 11:15:27 -0000 1.3 --- display-collections.xq 17 May 2004 09:59:46 -0000 1.4 *************** *** 48,52 **** let $rootColl := ! xmldb:collection("xmldb:exist:///db", "admin", "") return local:display-collection($rootColl) --- 48,52 ---- let $rootColl := ! xmldb:collection("xmldb:exist:///db/", "admin", "") return local:display-collection($rootColl) |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 09:59:55
|
Update of /cvsroot/exist/eXist-1.0/webapp/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9035/webapp/xquery Modified Files: guess.xql biblio.xq login.xql process.xq Added Files: watchdog.gif Log Message: WatchDog + XQuery cache integration --- NEW FILE: watchdog.gif --- (This appears to be a binary file; contents omitted.) Index: login.xql =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/xquery/login.xql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** login.xql 16 Feb 2004 08:38:08 -0000 1.2 --- login.xql 17 May 2004 09:59:45 -0000 1.3 *************** *** 12,16 **** $login := xdb:authenticate($database-uri, $user, $pass) return ! if ($login) then ( request:set-session-attribute("user", $user), request:set-session-attribute("password", $pass), --- 12,16 ---- $login := xdb:authenticate($database-uri, $user, $pass) return ! if ($login) then ( request:set-session-attribute("user", $user), request:set-session-attribute("password", $pass), *************** *** 29,32 **** --- 29,33 ---- }; + request:invalidate-session(), request:create-session(), <html> Index: biblio.xq =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/xquery/biblio.xq,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** biblio.xq 29 Jan 2004 15:06:46 -0000 1.4 --- biblio.xq 17 May 2004 09:59:45 -0000 1.5 *************** *** 147,151 **** " return $r"), $hits := util:eval($expr), ! $s := request:set-session-attribute("results", $hits) return if (empty($hits)) then --- 147,153 ---- " return $r"), $hits := util:eval($expr), ! $s := request:set-session-attribute( ! "results", subsequence($hits, 1, 100) ! ) return if (empty($hits)) then Index: process.xq =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/xquery/process.xq,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** process.xq 7 Mar 2004 09:34:11 -0000 1.4 --- process.xq 17 May 2004 09:59:45 -0000 1.5 *************** *** 137,140 **** --- 137,183 ---- }; + declare function f:handleException() as element()+ + { + <img src="watchdog.gif" border="0"/>, + <h2>Defined server limits exceeded!</h2>, + ( + if($util:exception eq + "org.exist.xquery.TerminatedException$TimeoutException") then + <p>The execution time of your query exceeded the predefined limits. + It has been forced to terminate.</p> + else + <p>The query exceeded the predefined size limits for + temporary document fragments and has been forced to + terminate.</p> + ), + <p><b>Limits can be configured</b>! Please have a look at the + "watchdog" section in the configuration file (conf.xml).</p> + }; + + declare function f:eval($query as xs:string) as element()+ + { + let $startTime := current-time(), + $collection := request:request-parameter("collection", ()) + return + util:catch("org.exist.xquery.TerminatedException", + let $result := util:eval($query, $collection), + $count := count($result), + $queryTime := current-time() - $startTime + return ( + <p>Found {$count} hits in + {get-seconds-from-dayTimeDuration($queryTime)} seconds. + {if($count gt 100) then "Max. 100 will be shown." else ()} + </p>, + request:set-session-attribute( + "results", + subsequence($result, 1, 100) + ), + f:add-to-history($query), + f:display($result, $count) + ), + f:handleException() + ) + }; + (: The main function. If a query has been passed in parameter "query", execute the query and store the results into the *************** *** 145,163 **** { let $query := request:request-parameter("query", ()), ! $previous := request:get-session-attribute("results"), ! $collection := request:request-parameter("collection", ()) return if ($query) then ! let $startTime := current-time(), ! $result := util:eval($query, $collection), ! $count := count($result), ! $queryTime := current-time() - $startTime ! return ( ! <p>Found {$count} hits in ! {get-seconds-from-dayTimeDuration($queryTime)} seconds.</p>, ! request:set-session-attribute("results", $result), ! f:add-to-history($query), ! f:display($result, $count) ! ) else if ($previous) then f:display($previous, count($previous)) --- 188,195 ---- { let $query := request:request-parameter("query", ()), ! $previous := request:get-session-attribute("results") return if ($query) then ! f:eval($query) else if ($previous) then f:display($previous, count($previous)) Index: guess.xql =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/xquery/guess.xql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** guess.xql 6 Jan 2004 14:10:13 -0000 1.1 --- guess.xql 17 May 2004 09:59:45 -0000 1.2 *************** *** 38,43 **** $guess := request:request-parameter("guess", ()) return ! if ($rand) then local:guess($guess, $rand) ! else local:random(100) }; --- 38,47 ---- $guess := request:request-parameter("guess", ()) return ! if ($rand) then ! if ($guess) then ! local:guess($guess, $rand) ! else ! <p>No input!</p> ! else local:random(100) }; |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 09:58:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8700/src/org/exist/xquery Added Files: TerminatedException.java XQueryWatchDog.java Log Message: Added WatchDog to control XQuery execution process. --- NEW FILE: XQueryWatchDog.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: XQueryWatchDog.java,v 1.1 2004/05/17 09:57:55 wolfgang_m Exp $ */ package org.exist.xquery; import org.apache.log4j.Logger; import org.exist.EXistException; import org.exist.memtree.MemTreeBuilder; import org.exist.storage.BrokerPool; import org.exist.util.Configuration; /** * @author wolf */ public class XQueryWatchDog { /** * Log4J Logger for this class */ private static final Logger LOG = Logger.getLogger(XQueryWatchDog.class); private XQueryContext context; private long timeout = Long.MAX_VALUE; private long startTime; private int maxNodesLimit = Integer.MAX_VALUE; /** * */ public XQueryWatchDog(XQueryContext context) { this.context = context; configure(); startTime = System.currentTimeMillis(); } private void configure() { try { Configuration conf = BrokerPool.getInstance().getConfiguration(); Object option = conf.getProperty("db-connection.watchdog.query-timeout"); if(option != null) timeout = ((Long)option).longValue(); option = conf.getProperty("db-connection.watchdog.output-size-limit"); if(option != null) maxNodesLimit = ((Integer)option).intValue(); } catch (EXistException e) { LOG.warn("configure() - Watchdog configuration failed"); } } public void proceed(Expression expr) throws TerminatedException { final long elapsed = System.currentTimeMillis() - startTime; if(elapsed > timeout) { if(expr == null) expr = context.getRootExpression(); LOG.warn("Query exceeded predefined timeout (" + elapsed + "ms.): " + expr.pprint()); throw new TerminatedException.TimeoutException(expr.getASTNode(), "The query exceeded the predefined timeout and has been killed."); } } public void proceed(Expression expr, MemTreeBuilder builder) throws TerminatedException { proceed(expr); if(builder.getSize() > maxNodesLimit) { if(expr == null) expr = context.getRootExpression(); LOG.warn("Query exceeded predefined limit for document fragments: " + expr.pprint()); throw new TerminatedException.SizeLimitException(expr.getASTNode(), "The constructed document fragment exceeded the predefined size limit (current: " + builder.getSize() + "; allowed: " + maxNodesLimit + "). The query has been killed."); } } public void reset() { startTime = System.currentTimeMillis(); } } --- NEW FILE: TerminatedException.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: TerminatedException.java,v 1.1 2004/05/17 09:57:55 wolfgang_m Exp $ */ package org.exist.xquery; import org.exist.xquery.parser.XQueryAST; /** * @author wolf */ public class TerminatedException extends XPathException { /** * @param ast * @param message */ public TerminatedException(XQueryAST ast, String message) { super(ast, message); } public final static class TimeoutException extends TerminatedException { public TimeoutException(XQueryAST ast, String message) { super(ast, message); } } public final static class SizeLimitException extends TerminatedException { public SizeLimitException(XQueryAST ast, String message) { super(ast, message); } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-17 09:55:58
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8329/src/org/exist/xquery Added Files: XQuery.java Log Message: Moved the caching infrastructure for XQueries from the interfaces to the database core. --- NEW FILE: XQuery.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: XQuery.java,v 1.1 2004/05/17 09:55:48 wolfgang_m Exp $ */ package org.exist.xquery; import java.io.IOException; import java.io.Reader; import org.apache.log4j.Logger; import org.exist.source.Source; import org.exist.storage.DBBroker; import org.exist.storage.XQueryPool; import org.exist.xquery.parser.XQueryLexer; import org.exist.xquery.parser.XQueryParser; import org.exist.xquery.parser.XQueryTreeParser; import org.exist.xquery.value.Sequence; import antlr.RecognitionException; import antlr.TokenStreamException; import antlr.collections.AST; /** * @author wolf */ public class XQuery { private final static Logger LOG = Logger.getLogger(XQuery.class); private DBBroker broker; /** * */ public XQuery(DBBroker broker) { this.broker = broker; } public XQueryContext newContext() { return new XQueryContext(broker); } public XQueryPool getXQueryPool() { return broker.getBrokerPool().getXQueryPool(); } public CompiledXQuery compile(XQueryContext context, Source source) throws XPathException, IOException { Reader reader = source.getReader(); return compile(context, reader); } public CompiledXQuery compile(XQueryContext context, Reader reader) throws XPathException { long start = System.currentTimeMillis(); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); XQueryTreeParser treeParser = new XQueryTreeParser(context); try { parser.xpath(); if (parser.foundErrors()) { LOG.debug(parser.getErrorMessage()); throw new XPathException( parser.getErrorMessage()); } AST ast = parser.getAST(); PathExpr expr = new PathExpr(context); treeParser.xpath(ast, expr); if (treeParser.foundErrors()) { throw new XPathException( treeParser.getErrorMessage(), treeParser.getLastException()); } LOG.debug("compilation took " + (System.currentTimeMillis() - start)); return expr; } catch (RecognitionException e) { throw new XPathException(e.getMessage(), e); } catch (TokenStreamException e) { throw new XPathException(e.getMessage(), e); } } public Sequence execute(CompiledXQuery expression, Sequence contextSequence) throws XPathException { XQueryContext context = expression.getContext(); context.setBroker(broker); expression.reset(); context.getWatchDog().reset(); Sequence result = expression.eval(contextSequence); expression.reset(); context.reset(); return result; } } |