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
(82) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:01:44
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/io/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17296/src/org/exist/storage/io/test Added Files: VariableByteStreamTest.java Log Message: Moved VariableByteOutput classes to their own package. Performance improvements. --- NEW FILE: VariableByteStreamTest.java --- package org.exist.storage.io.test; import junit.framework.TestCase; import java.io.EOFException; import java.io.IOException; import java.util.Random; import org.exist.storage.io.VariableByteArrayInput; import org.exist.storage.io.VariableByteOutputStream; public class VariableByteStreamTest extends TestCase { private final static int SIZE = 1000; private long[] values = new long[1000 * 3]; /** * Constructor for VariableByteStreamTest. * @param arg0 */ public VariableByteStreamTest(String arg0) { super(arg0); } protected void setUp() { System.out.println("generating " + (SIZE * 3) + " numbers ..."); Random rand = new Random(System.currentTimeMillis()); for(int i = 0; i < SIZE * 3; i++) { values[i++] = rand.nextInt(); values[i++] = rand.nextInt() & 0xffffff; values[i] = rand.nextInt() & 0xff; } } public void testInOutLong() { VariableByteOutputStream os = new VariableByteOutputStream(); for(int i = 0; i < SIZE * 3; i++) { os.writeLong(values[i++]); os.writeInt((int)values[i++]); os.writeShort((short)values[i]); } byte[] data = os.toByteArray(); System.out.println("long data length: " + data.length + "; original: " + (SIZE * 8 + SIZE * 2 + SIZE * 4)); VariableByteArrayInput is = new VariableByteArrayInput(data); long l; short s; int i; try { for(int j = 0; j < SIZE * 3; j++) { l = is.readLong(); assertEquals(l, values[j++]); i = is.readInt(); assertEquals(i, values[j++]); s = is.readShort(); assertEquals(s, values[j]); } } catch (EOFException e) { fail("Exception: " + e); } catch(IOException e) { fail("Exception: " + e); } } public void testCopyTo() throws IOException { Random rand = new Random(System.currentTimeMillis()); int valuesWritten = 0; int dataLen = 0; VariableByteOutputStream os = new VariableByteOutputStream(); for(int i = 0; i < 1000; i++) { int count = rand.nextInt(0xfff); os.writeShort((short)count); dataLen += 2; for(int j = 0; j < count; j++) { int next = rand.nextInt(0xff); os.writeShort((short) next); valuesWritten++; dataLen += 2; } } byte[] data = os.toByteArray(); System.out.println(valuesWritten + " values written"); System.out.println("compressed data length: " + data.length + "; original: " + dataLen); int valuesCopied = 0; dataLen = 0; VariableByteArrayInput is = new VariableByteArrayInput(data); os = new VariableByteOutputStream(); while(is.available() > 0) { int count = is.readShort(); boolean skip = rand.nextBoolean(); if(skip) is.skip(count); else { os.writeShort(count); is.copyTo(os, count); valuesCopied += count; dataLen += 2 * count + 2; } } data = os.toByteArray(); System.out.println("copied " + valuesCopied + " values; skipped " + (valuesWritten - valuesCopied)); System.out.println("compressed data length: " + data.length + "; original: " + dataLen); int valuesRead = 0; is = new VariableByteArrayInput(data); while(is.available() > 0) { int count = is.readShort(); for(int i = 0; i < count; i++) { is.readShort(); valuesRead++; } } assertEquals(valuesRead, valuesCopied); } public static void main(String args[]) { junit.textui.TestRunner.run(VariableByteStreamTest.class); } } |
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17296/src/org/exist/storage/io Added Files: AbstractVariableByteInput.java VariableByteArrayInput.java VariableByteInputStream.java VariableByteOutputStream.java VariableByteInput.java Log Message: Moved VariableByteOutput classes to their own package. Performance improvements. --- NEW FILE: VariableByteOutputStream.java --- package org.exist.storage.io; import java.io.OutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import org.exist.util.ByteArray; import org.exist.util.FastByteBuffer; /** * A byte array output stream using variable byte encoding. * * @author wolf */ public class VariableByteOutputStream extends OutputStream { protected ByteArray buf; public VariableByteOutputStream() { super(); buf = new FastByteBuffer(9); } public VariableByteOutputStream(int size) { super(); buf = new FastByteBuffer(size); } public void clear() { buf.setLength(0); } public void close() throws IOException { buf = null; } public void flush() throws IOException { } public byte[] toByteArray() { byte[] b = new byte[buf.size()]; buf.copyTo(b, 0); return b; } public ByteArray data() { return buf; } public void write(int b) throws IOException { buf.append((byte) b); } public void write(byte[] b) throws IOException { buf.append(b); } public void write(byte[] b, int off, int len) throws IOException { buf.append(b, off, len); } public void writeByte(byte b) { buf.append(b); } public void writeShort(int s) { while ((s & ~0177) != 0) { buf.append((byte) ((s & 0177) | 0200)); s >>>= 7; } buf.append((byte) s); } public void writeInt(int i) { while ((i & ~0177) != 0) { buf.append((byte) ((i & 0177) | 0200)); i >>>= 7; } buf.append((byte) i); } public void writeLong(long l) { while ((l & ~0177) != 0) { buf.append((byte) ((l & 0177) | 0200)); l >>>= 7; } buf.append((byte) l); } public void writeFixedLong(long l) { buf.append((byte) ((l >>> 56) & 0xff)); buf.append((byte) ((l >>> 48) & 0xff)); buf.append((byte) ((l >>> 40) & 0xff)); buf.append((byte) ((l >>> 32) & 0xff)); buf.append((byte) ((l >>> 24) & 0xff)); buf.append((byte) ((l >>> 16) & 0xff)); buf.append((byte) ((l >>> 8) & 0xff)); buf.append((byte) ((l >>> 0) & 0xff)); } public void writeUTF(String s) throws IOException { byte[] data = null; try { data = s.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { data = s.getBytes(); } writeInt(data.length); write(data, 0, data.length); } } --- NEW FILE: VariableByteArrayInput.java --- /* * eXist Open Source Native XML Database Copyright (C) 2001, Wolfgang M. Meier * (me...@if...) * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Library General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more * details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: VariableByteArrayInput.java,v 1.1 2004/05/03 13:01:34 wolfgang_m Exp $ */ package org.exist.storage.io; import java.io.EOFException; import java.io.IOException; /** * Implements VariableByteInput on top of a byte array. * * @author wolf */ public class VariableByteArrayInput extends AbstractVariableByteInput { private byte[] data; private int position; private int end; public VariableByteArrayInput() { super(); } public VariableByteArrayInput(byte[] data) { super(); this.data = data; this.position = 0; this.end = data.length; } public VariableByteArrayInput(byte[] data, int offset, int length) { super(); this.data = data; this.position = offset; this.end = offset + length; } public void initialize(byte[] data, int offset, int length) { this.data = data; this.position = offset; this.end = offset + length; } public byte readByte() throws IOException, EOFException { if (position == end) throw new EOFException(); return data[position++]; } /* * (non-Javadoc) * * @see java.io.InputStream#read() */ public int read() throws IOException { if (position == end) return -1; return data[position++] & 0xFF; } /* * (non-Javadoc) * * @see java.io.InputStream#available() */ public int available() throws IOException { return end - position; } public short readShort() throws IOException { if (position == end) throw new EOFException(); byte b = data[position++]; short i = (short) (b & 0177); for (int shift = 7; (b & 0200) != 0; shift += 7) { if (position == end) throw new EOFException(); b = data[position++]; i |= (b & 0177) << shift; } return i; } public int readInt() throws IOException { if (position == end) throw new EOFException(); byte b = data[position++]; int i = b & 0177; for (int shift = 7; (b & 0200) != 0; shift += 7) { if (position == end) throw new EOFException(); b = data[position++]; i |= (b & 0177) << shift; } return i; } public long readLong() throws IOException { if (position == end) throw new EOFException(); byte b = data[position++]; long i = b & 0177L; for (int shift = 7; (b & 0200) != 0; shift += 7) { if (position == end) throw new EOFException(); b = data[position++]; i |= (b & 0177L) << shift; } return i; } public void copyTo(VariableByteOutputStream os, int count) throws IOException { byte more; for (int i = 0; i < count; i++) { do { more = data[position++]; os.buf.append(more); } while ((more & 0x200) > 0); } } public void skip(int count) throws IOException { for (int i = 0; i < count; i++) { while (position < end && (data[position++] & 0200) > 0) ; } } } --- NEW FILE: VariableByteInputStream.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: VariableByteInputStream.java,v 1.1 2004/05/03 13:01:34 wolfgang_m Exp $ */ package org.exist.storage.io; import java.io.IOException; import java.io.InputStream; /** * Implements VariableByteInput on top of an InputStream. * * @author wolf */ public class VariableByteInputStream extends AbstractVariableByteInput { private InputStream is; /** * */ public VariableByteInputStream(InputStream is) { super(); this.is = is; } /* (non-Javadoc) * @see java.io.InputStream#read() */ public int read() throws IOException { return is.read(); } /* (non-Javadoc) * @see java.io.InputStream#available() */ public int available() throws IOException { return is.available(); } } --- NEW FILE: AbstractVariableByteInput.java --- /* * eXist Open Source Native XML Database Copyright (C) 2001-04, Wolfgang M. * Meier (me...@if...) * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Library General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more * details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: AbstractVariableByteInput.java,v 1.1 2004/05/03 13:01:34 wolfgang_m Exp $ */ package org.exist.storage.io; import java.io.EOFException; import java.io.IOException; import java.io.UnsupportedEncodingException; /** * Abstract base class for implementations of VariableByteInput. * * @author wolf */ public abstract class AbstractVariableByteInput implements VariableByteInput { public AbstractVariableByteInput() { } public abstract int available() throws IOException; public abstract int read() throws IOException; public byte readByte() throws IOException { final int i = read(); if (i < 0) throw new EOFException(); return (byte) i; } public short readShort() throws IOException { byte b = readByte(); short i = (short) (b & 0177); for (int shift = 7; (b & 0200) != 0; shift += 7) { b = readByte(); i |= (b & 0177L) << shift; } return i; } public int readInt() throws IOException { byte b = readByte(); int i = b & 0177; for (int shift = 7; (b & 0200) != 0; shift += 7) { b = readByte(); i |= (b & 0177L) << shift; } return i; } public long readLong() throws IOException { byte b = readByte(); long i = b & 0177; for (int shift = 7; (b & 0200) != 0; shift += 7) { b = readByte(); i |= (b & 0177L) << shift; } return i; } public String readUTF() throws IOException, EOFException { int len = readInt(); byte data[] = new byte[len]; read(data); String s; try { s = new String(data, "UTF-8"); } catch (UnsupportedEncodingException e) { s = new String(data); } return s; } public void skip(int count) throws IOException { for (int i = 0; i < count && available() > 0; i++) { while ((readByte() & 0200) > 0) ; } } public int read(byte[] data) throws IOException { return read(data, 0, data.length); } public int read(byte b[], int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } b[off] = (byte) c; int i = 1; try { for (; i < len; i++) { c = read(); if (c == -1) { break; } if (b != null) { b[off + i] = (byte) c; } } } catch (IOException ee) { } return i; } public void copyTo(VariableByteOutputStream os) throws IOException { int more; do { more = read(); os.buf.append((byte) more); more &= 0200; } while (more > 0); } public void copyTo(VariableByteOutputStream os, int count) throws IOException { int more; for (int i = 0; i < count; i++) { do { more = read(); os.buf.append((byte)more); more &= 0200; } while (more > 0); } } /* (non-Javadoc) * @see org.exist.storage.io.VariableByteInput#release() */ public void release() { } } --- NEW FILE: VariableByteInput.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: VariableByteInput.java,v 1.1 2004/05/03 13:01:34 wolfgang_m Exp $ */ package org.exist.storage.io; import java.io.EOFException; import java.io.IOException; /** * Interface for reading variable byte encoded values. * * Variable byte encoding offers a good compression ratio if the stored * values are rather small, i.e. much smaller than the possible maximum for * the given type. * * @author wolf */ public interface VariableByteInput { /** * Read a single byte and return as an int value. * * @return the byte value as int or -1 if no more bytes are available. * @throws IOException */ public int read() throws IOException; /** * Fill the provided byte array with data from the input. * * @param data * @return * @throws IOException */ public int read(byte[] data) throws IOException; public int read(byte b[], int off, int len) throws IOException; /** * Returns a value > 0 if more bytes can be read * from the input. * * @return * @throws IOException */ public int available() throws IOException; /** * Read a single byte. Throws EOFException if no * more bytes are available. * * @return * @throws IOException */ public byte readByte() throws IOException; /** * Read a short value in variable byte encoding. * * @return * @throws IOException */ public short readShort() throws IOException; /** * Read an integer value in variable byte encoding. * * @return * @throws IOException */ public int readInt() throws IOException; /** * Read a long value in variable byte encoding. * * @return * @throws IOException */ public long readLong() throws IOException; public String readUTF() throws IOException, EOFException; /** * Read the following count numeric values from the input * and drop them. * * @param count * @throws IOException */ public void skip(int count) throws IOException; /** * Copy the next numeric value from the input to the * specified output stream. * * @param os * @throws IOException */ public void copyTo(VariableByteOutputStream os) throws IOException; /** * Copy the count next numeric values from the input to * the specified output stream. * * @param os * @param count * @throws IOException */ public void copyTo(VariableByteOutputStream os, int count) throws IOException; } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:00:17
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16678/src/org/exist/storage/io Log Message: Directory /cvsroot/exist/eXist-1.0/src/org/exist/storage/io added to the repository |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 13:00:13
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/io/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16678/src/org/exist/storage/io/test Log Message: Directory /cvsroot/exist/eXist-1.0/src/org/exist/storage/io/test added to the repository |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 12:58:22
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16328/src/org/exist/xmldb Modified Files: LocalXUpdateQueryService.java LocalCollection.java LocalUserManagementService.java LocalXMLResource.java LocalXPathQueryService.java DatabaseImpl.java LocalIndexQueryService.java LocalResourceSet.java Log Message: org.exist.xmldb.LocalCollection should not hold a direct reference to the actual database collection object. Keeping the reference conflicts with the database internal collection caching. Index: DatabaseImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/DatabaseImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DatabaseImpl.java 24 Apr 2004 13:45:54 -0000 1.13 --- DatabaseImpl.java 3 May 2004 12:58:11 -0000 1.14 *************** *** 177,181 **** try { current = new LocalCollection( u, pool, c.substring( 2 ) ); ! return ( current != null && ( (LocalCollection) current ).isValid() ) ? current : null; } catch ( XMLDBException e ) { --- 177,181 ---- try { current = new LocalCollection( u, pool, c.substring( 2 ) ); ! return ( current != null ) ? current : null; } catch ( XMLDBException e ) { Index: LocalXUpdateQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXUpdateQueryService.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** LocalXUpdateQueryService.java 29 Jan 2004 15:06:43 -0000 1.11 --- LocalXUpdateQueryService.java 3 May 2004 12:58:11 -0000 1.12 *************** *** 57,71 **** DocumentSet docs = new DocumentSet(); DBBroker broker = null; try { broker = pool.get(user); if (resource == null) { ! docs = parent.collection.allDocs(broker, docs, true); } else { String id = parent.getName() + '/' + resource; ! DocumentImpl doc = parent.collection.getDocument(id); LOG.debug("updating resource " + doc.getFileName()); docs.add(doc); } - //LOG.debug(xupdate); XUpdateProcessor processor = new XUpdateProcessor(broker, docs); Modification modifications[] = --- 57,71 ---- DocumentSet docs = new DocumentSet(); DBBroker broker = null; + org.exist.collections.Collection c = parent.getCollection(); try { broker = pool.get(user); if (resource == null) { ! docs = c.allDocs(broker, docs, true); } else { String id = parent.getName() + '/' + resource; ! DocumentImpl doc = c.getDocument(id); LOG.debug("updating resource " + doc.getFileName()); docs.add(doc); } XUpdateProcessor processor = new XUpdateProcessor(broker, docs); Modification modifications[] = Index: LocalIndexQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalIndexQueryService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LocalIndexQueryService.java 16 Feb 2004 13:02:16 -0000 1.4 --- LocalIndexQueryService.java 3 May 2004 12:58:11 -0000 1.5 *************** *** 1,7 **** - /* - * LocalIndexQueryService.java - Mar 5, 2003 - * - * @author wolf - */ package org.exist.xmldb; --- 1,2 ---- *************** *** 16,25 **** import org.xmldb.api.base.XMLDBException; - /** - * @author wolf - * - * To change this generated comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ public class LocalIndexQueryService implements IndexQueryService { --- 11,14 ---- *************** *** 45,49 **** try { broker = pool.get(user); ! return broker.scanIndexedElements(parent.collection, inclusive); } catch (EXistException e) { throw new XMLDBException( --- 34,38 ---- try { broker = pool.get(user); ! return broker.scanIndexedElements(parent.getCollection(), inclusive); } catch (EXistException e) { throw new XMLDBException( *************** *** 108,112 **** try { broker = pool.get(user); ! return broker.getTextEngine().scanIndexTerms(user, parent.collection, start, end, inclusive); } catch (PermissionDeniedException e) { --- 97,101 ---- try { broker = pool.get(user); ! return broker.getTextEngine().scanIndexTerms(user, parent.getCollection(), start, end, inclusive); } catch (PermissionDeniedException e) { Index: LocalUserManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalUserManagementService.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** LocalUserManagementService.java 9 Feb 2004 08:56:20 -0000 1.14 --- LocalUserManagementService.java 3 May 2004 12:58:11 -0000 1.15 *************** *** 419,432 **** public Permission[] listResourcePermissions() throws XMLDBException { ! if (!collection ! .collection ! .getPermissions() .validate(user, Permission.READ)) return new Permission[0]; Permission perms[] = ! new Permission[collection.collection.getDocumentCount()]; int j = 0; DocumentImpl doc; ! for (Iterator i = collection.collection.iterator(); i.hasNext(); j++) { doc = (DocumentImpl) i.next(); perms[j] = doc.getPermissions(); --- 419,431 ---- public Permission[] listResourcePermissions() throws XMLDBException { ! org.exist.collections.Collection c = collection.getCollection(); ! if (!c .getPermissions() .validate(user, Permission.READ)) return new Permission[0]; Permission perms[] = ! new Permission[c.getDocumentCount()]; int j = 0; DocumentImpl doc; ! for (Iterator i = c.iterator(); i.hasNext(); j++) { doc = (DocumentImpl) i.next(); perms[j] = doc.getPermissions(); *************** *** 436,446 **** public Permission[] listCollectionPermissions() throws XMLDBException { ! if (!collection ! .collection ! .getPermissions() .validate(user, Permission.READ)) return new Permission[0]; Permission perms[] = ! new Permission[collection.collection.getChildCollectionCount()]; DBBroker broker = null; try { --- 435,444 ---- public Permission[] listCollectionPermissions() throws XMLDBException { ! org.exist.collections.Collection c = collection.getCollection(); ! if (!c.getPermissions() .validate(user, Permission.READ)) return new Permission[0]; Permission perms[] = ! new Permission[c.getChildCollectionCount()]; DBBroker broker = null; try { *************** *** 449,453 **** org.exist.collections.Collection childColl; int j = 0; ! for (Iterator i = collection.collection.collectionIterator(); i.hasNext(); j++) { --- 447,451 ---- org.exist.collections.Collection childColl; int j = 0; ! for (Iterator i = c.collectionIterator(); i.hasNext(); j++) { Index: LocalXPathQueryService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXPathQueryService.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** LocalXPathQueryService.java 16 Apr 2004 14:44:22 -0000 1.37 --- LocalXPathQueryService.java 3 May 2004 12:58:11 -0000 1.38 *************** *** 111,115 **** try { broker = brokerPool.get(user); ! docs = collection.collection.allDocs(broker, new DocumentSet(), true); } catch (EXistException e) { throw new XMLDBException( --- 111,115 ---- try { broker = brokerPool.get(user); ! docs = collection.getCollection().allDocs(broker, new DocumentSet(), true); } catch (EXistException e) { throw new XMLDBException( *************** *** 152,158 **** try { broker = brokerPool.get(user); ! if(docs == null) ! docs = collection.collection.allDocs(broker, new DocumentSet(), true); ! expression.reset(); XQueryContext context = ((PathExpr)expression).getContext(); --- 152,159 ---- try { broker = brokerPool.get(user); ! if(docs == null) { ! docs = collection.getCollection().allDocs(broker, new DocumentSet(), true); ! } ! expression.reset(); XQueryContext context = ((PathExpr)expression).getContext(); *************** *** 160,164 **** context.setBackwardsCompatibility(xpathCompatible); context.setStaticallyKnownDocuments(docs); ! Map.Entry entry; // declare namespace/prefix mappings --- 161,165 ---- context.setBackwardsCompatibility(xpathCompatible); context.setStaticallyKnownDocuments(docs); ! LOG.debug("docs: " + docs.getLength()); Map.Entry entry; // declare namespace/prefix mappings Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** LocalCollection.java 23 Apr 2004 13:07:43 -0000 1.30 --- LocalCollection.java 3 May 2004 12:58:11 -0000 1.31 *************** *** 25,29 **** import java.net.URI; - import java.net.URLEncoder; import java.util.ArrayList; import java.util.Date; --- 25,28 ---- *************** *** 38,41 **** --- 37,41 ---- import org.apache.log4j.Category; import org.exist.EXistException; + import org.exist.collections.Collection; import org.exist.collections.triggers.TriggerException; import org.exist.dom.BinaryDocument; *************** *** 49,53 **** import org.exist.util.LockException; import org.xml.sax.InputSource; - import org.xmldb.api.base.Collection; import org.xmldb.api.base.ErrorCodes; import org.xmldb.api.base.Resource; --- 49,52 ---- *************** *** 65,69 **** * *@author wolf - *@created April 2, 2002 */ public class LocalCollection extends Observable implements CollectionImpl { --- 64,67 ---- *************** *** 79,84 **** } protected BrokerPool brokerPool = null; - protected org.exist.collections.Collection collection = null; protected Properties properties = new Properties(defaultProperties); protected LocalCollection parent = null; --- 77,82 ---- } + protected String path = null; protected BrokerPool brokerPool = null; protected Properties properties = new Properties(defaultProperties); protected LocalCollection parent = null; *************** *** 101,123 **** /** - * Create a collection using the supplied internal collection. - * - * @param user - * @param brokerPool - * @param parent - * @param collection - */ - public LocalCollection( - User user, - BrokerPool brokerPool, - LocalCollection parent, - org.exist.collections.Collection collection) { - this.user = user; - this.brokerPool = brokerPool; - this.parent = parent; - this.collection = collection; - } - - /** * Create a collection identified by its name. Load the collection from the database. * --- 99,102 ---- *************** *** 139,156 **** this.parent = parent; this.brokerPool = brokerPool; ! load(name); } ! private void load(String name) throws XMLDBException { DBBroker broker = null; try { broker = brokerPool.get(user); ! if (name == null) ! name = "/db"; ! collection = broker.getCollection(name); if (collection == null) throw new XMLDBException( ! ErrorCodes.NO_SUCH_RESOURCE, "collection not found"); } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); --- 118,137 ---- this.parent = parent; this.brokerPool = brokerPool; ! this.path = name; ! if (path == null) ! path = "/db"; ! getCollection(); } ! protected Collection getCollection() throws XMLDBException { DBBroker broker = null; try { broker = brokerPool.get(user); ! org.exist.collections.Collection collection = broker.getCollection(path); if (collection == null) throw new XMLDBException( ! ErrorCodes.NO_SUCH_COLLECTION, "collection not found"); + return collection; } catch (EXistException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e); *************** *** 160,169 **** } ! protected boolean checkOwner(User user) { ! return user.getName().equals(collection.getPermissions().getOwner()); } ! protected boolean checkPermissions(int perm) { ! return collection.getPermissions().validate(user, perm); } --- 141,150 ---- } ! protected boolean checkOwner(User user) throws XMLDBException { ! return user.getName().equals(getCollection().getPermissions().getOwner()); } ! protected boolean checkPermissions(int perm) throws XMLDBException { ! return getCollection().getPermissions().validate(user, perm); } *************** *** 194,201 **** id = Integer.toHexString(rand.nextInt()) + ".xml"; // check if this id does already exist ! if (collection.hasDocument(id)) ok = false; ! if (collection.hasSubcollection(id)) ok = false; --- 175,182 ---- id = Integer.toHexString(rand.nextInt()) + ".xml"; // check if this id does already exist ! if (getCollection().hasDocument(id)) ok = false; ! if (getCollection().hasSubcollection(id)) ok = false; *************** *** 220,224 **** } ! public Collection getChildCollection(String name) throws XMLDBException { if (!checkPermissions(Permission.READ)) throw new XMLDBException( --- 201,205 ---- } ! public org.xmldb.api.base.Collection getChildCollection(String name) throws XMLDBException { if (!checkPermissions(Permission.READ)) throw new XMLDBException( *************** *** 226,235 **** "you are not allowed to access this collection"); String cname; ! for (Iterator i = collection.collectionIterator(); i.hasNext();) { cname = (String) i.next(); if (cname.equals(name)) { cname = getPath() + '/' + cname; ! Collection temp = new LocalCollection(user, brokerPool, this, cname); ! return temp; } } --- 207,215 ---- "you are not allowed to access this collection"); String cname; ! for (Iterator i = getCollection().collectionIterator(); i.hasNext();) { cname = (String) i.next(); if (cname.equals(name)) { cname = getPath() + '/' + cname; ! return new LocalCollection(user, brokerPool, this, cname); } } *************** *** 238,241 **** --- 218,222 ---- public int getChildCollectionCount() throws XMLDBException { + Collection collection = getCollection(); if (collection.getPermissions().validate(user, Permission.READ)) return collection.getChildCollectionCount(); *************** *** 244,258 **** } - protected org.exist.collections.Collection getCollection() { - return collection; - } - public String getName() throws XMLDBException { ! return collection.getName(); } ! public Collection getParentCollection() throws XMLDBException { if (getName().equals("/db")) return null; if (parent == null && collection != null) { DBBroker broker = null; --- 225,236 ---- } public String getName() throws XMLDBException { ! return getCollection().getName(); } ! public org.xmldb.api.base.Collection getParentCollection() throws XMLDBException { if (getName().equals("/db")) return null; + Collection collection = getCollection(); if (parent == null && collection != null) { DBBroker broker = null; *************** *** 260,264 **** broker = brokerPool.get(user); org.exist.collections.Collection c = collection.getParent(broker); ! parent = new LocalCollection(user, brokerPool, null, c); } catch (EXistException e) { throw new XMLDBException( --- 238,242 ---- broker = brokerPool.get(user); org.exist.collections.Collection c = collection.getParent(broker); ! parent = new LocalCollection(user, brokerPool, null, c.getName()); } catch (EXistException e) { throw new XMLDBException( *************** *** 274,281 **** public String getPath() throws XMLDBException { ! //if (parent == null) ! return collection.getName(); ! //return (parent.getName().equals("/") ? '/' + collection.getName() : ! // parent.getPath() + '/' + collection.getName()); } --- 252,256 ---- public String getPath() throws XMLDBException { ! return path; } *************** *** 285,288 **** --- 260,264 ---- public Resource getResource(String id) throws XMLDBException { + Collection collection = getCollection(); if (!collection.getPermissions().validate(user, Permission.READ)) throw new XMLDBException( *************** *** 306,309 **** --- 282,286 ---- public int getResourceCount() throws XMLDBException { + Collection collection = getCollection(); if (!collection.getPermissions().validate(user, Permission.READ)) return 0; *************** *** 349,365 **** } - protected boolean hasChildCollection(String name) { - return collection.hasSubcollection(name); - } - public boolean isOpen() throws XMLDBException { return true; } - public boolean isValid() { - return collection != null; - } - public String[] listChildCollections() throws XMLDBException { if (!checkPermissions(Permission.READ)) return new String[0]; --- 326,335 ---- } public boolean isOpen() throws XMLDBException { return true; } public String[] listChildCollections() throws XMLDBException { + Collection collection = getCollection(); if (!checkPermissions(Permission.READ)) return new String[0]; *************** *** 376,379 **** --- 346,350 ---- public String[] listResources() throws XMLDBException { + Collection collection = getCollection(); if (!collection.getPermissions().validate(user, Permission.READ)) return new String[0]; *************** *** 403,406 **** --- 374,378 ---- if (res == null) return; + Collection collection = getCollection(); String name = res.getId(); LOG.debug("removing " + name); *************** *** 431,435 **** } needsSync = true; - load(getPath()); } --- 403,406 ---- *************** *** 453,456 **** --- 424,428 ---- private void storeBinaryResource(LocalBinaryResource res) throws XMLDBException { + Collection collection = getCollection(); DBBroker broker = null; try { *************** *** 473,476 **** --- 445,449 ---- private void storeXMLResource(LocalXMLResource res) throws XMLDBException { + Collection collection = getCollection(); DBBroker broker = null; String name = res.getDocumentId(); *************** *** 506,511 **** } ! public Date getCreationTime() { ! return new Date(collection.getCreationTime()); } --- 479,484 ---- } ! public Date getCreationTime() throws XMLDBException { ! return new Date(getCollection().getCreationTime()); } Index: LocalXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalXMLResource.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** LocalXMLResource.java 3 Feb 2004 08:33:51 -0000 1.30 --- LocalXMLResource.java 3 May 2004 12:58:11 -0000 1.31 *************** *** 208,211 **** --- 208,212 ---- public void getContentAsSAX(ContentHandler handler) throws XMLDBException { DBBroker broker = null; + // case 1: content is an external DOM node if (root != null && !(root instanceof NodeValue)) { try { *************** *** 221,224 **** --- 222,227 ---- .getMessage(), e); } + + // case 2: content is an atomic value } else if (value != null) { try { *************** *** 234,237 **** --- 237,242 ---- brokerPool.release(broker); } + + // case 3: content is an internal node or a document } else { try { Index: LocalResourceSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalResourceSet.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** LocalResourceSet.java 8 Mar 2004 11:21:22 -0000 1.17 --- LocalResourceSet.java 3 May 2004 12:58:11 -0000 1.18 *************** *** 157,162 **** if (coll == null || p.doc.getCollection() == null ! || coll.collection.getId() != p.doc.getCollection().getId()) { ! coll = new LocalCollection(user, brokerPool, null, p.doc.getCollection()); } res = new LocalXMLResource(user, brokerPool, coll, p); --- 157,162 ---- if (coll == null || p.doc.getCollection() == null ! || coll.getCollection().getId() != p.doc.getCollection().getId()) { ! coll = new LocalCollection(user, brokerPool, null, p.doc.getCollection().getName()); } res = new LocalXMLResource(user, brokerPool, coll, p); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 12:58:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16328/src/org/exist/storage/store Modified Files: CollectionStore.java Log Message: org.exist.xmldb.LocalCollection should not hold a direct reference to the actual database collection object. Keeping the reference conflicts with the database internal collection caching. Index: CollectionStore.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/CollectionStore.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CollectionStore.java 6 Jan 2004 14:10:16 -0000 1.3 --- CollectionStore.java 3 May 2004 12:58:12 -0000 1.4 *************** *** 13,17 **** // size of the internal buffer for collection objects ! public static final int COLLECTION_BUFFER_SIZE = 64; private CollectionCache collectionsCache = new CollectionCache(COLLECTION_BUFFER_SIZE); --- 13,17 ---- // size of the internal buffer for collection objects ! public static final int COLLECTION_BUFFER_SIZE = 128; private CollectionCache collectionsCache = new CollectionCache(COLLECTION_BUFFER_SIZE); |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 12:58:20
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16328/src/org/exist/storage/cache Modified Files: LRDCache.java ClockCache.java GClockCache.java Log Message: org.exist.xmldb.LocalCollection should not hold a direct reference to the actual database collection object. Keeping the reference conflicts with the database internal collection caching. Index: GClockCache.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/cache/GClockCache.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GClockCache.java 29 Mar 2004 14:15:12 -0000 1.9 --- GClockCache.java 3 May 2004 12:58:11 -0000 1.10 *************** *** 112,117 **** } ! protected void removeOne(Cacheable item) { ! Cacheable old; boolean removed = false; int bucket; --- 112,117 ---- } ! protected Cacheable removeOne(Cacheable item) { ! Cacheable old = null; boolean removed = false; int bucket; *************** *** 140,143 **** --- 140,144 ---- } } while (!removed); + return old; } Index: LRDCache.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/cache/LRDCache.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LRDCache.java 13 Dec 2003 12:33:20 -0000 1.3 --- LRDCache.java 3 May 2004 12:58:11 -0000 1.4 *************** *** 90,94 **** * @see org.exist.storage.cache.LFUCache#removeOne(org.exist.storage.cache.Cacheable) */ ! protected void removeOne(Cacheable item) { Cacheable old; double rd = 0, minRd = -1; --- 90,94 ---- * @see org.exist.storage.cache.LFUCache#removeOne(org.exist.storage.cache.Cacheable) */ ! protected Cacheable removeOne(Cacheable item) { Cacheable old; double rd = 0, minRd = -1; *************** *** 117,120 **** --- 117,121 ---- items[bucket] = item; map.put(item.getKey(), item); + return old; } Index: ClockCache.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/cache/ClockCache.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ClockCache.java 29 Mar 2004 14:15:12 -0000 1.11 --- ClockCache.java 3 May 2004 12:58:11 -0000 1.12 *************** *** 137,141 **** for (int i = 0; i < count; i++) { if (items[i] != null && items[i].getKey() == key) { ! items[i] = null; return; } --- 137,141 ---- for (int i = 0; i < count; i++) { if (items[i] != null && items[i].getKey() == key) { ! System.arraycopy(items, i + 1, items, i, --count - i); return; } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 12:52:03
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14644/src/org/exist/xquery Modified Files: XQueryContext.java Log Message: Fixed XQueryGenerator + XQueryContext to allow access to remote database instance. Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** XQueryContext.java 23 Apr 2004 13:07:45 -0000 1.11 --- XQueryContext.java 3 May 2004 12:51:53 -0000 1.12 *************** *** 167,171 **** public void declareNamespaces(Map namespaceMap) { - this.namespaces = namespaceMap; Map.Entry entry; String prefix, uri; --- 167,170 ---- *************** *** 178,182 **** if(uri == null) uri = ""; ! prefixes.put(prefix, uri); } } --- 177,182 ---- if(uri == null) uri = ""; ! namespaces.put(prefix, uri); ! prefixes.put(uri, prefix); } } |
From: Wolfgang M. M. <wol...@us...> - 2004-05-03 12:52:02
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/cocoon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14644/src/org/exist/cocoon Modified Files: XQueryGenerator.java Log Message: Fixed XQueryGenerator + XQueryContext to allow access to remote database instance. Index: XQueryGenerator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/cocoon/XQueryGenerator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** XQueryGenerator.java 23 Apr 2004 14:07:11 -0000 1.14 --- XQueryGenerator.java 3 May 2004 12:51:50 -0000 1.15 *************** *** 148,152 **** Class driver = Class.forName(DRIVER); Database database = (Database)driver.newInstance(); - database.setProperty("create-database", "true"); DatabaseManager.registerDatabase(database); } catch(Exception e) { --- 148,151 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-04-30 09:08:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23766/src/org/exist/xupdate Modified Files: Append.java XUpdateProcessor.java Log Message: XUpdate: added missing support for optional child attribute in xupdate:append. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** XUpdateProcessor.java 2 Feb 2004 15:30:38 -0000 1.20 --- XUpdateProcessor.java 30 Apr 2004 09:08:12 -0000 1.21 *************** *** 231,237 **** // start a new modification section ! if (localName.equals("append")) ! modification = new Append(broker, documentSet, select); ! else if (localName.equals("update")) modification = new Update(broker, documentSet, select); else if (localName.equals("insert-before")) --- 231,238 ---- // start a new modification section ! if (localName.equals("append")) { ! String child = atts.getValue("child"); ! modification = new Append(broker, documentSet, select, child); ! } else if (localName.equals("update")) modification = new Update(broker, documentSet, select); else if (localName.equals("insert-before")) Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Append.java 14 Apr 2004 12:17:23 -0000 1.12 --- Append.java 30 Apr 2004 09:08:12 -0000 1.13 *************** *** 19,28 **** public class Append extends Modification { /** * Constructor for Append. * @param selectStmt */ ! public Append(DBBroker broker, DocumentSet docs, String selectStmt) { super(broker, docs, selectStmt); } --- 19,34 ---- public class Append extends Modification { + private int child; + /** * Constructor for Append. * @param selectStmt */ ! public Append(DBBroker broker, DocumentSet docs, String selectStmt, String childAttr) { super(broker, docs, selectStmt); + if(childAttr == null || childAttr.equals("last()")) + child = -1; + else + child = Integer.parseInt(childAttr); } *************** *** 49,53 **** if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); ! node.appendChildren(children); doc.clearIndexListener(); doc.setLastModified(System.currentTimeMillis()); --- 55,59 ---- if (!doc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) throw new PermissionDeniedException("permission to update document denied"); ! node.appendChildren(children, child); doc.clearIndexListener(); doc.setLastModified(System.currentTimeMillis()); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-30 09:07:48
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23662/src/org/exist/dom Modified Files: ElementImpl.java NodeImpl.java Log Message: XUpdate: added missing support for optional child attribute in xupdate:append. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ElementImpl.java 27 Apr 2004 15:46:56 -0000 1.31 --- ElementImpl.java 30 Apr 2004 09:07:31 -0000 1.32 *************** *** 265,269 **** } ! public Node appendChildren(NodeList nodes) throws DOMException { DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; --- 265,269 ---- } ! public Node appendChildren(NodeList nodes, int child) throws DOMException { DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; *************** *** 271,281 **** node = appendChildren(firstChildID(), this, nodes, true); else { ! long last = lastChildID(); ! NodeImpl lastNode = getLastNode((NodeImpl) ownerDocument.getNode(last)); ! if (lastNode == null) ! throw new DOMException( ! DOMException.HIERARCHY_REQUEST_ERR, ! "invalid node: null"); ! node = appendChildren(last + 1, lastNode, nodes, true); } ownerDocument.broker.update(this); --- 271,289 ---- node = appendChildren(firstChildID(), this, nodes, true); else { ! if(child == 1) { ! Node firstChild = getFirstChild(); ! insertBefore(nodes, firstChild); ! } else { ! NodeImpl prevNode; ! long pos = firstChildID(); ! if(0 < child && child <= children) { ! pos = firstChildID() + child - 2; ! prevNode = getLastNode((NodeImpl) ownerDocument.getNode(pos)); ! node = insertAfter(nodes, prevNode); ! } else { ! prevNode = getLastNode((NodeImpl) ownerDocument.getNode(lastChildID())); ! node = appendChildren(lastChildID() + 1, prevNode, nodes, true); ! } ! } } ownerDocument.broker.update(this); *************** *** 994,998 **** DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes); NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); --- 1002,1006 ---- DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes, -1); NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); *************** *** 1029,1033 **** final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); --- 1037,1041 ---- final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes, -1); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NodeImpl.java 27 Apr 2004 15:46:56 -0000 1.17 --- NodeImpl.java 30 Apr 2004 09:07:32 -0000 1.18 *************** *** 163,167 **** } ! public Node appendChildren(NodeList nodes) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "not implemented"); } --- 163,167 ---- } ! public Node appendChildren(NodeList nodes, int child) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "not implemented"); } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-28 14:20:46
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21206/src/org/exist/xmlrpc Modified Files: RpcConnection.java Log Message: Replace document flag ignored in XMLRPC method parse(). Index: RpcConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmlrpc/RpcConnection.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** RpcConnection.java 23 Apr 2004 13:07:50 -0000 1.51 --- RpcConnection.java 28 Apr 2004 14:20:22 -0000 1.52 *************** *** 800,813 **** } ! public boolean parse(User user, byte[] xml, String docName, boolean replace) throws Exception { DBBroker broker = null; try { broker = brokerPool.get(user); ! int p = docName.lastIndexOf('/'); ! if (p < 0 || p == docName.length() - 1) throw new EXistException("Illegal document path"); ! String collectionName = docName.substring(0, p); ! docName = docName.substring(p + 1); Collection collection = broker.getCollection(collectionName); if (collection == null) --- 800,813 ---- } ! public boolean parse(User user, byte[] xml, String path, boolean replace) throws Exception { DBBroker broker = null; try { broker = brokerPool.get(user); ! int p = path.lastIndexOf('/'); ! if (p < 0 || p == path.length() - 1) throw new EXistException("Illegal document path"); ! String collectionName = path.substring(0, p); ! String docName = path.substring(p + 1); Collection collection = broker.getCollection(collectionName); if (collection == null) *************** *** 815,819 **** + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(docName); if (old != null) throw new PermissionDeniedException( --- 815,819 ---- + " not found"); if (!replace) { ! DocumentImpl old = collection.getDocument(path); if (old != null) throw new PermissionDeniedException( *************** *** 824,828 **** DocumentImpl doc = collection.addDocument(broker, docName, new InputSource(is)); ! LOG.debug("parsing " + docName + " took " + (System.currentTimeMillis() - startTime) + "ms."); documentCache.clear(); --- 824,828 ---- DocumentImpl doc = collection.addDocument(broker, docName, new InputSource(is)); ! LOG.debug("parsing " + path + " took " + (System.currentTimeMillis() - startTime) + "ms."); documentCache.clear(); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/storage/serializers Modified Files: Serializer.java NativeSerializer.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: NativeSerializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers/NativeSerializer.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** NativeSerializer.java 29 Jan 2004 15:06:44 -0000 1.22 --- NativeSerializer.java 27 Apr 2004 15:46:58 -0000 1.23 *************** *** 1,23 **** /* ! * eXist Open Source Native XML Database ! * Copyright (C) 2001-03 Wolfgang M. Meier ! * me...@if... ! * http://exist.sourceforge.net ! * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ! * $Id: */ package org.exist.storage.serializers; --- 1,21 ---- /* ! * eXist Open Source Native XML Database Copyright (C) 2001-03 Wolfgang M. Meier ! * me...@if... http://exist.sourceforge.net * ! * This program is free software; you can redistribute it and/or modify it under ! * the terms of the GNU Lesser General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) any ! * later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ! * details. ! * ! * You should have received a copy of the GNU Lesser General Public License ! * along with this program; if not, write to the Free Software Foundation, Inc., ! * 675 Mass Ave, Cambridge, MA 02139, USA. ! * ! * $Id: */ package org.exist.storage.serializers; *************** *** 26,30 **** import java.util.Set; import java.util.TreeSet; - import org.apache.oro.text.perl.Perl5Util; import org.exist.dom.AttrImpl; --- 24,27 ---- *************** *** 37,42 **** --- 34,41 ---- import org.exist.dom.NodeSet; import org.exist.dom.ProcessingInstructionImpl; + import org.exist.dom.QName; import org.exist.dom.TextImpl; import org.exist.dom.XMLUtil; + import org.exist.memtree.Receiver; import org.exist.storage.DBBroker; import org.exist.util.Configuration; *************** *** 48,453 **** public class NativeSerializer extends Serializer { ! public final static int EXIST_ID_NONE = 0; ! public final static int EXIST_ID_ELEMENT = 1; ! public final static int EXIST_ID_ALL = 2; ! ! private int showId = EXIST_ID_ELEMENT; ! private Perl5Util reutil = new Perl5Util(); ! public NativeSerializer(DBBroker broker, Configuration config) { ! super(broker, config); ! String showIdParam = (String) config.getProperty("serialization.add-exist-id"); ! if (showIdParam != null) { ! if (showIdParam.equals("element")) ! showId = EXIST_ID_ELEMENT; ! else if (showIdParam.equals("all")) ! showId = EXIST_ID_ALL; ! else ! showId = EXIST_ID_NONE; ! } ! } ! protected void serializeToSAX(NodeSet set, int start, int howmany, long queryTime) ! throws SAXException { ! boolean generateDocEvents = ! getProperty(Serializer.GENERATE_DOC_EVENTS, "false").equals("true"); ! Iterator iter = set.iterator(); ! for (int i = 0; i < start - 1; i++) ! iter.next(); ! if (!iter.hasNext()) ! return; ! if(generateDocEvents) ! contentHandler.startDocument(); ! contentHandler.startPrefixMapping("exist", EXIST_NS); ! AttributesImpl attribs = new AttributesImpl(); ! attribs.addAttribute( ! "", ! "hitCount", ! "hitCount", ! "CDATA", ! Integer.toString(set.getLength())); ! if (queryTime >= 0) ! attribs.addAttribute("", "queryTime", "queryTime", "CDATA", Long.toString(queryTime)); ! contentHandler.startElement(EXIST_NS, "result", "exist:result", attribs); ! NodeProxy p; ! long startTime = System.currentTimeMillis(); ! Iterator domIter; ! for (int i = 0; i < howmany && iter.hasNext(); i++) { ! p = (NodeProxy) iter.next(); ! if (p == null) ! continue; ! domIter = broker.getNodeIterator(p); ! if (domIter == null) ! continue; ! serializeToSAX(null, domIter, p.doc, p.gid, true, p.match); ! } ! contentHandler.endElement(EXIST_NS, "result", "exist:result"); ! if(generateDocEvents) ! contentHandler.endDocument(); ! } ! protected void serializeToSAX(DocumentImpl doc, boolean generateDocEvent) throws SAXException { ! long start = System.currentTimeMillis(); ! setDocument((DocumentImpl) doc); ! NodeList children = doc.getChildNodes(); ! if (generateDocEvent) ! contentHandler.startDocument(); ! //contentHandler.startPrefixMapping("exist", EXIST_NS); ! // iterate through children ! for (int i = 0; i < children.getLength(); i++) { ! final NodeImpl n = (NodeImpl) children.item(i); ! final NodeProxy p = ! new NodeProxy( ! (DocumentImpl) n.getOwnerDocument(), ! n.getGID(), ! n.getInternalAddress()); ! Iterator domIter = broker.getNodeIterator(p); ! domIter.next(); ! serializeToSAX( ! n, ! domIter, ! (DocumentImpl) n.getOwnerDocument(), ! n.getGID(), ! false, ! null); ! } ! LOG.debug( ! "serializing document " ! + ((DocumentImpl) doc).getDocId() ! + "to SAX took " ! + (System.currentTimeMillis() - start)); ! //contentHandler.endPrefixMapping("exist"); ! if (generateDocEvent) ! contentHandler.endDocument(); ! } ! protected void serializeToSAX(NodeImpl n) throws SAXException { ! if (!(n instanceof NodeImpl)) ! throw new RuntimeException("wrong implementation"); ! serializeToSAX(new NodeProxy((DocumentImpl) n.getOwnerDocument(), ((NodeImpl) n).getGID())); ! } ! protected void serializeToSAX(NodeProxy p) throws SAXException { ! serializeToSAX(p, true); ! } ! protected void serializeToSAX(NodeProxy p, boolean generateDocEvents) throws SAXException { ! if (generateDocEvents) ! contentHandler.startDocument(); ! //contentHandler.startPrefixMapping("exist", EXIST_NS); ! Iterator domIter = broker.getNodeIterator(p); ! serializeToSAX(null, domIter, p.doc, p.gid, true, p.match); ! //contentHandler.endPrefixMapping("exist"); ! if (generateDocEvents) ! contentHandler.endDocument(); ! } ! ! protected void serializeToSAX(Iterator iter, DocumentImpl doc, long gid) throws SAXException { ! serializeToSAX(null, iter, doc, gid, true, null); ! } ! protected void serializeToSAX( ! NodeImpl node, ! Iterator iter, ! DocumentImpl doc, ! long gid, ! boolean first, ! Match match) ! throws SAXException { ! serializeToSAX(node, iter, doc, gid, first, new TreeSet(), match); ! } ! protected void serializeToSAX( ! NodeImpl node, ! Iterator iter, ! DocumentImpl doc, ! long gid, ! boolean first, ! Set namespaces, ! Match match) ! throws SAXException { ! setDocument(doc); ! if (node == null) ! node = (NodeImpl) iter.next(); ! if (node == null) ! return; ! char ch[]; ! String cdata; ! switch (node.getNodeType()) { ! case Node.ELEMENT_NODE : ! int children = node.getChildCount(); ! int count = 0; ! int childLen; ! NodeImpl child = null; ! AttributesImpl attributes = new AttributesImpl(); ! if ((first && showId == EXIST_ID_ELEMENT) || showId == EXIST_ID_ALL) { ! attributes.addAttribute( ! EXIST_NS, ! "id", ! "exist:id", ! "CDATA", ! Long.toString(gid)); ! } ! if (first && showId > 0) { ! attributes.addAttribute( ! EXIST_NS, ! "source", ! "exist:source", ! "CDATA", ! doc.getFileName()); ! } ! if (children > 0) ! gid = XMLUtil.getFirstChildId(doc, gid); ! while (count < children) { ! child = (NodeImpl) iter.next(); ! if (child.getNodeType() == Node.ATTRIBUTE_NODE) { ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) > 0) ! cdata = processAttribute(((AttrImpl) child).getValue(), gid, match); ! else ! cdata = ((AttrImpl) child).getValue(); ! attributes.addAttribute( ! child.getNamespaceURI(), ! child.getLocalName(), ! child.getNodeName(), ! "CDATA", ! cdata); ! count++; ! gid++; ! } else ! break; ! } ! String defaultNS = null; ! if (((ElementImpl) node).declaresNamespacePrefixes()) { ! // declare namespaces used by this element ! String prefix, uri; ! for (Iterator i = ((ElementImpl) node).getPrefixes(); i.hasNext();) { ! prefix = (String) i.next(); ! if (prefix.length() == 0) { ! defaultNS = ((ElementImpl) node).getNamespaceForPrefix(prefix); ! contentHandler.startPrefixMapping("", defaultNS); ! namespaces.add(defaultNS); ! } else { ! uri = ((ElementImpl) node).getNamespaceForPrefix(prefix); ! if (uri.equals(EXIST_NS)) ! continue; ! contentHandler.startPrefixMapping(prefix, uri); ! namespaces.add(uri); ! } ! } ! } ! String ns = defaultNS == null ? node.getNamespaceURI() : defaultNS; ! if(ns.length() > 0 && (!namespaces.contains(ns))) ! contentHandler.startPrefixMapping(node.getPrefix(), ns); ! contentHandler.startElement( ! ns, ! node.getLocalName(), ! node.getNodeName(), ! attributes); ! while (count < children) { ! serializeToSAX(child, iter, doc, gid++, false, namespaces, match); ! if (++count < children) { ! child = (NodeImpl) iter.next(); ! } else ! break; ! } ! contentHandler.endElement(ns, node.getLocalName(), node.getNodeName()); ! if (((ElementImpl) node).declaresNamespacePrefixes()) { ! String prefix; ! for (Iterator i = ((ElementImpl) node).getPrefixes(); i.hasNext();) { ! prefix = (String) i.next(); ! contentHandler.endPrefixMapping(prefix); ! } ! } ! if(ns.length() > 0 && (!namespaces.contains(ns))) ! contentHandler.endPrefixMapping(node.getPrefix()); ! break; ! case Node.TEXT_NODE : ! if (first && createContainerElements) { ! AttributesImpl attribs = new AttributesImpl(); ! if (showId > 0) { ! attribs.addAttribute( ! EXIST_NS, ! "id", ! "exist:id", ! "CDATA", ! Long.toString(gid)); ! attribs.addAttribute( ! EXIST_NS, ! "source", ! "exist:source", ! "CDATA", ! doc.getFileName()); ! } ! contentHandler.startElement(EXIST_NS, "text", "exist:text", attribs); ! } ! if ((getHighlightingMode() & TAG_ELEMENT_MATCHES) == TAG_ELEMENT_MATCHES ! && (cdata = processText((TextImpl) node, gid, match)) != null) ! scanText(cdata); ! else { ! ((TextImpl) node).getXMLString().toSAX(contentHandler); ! } ! if (first && createContainerElements) ! contentHandler.endElement(EXIST_NS, "text", "exist:text"); ! break; ! case Node.ATTRIBUTE_NODE : ! if (first && createContainerElements) { ! AttributesImpl attribs = new AttributesImpl(); ! if (showId > 0) { ! attribs.addAttribute( ! EXIST_NS, ! "id", ! "exist:id", ! "CDATA", ! Long.toString(gid)); ! attribs.addAttribute( ! EXIST_NS, ! "source", ! "exist:source", ! "CDATA", ! doc.getFileName()); ! } ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) > 0) ! cdata = processAttribute(((AttrImpl) node).getValue(), gid, match); ! else ! cdata = ((AttrImpl) node).getValue(); ! attribs.addAttribute( ! node.getNamespaceURI(), ! node.getLocalName(), ! node.getNodeName(), ! "CDATA", ! cdata); ! contentHandler.startElement(EXIST_NS, "attribute", "exist:attribute", attribs); ! contentHandler.endElement(EXIST_NS, "attribute", "exist:attribute"); ! } else { ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) == TAG_ATTRIBUTE_MATCHES) ! cdata = processAttribute(((AttrImpl) node).getValue(), gid, match); ! else ! cdata = ((AttrImpl) node).getValue(); ! ch = new char[cdata.length()]; ! cdata.getChars(0, ch.length, ch, 0); ! contentHandler.characters(ch, 0, ch.length); ! } ! break; ! case Node.PROCESSING_INSTRUCTION_NODE : ! contentHandler.processingInstruction( ! ((ProcessingInstructionImpl) node).getTarget(), ! ((ProcessingInstructionImpl) node).getData()); ! break; ! case Node.COMMENT_NODE : ! if (lexicalHandler != null) { ! String comment = ((CommentImpl) node).getData(); ! char data[] = new char[comment.length()]; ! comment.getChars(0, data.length - 1, data, 0); ! lexicalHandler.comment(data, 0, data.length - 1); ! } ! break; ! } ! } ! private final String processAttribute(String data, long gid, Match match) { ! if (match == null) ! return data; ! // prepare a regular expression to mark match-terms ! StringBuffer expr = null; ! Match next = match; ! while(next != null) { ! if (next.getNodeId() == gid) { ! if (expr == null) { ! expr = new StringBuffer(); ! expr.append("s/\\b("); ! } ! if (expr.length() > 5) ! expr.append('|'); ! expr.append(next.getMatchingTerm()); ! } ! next = next.getNextMatch(); ! } ! if (expr != null) { ! expr.append(")\\b/||$1||/gi"); ! data = reutil.substitute(expr.toString(), data); ! } ! return data; ! } ! private final String processText(TextImpl text, long gid, Match match) { ! if (match == null) ! return null; ! // prepare a regular expression to mark match-terms ! StringBuffer expr = null; ! Match next = match; ! while(next != null) { ! if (next.getNodeId() == gid) { ! if (expr == null) { ! expr = new StringBuffer(); ! expr.append("s/\\b("); ! } ! if (expr.length() > 5) ! expr.append('|'); ! expr.append(next.getMatchingTerm()); ! } ! next = next.getNextMatch(); ! } ! if (expr != null) { ! expr.append(")\\b/||$1||/gi"); ! return reutil.substitute(expr.toString(), text.getData()); ! } else ! return null; ! } ! private final void scanText(String data) throws SAXException { ! AttributesImpl atts = new AttributesImpl(); ! int p0 = 0, p1; ! boolean inTerm = false; ! while (p0 < data.length()) { ! p1 = data.indexOf("||", p0); ! if (p1 < 0) { ! outputText(data.substring(p0)); ! break; ! } ! if (inTerm) { ! contentHandler.startElement(EXIST_NS, "match", "exist:match", atts); ! outputText(data.substring(p0, p1)); ! contentHandler.endElement(EXIST_NS, "match", "exist:match"); ! inTerm = false; ! } else { ! inTerm = true; ! outputText(data.substring(p0, p1)); ! } ! p0 = p1 + 2; ! } ! } ! private final void outputText(String data) throws SAXException { ! final char ch[] = new char[data.length()]; ! data.getChars(0, ch.length, ch, 0); ! contentHandler.characters(ch, 0, ch.length); ! } ! } --- 47,504 ---- public class NativeSerializer extends Serializer { ! public final static int EXIST_ID_NONE = 0; ! public final static int EXIST_ID_ELEMENT = 1; ! public final static int EXIST_ID_ALL = 2; ! private final static AttributesImpl EMPTY_ATTRIBUTES = new AttributesImpl(); ! ! private final static QName MATCH_ELEMENT = new QName("match", EXIST_NS, "exist"); ! ! private int showId = EXIST_ID_ELEMENT; ! private Perl5Util reutil = new Perl5Util(); ! public NativeSerializer(DBBroker broker, Configuration config) { ! super(broker, config); ! String showIdParam = (String) config ! .getProperty("serialization.add-exist-id"); ! if (showIdParam != null) { ! if (showIdParam.equals("element")) ! showId = EXIST_ID_ELEMENT; ! else if (showIdParam.equals("all")) ! showId = EXIST_ID_ALL; ! else ! showId = EXIST_ID_NONE; ! } ! } ! protected void serializeToSAX(NodeSet set, int start, int howmany, ! long queryTime) throws SAXException { ! boolean generateDocEvents = getProperty(Serializer.GENERATE_DOC_EVENTS, ! "false").equals("true"); ! Iterator iter = set.iterator(); ! for (int i = 0; i < start - 1; i++) ! iter.next(); ! if (!iter.hasNext()) return; ! if (generateDocEvents) contentHandler.startDocument(); ! contentHandler.startPrefixMapping("exist", EXIST_NS); ! AttributesImpl attribs = new AttributesImpl(); ! attribs.addAttribute("", "hitCount", "hitCount", "CDATA", Integer ! .toString(set.getLength())); ! if (queryTime >= 0) ! attribs.addAttribute("", "queryTime", "queryTime", "CDATA", ! Long.toString(queryTime)); ! contentHandler ! .startElement(EXIST_NS, "result", "exist:result", attribs); ! NodeProxy p; ! long startTime = System.currentTimeMillis(); ! Iterator domIter; ! for (int i = 0; i < howmany && iter.hasNext(); i++) { ! p = (NodeProxy) iter.next(); ! if (p == null) continue; ! domIter = broker.getNodeIterator(p); ! if (domIter == null) continue; ! serializeToSAX(null, domIter, p.doc, p.gid, true, p.match); ! } ! contentHandler.endElement(EXIST_NS, "result", "exist:result"); ! if (generateDocEvents) contentHandler.endDocument(); ! } ! protected void serializeToSAX(DocumentImpl doc, boolean generateDocEvent) ! throws SAXException { ! long start = System.currentTimeMillis(); ! setDocument((DocumentImpl) doc); ! NodeList children = doc.getChildNodes(); ! if (generateDocEvent) contentHandler.startDocument(); ! //contentHandler.startPrefixMapping("exist", EXIST_NS); ! // iterate through children ! for (int i = 0; i < children.getLength(); i++) { ! final NodeImpl n = (NodeImpl) children.item(i); ! final NodeProxy p = new NodeProxy((DocumentImpl) n ! .getOwnerDocument(), n.getGID(), n.getInternalAddress()); ! Iterator domIter = broker.getNodeIterator(p); ! domIter.next(); ! serializeToSAX(n, domIter, (DocumentImpl) n.getOwnerDocument(), n ! .getGID(), false, null); ! } ! LOG.debug("serializing document " + ((DocumentImpl) doc).getDocId() ! + "to SAX took " + (System.currentTimeMillis() - start)); ! //contentHandler.endPrefixMapping("exist"); ! if (generateDocEvent) contentHandler.endDocument(); ! } ! protected void serializeToSAX(NodeImpl n) throws SAXException { ! if (!(n instanceof NodeImpl)) ! throw new RuntimeException("wrong implementation"); ! serializeToSAX(new NodeProxy((DocumentImpl) n.getOwnerDocument(), ! ((NodeImpl) n).getGID())); ! } ! protected void serializeToSAX(NodeProxy p) throws SAXException { ! serializeToSAX(p, true); ! } ! protected void serializeToSAX(NodeProxy p, boolean generateDocEvents) ! throws SAXException { ! if (generateDocEvents) contentHandler.startDocument(); ! //contentHandler.startPrefixMapping("exist", EXIST_NS); ! Iterator domIter = broker.getNodeIterator(p); ! serializeToSAX(null, domIter, p.doc, p.gid, true, p.match); ! //contentHandler.endPrefixMapping("exist"); ! if (generateDocEvents) contentHandler.endDocument(); ! } ! protected void serializeToSAX(Iterator iter, DocumentImpl doc, long gid) ! throws SAXException { ! serializeToSAX(null, iter, doc, gid, true, null); ! } ! protected void serializeToSAX(NodeImpl node, Iterator iter, ! DocumentImpl doc, long gid, boolean first, Match match) ! throws SAXException { ! serializeToSAX(node, iter, doc, gid, first, new TreeSet(), match); ! } ! protected void serializeToSAX(NodeImpl node, Iterator iter, ! DocumentImpl doc, long gid, boolean first, Set namespaces, ! Match match) throws SAXException { ! setDocument(doc); ! if (node == null) node = (NodeImpl) iter.next(); ! if (node == null) return; ! char ch[]; ! String cdata; ! switch (node.getNodeType()) { ! case Node.ELEMENT_NODE: ! int children = node.getChildCount(); ! int count = 0; ! int childLen; ! NodeImpl child = null; ! AttributesImpl attributes = new AttributesImpl(); ! if ((first && showId == EXIST_ID_ELEMENT) || showId == EXIST_ID_ALL) { ! attributes.addAttribute(EXIST_NS, "id", "exist:id", "CDATA", ! Long.toString(gid)); ! } ! if (first && showId > 0) { ! attributes.addAttribute(EXIST_NS, "source", "exist:source", ! "CDATA", doc.getFileName()); ! } ! if (children > 0) gid = XMLUtil.getFirstChildId(doc, gid); ! while (count < children) { ! child = (NodeImpl) iter.next(); ! if (child.getNodeType() == Node.ATTRIBUTE_NODE) { ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) > 0) ! cdata = processAttribute(((AttrImpl) child).getValue(), ! gid, match); ! else ! cdata = ((AttrImpl) child).getValue(); ! attributes.addAttribute(child.getNamespaceURI(), child ! .getLocalName(), child.getNodeName(), "CDATA", ! cdata); ! count++; ! gid++; ! child.release(); ! } else ! break; ! } ! String defaultNS = null; ! if (((ElementImpl) node).declaresNamespacePrefixes()) { ! // declare namespaces used by this element ! String prefix, uri; ! for (Iterator i = ((ElementImpl) node).getPrefixes(); i ! .hasNext();) { ! prefix = (String) i.next(); ! if (prefix.length() == 0) { ! defaultNS = ((ElementImpl) node) ! .getNamespaceForPrefix(prefix); ! contentHandler.startPrefixMapping("", defaultNS); ! namespaces.add(defaultNS); ! } else { ! uri = ((ElementImpl) node) ! .getNamespaceForPrefix(prefix); ! if (uri.equals(EXIST_NS)) continue; ! contentHandler.startPrefixMapping(prefix, uri); ! namespaces.add(uri); ! } ! } ! } ! String ns = defaultNS == null ? node.getNamespaceURI() : defaultNS; ! if (ns.length() > 0 && (!namespaces.contains(ns))) ! contentHandler.startPrefixMapping(node.getPrefix(), ns); ! contentHandler.startElement(ns, node.getLocalName(), node ! .getNodeName(), attributes); ! while (count < children) { ! serializeToSAX(child, iter, doc, gid++, false, namespaces, ! match); ! if (++count < children) { ! child = (NodeImpl) iter.next(); ! } else ! break; ! } ! contentHandler.endElement(ns, node.getLocalName(), node ! .getNodeName()); ! if (((ElementImpl) node).declaresNamespacePrefixes()) { ! String prefix; ! for (Iterator i = ((ElementImpl) node).getPrefixes(); i ! .hasNext();) { ! prefix = (String) i.next(); ! contentHandler.endPrefixMapping(prefix); ! } ! } ! if (ns.length() > 0 && (!namespaces.contains(ns))) ! contentHandler.endPrefixMapping(node.getPrefix()); ! break; ! case Node.TEXT_NODE: ! if (first && createContainerElements) { ! AttributesImpl attribs = new AttributesImpl(); ! if (showId > 0) { ! attribs.addAttribute(EXIST_NS, "id", "exist:id", "CDATA", ! Long.toString(gid)); ! attribs.addAttribute(EXIST_NS, "source", "exist:source", ! "CDATA", doc.getFileName()); ! } ! contentHandler.startElement(EXIST_NS, "text", "exist:text", ! attribs); ! } ! if ((getHighlightingMode() & TAG_ELEMENT_MATCHES) == TAG_ELEMENT_MATCHES ! && (cdata = processText((TextImpl) node, gid, match)) != null) ! scanText(cdata); ! else { ! ((TextImpl) node).getXMLString().toSAX(contentHandler); ! } ! if (first && createContainerElements) ! contentHandler.endElement(EXIST_NS, "text", "exist:text"); ! node.release(); ! break; ! case Node.ATTRIBUTE_NODE: ! if (first && createContainerElements) { ! AttributesImpl attribs = new AttributesImpl(); ! if (showId > 0) { ! attribs.addAttribute(EXIST_NS, "id", "exist:id", "CDATA", ! Long.toString(gid)); ! attribs.addAttribute(EXIST_NS, "source", "exist:source", ! "CDATA", doc.getFileName()); ! } ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) > 0) ! cdata = processAttribute(((AttrImpl) node).getValue(), gid, ! match); ! else ! cdata = ((AttrImpl) node).getValue(); ! attribs.addAttribute(node.getNamespaceURI(), node ! .getLocalName(), node.getNodeName(), "CDATA", cdata); ! contentHandler.startElement(EXIST_NS, "attribute", ! "exist:attribute", attribs); ! contentHandler.endElement(EXIST_NS, "attribute", ! "exist:attribute"); ! } else { ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) == TAG_ATTRIBUTE_MATCHES) ! cdata = processAttribute(((AttrImpl) node).getValue(), gid, ! match); ! else ! cdata = ((AttrImpl) node).getValue(); ! ch = new char[cdata.length()]; ! cdata.getChars(0, ch.length, ch, 0); ! contentHandler.characters(ch, 0, ch.length); ! } ! node.release(); ! break; ! case Node.PROCESSING_INSTRUCTION_NODE: ! contentHandler.processingInstruction( ! ((ProcessingInstructionImpl) node).getTarget(), ! ((ProcessingInstructionImpl) node).getData()); ! node.release(); ! break; ! case Node.COMMENT_NODE: ! if (lexicalHandler != null) { ! String comment = ((CommentImpl) node).getData(); ! char data[] = new char[comment.length()]; ! comment.getChars(0, data.length - 1, data, 0); ! lexicalHandler.comment(data, 0, data.length - 1); ! } ! node.release(); ! break; ! } ! } ! protected void serializeToReceiver(NodeProxy p, Receiver receiver) ! throws SAXException { ! Iterator domIter = broker.getNodeIterator(p); ! serializeToReceiver(null, domIter, p.doc, p.gid, p.match, receiver); ! } ! ! protected void serializeToReceiver(NodeImpl node, Iterator iter, ! DocumentImpl doc, long gid, Match match, Receiver receiver) ! throws SAXException { ! if (node == null) node = (NodeImpl) iter.next(); ! if (node == null) return; ! char ch[]; ! String cdata; ! switch (node.getNodeType()) { ! case Node.ELEMENT_NODE: ! receiver.startElement(node.getQName()); ! int children = node.getChildCount(); ! int count = 0; ! int childLen; ! NodeImpl child = null; ! if (children > 0) gid = XMLUtil.getFirstChildId(doc, gid); ! while (count < children) { ! child = (NodeImpl) iter.next(); ! if (child.getNodeType() == Node.ATTRIBUTE_NODE) { ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) > 0) ! cdata = processAttribute(((AttrImpl) child).getValue(), ! gid, match); ! else ! cdata = ((AttrImpl) child).getValue(); ! receiver.attribute(child.getQName(), cdata); ! count++; ! gid++; ! child.release(); ! } else ! break; ! } ! while (count < children) { ! serializeToReceiver(child, iter, doc, gid++, match, receiver); ! if (++count < children) { ! child = (NodeImpl) iter.next(); ! } else ! break; ! } ! receiver.endElement(node.getQName()); ! node.release(); ! break; ! case Node.TEXT_NODE: ! if ((getHighlightingMode() & TAG_ELEMENT_MATCHES) == TAG_ELEMENT_MATCHES ! && (cdata = processText((TextImpl) node, gid, match)) != null) ! textToReceiver(cdata, receiver); ! else { ! receiver.characters(((TextImpl) node).getXMLString()); ! } ! node.release(); ! break; ! case Node.ATTRIBUTE_NODE: ! if ((getHighlightingMode() & TAG_ATTRIBUTE_MATCHES) == TAG_ATTRIBUTE_MATCHES) ! cdata = processAttribute(((AttrImpl) node).getValue(), gid, ! match); ! else ! cdata = ((AttrImpl) node).getValue(); ! receiver.attribute(node.getQName(), cdata); ! node.release(); ! break; ! case Node.PROCESSING_INSTRUCTION_NODE: ! contentHandler.processingInstruction( ! ((ProcessingInstructionImpl) node).getTarget(), ! ((ProcessingInstructionImpl) node).getData()); ! node.release(); ! break; ! case Node.COMMENT_NODE: ! if (lexicalHandler != null) { ! String comment = ((CommentImpl) node).getData(); ! char data[] = new char[comment.length()]; ! comment.getChars(0, data.length - 1, data, 0); ! lexicalHandler.comment(data, 0, data.length - 1); ! } ! node.release(); ! break; ! } ! } ! private final String processAttribute(String data, long gid, Match match) { ! if (match == null) return data; ! // prepare a regular expression to mark match-terms ! StringBuffer expr = null; ! Match next = match; ! while (next != null) { ! if (next.getNodeId() == gid) { ! if (expr == null) { ! expr = new StringBuffer(); ! expr.append("s/\\b("); ! } ! if (expr.length() > 5) expr.append('|'); ! expr.append(next.getMatchingTerm()); ! } ! next = next.getNextMatch(); ! } ! if (expr != null) { ! expr.append(")\\b/||$1||/gi"); ! data = reutil.substitute(expr.toString(), data); ! } ! return data; ! } ! private final String processText(TextImpl text, long gid, Match match) { ! if (match == null) return null; ! // prepare a regular expression to mark match-terms ! StringBuffer expr = null; ! Match next = match; ! while (next != null) { ! if (next.getNodeId() == gid) { ! if (expr == null) { ! expr = new StringBuffer(); ! expr.append("s/\\b("); ! } ! if (expr.length() > 5) expr.append('|'); ! expr.append(next.getMatchingTerm()); ! } ! next = next.getNextMatch(); ! } ! if (expr != null) { ! expr.append(")\\b/||$1||/gi"); ! return reutil.substitute(expr.toString(), text.getData()); ! } else ! return null; ! } ! private final void textToReceiver(String data, Receiver receiver) ! throws SAXException { ! int p0 = 0, p1; ! boolean inTerm = false; ! while (p0 < data.length()) { ! p1 = data.indexOf("||", p0); ! if (p1 < 0) { ! receiver.characters(data.substring(p0)); ! break; ! } ! if (inTerm) { ! receiver.startElement(MATCH_ELEMENT); ! receiver.characters(data.substring(p0, p1)); ! receiver.endElement(MATCH_ELEMENT); ! inTerm = false; ! } else { ! inTerm = true; ! receiver.characters(data.substring(p0, p1)); ! } ! p0 = p1 + 2; ! } ! } ! private final void scanText(String data) throws SAXException { ! int p0 = 0, p1; ! boolean inTerm = false; ! while (p0 < data.length()) { ! p1 = data.indexOf("||", p0); ! if (p1 < 0) { ! outputText(data.substring(p0)); ! break; ! } ! if (inTerm) { ! contentHandler.startElement(EXIST_NS, "match", "exist:match", ! EMPTY_ATTRIBUTES); ! outputText(data.substring(p0, p1)); ! contentHandler.endElement(EXIST_NS, "match", "exist:match"); ! inTerm = false; ! } else { ! inTerm = true; ! outputText(data.substring(p0, p1)); ! } ! p0 = p1 + 2; ! } ! } ! private final void outputText(String data) throws SAXException { ! final char ch[] = new char[data.length()]; ! data.getChars(0, ch.length, ch, 0); ! contentHandler.characters(ch, 0, ch.length); ! } ! } \ No newline at end of file Index: Serializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/serializers/Serializer.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Serializer.java 30 Mar 2004 16:56:31 -0000 1.21 --- Serializer.java 27 Apr 2004 15:46:58 -0000 1.22 *************** *** 50,53 **** --- 50,54 ---- import org.exist.dom.NodeSet; import org.exist.dom.XMLUtil; + import org.exist.memtree.Receiver; import org.exist.security.PermissionDeniedException; import org.exist.security.User; *************** *** 90,94 **** *@author Wolfgang Meier <wol...@ex...> */ ! public class Serializer implements XMLReader { protected final static Logger LOG = Logger.getLogger(Serializer.class); --- 91,95 ---- *@author Wolfgang Meier <wol...@ex...> */ ! public abstract class Serializer implements XMLReader { protected final static Logger LOG = Logger.getLogger(Serializer.class); *************** *** 817,820 **** --- 818,827 ---- } + public void toReceiver(NodeProxy p, Receiver receiver) throws SAXException { + serializeToReceiver(p, receiver); + } + + protected abstract void serializeToReceiver(NodeProxy p, Receiver receiver) throws SAXException; + private String hasXSLPi(Document doc) { NodeList docChildren = doc.getChildNodes(); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/xquery Modified Files: LocationStep.java ElementConstructor.java EnclosedExpr.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LocationStep.java 25 Mar 2004 12:50:50 -0000 1.3 --- LocationStep.java 27 Apr 2004 15:46:58 -0000 1.4 *************** *** 196,208 **** ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector; ! if(axis == Constants.DESCENDANT_ATTRIBUTE_AXIS) ! selector = new DescendantSelector(contextSet, inPredicate); ! else ! selector = new ChildSelector(contextSet, inPredicate); ! result = context.getBroker().findElementsByTagName( ! ElementValue.ATTRIBUTE, docs, test.getName(), selector ! ); } return result; --- 196,220 ---- ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().getAttributesByName( ! currentDocs, test.getName()); ! } ! if (axis == Constants.DESCENDANT_ATTRIBUTE_AXIS) { ! result = ! currentSet.selectAncestorDescendant( ! contextSet, ! NodeSet.DESCENDANT, ! inPredicate); ! ! } else { ! result = ! currentSet.selectParentChild( ! contextSet, ! NodeSet.DESCENDANT, ! inPredicate); ! } } return result; *************** *** 218,226 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector = new ChildSelector(contextSet, inPredicate); ! NodeSet result = context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, docs, test.getName(), selector ! ); return result; } --- 230,249 ---- return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, ! currentDocs, ! test.getName(), null); ! } ! NodeSet result = ! currentSet.selectParentChild(contextSet, NodeSet.DESCENDANT, inPredicate); ! // DocumentSet docs = contextSet.getDocumentSet(); ! // NodeSelector selector = new ChildSelector(contextSet, inPredicate); ! // NodeSet result = context.getBroker().findElementsByTagName( ! // ElementValue.ELEMENT, docs, test.getName(), selector ! // ); return result; } *************** *** 236,246 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector = axis == Constants.DESCENDANT_SELF_AXIS ? ! new DescendantOrSelfSelector(contextSet, inPredicate) : ! new DescendantSelector(contextSet, inPredicate); ! NodeSet result = context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, docs, test.getName(), selector ! ); return result; } --- 259,275 ---- return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, currentDocs, ! test.getName(), null); ! } ! NodeSet result = currentSet.selectAncestorDescendant( ! contextSet, ! NodeSet.DESCENDANT, ! axis == Constants.DESCENDANT_SELF_AXIS, ! inPredicate); return result; } Index: EnclosedExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/EnclosedExpr.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnclosedExpr.java 23 Feb 2004 09:36:11 -0000 1.2 --- EnclosedExpr.java 27 Apr 2004 15:46:59 -0000 1.3 *************** *** 63,77 **** Item next = i.nextItem(); boolean readNext = true; ! StringBuffer buf = new StringBuffer(); while (next != null) { // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. if (Type.subTypeOf(next.getType(), Type.ATOMIC)) { ! if (buf.length() > 0) buf.append(' '); buf.append(next.getStringValue()); next = i.nextItem(); } else if (Type.subTypeOf(next.getType(), Type.NODE)) { ! if (buf.length() > 0) { receiver.characters(buf); buf.setLength(0); --- 63,79 ---- Item next = i.nextItem(); boolean readNext = true; ! StringBuffer buf = null; while (next != null) { // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. if (Type.subTypeOf(next.getType(), Type.ATOMIC)) { ! if(buf == null) ! buf = new StringBuffer(); ! else if (buf.length() > 0) buf.append(' '); buf.append(next.getStringValue()); next = i.nextItem(); } else if (Type.subTypeOf(next.getType(), Type.NODE)) { ! if (buf != null && buf.length() > 0) { receiver.characters(buf); buf.setLength(0); *************** *** 81,85 **** } } ! if (buf.length() > 0) receiver.characters(buf); } catch (SAXException e) { --- 83,87 ---- } } ! if (buf != null && buf.length() > 0) receiver.characters(buf); } catch (SAXException e) { Index: ElementConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ElementConstructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ElementConstructor.java 29 Jan 2004 15:06:42 -0000 1.1 --- ElementConstructor.java 27 Apr 2004 15:46:58 -0000 1.2 *************** *** 89,93 **** } } ! // process the remaining attributes for(Iterator i = attributes.iterator(); i.hasNext(); ) { constructor = (AttributeConstructor)i.next(); --- 89,93 ---- } } ! // process the remaining attributesCharArr for(Iterator i = attributes.iterator(); i.hasNext(); ) { constructor = (AttributeConstructor)i.next(); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/xupdate Modified Files: Rename.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: Rename.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Rename.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Rename.java 29 Jan 2004 15:06:45 -0000 1.11 --- Rename.java 27 Apr 2004 15:46:57 -0000 1.12 *************** *** 1,7 **** - /* - * Rename.java - May 1, 2003 - * - * @author wolf - */ package org.exist.xupdate; --- 1,2 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/storage/store Modified Files: BFile.java NodeIterator.java DOMFile.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** DOMFile.java 23 Apr 2004 13:07:45 -0000 1.22 --- DOMFile.java 27 Apr 2004 15:46:57 -0000 1.23 *************** *** 997,1001 **** RecordPos rec = findRecord(p, false); DOMFilePageHeader ph = rec.page.getPageHeader(); - // TODO: 10 is wrong int end = rec.offset + 8; System.arraycopy(rec.page.data, rec.offset + 8, rec.page.data, rec.offset - 2, rec.page.len - end); --- 997,1000 ---- *************** *** 1100,1107 **** } - LOG.debug("previous = " + ph.getPrevDataPage()); if(ph.getPrevDataPage() > -1) { DOMPage prev = getCurrentPage(ph.getPrevDataPage()); - LOG.debug("previous = " + prev.getPageNum()); prev.getPageHeader().setNextDataPage(ph.getNextDataPage()); prev.setDirty(true); --- 1099,1104 ---- *************** *** 1112,1116 **** ph.setNextDataPage(-1); ph.setDataLength(0); - ph.setDataLength(0); ph.setNextTID((short) -1); ph.setRecordCount((short) 0); --- 1109,1112 ---- *************** *** 1210,1214 **** if (value.length < l) { // value is smaller than before ! System.out.println(value.length + " < " + l); System.out.println(rec.page.page.getPageInfo() + "; offset = " + rec.offset + "; data-len = " --- 1206,1210 ---- if (value.length < l) { // value is smaller than before ! System.out.println(value.length + " < " + l + ": " + new String(value)); System.out.println(rec.page.page.getPageInfo() + "; offset = " + rec.offset + "; data-len = " Index: NodeIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/NodeIterator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NodeIterator.java 23 Apr 2004 13:07:45 -0000 1.6 --- NodeIterator.java 27 Apr 2004 15:46:57 -0000 1.7 *************** *** 35,43 **** private long startAddress = -1; private Object lockKey; ! public NodeIterator(Object lock, DOMFile db, NodeProxy node) throws BTreeException, IOException { this.db = db; this.doc = node.doc; if (-1 < node.getInternalAddress()) startAddress = node.getInternalAddress(); --- 35,45 ---- private long startAddress = -1; private Object lockKey; + private boolean useNodePool = false; ! public NodeIterator(Object lock, DOMFile db, NodeProxy node, boolean poolable) throws BTreeException, IOException { this.db = db; this.doc = node.doc; + this.useNodePool = poolable; if (-1 < node.getInternalAddress()) startAddress = node.getInternalAddress(); *************** *** 151,158 **** offset += 8; final byte[] odata = db.getOverflowValue(overflow); ! nextNode = NodeImpl.deserialize(odata, 0, odata.length, doc); // normal node } else { ! nextNode = NodeImpl.deserialize(p.data, offset, l, doc); offset += l; } --- 153,160 ---- offset += 8; final byte[] odata = db.getOverflowValue(overflow); ! nextNode = NodeImpl.deserialize(odata, 0, odata.length, doc, useNodePool); // normal node } else { ! nextNode = NodeImpl.deserialize(p.data, offset, l, doc, useNodePool); offset += l; } *************** *** 161,165 **** ); nextNode.setOwnerDocument(doc); ! // System.out.println("Next: " + nextNode.getNodeName() + " [" + page + "]"); } while(nextNode == null); } --- 163,167 ---- ); nextNode.setOwnerDocument(doc); ! // System.out.println("Next: " + nextNode.getNodeName() + " [" + page + "]"); } while(nextNode == null); } Index: BFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/BFile.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** BFile.java 23 Apr 2004 13:07:45 -0000 1.18 --- BFile.java 27 Apr 2004 15:46:57 -0000 1.19 *************** *** 397,401 **** final int offset = findValuePosition(page, tid); if(offset < 0) { - System.out.println("no data found at tid " + tid + "; page " + page.getPageNum()); throw new IOException("no data found at tid " + tid + "; page " + page.getPageNum()); } --- 397,400 ---- *************** *** 931,939 **** int skip = 0; if (freeList.size() > MAX_FREE_LIST_LEN) { ! LOG.debug("removing " + (freeList.size() - MAX_FREE_LIST_LEN) + " free pages."); // no: remove some smaller entries to make it fit ! skip = freeList.size() - MAX_FREE_LIST_LEN; ! // for (int i = 0; i < freeList.size() - MAX_FREE_LIST_LEN; i++) ! // freeList.removeFirst(); } super.write(raf); --- 930,938 ---- int skip = 0; if (freeList.size() > MAX_FREE_LIST_LEN) { ! LOG.warn("removing " + (freeList.size() - MAX_FREE_LIST_LEN) + " free pages."); // no: remove some smaller entries to make it fit ! // skip = freeList.size() - MAX_FREE_LIST_LEN; ! for (int i = 0; i < freeList.size() - MAX_FREE_LIST_LEN; i++) ! freeList.removeFirst(); } super.write(raf); *************** *** 943,949 **** Iterator i = freeList.iterator(); // skip ! for(int j = 0; j < skip && i.hasNext(); j++) { ! i.next(); ! } while (i.hasNext()) { freeSpace = (FreeSpace) i.next(); --- 942,948 ---- Iterator i = freeList.iterator(); // skip ! // for(int j = 0; j < skip && i.hasNext(); j++) { ! // i.next(); ! // } while (i.hasNext()) { freeSpace = (FreeSpace) i.next(); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/util Modified Files: CharArrayPool.java XMLString.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: CharArrayPool.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/CharArrayPool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CharArrayPool.java 9 Sep 2003 07:29:03 -0000 1.2 --- CharArrayPool.java 27 Apr 2004 15:46:57 -0000 1.3 *************** *** 21,32 **** public static char[] getCharArray(int size) { ! if(size < MAX) { final char[][] pool = (char[][])pools_.get(); ! for(int i = pool.length; i-- > 0; ) { if(pool[i] != null && pool[i].length == size) { ! //System.out.println("found char[" + size + "]"); ! char[] b = pool[i]; ! pool[i] = null; ! return b; } } --- 21,31 ---- public static char[] getCharArray(int size) { ! if(MAX > size) { final char[][] pool = (char[][])pools_.get(); ! for(int i = 0; i < pool.length; i++) { if(pool[i] != null && pool[i].length == size) { ! char[] b = pool[i]; ! pool[i] = null; ! return b; } } *************** *** 39,45 **** if(b == null || b.length > MAX) return; - //System.out.println("releasing char[" + b.length + "]"); final char[][] pool = (char[][]) pools_.get(); ! for(int i = pool.length; i-- > 0;) { if(pool[i] == null) { pool[i] = b; --- 38,43 ---- if(b == null || b.length > MAX) return; final char[][] pool = (char[][]) pools_.get(); ! for(int i = 0; i < pool.length; i++) { if(pool[i] == null) { pool[i] = b; Index: XMLString.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/XMLString.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** XMLString.java 29 Jan 2004 15:06:49 -0000 1.8 --- XMLString.java 27 Apr 2004 15:46:57 -0000 1.9 *************** *** 186,193 **** } ! /* (non-Javadoc) ! * @see java.lang.Object#finalize() */ ! protected void finalize() throws Throwable { CharArrayPool.releaseCharArray(value_); value_ = null; --- 186,193 ---- } ! /** ! * Release all resources hold by this XMLString. */ ! public final void release() { CharArrayPool.releaseCharArray(value_); value_ = null; |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/security Modified Files: SecurityManager.java security.properties Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: security.properties =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/security/security.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** security.properties 23 Apr 2004 13:07:43 -0000 1.1 --- security.properties 27 Apr 2004 15:46:59 -0000 1.2 *************** *** 10,12 **** # the database will not recognize the old passwords. ! passwords.encoding=md5 \ No newline at end of file --- 10,12 ---- # the database will not recognize the old passwords. ! passwords.encoding=md5 Index: SecurityManager.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/security/SecurityManager.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SecurityManager.java 23 Apr 2004 13:07:43 -0000 1.17 --- SecurityManager.java 27 Apr 2004 15:46:59 -0000 1.18 *************** *** 19,23 **** * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ! * $Id: */ package org.exist.security; --- 19,23 ---- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ! * $Id$ */ package org.exist.security; |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/util/hashtable Modified Files: NamePool.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: NamePool.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/NamePool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NamePool.java 2 Mar 2004 08:35:52 -0000 1.1 --- NamePool.java 27 Apr 2004 15:47:00 -0000 1.2 *************** *** 75,79 **** if (idx < 0) idx *= -1; - // System.out.println("adding " + value + " to " + idx + "; size: " + items); int bucket = -1; // look for an empty bucket --- 75,78 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/util/serializer Modified Files: XMLWriter.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: XMLWriter.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/XMLWriter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLWriter.java 9 Feb 2004 08:40:11 -0000 1.6 --- XMLWriter.java 27 Apr 2004 15:47:00 -0000 1.7 *************** *** 185,189 **** if (!declarationWritten) writeDeclaration(); ! characters(new XMLString(ch, start, len)); } --- 185,191 ---- if (!declarationWritten) writeDeclaration(); ! XMLString s = new XMLString(ch, start, len); ! characters(s); ! s.release(); } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:39
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/realm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/http/realm Modified Files: XmldbRealm.java Removed Files: XmldbPrincipal.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: XmldbRealm.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/realm/XmldbRealm.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmldbRealm.java 24 Apr 2004 13:45:54 -0000 1.1 --- XmldbRealm.java 27 Apr 2004 15:46:59 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- import org.apache.catalina.realm.GenericPrincipal; import org.exist.EXistException; + import org.exist.security.*; import org.exist.security.User; import org.exist.security.SecurityManager; --- XmldbPrincipal.java DELETED --- |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:12
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/storage Modified Files: NativeBroker.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** NativeBroker.java 23 Apr 2004 13:07:44 -0000 1.63 --- NativeBroker.java 27 Apr 2004 15:47:02 -0000 1.64 *************** *** 597,601 **** domDb.setOwnerObject(this); try { ! return new NodeIterator(this, domDb, proxy); } catch (BTreeException e) { LOG.debug("failed to create node iterator", e); --- 597,601 ---- domDb.setOwnerObject(this); try { ! return new NodeIterator(this, domDb, proxy, true); } catch (BTreeException e) { LOG.debug("failed to create node iterator", e); *************** *** 2098,2101 **** --- 2098,2105 ---- ByteArrayPool.releaseByteArray(data); } catch (Exception e) { + Value oldVal = domDb.get(node.getInternalAddress()); + NodeImpl old = + NodeImpl.deserialize(oldVal.data(), oldVal.start(), oldVal.getLength(), + (DocumentImpl)node.getOwnerDocument(), false); LOG.debug( "Exception while storing " *************** *** 2103,2107 **** + "; gid = " + node.getGID() ! + "; address = ", e); } --- 2107,2111 ---- + "; gid = " + node.getGID() ! + "; old = " + old.getNodeName(), e); } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/memtree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/memtree Modified Files: Receiver.java MemTreeBuilder.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: MemTreeBuilder.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/MemTreeBuilder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MemTreeBuilder.java 29 Jan 2004 15:06:49 -0000 1.6 --- MemTreeBuilder.java 27 Apr 2004 15:47:02 -0000 1.7 *************** *** 105,131 **** public int startElement(QName qn, Attributes attributes) { int nodeNr = doc.addNode(Node.ELEMENT_NODE, level, qn); ! // parse attributes ! String attrPrefix; ! String attrLocalName; ! String attrNS; ! String attrQName; ! int p; ! for (int i = 0; i < attributes.getLength(); i++) { ! attrNS = attributes.getURI(i); ! attrLocalName = attributes.getLocalName(i); ! attrQName = attributes.getQName(i); ! // skip xmlns-attributes and attributes in eXist's namespace ! if (!(attrQName.startsWith("xmlns") ! || attrNS.equals("http://exist.sourceforge.net/NS/exist"))) { ! p = attrQName.indexOf(':'); ! attrPrefix = (p > -1) ? attrQName.substring(0, p) : null; ! p = ! doc.addAttribute( ! nodeNr, ! new QName(attrLocalName, attrNS, attrPrefix), ! attributes.getValue(i)); } } - // update links if (level + 1 >= prevNodeInLevel.length) { --- 105,132 ---- public int startElement(QName qn, Attributes attributes) { int nodeNr = doc.addNode(Node.ELEMENT_NODE, level, qn); ! if(attributes != null) { ! // parse attributes ! String attrPrefix; ! String attrLocalName; ! String attrNS; ! String attrQName; ! int p; ! for (int i = 0; i < attributes.getLength(); i++) { ! attrNS = attributes.getURI(i); ! attrLocalName = attributes.getLocalName(i); ! attrQName = attributes.getQName(i); ! // skip xmlns-attributes and attributes in eXist's namespace ! if (!(attrQName.startsWith("xmlns") ! || attrNS.equals("http://exist.sourceforge.net/NS/exist"))) { ! p = attrQName.indexOf(':'); ! attrPrefix = (p > -1) ? attrQName.substring(0, p) : null; ! p = ! doc.addAttribute( ! nodeNr, ! new QName(attrLocalName, attrNS, attrPrefix), ! attributes.getValue(i)); ! } } } // update links if (level + 1 >= prevNodeInLevel.length) { *************** *** 154,158 **** int lastNode = doc.getLastNode(); if(doc.nodeKind[lastNode] != Node.ELEMENT_NODE) { - System.out.println("appending attribute as text; last = " + doc.nodeKind[lastNode]); characters(value); } else { --- 155,158 ---- Index: Receiver.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/memtree/Receiver.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Receiver.java 22 Dec 2003 18:48:44 -0000 1.2 --- Receiver.java 27 Apr 2004 15:47:01 -0000 1.3 *************** *** 100,103 **** --- 100,107 ---- } + public void startElement(QName qname) { + builder.startElement(qname, null); + } + /* (non-Javadoc) * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) *************** *** 108,111 **** --- 112,119 ---- } + public void endElement(QName qname) throws SAXException { + builder.endElement(); + } + public void characters(CharSequence seq) throws SAXException { builder.characters(seq); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:11
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184 Modified Files: log4j.xml Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: log4j.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/log4j.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** log4j.xml 3 Feb 2004 11:08:09 -0000 1.2 --- log4j.xml 27 Apr 2004 15:47:01 -0000 1.3 *************** *** 41,45 **** <category name="org.exist.xmldb" additivity="false"> ! <priority value="debug"/> <appender-ref ref="console"/> </category> --- 41,45 ---- <category name="org.exist.xmldb" additivity="false"> ! <priority value="debug"/> <appender-ref ref="console"/> </category> *************** *** 53,63 **** priority is set to debug --> <category name="org.apache" additivity="false"> ! <priority value="info"/> <appender-ref ref="console"/> </category> <root> ! <priority value="debug"/> ! <appender-ref ref="console"/> </root> </log4j:configuration> --- 53,63 ---- priority is set to debug --> <category name="org.apache" additivity="false"> ! <priority value="info"/> <appender-ref ref="console"/> </category> <root> ! <priority value="debug"/> ! <appender-ref ref="console"/> </root> </log4j:configuration> |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist Modified Files: Indexer.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: Indexer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/Indexer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Indexer.java 18 Feb 2004 10:15:23 -0000 1.6 --- Indexer.java 27 Apr 2004 15:47:01 -0000 1.7 *************** *** 38,41 **** --- 38,42 ---- import org.exist.dom.DocumentTypeImpl; import org.exist.dom.ElementImpl; + import org.exist.dom.NodeObjectPool; import org.exist.dom.ProcessingInstructionImpl; import org.exist.dom.QName; *************** *** 397,401 **** int p = qname.indexOf(':'); String prefix = p > -1 ? qname.substring(0, p) : ""; ! QName qn = new QName(name, namespace, prefix); if (!stack.empty()) { last = (ElementImpl) stack.peek(); --- 398,402 ---- int p = qname.indexOf(':'); String prefix = p > -1 ? qname.substring(0, p) : ""; ! QName qn = broker.getSymbols().getQName(namespace, name, prefix); if (!stack.empty()) { last = (ElementImpl) stack.peek(); *************** *** 479,486 **** p = attrQName.indexOf(':'); attrPrefix = (p > -1) ? attrQName.substring(0, p) : null; ! final AttrImpl attr = ! new AttrImpl( ! new QName(attrLocalName, attrNS, attrPrefix), ! attributes.getValue(i)); attr.setOwnerDocument(document); if (attributes.getType(i).equals("ID")) --- 480,486 ---- p = attrQName.indexOf(':'); attrPrefix = (p > -1) ? attrQName.substring(0, p) : null; ! final AttrImpl attr = (AttrImpl)NodeObjectPool.getInstance().borrowNode(AttrImpl.class); ! attr.setNodeName(document.getSymbols().getQName(attrNS, attrLocalName, attrPrefix)); ! attr.setValue(attributes.getValue(i)); attr.setOwnerDocument(document); if (attributes.getType(i).equals("ID")) *************** *** 489,492 **** --- 489,493 ---- if (!validate) broker.store(attr, currentPath); + attr.release(); } } |