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
(25) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-07-16 17:40:22
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28961/src/org/exist/xquery/functions/text Modified Files: MatchCount.java Log Message: Fixed text:match-count function. Index: MatchCount.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text/MatchCount.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MatchCount.java 17 May 2004 12:17:32 -0000 1.1 --- MatchCount.java 16 Jul 2004 17:39:40 -0000 1.2 *************** *** 76,80 **** 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(); } --- 76,81 ---- throw new XPathException(getName() + " cannot be applied to XQuery-constructed nodes."); NodeProxy np = (NodeProxy)nv; ! for(Match nextMatch = np.match; nextMatch != null; ) { ! count += nextMatch.getFrequency(); nextMatch = nextMatch.getNextMatch(); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-16 17:39:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28961/src/org/exist/util Modified Files: OrderedLinkedList.java Log Message: Fixed text:match-count function. Index: OrderedLinkedList.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/OrderedLinkedList.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OrderedLinkedList.java 14 Jul 2004 19:03:25 -0000 1.3 --- OrderedLinkedList.java 16 Jul 2004 17:39:41 -0000 1.4 *************** *** 111,114 **** --- 111,115 ---- public void removeNode(Node node) { + --size; if (node.prev == null) { if (node.next != null) { *************** *** 124,128 **** last = node.prev; } - size--; } --- 125,128 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-07-16 17:39:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28961/src/org/exist/storage Modified Files: NativeTextEngine.java Log Message: Fixed text:match-count function. Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** NativeTextEngine.java 14 Jul 2004 19:03:24 -0000 1.60 --- NativeTextEngine.java 16 Jul 2004 17:39:41 -0000 1.61 *************** *** 854,860 **** } else { o = (TermOccurrence)buf.getLast(); ! if(o.gid == gid) o.frequency++; ! else { o = new TermOccurrence(gid); buf.add(o); --- 854,860 ---- } else { o = (TermOccurrence)buf.getLast(); ! if(o.gid == gid) { o.frequency++; ! } else { o = new TermOccurrence(gid); buf.add(o); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-16 15:36:51
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4740/src/org/exist/storage/store Modified Files: BFile.java Log Message: Wrong size information for list of free pages in class BFile. Index: BFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/BFile.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** BFile.java 14 Jul 2004 19:03:25 -0000 1.27 --- BFile.java 16 Jul 2004 15:36:42 -0000 1.28 *************** *** 948,952 **** public void removeFreeSpace(FreeSpace space) { if (space == null) return; ! freeList.removeNode(space); } --- 948,952 ---- public void removeFreeSpace(FreeSpace space) { if (space == null) return; ! freeList.remove(space); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-16 12:39:16
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1728/src/org/exist/xquery Modified Files: XQueryContext.java Log Message: Avoid loading modules multiple times. Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** XQueryContext.java 15 Jul 2004 19:43:23 -0000 1.19 --- XQueryContext.java 16 Jul 2004 12:39:04 -0000 1.20 *************** *** 402,409 **** * @param moduleClass */ ! public void loadBuiltInModule(String namespaceURI, String moduleClass) { ! if (modules.containsKey(namespaceURI)) { LOG.debug("module " + namespaceURI + " is already present"); ! return; } try { --- 402,410 ---- * @param moduleClass */ ! public Module loadBuiltInModule(String namespaceURI, String moduleClass) { ! Module module = (Module)modules.get(namespaceURI); ! if (module != null) { LOG.debug("module " + namespaceURI + " is already present"); ! return module; } try { *************** *** 414,423 **** + moduleClass + " is not an instance of org.exist.xquery.Module."); ! return; } ! Module module = (Module) mClass.newInstance(); if (!module.getNamespaceURI().equals(namespaceURI)) { LOG.warn("the module declares a different namespace URI. Skipping..."); ! return; } if (getPrefixForURI(module.getNamespaceURI()) == null --- 415,424 ---- + moduleClass + " is not an instance of org.exist.xquery.Module."); ! return null; } ! module = (Module) mClass.newInstance(); if (!module.getNamespaceURI().equals(namespaceURI)) { LOG.warn("the module declares a different namespace URI. Skipping..."); ! return null; } if (getPrefixForURI(module.getNamespaceURI()) == null *************** *** 434,437 **** --- 435,439 ---- LOG.warn("error while instantiating module class " + moduleClass, e); } + return module; } *************** *** 768,847 **** public void importModule(String namespaceURI, String prefix, String location) throws XPathException { ! if(location == null) ! location = namespaceURI; ! if(location.startsWith("java:")) { ! location = location.substring("java:".length()); ! loadBuiltInModule(namespaceURI, location); ! if(prefix != null) ! declareNamespace(prefix, namespaceURI); ! return; ! } ! if(location.indexOf(':') < 0) { ! File f = new File(moduleLoadPath + File.separatorChar + location); ! if(!f.canRead()) { ! f = new File(location); ! if(!f.canRead()) ! throw new XPathException("cannot read module source from file at " + f.getAbsolutePath()); ! } ! try { ! location = new URI(f.toURL().toString()).toASCIIString(); ! } catch (Exception e1) { ! } ! } ! LOG.debug("Loading module from " + location); ! InputStreamReader reader; ! try { ! URL url = new URL(location); ! reader = new InputStreamReader(url.openStream(), "UTF-8"); ! } catch (MalformedURLException e) { ! throw new XPathException("source location for module " + namespaceURI + " should be a valid URL"); ! } catch (UnsupportedEncodingException e) { ! throw new XPathException("unsupported source encoding"); ! } catch (IOException e) { ! throw new XPathException("IO exception while loading module " + namespaceURI, e); ! } ! XQueryContext context = new ModuleContext(this); ! XQueryLexer lexer = new XQueryLexer(reader); ! XQueryParser parser = new XQueryParser(lexer); ! XQueryTreeParser astParser = new XQueryTreeParser(context); ! try { ! parser.xpath(); ! if (parser.foundErrors()) { ! LOG.debug(parser.getErrorMessage()); ! throw new XPathException( ! "error found while loading module from " + location + ": " ! + parser.getErrorMessage()); ! } ! AST ast = parser.getAST(); ! ! PathExpr path = new PathExpr(context); ! astParser.xpath(ast, path); ! if (astParser.foundErrors()) { ! throw new XPathException( ! "error found while loading module from " + location + ": " ! + astParser.getErrorMessage(), ! astParser.getLastException()); } - - ExternalModule module = astParser.getModule(); - if(module == null) - throw new XPathException("source at " + location + " is not a valid module"); - if(!module.getNamespaceURI().equals(namespaceURI)) - throw new XPathException("namespace URI declared by module (" + module.getNamespaceURI() + - ") does not match namespace URI in import statement, which was: " + namespaceURI); - if(prefix == null) - prefix = module.getDefaultPrefix(); - declareNamespace(prefix, namespaceURI); - modules.put(module.getNamespaceURI(), module); - context.modules.put(module.getNamespaceURI(), module); - } catch (RecognitionException e) { - throw new XPathException( - "error found while loading module from " + location + ": " + e.getMessage(), - e); - } catch (TokenStreamException e) { - throw new XPathException( - "error found while loading module from " + location + ": " + e.getMessage(), - e); } } --- 770,852 ---- public void importModule(String namespaceURI, String prefix, String location) throws XPathException { ! Module module = (Module)modules.get(namespaceURI); ! if(module != null) { ! LOG.debug("Module " + namespaceURI + " already present."); ! } else { ! if(location == null) ! location = namespaceURI; ! // is it a Java module? ! if(location.startsWith("java:")) { ! location = location.substring("java:".length()); ! module = loadBuiltInModule(namespaceURI, location); ! } else { ! if(location.indexOf(':') < 0) { ! File f = new File(moduleLoadPath + File.separatorChar + location); ! if(!f.canRead()) { ! f = new File(location); ! if(!f.canRead()) ! throw new XPathException("cannot read module source from file at " + f.getAbsolutePath()); ! } ! try { ! location = new URI(f.toURL().toString()).toASCIIString(); ! } catch (Exception e1) { ! } ! } ! LOG.debug("Loading module from " + location); ! InputStreamReader reader; ! try { ! URL url = new URL(location); ! reader = new InputStreamReader(url.openStream(), "UTF-8"); ! } catch (MalformedURLException e) { ! throw new XPathException("source location for module " + namespaceURI + " should be a valid URL"); ! } catch (UnsupportedEncodingException e) { ! throw new XPathException("unsupported source encoding"); ! } catch (IOException e) { ! throw new XPathException("IO exception while loading module " + namespaceURI, e); ! } ! XQueryContext context = new ModuleContext(this); ! XQueryLexer lexer = new XQueryLexer(reader); ! XQueryParser parser = new XQueryParser(lexer); ! XQueryTreeParser astParser = new XQueryTreeParser(context); ! try { ! parser.xpath(); ! if (parser.foundErrors()) { ! LOG.debug(parser.getErrorMessage()); ! throw new XPathException( ! "error found while loading module from " + location + ": " ! + parser.getErrorMessage()); ! } ! AST ast = parser.getAST(); ! ! PathExpr path = new PathExpr(context); ! astParser.xpath(ast, path); ! if (astParser.foundErrors()) { ! throw new XPathException( ! "error found while loading module from " + location + ": " ! + astParser.getErrorMessage(), ! astParser.getLastException()); ! } ! ! module = astParser.getModule(); ! if(module == null) ! throw new XPathException("source at " + location + " is not a valid module"); ! if(!module.getNamespaceURI().equals(namespaceURI)) ! throw new XPathException("namespace URI declared by module (" + module.getNamespaceURI() + ! ") does not match namespace URI in import statement, which was: " + namespaceURI); ! modules.put(module.getNamespaceURI(), module); ! } catch (RecognitionException e) { ! throw new XPathException( ! "error found while loading module from " + location + ": " + e.getMessage(), ! e); ! } catch (TokenStreamException e) { ! throw new XPathException( ! "error found while loading module from " + location + ": " + e.getMessage(), ! e); ! } } } + if(prefix == null) + prefix = module.getDefaultPrefix(); + declareNamespace(prefix, namespaceURI); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:43:44
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/cocoon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/src/org/exist/cocoon Modified Files: XQueryGenerator.java Log Message: Pass global context information to imported XQuery modules. Index: XQueryGenerator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/cocoon/XQueryGenerator.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** XQueryGenerator.java 18 May 2004 14:18:40 -0000 1.18 --- XQueryGenerator.java 15 Jul 2004 19:43:24 -0000 1.19 *************** *** 190,204 **** expandXIncludes ? "yes" : "no"); service.setProperty("base-uri", baseURI); ! String prefix = RequestModule.PREFIX; ! service.setNamespace(prefix, RequestModule.NAMESPACE_URI); service.setModuleLoadPath(baseURI); if(!((CollectionImpl)collection).isRemoteCollection()) { HttpServletRequest httpRequest = (HttpServletRequest) objectModel .get(HttpEnvironment.HTTP_REQUEST_OBJECT); ! service.declareVariable(prefix + ":request", new CocoonRequestWrapper(request, httpRequest)); ! service.declareVariable(prefix + ":response", new CocoonResponseWrapper(response)); ! service.declareVariable(prefix + ":session", new CocoonSessionWrapper(session)); } --- 190,203 ---- expandXIncludes ? "yes" : "no"); service.setProperty("base-uri", baseURI); ! service.setNamespace(RequestModule.PREFIX, RequestModule.NAMESPACE_URI); service.setModuleLoadPath(baseURI); if(!((CollectionImpl)collection).isRemoteCollection()) { HttpServletRequest httpRequest = (HttpServletRequest) objectModel .get(HttpEnvironment.HTTP_REQUEST_OBJECT); ! service.declareVariable(RequestModule.PREFIX + ":request", new CocoonRequestWrapper(request, httpRequest)); ! service.declareVariable(RequestModule.PREFIX + ":response", new CocoonResponseWrapper(response)); ! service.declareVariable(RequestModule.PREFIX + ":session", new CocoonSessionWrapper(session)); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:43:43
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/src/org/exist/xmldb/test Modified Files: CreateCollectionsTest.java ResourceTest.java Log Message: Pass global context information to imported XQuery modules. Index: CreateCollectionsTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test/CreateCollectionsTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CreateCollectionsTest.java 9 Jul 2004 12:20:31 -0000 1.8 --- CreateCollectionsTest.java 15 Jul 2004 19:43:23 -0000 1.9 *************** *** 136,140 **** testCollection); ! byte[] data = storeBinaryResourceFromFile( new File( "../webapp/logo.jpg"), testCollection); Object content = testCollection.getResource("logo.jpg").getContent(); byte[] dataStored = (byte[])content; --- 136,140 ---- testCollection); ! byte[] data = storeBinaryResourceFromFile( new File( "webapp/logo.jpg"), testCollection); Object content = testCollection.getResource("logo.jpg").getContent(); byte[] dataStored = (byte[])content; Index: ResourceTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test/ResourceTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ResourceTest.java 9 Jul 2004 16:44:41 -0000 1.8 --- ResourceTest.java 15 Jul 2004 19:43:23 -0000 1.9 *************** *** 22,26 **** --- 22,28 ---- import org.xmldb.api.DatabaseManager; import org.xmldb.api.base.Collection; + import org.xmldb.api.base.Database; import org.xmldb.api.base.XMLDBException; + import org.xmldb.api.modules.CollectionManagementService; import org.xmldb.api.modules.XMLResource; *************** *** 37,41 **** super(arg0); } ! public void testReadResource() { try { --- 39,43 ---- super(arg0); } ! public void testReadResource() { try { |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:43:32
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/src/org/exist/xquery Modified Files: AbstractInternalModule.java XQueryContext.java Added Files: ModuleContext.java Log Message: Pass global context information to imported XQuery modules. Index: AbstractInternalModule.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/AbstractInternalModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractInternalModule.java 28 May 2004 10:54:13 -0000 1.2 --- AbstractInternalModule.java 15 Jul 2004 19:43:23 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- import java.util.TreeMap; + import org.apache.log4j.Logger; import org.exist.dom.QName; import org.exist.xquery.value.Sequence; *************** *** 36,39 **** --- 37,42 ---- public abstract class AbstractInternalModule implements InternalModule { + private final static Logger LOG = Logger.getLogger(AbstractInternalModule.class); + protected TreeMap mFunctionMap = new TreeMap(); protected FunctionDef[] mFunctions; Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** XQueryContext.java 27 Jun 2004 21:10:06 -0000 1.18 --- XQueryContext.java 15 Jul 2004 19:43:23 -0000 1.19 *************** *** 801,808 **** throw new XPathException("IO exception while loading module " + namespaceURI, e); } ! XQueryContext context = new XQueryContext(broker); ! context.setStaticallyKnownDocuments(getStaticallyKnownDocuments()); ! context.setBaseURI(baseURI); ! context.setWatchDog(watchdog); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); --- 801,805 ---- throw new XPathException("IO exception while loading module " + namespaceURI, e); } ! XQueryContext context = new ModuleContext(this); XQueryLexer lexer = new XQueryLexer(reader); XQueryParser parser = new XQueryParser(lexer); --- NEW FILE: ModuleContext.java --- /* * Created on Jul 15, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package org.exist.xquery; import java.util.Iterator; import org.exist.dom.DocumentSet; /** * @author wolf * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class ModuleContext extends XQueryContext { private XQueryContext parentContext; /** * @param broker */ public ModuleContext(XQueryContext parentContext) { super(parentContext.getBroker()); this.parentContext = parentContext; } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getStaticallyKnownDocuments() */ public DocumentSet getStaticallyKnownDocuments() { return parentContext.getStaticallyKnownDocuments(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getModule(java.lang.String) */ public Module getModule(String namespaceURI) { return parentContext.getModule(namespaceURI); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getModules() */ public Iterator getModules() { return parentContext.getModules(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getWatchDog() */ public XQueryWatchDog getWatchDog() { return parentContext.getWatchDog(); } /* (non-Javadoc) * @see org.exist.xquery.XQueryContext#getBaseURI() */ public String getBaseURI() { return parentContext.getBaseURI(); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:43:31
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/request In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/src/org/exist/xquery/functions/request Modified Files: RequestParameterNames.java Log Message: Pass global context information to imported XQuery modules. Index: RequestParameterNames.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/request/RequestParameterNames.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RequestParameterNames.java 28 May 2004 10:54:20 -0000 1.2 --- RequestParameterNames.java 15 Jul 2004 19:43:23 -0000 1.3 *************** *** 73,79 **** // request object is read from global variable $request Variable var = myModule.resolveVariable(RequestModule.REQUEST_VAR); if (var.getValue().getItemType() != Type.JAVA_OBJECT) throw new XPathException("Variable $request is not bound to an Java object."); - JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0); if (value.getObject() instanceof RequestWrapper) { --- 73,80 ---- // request object is read from global variable $request Variable var = myModule.resolveVariable(RequestModule.REQUEST_VAR); + if(var == null) + throw new XPathException("No request object found in the current XQuery context."); if (var.getValue().getItemType() != Type.JAVA_OBJECT) throw new XPathException("Variable $request is not bound to an Java object."); JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0); if (value.getObject() instanceof RequestWrapper) { |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 19:41:14
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9151/src/org/exist/xquery Modified Files: BindingExpression.java Log Message: "where" clause in FLWOR expression selected wrong nodes. Index: BindingExpression.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/BindingExpression.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BindingExpression.java 30 Jun 2004 15:56:59 -0000 1.4 --- BindingExpression.java 15 Jul 2004 19:41:04 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- import org.exist.dom.NodeProxy; import org.exist.dom.NodeSet; + import org.exist.dom.VirtualNodeSet; import org.exist.xquery.value.BooleanValue; import org.exist.xquery.value.Item; *************** *** 117,121 **** // if the where expression returns a node set, check the context // node of each node in the set ! NodeSet temp = whereExpr.eval(contextSequence).toNodeSet(); NodeProxy current; ContextItem contextNode; --- 118,124 ---- // if the where expression returns a node set, check the context // node of each node in the set ! NodeSet contextSet = contextSequence.toNodeSet(); ! boolean contextIsVirtual = contextSet instanceof VirtualNodeSet; ! NodeSet nodes = whereExpr.eval(contextSequence).toNodeSet(); NodeProxy current; ContextItem contextNode; *************** *** 124,142 **** int count = 0, sizeHint = -1; NodeSet result = new ExtArrayNodeSet(); ! for (Iterator i = temp.iterator(); i.hasNext(); count++) { current = (NodeProxy) i.next(); ! if (lastDoc == null || current.doc != lastDoc) { lastDoc = current.doc; ! sizeHint = temp.getSizeHint(lastDoc); } contextNode = current.getContext(); if (contextNode == null) { ! throw new XPathException("Internal evaluation error: context node is missing!"); } while (contextNode != null) { next = contextNode.getNode(); ! next.addMatches(current); ! if (!result.contains(next)) result.add(next, sizeHint); contextNode = contextNode.getNextItem(); } --- 127,147 ---- int count = 0, sizeHint = -1; NodeSet result = new ExtArrayNodeSet(); ! for (Iterator i = nodes.iterator(); i.hasNext(); count++) { current = (NodeProxy) i.next(); ! if(lastDoc == null || current.doc != lastDoc) { lastDoc = current.doc; ! sizeHint = nodes.getSizeHint(lastDoc); } contextNode = current.getContext(); if (contextNode == null) { ! throw new XPathException("Internal evaluation error: context node is missing for node " + ! current.gid + "!"); } while (contextNode != null) { next = contextNode.getNode(); ! if(contextIsVirtual || contextSet.contains(next)) { ! next.addMatches(current); result.add(next, sizeHint); + } contextNode = contextNode.getNextItem(); } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-15 08:29:00
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16851/src/org/exist/dom Modified Files: SortedNodeSet.java Log Message: Added missing equal() method. Index: SortedNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/SortedNodeSet.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** SortedNodeSet.java 14 Jul 2004 19:03:24 -0000 1.20 --- SortedNodeSet.java 15 Jul 2004 08:28:52 -0000 1.21 *************** *** 242,245 **** --- 242,250 ---- return value.compareTo(o.value); } + + public boolean equals(OrderedLinkedList.Node other) { + IteratorItem o = (IteratorItem) other; + return value.equals(o.value); + } } *************** *** 249,251 **** --- 254,257 ---- public void add(NodeProxy proxy) { } + } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:04:09
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14611 Modified Files: conf.xml Log Message: Added optional term frequency counts to fulltext index. Index: conf.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/conf.xml,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** conf.xml 23 Jun 2004 15:00:19 -0000 1.54 --- conf.xml 14 Jul 2004 19:04:00 -0000 1.55 *************** *** 120,125 **** --> <indexer stemming="no" caseSensitive="no" suppress-whitespace="both" ! index-depth="1" tokenizer="org.exist.storage.analysis.SimpleTokenizer" ! validation="no"> <!-- where's the file containing a list of stopwords to be ignored --- 120,126 ---- --> <indexer stemming="no" caseSensitive="no" suppress-whitespace="both" ! index-depth="1" tokenizer="org.exist.storage.analysis.SimpleTokenizer" ! track-term-freq="no" ! validation="no"> <!-- where's the file containing a list of stopwords to be ignored |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/util Modified Files: OrderedLinkedList.java Configuration.java Log Message: Added optional term frequency counts to fulltext index. Index: OrderedLinkedList.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/OrderedLinkedList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OrderedLinkedList.java 31 Mar 2003 09:22:10 -0000 1.2 --- OrderedLinkedList.java 14 Jul 2004 19:03:25 -0000 1.3 *************** *** 25,39 **** public class OrderedLinkedList { ! private final static class Node { ! Comparable data; Node next = null; Node prev = null; ! public Node(Comparable data) { ! this.data = data; } } private Node header = null; private Node last = null; --- 25,63 ---- public class OrderedLinkedList { ! public abstract static class Node { Node next = null; Node prev = null; ! public Node() { } + public Node getNextNode() { return next; } + public Node getPrevNode() { return prev; } + + public abstract int compareTo(Node other); + public abstract boolean equals(Node other); } + public static class SimpleNode extends Node { + Comparable data; + + public SimpleNode(Comparable data) { + this.data = data; + } + + public int compareTo(Node other) { + final SimpleNode o = (SimpleNode)other; + return data.compareTo(o.data); + } + + public boolean equals(Node other) { + return ((SimpleNode)other).data.equals(data); + } + + public Comparable getData() { + return data; + } + } + private Node header = null; private Node last = null; *************** *** 43,57 **** public OrderedLinkedList() { } ! ! public Node add(Comparable obj) { size++; if (header == null) { ! header = new Node(obj); last = header; return header; } - Node newNode = new Node(obj); Node node = header; ! while (obj.compareTo(node.data) > 0) { if (node.next == null) { // append to end of list --- 67,82 ---- public OrderedLinkedList() { } ! ! public Node add(Node newNode) { ! newNode.next = null; ! newNode.prev = null; size++; if (header == null) { ! header = newNode; last = header; return header; } Node node = header; ! while (newNode.compareTo(node) > 0) { if (node.next == null) { // append to end of list *************** *** 74,95 **** } ! public void remove(Comparable obj) { Node node = header; while (node != null) { ! if (node.data == obj) { ! if (node.prev == null) { ! if (node.next != null) { ! node.next.prev = null; ! header = node.next; ! } else ! header = null; ! } else { ! node.prev.next = node.next; ! if (node.next != null) ! node.next.prev = node.prev; ! else ! last = node.prev; ! } ! size--; return; } --- 99,107 ---- } ! public void remove(Node n) { Node node = header; while (node != null) { ! if (node.equals(n)) { ! removeNode(n); return; } *************** *** 98,102 **** } ! public Object removeFirst() { Node node = header; header = node.next; --- 110,131 ---- } ! public void removeNode(Node node) { ! if (node.prev == null) { ! if (node.next != null) { ! node.next.prev = null; ! header = node.next; ! } else ! header = null; ! } else { ! node.prev.next = node.next; ! if (node.next != null) ! node.next.prev = node.prev; ! else ! last = node.prev; ! } ! size--; ! } ! ! public Node removeFirst() { Node node = header; header = node.next; *************** *** 104,124 **** header.prev = null; --size; ! return node.data; } ! public Object removeLast() { Node node = last; last = node.prev; last.next = null; --size; ! return node.data; } ! ! public Object get(int pos) { Node node = header; int count = 0; while (node != null) { if (count++ == pos) ! return node.data; node = node.next; } --- 133,157 ---- header.prev = null; --size; ! return node; } ! public Node removeLast() { Node node = last; last = node.prev; last.next = null; --size; ! return node; } ! ! public Node getLast() { ! return last == null ? null : last; ! } ! ! public Node get(int pos) { Node node = header; int count = 0; while (node != null) { if (count++ == pos) ! return node; node = node.next; } *************** *** 126,129 **** --- 159,193 ---- } + public Node[] getData() { + Node[] data = new Node[size]; + Node next = header; + int i = 0; + while( next != null ) { + data[i++] = next; + next = next.next; + } + return data; + } + + public Node[] toArray(Node[] data) { + Node next = header; + int i = 0; + while( next != null ) { + data[i++] = next; + next = next.next; + } + return data; + } + + public boolean contains(Node c) { + Node next = header; + while( next != null ) { + if(next.equals(c)) + return true; + next = next.next; + } + return false; + } + public int size() { return size; *************** *** 155,161 **** if (next == null) return null; ! Node current = next; next = next.next; ! return current.data; } --- 219,225 ---- if (next == null) return null; ! final Node current = next; next = next.next; ! return current; } *************** *** 167,189 **** public static void main(String args[]) { OrderedLinkedList list = new OrderedLinkedList(); ! list.add("Adam"); ! list.add("Sabine"); ! list.add("Adam"); ! list.add("Georg"); ! list.add("Heinrich"); ! list.add("Georg"); ! list.add("Wolfgang"); ! list.add("Egon"); ! list.add("Berta"); ! list.add("Fritz"); ! list.remove("Berta"); ! list.add("Hans"); ! list.add("Xerces"); ! list.add("Hubert"); ! list.add("Georg"); ! list.remove("Xerces"); ! list.remove("Wolfgang"); for(int i = 0; i < list.size(); i++) ! System.out.println(list.get(i)); } } --- 231,251 ---- public static void main(String args[]) { OrderedLinkedList list = new OrderedLinkedList(); ! list.add(new SimpleNode("Adam")); ! list.add(new SimpleNode("Sabine")); ! list.add(new SimpleNode("Georg")); ! list.add(new SimpleNode("Henry")); ! list.add(new SimpleNode("Achim")); ! list.add(new SimpleNode("Franz")); ! list.add(new SimpleNode("Doris")); ! list.add(new SimpleNode("Rudi")); ! list.add(new SimpleNode("Hermann")); ! list.add(new SimpleNode("Lisa")); ! list.add(new SimpleNode("Xaver")); ! list.add(new SimpleNode("Reinhard")); ! list.add(new SimpleNode("Ludwig")); ! list.remove(new SimpleNode("Lisa")); ! list.remove(new SimpleNode("Henry")); for(int i = 0; i < list.size(); i++) ! System.out.println(((SimpleNode)list.get(i)).data); } } Index: Configuration.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/Configuration.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Configuration.java 27 Jun 2004 21:10:09 -0000 1.19 --- Configuration.java 14 Jul 2004 19:03:25 -0000 1.20 *************** *** 114,117 **** --- 114,118 ---- String indexDepth = p.getAttribute("index-depth"); String stemming = p.getAttribute("stemming"); + String termFreq = p.getAttribute("track-term-freq"); String suppressWS = p.getAttribute("suppress-whitespace"); String caseSensitive = p.getAttribute("caseSensitive"); *************** *** 127,130 **** --- 128,134 ---- config.put("indexer.stem", Boolean.valueOf(stemming.equals("yes"))); + if (termFreq != null) + config.put("indexer.store-term-freq", Boolean.valueOf(termFreq.equals("yes"))); + if (caseSensitive != null) config.put( |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/xquery/functions/text Modified Files: TextRank.java Log Message: Added optional term frequency counts to fulltext index. Index: TextRank.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text/TextRank.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TextRank.java 30 Mar 2004 17:12:52 -0000 1.1 --- TextRank.java 14 Jul 2004 19:03:25 -0000 1.2 *************** *** 23,29 **** package org.exist.xquery.functions.text; - import java.util.Set; - import java.util.TreeSet; - import org.exist.dom.Match; import org.exist.dom.NodeProxy; --- 23,26 ---- *************** *** 69,80 **** return DoubleValue.ZERO; NodeProxy proxy = (NodeProxy)val; // this is a persistent node, so casting is safe ! Set distinctTerms = new TreeSet(); Match nextMatch = proxy.match; // we just count the number of distinct terms matched while(nextMatch != null) { ! distinctTerms.add(nextMatch.getMatchingTerm()); nextMatch = nextMatch.getNextMatch(); } ! return new DoubleValue(distinctTerms.size()); } } --- 66,78 ---- return DoubleValue.ZERO; NodeProxy proxy = (NodeProxy)val; // this is a persistent node, so casting is safe ! ! int freq = 0; Match nextMatch = proxy.match; // we just count the number of distinct terms matched while(nextMatch != null) { ! freq += nextMatch.getFrequency(); nextMatch = nextMatch.getNextMatch(); } ! return new DoubleValue(freq); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/storage/store Modified Files: BFile.java Log Message: Added optional term frequency counts to fulltext index. Index: BFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/BFile.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** BFile.java 8 Jun 2004 08:16:15 -0000 1.26 --- BFile.java 14 Jul 2004 19:03:25 -0000 1.27 *************** *** 55,58 **** --- 55,59 ---- import org.exist.util.ReadOnlyException; import org.exist.util.ReentrantReadWriteLock; + import org.exist.util.OrderedLinkedList.Node; import org.exist.xquery.TerminatedException; *************** *** 864,868 **** } ! private final static class FreeSpace implements Comparable { /** * Log4J Logger for this class --- 865,870 ---- } ! private final static class FreeSpace extends OrderedLinkedList.Node { ! /** * Log4J Logger for this class *************** *** 879,884 **** } ! public int compareTo(Object obj) { ! FreeSpace other = (FreeSpace) obj; if (free < other.free) return -1; --- 881,886 ---- } ! public int compareTo(Node node) { ! FreeSpace other = (FreeSpace) node; if (free < other.free) return -1; *************** *** 887,892 **** else return 0; ! } ! public int getFree() { return free; --- 889,898 ---- else return 0; ! } ! ! public boolean equals(Node other) { ! return page == ((FreeSpace)other).page; ! } ! public int getFree() { return free; *************** *** 939,945 **** return null; } ! ! public long getLastDataPage() { ! return lastDataPage; } --- 945,952 ---- return null; } ! ! public void removeFreeSpace(FreeSpace space) { ! if (space == null) return; ! freeList.removeNode(space); } *************** *** 966,969 **** --- 973,980 ---- } + public long getLastDataPage() { + return lastDataPage; + } + public void read(java.io.RandomAccessFile raf) throws IOException { super.read(raf); *************** *** 979,987 **** } - public void removeFreeSpace(FreeSpace space) { - if (space == null) return; - freeList.remove(space); - } - public void setLastDataPage(long last) { lastDataPage = last; --- 990,993 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/dom Modified Files: Match.java SortedNodeSet.java Log Message: Added optional term frequency counts to fulltext index. Index: Match.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/Match.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Match.java 29 Jan 2004 15:06:46 -0000 1.5 --- Match.java 14 Jul 2004 19:03:24 -0000 1.6 *************** *** 10,13 **** --- 10,15 ---- private String matchTerm; private long nodeId; + private int frequency = 1; + protected Match nextMatch = null; protected Match prevMatch = null; *************** *** 31,34 **** --- 33,44 ---- } + public void setFrequency(int freq) { + this.frequency = freq; + } + + public int getFrequency() { + return frequency; + } + public Match getNextMatch() { return nextMatch; Index: SortedNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/SortedNodeSet.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SortedNodeSet.java 28 May 2004 10:54:14 -0000 1.19 --- SortedNodeSet.java 14 Jul 2004 19:03:24 -0000 1.20 *************** *** 206,210 **** } ! private static final class IteratorItem implements Comparable { NodeProxy proxy; String value = null; --- 206,210 ---- } ! private static final class IteratorItem extends OrderedLinkedList.Node { NodeProxy proxy; String value = null; *************** *** 224,231 **** for(SequenceIterator i = seq.iterate(); i.hasNext(); ) { item = i.nextItem(); ! strings.add(item.getStringValue().toUpperCase()); } for (Iterator j = strings.iterator(); j.hasNext();) ! buf.append((String) j.next()); value = buf.toString(); } catch (XPathException e) { --- 224,231 ---- for(SequenceIterator i = seq.iterate(); i.hasNext(); ) { item = i.nextItem(); ! strings.add(new OrderedLinkedList.SimpleNode(item.getStringValue().toUpperCase())); } for (Iterator j = strings.iterator(); j.hasNext();) ! buf.append(((OrderedLinkedList.SimpleNode) j.next()).getData()); value = buf.toString(); } catch (XPathException e) { *************** *** 234,238 **** } ! public int compareTo(Object other) { IteratorItem o = (IteratorItem) other; if (value == null) --- 234,238 ---- } ! public int compareTo(OrderedLinkedList.Node other) { IteratorItem o = (IteratorItem) other; if (value == null) |
From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:37
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/storage Modified Files: NativeTextEngine.java TextSearchEngine.java Log Message: Added optional term frequency counts to fulltext index. Index: TextSearchEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/TextSearchEngine.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TextSearchEngine.java 21 Jun 2004 15:27:34 -0000 1.12 --- TextSearchEngine.java 14 Jul 2004 19:03:24 -0000 1.13 *************** *** 65,68 **** --- 65,69 ---- protected boolean indexNumbers = false ; protected boolean stem = false ; + protected boolean termFreq = true; protected PorterStemmer stemmer = null; *************** *** 77,81 **** this.config = conf; String stopword, tokenizerClass; ! Boolean num, stemming; if ((num = (Boolean) config.getProperty("indexer.indexNumbers")) != null) --- 78,82 ---- this.config = conf; String stopword, tokenizerClass; ! Boolean num, stemming, termFrequencies; if ((num = (Boolean) config.getProperty("indexer.indexNumbers")) != null) *************** *** 83,86 **** --- 84,89 ---- if ((stemming = (Boolean) config.getProperty("indexer.stem")) != null) stem = stemming.booleanValue(); + if((termFrequencies = (Boolean) config.getProperty("indexer.store-term-freq")) != null) + termFreq = termFrequencies.booleanValue(); if ((tokenizerClass = (String) config.getProperty("indexer.tokenizer")) != null) { Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** NativeTextEngine.java 2 Jul 2004 18:24:45 -0000 1.59 --- NativeTextEngine.java 14 Jul 2004 19:03:24 -0000 1.60 *************** *** 75,81 **** import org.exist.util.Lock; import org.exist.util.LockException; - import org.exist.util.LongLinkedList; import org.exist.util.Occurrences; ! import org.exist.util.OrderedLongLinkedList; import org.exist.util.ProgressIndicator; import org.exist.util.ReadOnlyException; --- 75,80 ---- import org.exist.util.Lock; import org.exist.util.LockException; import org.exist.util.Occurrences; ! import org.exist.util.OrderedLinkedList; import org.exist.util.ProgressIndicator; import org.exist.util.ReadOnlyException; *************** *** 301,304 **** --- 300,304 ---- byte[] data; long gid; + int freq = 1; int docId; int len; *************** *** 312,315 **** --- 312,316 ---- NodeProxy parent, current = new NodeProxy(); NodeSet result; + Match match; if (contextSet == null) result = new TextSearchResult(trackMatches != Serializer.TAG_NONE); *************** *** 336,340 **** if ((doc = docs.getDoc(docId)) == null || (contextSet != null && !contextSet.containsDoc(doc))) { ! is.skip(len); continue; } --- 337,341 ---- if ((doc = docs.getDoc(docId)) == null || (contextSet != null && !contextSet.containsDoc(doc))) { ! is.skip(termFreq ? len * 2 : len); continue; } *************** *** 344,347 **** --- 345,350 ---- for (int j = 0; j < len; j++) { delta = is.readLong(); + if(termFreq) + freq = is.readInt(); gid = last + delta; last = gid; *************** *** 355,360 **** if (parent != null) { result.add(parent, sizeHint); ! if (trackMatches != Serializer.TAG_NONE) ! parent.addMatch(new Match(term, gid)); } } else --- 358,366 ---- if (parent != null) { result.add(parent, sizeHint); ! if (trackMatches != Serializer.TAG_NONE) { ! match = new Match(term, gid); ! match.setFrequency(freq); ! parent.addMatch(match); ! } } } else *************** *** 540,544 **** section = is.readByte(); len = is.readInt(); ! is.skip(len); oc.addOccurrences(len); } --- 546,550 ---- section = is.readByte(); len = is.readInt(); ! is.skip(termFreq ? len * 2 : len); oc.addOccurrences(len); } *************** *** 641,649 **** os.writeByte(section); os.writeInt(len); ! is.copyTo(os, len); } else { changed = true; // skip ! is.skip(len); } } --- 647,655 ---- os.writeByte(section); os.writeInt(len); ! is.copyTo(os, termFreq ? len * 2 : len); } else { changed = true; // skip ! is.skip(termFreq ? len * 2 : len); } } *************** *** 732,736 **** invIdx.setDocument(doc); String sal= text.getXMLString().transformToLower().toString() ; ! invIdx.addText(sal, gid); } else { while (null != (token = tokenizer.nextToken())) { --- 738,742 ---- invIdx.setDocument(doc); String sal= text.getXMLString().transformToLower().toString() ; ! invIdx.addText(sal, gid); } else { while (null != (token = tokenizer.nextToken())) { *************** *** 790,793 **** --- 796,800 ---- } } + /** * This inner class is responsible for actually storing the list of *************** *** 797,805 **** */ final class InvertedIndex { ! private DocumentImpl doc = null; private Map words[] = new TreeMap[2]; private VariableByteOutputStream os = new VariableByteOutputStream(7); ! public InvertedIndex() { // To distinguish between attribute values and text, we use --- 804,839 ---- */ final class InvertedIndex { ! ! private class TermOccurrence extends OrderedLinkedList.Node implements Comparable { ! long gid; ! int frequency = 1; ! ! public TermOccurrence(long gid) { ! this.gid = gid; ! } ! ! public int compareTo(OrderedLinkedList.Node o) { ! final TermOccurrence other = (TermOccurrence)o; ! if(gid == other.gid) ! return 0; ! else if(gid < other.gid) ! return -1; ! else ! return 1; ! } ! ! public int compareTo(Object o) { ! return compareTo((OrderedLinkedList.Node)o); ! } ! ! public boolean equals(org.exist.util.OrderedLinkedList.Node other) { ! return gid == ((TermOccurrence)other).gid; ! } ! } ! private DocumentImpl doc = null; private Map words[] = new TreeMap[2]; private VariableByteOutputStream os = new VariableByteOutputStream(7); ! public InvertedIndex() { // To distinguish between attribute values and text, we use *************** *** 811,833 **** public void addText(String word, long gid) { ! LongLinkedList buf = (LongLinkedList) words[0].get(word); if (buf == null) { ! buf = new OrderedLongLinkedList(); words[0].put(word, buf); ! } else if (buf.getLast() == gid) { ! return; // double entry: skip } - buf.add(gid); } public void addAttribute(String word, long gid) { ! LongLinkedList buf = (LongLinkedList) words[1].get(word); if (buf == null) { ! buf = new OrderedLongLinkedList(); words[1].put(word, buf); ! } else if (buf.getLast() == gid) { ! return; // double entry: skip } - buf.add(gid); } --- 845,883 ---- public void addText(String word, long gid) { ! OrderedLinkedList buf = (OrderedLinkedList) words[0].get(word); ! TermOccurrence o; if (buf == null) { ! buf = new OrderedLinkedList(); ! o = new TermOccurrence(gid); ! buf.add(o); words[0].put(word, buf); ! } else { ! o = (TermOccurrence)buf.getLast(); ! if(o.gid == gid) ! o.frequency++; ! else { ! o = new TermOccurrence(gid); ! buf.add(o); ! } } } public void addAttribute(String word, long gid) { ! OrderedLinkedList buf = (OrderedLinkedList) words[1].get(word); ! TermOccurrence o; if (buf == null) { ! buf = new OrderedLinkedList(); ! o = new TermOccurrence(gid); ! buf.add(o); words[1].put(word, buf); ! } else { ! o = (TermOccurrence)buf.getLast(); ! if(o.gid == gid) ! o.frequency++; ! else { ! o = new TermOccurrence(gid); ! buf.add(o); ! } } } *************** *** 840,845 **** Map.Entry entry; String word; ! LongLinkedList idList; ! long[] ids; byte[] data; long last, gid; --- 890,895 ---- Map.Entry entry; String word; ! OrderedLinkedList idList; ! TermOccurrence[] ids; byte[] data; long last, gid; *************** *** 848,852 **** NodeProxy p; WordRef ref; ! LongLinkedList newList; Value val = null; VariableByteArrayInput is; --- 898,903 ---- NodeProxy p; WordRef ref; ! TermOccurrence t; ! OrderedLinkedList newList; Value val = null; VariableByteArrayInput is; *************** *** 856,860 **** entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (LongLinkedList) entry.getValue(); ref = new WordRef(collectionId, word); try { --- 907,911 ---- entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (OrderedLinkedList) entry.getValue(); ref = new WordRef(collectionId, word); try { *************** *** 862,866 **** val = dbWords.get(ref); os.clear(); ! newList = new LongLinkedList(); if (val != null) { // add old entries to the new list --- 913,917 ---- val = dbWords.get(ref); os.clear(); ! newList = new OrderedLinkedList(); if (val != null) { // add old entries to the new list *************** *** 879,884 **** delta = is.readLong(); last = last + delta; ! if (!idList.contains(last)) ! newList.add(last); } } else { --- 930,938 ---- delta = is.readLong(); last = last + delta; ! t = new TermOccurrence(last); ! if(termFreq) ! t.frequency = is.readInt(); ! if (!idList.contains(t)) ! newList.add(t); } } else { *************** *** 888,893 **** os.writeByte(section); os.writeInt(len); ! for (int j = 0; j < len; j++) ! is.copyTo(os); } } --- 942,946 ---- os.writeByte(section); os.writeInt(len); ! is.copyTo(os, termFreq ? len * 2 : len); } } *************** *** 901,905 **** } } ! ids = newList.getData(); //i.remove(); Arrays.sort(ids); --- 954,959 ---- } } ! ids = new TermOccurrence[newList.size()]; ! newList.toArray(ids); //i.remove(); Arrays.sort(ids); *************** *** 910,914 **** last = 0; for (int j = 0; j < len; j++) { ! delta = ids[j] - last; if (delta < 0) { LOG.debug("neg. delta: " + delta + " for " + word); --- 964,968 ---- last = 0; for (int j = 0; j < len; j++) { ! delta = ids[j].gid - last; if (delta < 0) { LOG.debug("neg. delta: " + delta + " for " + word); *************** *** 916,920 **** } os.writeLong(delta); ! last = ids[j]; } try { --- 970,976 ---- } os.writeLong(delta); ! if(termFreq) ! os.writeInt(ids[j].frequency); ! last = ids[j].gid; } try { *************** *** 942,947 **** Map.Entry entry; String word; ! LongLinkedList idList; ! long[] ids; long last, gid; long delta; --- 998,1004 ---- Map.Entry entry; String word; ! OrderedLinkedList idList; ! TermOccurrence[] ids; ! TermOccurrence t; long last, gid; long delta; *************** *** 955,959 **** entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (LongLinkedList) entry.getValue(); ref = new WordRef(collectionId, word); try { --- 1012,1016 ---- entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (OrderedLinkedList) entry.getValue(); ref = new WordRef(collectionId, word); try { *************** *** 974,978 **** os.writeByte(section); os.writeInt(len); ! is.copyTo(os, len); } else { // copy nodes to new list --- 1031,1035 ---- os.writeByte(section); os.writeInt(len); ! is.copyTo(os, (termFreq ? len * 2 : len)); } else { // copy nodes to new list *************** *** 981,988 **** delta = is.readLong(); gid += delta; if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc ! .reindexRequired()) { ! idList.add(gid); } else if (node != null && (!XMLUtil --- 1038,1047 ---- delta = is.readLong(); gid += delta; + t = new TermOccurrence(gid); + if(termFreq) + t.frequency = is.readInt(); if (node == null ! && oldDoc.getTreeLevel(gid) < oldDoc.reindexRequired()) { ! idList.add(t); } else if (node != null && (!XMLUtil *************** *** 991,995 **** node.getGID(), gid))) { ! idList.add(gid); } } --- 1050,1054 ---- node.getGID(), gid))) { ! idList.add(t); } } *************** *** 1004,1008 **** } } ! ids = idList.getData(); Arrays.sort(ids); len = ids.length; --- 1063,1068 ---- } } ! ids = new TermOccurrence[idList.size()]; ! idList.toArray(ids); Arrays.sort(ids); len = ids.length; *************** *** 1012,1016 **** last = 0; for (int j = 0; j < len; j++) { ! delta = ids[j] - last; if (delta < 0) { LOG.debug("neg. delta: " + delta + " for " + word); --- 1072,1076 ---- last = 0; for (int j = 0; j < len; j++) { ! delta = ids[j].gid - last; if (delta < 0) { LOG.debug("neg. delta: " + delta + " for " + word); *************** *** 1018,1022 **** } os.writeLong(delta); ! last = ids[j]; } try { --- 1078,1084 ---- } os.writeLong(delta); ! if(termFreq) ! os.writeInt(ids[j].frequency); ! last = ids[j].gid; } try { *************** *** 1055,1070 **** Map.Entry entry; String word; ! LongLinkedList idList; ! long[] ids; byte[] data; long prevId, id; long delta; for (int k = 0; k < 2; k++) { for (Iterator i = words[k].entrySet().iterator(); i.hasNext(); count++) { entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (LongLinkedList) entry.getValue(); os.clear(); ! len = idList.getSize(); os.writeInt(doc.getDocId()); os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); --- 1117,1133 ---- Map.Entry entry; String word; ! OrderedLinkedList idList; ! Comparable[] ids; byte[] data; long prevId, id; long delta; + TermOccurrence t; for (int k = 0; k < 2; k++) { for (Iterator i = words[k].entrySet().iterator(); i.hasNext(); count++) { entry = (Map.Entry) i.next(); word = (String) entry.getKey(); ! idList = (OrderedLinkedList) entry.getValue(); os.clear(); ! len = idList.size(); os.writeInt(doc.getDocId()); os.writeByte(k == 0 ? TEXT_SECTION : ATTRIBUTE_SECTION); *************** *** 1072,1076 **** prevId = 0; for (Iterator j = idList.iterator(); j.hasNext();) { ! id = ((LongLinkedList.ListItem) j.next()).l; delta = id - prevId; if (delta < 0) { --- 1135,1140 ---- prevId = 0; for (Iterator j = idList.iterator(); j.hasNext();) { ! t = (TermOccurrence) j.next(); ! id = t.gid; delta = id - prevId; if (delta < 0) { *************** *** 1079,1082 **** --- 1143,1150 ---- } os.writeLong(delta); + if(termFreq) { + // write out term frequencies + os.writeInt(t.frequency); + } prevId = id; } |
From: Wolfgang M. M. <wol...@us...> - 2004-07-13 17:39:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28773/src/org/exist/xquery/functions Modified Files: ExtCollection.java Log Message: The collection() function throws a NullPointerException if the specified collection does not exist in the database. Index: ExtCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtCollection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExtCollection.java 2 Jul 2004 16:53:55 -0000 1.6 --- ExtCollection.java 13 Jul 2004 17:39:49 -0000 1.7 *************** *** 102,106 **** String next = (String)args.get(i); Collection coll = context.getBroker().getCollection(next); ! coll.allDocs(context.getBroker(), docs, includeSubCollections, true); } NodeSet result = new ExtArrayNodeSet(docs.getLength(), 1); --- 102,107 ---- String next = (String)args.get(i); Collection coll = context.getBroker().getCollection(next); ! if(coll != null) ! coll.allDocs(context.getBroker(), docs, includeSubCollections, true); } NodeSet result = new ExtArrayNodeSet(docs.getLength(), 1); |
From: Jean-Marc V. <jm...@us...> - 2004-07-13 15:13:30
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29360/src/org/exist/xmldb Modified Files: LocalCollection.java Log Message: storing SAX events directly in the database Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** LocalCollection.java 2 Jul 2004 16:53:53 -0000 1.34 --- LocalCollection.java 13 Jul 2004 15:13:21 -0000 1.35 *************** *** 49,52 **** --- 49,53 ---- import org.exist.util.LockException; import org.xml.sax.InputSource; + import org.xml.sax.XMLReader; import org.xmldb.api.base.ErrorCodes; import org.xmldb.api.base.Resource; *************** *** 85,88 **** --- 86,91 ---- protected boolean needsSync = false; + private XMLReader userReader = null; + /** * Create a collection with no parent (root collection). *************** *** 133,136 **** --- 136,142 ---- ErrorCodes.NO_SUCH_COLLECTION, "collection not found"); + + collection.setReader(userReader); + return collection; } catch (EXistException e) { *************** *** 516,518 **** --- 522,531 ---- return false; } + + /** set user-defined Reader + * @param dataSource + */ + public void setReader(XMLReader reader){ + userReader = reader; + } } |
From: Jean-Marc V. <jm...@us...> - 2004-07-13 15:09:52
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27834/src/org/exist/collections Modified Files: Collection.java Log Message: storing SAX events directly in the database Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Collection.java 12 Jul 2004 17:17:40 -0000 1.40 --- Collection.java 13 Jul 2004 15:09:44 -0000 1.41 *************** *** 136,139 **** --- 136,142 ---- private Lock lock = null; + /** user-defined Reader */ + private XMLReader userReader = null; + public Collection(CollectionStore db, String name) { this.name = name; *************** *** 1308,1313 **** --- 1311,1327 ---- } + /** set user-defined Reader */ + public void setReader(XMLReader reader){ + userReader = reader; + } + + /** If user-defined Reader is set, return it; otherwise return JAXP default XMLReader + * configured by eXist. */ private XMLReader getReader(DBBroker broker) throws EXistException, SAXException { + + if ( userReader != null ) + return userReader; + Configuration config = broker.getConfiguration(); // get validation settings |
From: Jean-Marc V. <jm...@us...> - 2004-07-13 15:07:46
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27449/src/org/exist/xquery/test Added Files: TabularXMLReader.java SAXStorageTest.java Log Message: storing SAX events directly in the database --- NEW FILE: TabularXMLReader.java --- /* * Created on 11 juil. 2004 $Id: TabularXMLReader.java,v 1.1 2004/07/13 15:07:37 jmvanel Exp $ */ package org.exist.xquery.test; import java.io.IOException; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.AttributesImpl; /** A test data source producing adjustable tabular data */ class TabularXMLReader implements XMLReader { private int lines = 10; private int columns = 10; TabularXMLReader() {} TabularXMLReader( int lines , int columns) { this.lines = lines; this.columns = columns; } ContentHandler contentHandler; private static final boolean DIFFERENT_TAG_EACH_LINE = false; void writeDocument( ContentHandler xmldb) throws SAXException { xmldb.startDocument(); AttributesImpl attributesImpl = new AttributesImpl(); xmldb.startElement( "", "root", "root", attributesImpl ); for (int i = 0; i < lines; i++) { String line = "line"; if ( DIFFERENT_TAG_EACH_LINE) line += i; xmldb.startElement( "", line, line, attributesImpl ); for (int j = 0; j < columns; j++) { String column = "col" + j; xmldb.startElement( "", column, column, attributesImpl ); char ch[] = new char[20]; column.getChars(0, column.length(), ch, 0); xmldb.characters(ch, 0, column.length() ); xmldb.endElement("", column, column); } xmldb.endElement("", line, line); } xmldb.endElement( "", "root", "root" ); xmldb.endDocument(); } /** ? @see org.xml.sax.XMLReader#parse(java.lang.String) */ public void parse(String systemId) throws IOException, SAXException { writeDocument(contentHandler); } /** ? @see org.xml.sax.XMLReader#getFeature(java.lang.String) */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return false; } /** ? @see org.xml.sax.XMLReader#setFeature(java.lang.String, boolean) */ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {} /** ? @see org.xml.sax.XMLReader#getContentHandler() */ public ContentHandler getContentHandler() { return contentHandler; } /** ? @see org.xml.sax.XMLReader#setContentHandler(org.xml.sax.ContentHandler) */ public void setContentHandler(ContentHandler handler) { this.contentHandler = handler; } /** ? @see org.xml.sax.XMLReader#getDTDHandler() */ public DTDHandler getDTDHandler() { return null; } /** ? @see org.xml.sax.XMLReader#setDTDHandler(org.xml.sax.DTDHandler) */ public void setDTDHandler(DTDHandler handler) {} /** ? @see org.xml.sax.XMLReader#getEntityResolver() */ public EntityResolver getEntityResolver() { return null; } /** ? @see org.xml.sax.XMLReader#setEntityResolver(org.xml.sax.EntityResolver) */ public void setEntityResolver(EntityResolver resolver) {} /** ? @see org.xml.sax.XMLReader#getErrorHandler() */ public ErrorHandler getErrorHandler() { return null; } /** ? @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler) */ public void setErrorHandler(ErrorHandler handler) {} /** ? @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) */ public void parse(InputSource input) throws IOException, SAXException { writeDocument(contentHandler); } /** ? @see org.xml.sax.XMLReader#getProperty(java.lang.String) */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return null; } /** ? @see org.xml.sax.XMLReader#setProperty(java.lang.String, java.lang.Object) */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {} /** * @return Returns the number of lines. */ public int getLines() { return lines; } /** * @return Returns the number of columns. */ public int getColumns() { return columns; } } --- NEW FILE: SAXStorageTest.java --- /* * Created on 23 juin 2004 $Id: SAXStorageTest.java,v 1.1 2004/07/13 15:07:37 jmvanel Exp $ */ package org.exist.xquery.test; import java.io.File; import java.io.IOException; import junit.framework.TestCase; import org.exist.xmldb.DatabaseInstanceManager; import org.exist.xmldb.LocalCollection; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.AttributesImpl; import org.xmldb.api.DatabaseManager; import org.xmldb.api.base.Collection; import org.xmldb.api.base.Database; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.CollectionManagementService; import org.xmldb.api.modules.XMLResource; import org.xmldb.api.modules.XPathQueryService; /** This TestCase is for direct storage of SAX events in the database; one has to implement an XMLReader. * It is also a stress test that creates large documents using SAX, use main() for this. * @author jmv */ public class SAXStorageTest extends TestCase { /** */ public SAXStorageTest(String s) { super(s); } private XMLResource doc; private Collection root; private static String FILE_STORED; protected void setUp() { try { // initialize driver Class cl = Class.forName("org.exist.xmldb.DatabaseImpl"); Database database = (Database) cl.newInstance(); database.setProperty("create-database", "true"); DatabaseManager.registerDatabase(database); root = DatabaseManager.getCollection( "xmldb:exist:///db", "admin", null); CollectionManagementService service = (CollectionManagementService) root.getService( "CollectionManagementService", "1.0"); root = service.createCollection("test"); FILE_STORED = "big.xml"; doc = (XMLResource) root.createResource(FILE_STORED, "XMLResource"); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (XMLDBException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } /** * @param xquery * @param mess * @return TODO * @throws XMLDBException */ private ResourceSet querySingleLine(String xquery, String mess) throws XMLDBException { // query a single line: XPathQueryService service = (XPathQueryService) root.getService( "XPathQueryService", "1.0"); ResourceSet result = null; if ( xquery != "") { // xquery = "/*/*[2]"; System.out.println("Querying \""+xquery+"\" ..." ); long t0 = System.currentTimeMillis(); result = service.queryResource( "big.xml", xquery ); // assertEquals(1, result.getSize()); long t1 = System.currentTimeMillis(); System.out.println("Time for query \""+xquery+"\" on "+ mess + ": " + ( t1-t0) + " ms." ); } return result; } /** Store in the "classical" eXist way: the XMLResource stores an XML string before * storeResource() stores it in the database. * @throws XMLDBException * @throws SAXException */ public void testQueryStoreContentAsSAX() throws XMLDBException, SAXException { ContentHandler databaseInserter = doc.setContentAsSAX(); (new TabularXMLReader()).writeDocument(databaseInserter); root.storeResource(doc); querySingleLine("", "testQueryStoreContentAsSAX"); } /** Store in the new way: the XMLResource stores just a File object before * storeResource() stores the SAX events in the database. * @throws XMLDBException */ public void testQueryBigDocument() throws XMLDBException{ XMLReader dataSource = new TabularXMLReader(); storeSAXEvents(dataSource); ResourceSet result = querySingleLine("", "testQueryBigDocument"); assertEquals(1, result.getSize()); } /** * @param dataSource * @throws XMLDBException */ private void storeSAXEvents(XMLReader dataSource) throws XMLDBException { if ( root instanceof LocalCollection ) { long t0 = System.currentTimeMillis(); LocalCollection coll = (LocalCollection)root; coll.setReader(dataSource); doc.setContent(new File(FILE_STORED)); coll.storeResource(doc); long t1 = System.currentTimeMillis(); System.out.println("Time for storing: " + ( t1-t0) + " ms." ); } } /** arguments: lines , columns, XQuery string */ public static void main(String[] args) throws XMLDBException { String xquery = ""; int lines = 20; int columns = 20; if ( args.length >= 2 ) { lines = Integer.parseInt(args[0]); columns = Integer.parseInt(args[1]); } if ( args.length == 3 ) { xquery = args[2]; } if ( args.length < 2 ) { System.out.println("Taking default values"); } SAXStorageTest tester = new SAXStorageTest(null); tester.setUp(); XMLReader dataSource = new TabularXMLReader( lines , columns); tester.storeSAXEvents(dataSource); System.out.println("Stored tabular data, " +lines+" lines, "+columns+" columns"); if ( xquery != "" ) { ResourceSet result = tester.querySingleLine(xquery, "testQueryBigDocument" ); System.out.println("result size: " + result.getSize() ); } shutdown( tester.root ); } private static void shutdown(Collection collection) throws XMLDBException { // shutdown the database gracefully DatabaseInstanceManager manager = (DatabaseInstanceManager) collection.getService("DatabaseInstanceManager", "1.0"); manager.shutdown(); } } |
From: Jean-Marc V. <jm...@us...> - 2004-07-13 14:18:53
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17265/src/org/exist/xquery/test Modified Files: XPathQueryTest.java Log Message: remove reference to Shakespeare documents; added testStarAxis() that currently :-( demonstrates a bug Index: XPathQueryTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test/XPathQueryTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XPathQueryTest.java 9 Jul 2004 14:43:55 -0000 1.3 --- XPathQueryTest.java 13 Jul 2004 14:18:43 -0000 1.4 *************** *** 1,12 **** package org.exist.xquery.test; ! import java.io.File; import junit.framework.TestCase; import org.exist.xmldb.XPathQueryServiceImpl; ! import org.xmldb.api.*; ! import org.xmldb.api.base.*; ! import org.xmldb.api.modules.*; public class XPathQueryTest extends TestCase { --- 1,20 ---- package org.exist.xquery.test; ! import java.util.regex.Matcher; ! import java.util.regex.Pattern; import junit.framework.TestCase; import org.exist.xmldb.XPathQueryServiceImpl; ! import org.xmldb.api.DatabaseManager; ! import org.xmldb.api.base.Collection; ! import org.xmldb.api.base.Database; ! import org.xmldb.api.base.Resource; ! import org.xmldb.api.base.ResourceIterator; ! import org.xmldb.api.base.ResourceSet; ! import org.xmldb.api.base.XMLDBException; ! import org.xmldb.api.modules.CollectionManagementService; ! import org.xmldb.api.modules.XMLResource; ! import org.xmldb.api.modules.XPathQueryService; public class XPathQueryTest extends TestCase { *************** *** 41,44 **** --- 49,54 ---- + "</test>"; + private Collection testCollection; + public XPathQueryTest(String arg0) { super(arg0); *************** *** 52,55 **** --- 62,66 ---- database.setProperty("create-database", "true"); DatabaseManager.registerDatabase(database); + Collection root = DatabaseManager.getCollection( *************** *** 61,70 **** "CollectionManagementService", "1.0"); ! root = service.createCollection("test"); ! ! XMLResource doc = ! (XMLResource) root.createResource("r_and_j.xml", "XMLResource"); ! doc.setContent(new File("samples/shakespeare/r_and_j.xml")); ! root.storeResource(doc); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { --- 72,82 ---- "CollectionManagementService", "1.0"); ! testCollection = service.createCollection("test"); ! assertNotNull(testCollection); ! ! // XMLResource doc = ! // (XMLResource) root.createResource("r_and_j.xml", "XMLResource"); ! // doc.setContent(new File("samples/shakespeare/r_and_j.xml")); ! // root.storeResource(doc); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { *************** *** 75,97 **** } public void testNumbers() { try { ! Collection testCollection = ! DatabaseManager.getCollection(URI + "/test", "admin", null); ! assertNotNull(testCollection); ! XMLResource doc = ! (XMLResource) testCollection.createResource( ! "numbers.xml", ! "XMLResource"); ! doc.setContent(numbers); ! testCollection.storeResource(doc); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( ! "XPathQueryService", ! "1.0"); ResourceSet result = service.queryResource("numbers.xml", "sum(/test/item/price)"); ! assertEquals(result.getSize(), 1); ! assertEquals(result.getResource(0).getContent(), "96.94"); result = --- 87,120 ---- } + public void testStarAxis() { + try { + XPathQueryService service = + storeXMLStringAndGetQueryService("numbers.xml", numbers); + + ResourceSet result = service.queryResource( + "numbers.xml", "/*/item" ); + System.out.println("testElements 1: ========" ); printResult(result); + assertEquals( "XPath: /*/item", 4, result.getSize() ); + + result = service.queryResource( + "numbers.xml", "/*/*" ); + System.out.println("testElements 2: ========" ); printResult(result); + assertEquals( "XPath: /*/*", 4, result.getSize() ); + + } catch (XMLDBException e) { + System.out.println("testElements(): XMLDBException: "+e); + fail(e.getMessage()); + } + } + public void testNumbers() { try { ! XPathQueryService service = ! storeXMLStringAndGetQueryService("numbers.xml", numbers); ! ResourceSet result = service.queryResource("numbers.xml", "sum(/test/item/price)"); ! assertEquals( 1, result.getSize() ); ! assertEquals( "96.94", result.getResource(0).getContent() ); result = *************** *** 99,104 **** "numbers.xml", "round(sum(/test/item/price))"); ! assertEquals(result.getSize(), 1); ! assertEquals(result.getResource(0).getContent(), "97.0"); result = --- 122,127 ---- "numbers.xml", "round(sum(/test/item/price))"); ! assertEquals( 1, result.getSize() ); ! assertEquals( "97.0", result.getResource(0).getContent() ); result = *************** *** 106,111 **** "numbers.xml", "floor(sum(/test/item/stock))"); ! assertEquals(result.getSize(), 1); ! assertEquals(result.getResource(0).getContent(), "86.0"); result = --- 129,134 ---- "numbers.xml", "floor(sum(/test/item/stock))"); ! assertEquals( 1, result.getSize() ); ! assertEquals( "86.0", result.getResource(0).getContent()); result = *************** *** 113,117 **** "numbers.xml", "/test/item[round(price + 3) > 60]"); ! assertEquals(result.getSize(), 1); result = --- 136,140 ---- "numbers.xml", "/test/item[round(price + 3) > 60]"); ! assertEquals( 1, result.getSize() ); result = *************** *** 121,126 **** "123456789123456789123456789123456789123456789 )"); assertEquals("minimum of big integers", ! result.getResource(0).getContent(), ! "123456789123456789123456789" ); } catch (XMLDBException e) { --- 144,149 ---- "123456789123456789123456789123456789123456789 )"); assertEquals("minimum of big integers", ! "123456789123456789123456789", ! result.getResource(0).getContent() ); } catch (XMLDBException e) { *************** *** 131,147 **** public void testStrings() { try { ! Collection testCollection = ! DatabaseManager.getCollection(URI + "/test", "admin", null); ! assertNotNull(testCollection); ! XMLResource doc = ! (XMLResource) testCollection.createResource( ! "strings.xml", ! "XMLResource"); ! doc.setContent(strings); ! testCollection.storeResource(doc); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( ! "XPathQueryService", ! "1.0"); ResourceSet result = service.queryResource( --- 154,160 ---- public void testStrings() { try { ! XPathQueryService service = ! storeXMLStringAndGetQueryService("strings.xml", strings); ! ResourceSet result = service.queryResource( *************** *** 149,153 **** "substring(/test/string[1], 1, 5)"); assertEquals(1, result.getSize()); ! assertEquals(result.getResource(0).getContent(), "Hello"); result = --- 162,166 ---- "substring(/test/string[1], 1, 5)"); assertEquals(1, result.getSize()); ! assertEquals( "Hello", result.getResource(0).getContent() ); result = *************** *** 162,180 **** } public void testNamespaces() { try { ! Collection testCollection = ! DatabaseManager.getCollection(URI + "/test", "admin", null); ! assertNotNull(testCollection); ! XMLResource doc = ! (XMLResource) testCollection.createResource( ! "namespaces.xml", ! "XMLResource"); ! doc.setContent(namespaces); ! testCollection.storeResource(doc); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( ! "XPathQueryService", ! "1.0"); service.setNamespace("t", "http://www.foo.com"); ResourceSet result = --- 175,201 ---- } + /** + * @return + * @throws XMLDBException + */ + private XPathQueryService storeXMLStringAndGetQueryService(String documentName, + String content) throws XMLDBException { + XMLResource doc = + (XMLResource) testCollection.createResource( + documentName, "XMLResource" ); + doc.setContent(content); + testCollection.storeResource(doc); + XPathQueryService service = + (XPathQueryService) testCollection.getService( + "XPathQueryService", + "1.0"); + return service; + } + public void testNamespaces() { try { ! XPathQueryService service = ! storeXMLStringAndGetQueryService("namespaces.xml", namespaces); ! service.setNamespace("t", "http://www.foo.com"); ResourceSet result = *************** *** 198,222 **** public void testNestedElements() { try { ! Collection testCollection = ! DatabaseManager.getCollection(URI + "/test", "admin", null); ! assertNotNull(testCollection); ! XMLResource doc = ! (XMLResource) testCollection.createResource( ! "nested.xml", ! "XMLResource"); ! doc.setContent(nested); ! testCollection.storeResource(doc); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( ! "XPathQueryService", ! "1.0"); ResourceSet result = service.queryResource("nested.xml", "//c"); ! for (ResourceIterator i = result.getIterator(); ! i.hasMoreResources(); ! ) { ! Resource r = i.nextResource(); ! System.out.println(r.getContent()); ! } ! assertEquals(result.getSize(), 3); } catch (XMLDBException e) { fail(e.getMessage()); --- 219,228 ---- public void testNestedElements() { try { ! XPathQueryService service = ! storeXMLStringAndGetQueryService("nested.xml", nested); ! ResourceSet result = service.queryResource("nested.xml", "//c"); ! printResult(result); ! assertEquals( 3, result.getSize() ); } catch (XMLDBException e) { fail(e.getMessage()); *************** *** 225,268 **** public void testStaticVariables() { try { - Collection testCollection = - DatabaseManager.getCollection(URI + "/test", "admin", null); - assertNotNull(testCollection); XMLResource doc = (XMLResource) testCollection.createResource( ! "nested.xml", ! "XMLResource"); ! doc.setContent(nested); testCollection.storeResource(doc); ! XPathQueryServiceImpl service = ! (XPathQueryServiceImpl) testCollection.getService( "XPathQueryService", "1.0"); ! service.declareVariable("name", "MONTAGUE"); ! ResourceSet result = service.query("//SPEECH[SPEAKER=$name]"); ! for (ResourceIterator i = result.getIterator(); ! i.hasMoreResources(); ! ) { ! Resource r = i.nextResource(); ! System.out.println(r.getContent()); ! } ! assertEquals(result.getSize(), 10); } catch (XMLDBException e) { fail(e.getMessage()); } } public void testMembersAsResource() { try { ! Collection testCollection = ! DatabaseManager.getCollection(URI + "/test", "admin", null); ! assertNotNull(testCollection); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( ! "XPathQueryService", ! "1.0"); ! ResourceSet result = service.query("//SPEECH[LINE &= 'marriage']"); Resource r = result.getMembersAsResource(); ! System.out.println(r.getContent()); } catch (XMLDBException e) { fail(e.getMessage()); --- 231,303 ---- public void testStaticVariables() { + ResourceSet result = null; try { XMLResource doc = (XMLResource) testCollection.createResource( ! "numbers.xml", "XMLResource" ); ! doc.setContent(numbers); testCollection.storeResource(doc); ! XPathQueryService service = ! (XPathQueryService) testCollection.getService( "XPathQueryService", "1.0"); ! ! XPathQueryServiceImpl service2 = (XPathQueryServiceImpl) service; ! service2.declareVariable("name", "MONTAGUE"); ! service2.declareVariable("name", "43"); ! ! //ResourceSet result = service.query("//SPEECH[SPEAKER=$name]"); ! result = service2.query( doc, "//item[stock=$name]"); ! ! System.out.println( "testStaticVariables 1: ========" ); printResult(result); ! result = service2.query("$name"); ! assertEquals( 1, result.getSize() ); ! ! System.out.println("testStaticVariables 2: ========" ); printResult(result); ! result = service2.query( doc, "//item[stock=43]"); ! assertEquals( 1, result.getSize() ); ! ! System.out.println("testStaticVariables 3: ========" ); printResult(result); ! result = service2.query( doc, "//item"); ! assertEquals( 4, result.getSize() ); ! ! // assertEquals( 10, result.getSize() ); } catch (XMLDBException e) { + System.out.println("testStaticVariables(): XMLDBException: "+e); fail(e.getMessage()); } } + /** + * @param result + * @throws XMLDBException + */ + private void printResult(ResourceSet result) throws XMLDBException { + for (ResourceIterator i = result.getIterator(); + i.hasMoreResources(); + ) { + Resource r = i.nextResource(); + System.out.println(r.getContent()); + } + } + public void testMembersAsResource() { try { ! // XPathQueryService service = ! // (XPathQueryService) testCollection.getService( ! // "XPathQueryService", ! // "1.0"); ! // ResourceSet result = service.query("//SPEECH[LINE &= 'marriage']"); ! XPathQueryService service = ! storeXMLStringAndGetQueryService("numbers.xml", numbers); ! ResourceSet result = service.query("//item/price"); ! Resource r = result.getMembersAsResource(); ! String content = (String)r.getContent(); ! System.out.println(content); ! ! Pattern p = Pattern.compile( ".*(<price>.*){4}", Pattern.DOTALL); ! Matcher m = p.matcher(content); ! assertTrue( "get whole document numbers.xml", m.matches() ); } catch (XMLDBException e) { fail(e.getMessage()); |
From: Wolfgang M. M. <wol...@us...> - 2004-07-12 20:29:06
|
Update of /cvsroot/exist/eXist-1.0/lib/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8527/lib/core Modified Files: xmldb.jar Log Message: Update to newest version of the xmldb api. Index: xmldb.jar =================================================================== RCS file: /cvsroot/exist/eXist-1.0/lib/core/xmldb.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvshNruW9 and /tmp/cvshyvvLF differ |
From: Wolfgang M. M. <wol...@us...> - 2004-07-12 17:20:04
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv505/src/org/exist/storage/store Modified Files: DOMFile.java Log Message: Various concurrency-related bug fixes: * there has been a conflicting access to the owner property in class DOMFile: in some cases, a second thread set the property to itself while another thread has been in the process of writing data. As the owner object is used to determine the current page in the document, the writing thread used a wrong data page (for a very short period). Thus, one or two document nodes got lost. * a number of small caching problems in dom.dbx led to inconsistencies in the db. Also, queries using string-equality comparisons did not use the cache, so increasing the cache size had no positive effect on query speed. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** DOMFile.java 12 Jul 2004 17:17:41 -0000 1.39 --- DOMFile.java 12 Jul 2004 17:19:53 -0000 1.40 *************** *** 1466,1474 **** pageNr = StorageAddress.pageFromPointer(forwardLink); targetId = StorageAddress.tidFromPointer(forwardLink); ! LOG.debug("following link on " + StorageAddress.pageFromPointer(forwardLink) + ! " to page " ! + pageNr ! + "; tid=" ! + targetId); continue outerLoop; } else { --- 1466,1474 ---- pageNr = StorageAddress.pageFromPointer(forwardLink); targetId = StorageAddress.tidFromPointer(forwardLink); ! // LOG.debug("following link on " + StorageAddress.pageFromPointer(forwardLink) + ! // " to page " ! // + pageNr ! // + "; tid=" ! // + targetId); continue outerLoop; } else { *************** *** 1490,1501 **** return null; } ! LOG.debug( ! owner.toString() ! + ": tid " ! + targetId ! + " not found on " ! + page.page.getPageInfo() ! + ". Loading " ! + pageNr + "; contents: " + debugPageContents(page)); } return null; --- 1490,1501 ---- return null; } ! // LOG.debug( ! // owner.toString() ! // + ": tid " ! // + targetId ! // + " not found on " ! // + page.page.getPageInfo() ! // + ". Loading " ! // + pageNr + "; contents: " + debugPageContents(page)); } return null; |
From: Wolfgang M. M. <wol...@us...> - 2004-07-12 17:18:22
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32480/src/org/exist/storage/store Modified Files: DOMFileIterator.java DOMFile.java NodeIterator.java Log Message: Various concurrency-related bug fixes: * there has been a conflicting access to the owner property in class DOMFile: in some cases, a second thread set the property to itself while another thread has been in the process of writing data. As the owner object is used to determine the current page in the document, the writing thread used a wrong data page (for a very short period). Thus, one or two document nodes got lost. * a number of small caching problems in dom.dbx led to inconsistencies in the db. Also, queries using string-equality comparisons did not use the cache, so increasing the cache size had no positive effect on query speed. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** DOMFile.java 5 Jul 2004 20:16:14 -0000 1.38 --- DOMFile.java 12 Jul 2004 17:17:41 -0000 1.39 *************** *** 27,35 **** import java.io.UnsupportedEncodingException; import java.util.ArrayList; - import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; - import java.util.Map; - import java.util.TreeMap; import org.dbxml.core.DBException; --- 27,32 ---- *************** *** 51,56 **** import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.ClockCache; import org.exist.util.ByteConversion; - import org.exist.util.FastQSort; import org.exist.util.Lock; import org.exist.util.LockException; --- 48,53 ---- import org.exist.storage.cache.Cacheable; import org.exist.storage.cache.ClockCache; + import org.exist.storage.cache.LRDCache; import org.exist.util.ByteConversion; import org.exist.util.Lock; import org.exist.util.LockException; *************** *** 188,191 **** --- 185,189 ---- // overflow value? if (value.length + 4 > fileHeader.getWorkSize()) { + LOG.debug("Creating overflow page"); OverflowDOMPage overflow = new OverflowDOMPage(); overflow.write(value); *************** *** 319,323 **** if (value.length + 4 > fileHeader.getWorkSize()) { OverflowDOMPage overflow = new OverflowDOMPage(); ! // LOG.debug("creating overflow page: " + overflow.getPageNum()); overflow.write(value); value = ByteConversion.longToByte(overflow.getPageNum()); --- 317,321 ---- if (value.length + 4 > fileHeader.getWorkSize()) { OverflowDOMPage overflow = new OverflowDOMPage(); ! LOG.debug("creating overflow page: " + overflow.getPageNum()); overflow.write(value); value = ByteConversion.longToByte(overflow.getPageNum()); *************** *** 357,361 **** // still not enough free space: create a new page DOMPage newPage = new DOMPage(); ! // LOG.debug("creating additional page: " + newPage.getPageNum()); newPage.getPageHeader().setNextDataPage( rec.page.getPageHeader().getNextDataPage()); --- 355,359 ---- // still not enough free space: create a new page DOMPage newPage = new DOMPage(); ! LOG.debug("creating additional page: " + newPage.getPageNum()); newPage.getPageHeader().setNextDataPage( rec.page.getPageHeader().getNextDataPage()); *************** *** 379,383 **** // does value fit into page? DOMPage newPage = new DOMPage(); ! // LOG.debug("creating new page: " + newPage.getPageNum()); long next = rec.page.getPageHeader().getNextDataPage(); newPage.getPageHeader().setNextDataPage( --- 377,381 ---- // does value fit into page? DOMPage newPage = new DOMPage(); ! LOG.debug("creating new page: " + newPage.getPageNum()); long next = rec.page.getPageHeader().getNextDataPage(); newPage.getPageHeader().setNextDataPage( *************** *** 602,605 **** --- 600,604 ---- dataCache.add(nextPage); } + rec.page = getCurrentPage(rec.page.getPageNum()); if(firstSplitPage != null) { rec.page.getPageHeader().setNextDataPage(firstSplitPage.getPageNum()); *************** *** 645,649 **** for (int pos = 0; pos < dlen; count++) { currentId = ByteConversion.byteToShort(page.data, pos); ! buf.append(currentId + " "); if (ItemId.isLink(currentId)) { pos += 10; --- 644,648 ---- for (int pos = 0; pos < dlen; count++) { currentId = ByteConversion.byteToShort(page.data, pos); ! buf.append(ItemId.getId(currentId) + " "); if (ItemId.isLink(currentId)) { pos += 10; *************** *** 702,705 **** --- 701,705 ---- if(currentDocument != null) currentDocument.incPageCount(); + // LOG.debug("New page: " + page.getPageNum()); return page; } catch (IOException ioe) { *************** *** 797,801 **** n.setGID(id); final long address = findNode(n, node.gid, iter); ! return address == 0 ? KEY_NOT_FOUND : address; } else return p; --- 797,806 ---- n.setGID(id); final long address = findNode(n, node.gid, iter); ! if(address == 0) { ! if(LOG.isDebugEnabled()) ! LOG.debug("Node data location not found for node " + node.gid); ! return KEY_NOT_FOUND; ! } else ! return address; } else return p; *************** *** 988,991 **** --- 993,997 ---- DOMPage page = (DOMPage) dataCache.get(p); if (page == null) { + // LOG.debug("Loading page " + p + " from file"); page = new DOMPage(p); } *************** *** 1084,1088 **** public void remove(long p) { RecordPos rec = findRecord(p); ! // LOG.debug("removing value " + rec.tid + " from " + rec.page.getPageNum() + "; " + rec.page.page.hashCode()); int startOffset = rec.offset - 2; DOMFilePageHeader ph = rec.page.getPageHeader(); --- 1090,1094 ---- public void remove(long p) { RecordPos rec = findRecord(p); ! // LOG.debug("removing value " + rec.tid + " from " + rec.page.getPageNum()); int startOffset = rec.offset - 2; DOMFilePageHeader ph = rec.page.getPageHeader(); *************** *** 1116,1120 **** System.arraycopy(rec.page.data, end, rec.page.data, startOffset, len - end); ! ph.setDirty(true); len = len - l - 4; ph.setDataLength(len); --- 1122,1126 ---- System.arraycopy(rec.page.data, end, rec.page.data, startOffset, len - end); ! rec.page.setDirty(true); len = len - l - 4; ph.setDataLength(len); *************** *** 1124,1128 **** // LOG.debug(debugPageContents(rec.page)); if (rec.page.len == 0) { ! // LOG.debug("removing page " + rec.page.getPageNum()); removePage(rec.page); rec.page = null; --- 1130,1134 ---- // LOG.debug(debugPageContents(rec.page)); if (rec.page.len == 0) { ! LOG.debug("removing page " + rec.page.getPageNum()); removePage(rec.page); rec.page = null; *************** *** 1217,1220 **** --- 1223,1227 ---- while(-1 < pnum) { DOMPage page = getCurrentPage(pnum); + dataCache.add(page); buf.append(' ').append(pnum); pnum = page.getPageHeader().getNextDataPage(); *************** *** 1459,1466 **** pageNr = StorageAddress.pageFromPointer(forwardLink); targetId = StorageAddress.tidFromPointer(forwardLink); ! // LOG.debug("following link. page = " ! // + pageNr ! // + "; tid=" ! // + targetId); continue outerLoop; } else { --- 1466,1474 ---- pageNr = StorageAddress.pageFromPointer(forwardLink); targetId = StorageAddress.tidFromPointer(forwardLink); ! LOG.debug("following link on " + StorageAddress.pageFromPointer(forwardLink) + ! " to page " ! + pageNr ! + "; tid=" ! + targetId); continue outerLoop; } else { *************** *** 1479,1493 **** pageNr = page.getPageHeader().getNextDataPage(); if (pageNr == page.getPageNum()) { ! LOG.debug("illegal link to next page"); return null; } ! // LOG.debug( ! // owner.toString() ! // + ": tid " ! // + targetId ! // + " not found on " ! // + page.page.getPageInfo() ! // + ". Loading " ! // + pageNr); } return null; --- 1487,1501 ---- pageNr = page.getPageHeader().getNextDataPage(); if (pageNr == page.getPageNum()) { ! LOG.debug("circular link to next page on " + pageNr); return null; } ! LOG.debug( ! owner.toString() ! + ": tid " ! + targetId ! + " not found on " ! + page.page.getPageInfo() ! + ". Loading " ! + pageNr + "; contents: " + debugPageContents(page)); } return null; *************** *** 1618,1621 **** --- 1626,1643 ---- } + public int write(byte[] data, int offset) throws IOException { + offset = super.write(data, offset); + ByteConversion.shortToByte(records, data, offset); + offset += 2; + ByteConversion.intToByte(dataLen, data, offset); + offset += 4; + ByteConversion.longToByte(nextDataPage, data, offset); + offset += 8; + ByteConversion.longToByte(prevDataPage, data, offset); + offset += 8; + ByteConversion.shortToByte(tid, data, offset); + return offset + 2; + } + public void setDataLength(int len) { dataLen = len; *************** *** 1633,1650 **** records = recs; } - - public int write(byte[] data, int offset) throws IOException { - offset = super.write(data, offset); - ByteConversion.shortToByte(records, data, offset); - offset += 2; - ByteConversion.intToByte(dataLen, data, offset); - offset += 4; - ByteConversion.longToByte(nextDataPage, data, offset); - offset += 8; - ByteConversion.longToByte(prevDataPage, data, offset); - offset += 8; - ByteConversion.shortToByte(tid, data, offset); - return offset + 2; - } } --- 1655,1658 ---- *************** *** 1663,1668 **** --- 1671,1679 ---- boolean saved = true; + boolean invalidated = false; + public DOMPage() { page = createNewPage(); + // LOG.debug("Created new page: " + page.getPageNum()); data = new byte[fileHeader.getWorkSize()]; len = 0; *************** *** 1779,1786 **** if (!ph.isDirty()) return; ph.setDataLength(len); ! Value value = new Value(data); ! writeValue(page, value); setDirty(false); - //page.write(); } catch (IOException ioe) { LOG.error(ioe); --- 1790,1795 ---- if (!ph.isDirty()) return; ph.setDataLength(len); ! writeValue(page, data); setDirty(false); } catch (IOException ioe) { LOG.error(ioe); *************** *** 1788,1791 **** --- 1797,1805 ---- } + public String dumpPage() { + return "Contents of page " + page.getPageNum() + ": " + + hexDump(data); + } + public boolean sync() { if (isDirty()) { *************** *** 1814,1819 **** --- 1828,1849 ---- return page.equals(other.page); } + + public void invalidate() { + invalidated = true; + } + + public boolean isInvalidated() { + return invalidated; + } } + /** + * This represents an overflow page. Overflow pages are created if + * the node data exceeds the size of one page. An overflow page is a + * sequence of DOMPages. + * + * @author wolf + * + */ protected final class OverflowDOMPage { *************** *** 1821,1824 **** --- 1851,1855 ---- public OverflowDOMPage() { + LOG.debug("Creating overflow page"); firstPage = createNewPage(); } Index: NodeIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/NodeIterator.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NodeIterator.java 5 Jul 2004 20:02:47 -0000 1.12 --- NodeIterator.java 12 Jul 2004 17:17:41 -0000 1.13 *************** *** 79,82 **** --- 79,83 ---- return false; } + db.setOwnerObject(lockKey); if(gotoNextPosition()) { db.getPageBuffer().add(p); *************** *** 111,114 **** --- 112,116 ---- return null; } + db.setOwnerObject(lockKey); if(gotoNextPosition()) { boolean skipped = false; *************** *** 132,135 **** --- 134,138 ---- // extract the tid lastTID = ByteConversion.byteToShort(p.data, offset); + offset += 2; // check if this is just a link to a relocated node *************** *** 157,162 **** final long overflow = ByteConversion.byteToLong(p.data, offset); offset += 8; ! final byte[] odata = db.getOverflowValue(overflow); ! nextNode = NodeImpl.deserialize(odata, 0, odata.length, doc, useNodePool); // normal node } else { --- 160,170 ---- final long overflow = ByteConversion.byteToLong(p.data, offset); offset += 8; ! try { ! final byte[] odata = db.getOverflowValue(overflow); ! nextNode = NodeImpl.deserialize(odata, 0, odata.length, doc, useNodePool); ! } catch(Exception e) { ! LOG.warn("Exception while loading overflow value: " + e.getMessage() + ! "; originating page: " + p.page.getPageInfo()); ! } // normal node } else { *************** *** 170,173 **** --- 178,183 ---- "; len = " + p.getPageHeader().getDataLength()); LOG.debug(db.debugPageContents(p)); + LOG.debug(p.dumpPage()); + Thread.dumpStack(); return null; } *************** *** 193,197 **** // position the iterator at the start of the first value if (node != null) { - db.setOwnerObject(lockKey); final long addr = db.findValue(lockKey, node); if (addr == BTree.KEY_NOT_FOUND) --- 203,206 ---- Index: DOMFileIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFileIterator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DOMFileIterator.java 21 Jun 2004 15:27:35 -0000 1.7 --- DOMFileIterator.java 12 Jul 2004 17:17:41 -0000 1.8 *************** *** 129,132 **** --- 129,133 ---- p = db.getCurrentPage(nextPage); offset = 0; + db.addToBuffer(p); } lastOffset = offset; *************** *** 256,259 **** --- 257,261 ---- return false; p = db.getCurrentPage(page); + db.addToBuffer(p); return true; } |