You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
| 2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
| 2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
| 2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
| 2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
| 2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
| 2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
| 2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
| 2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
| 2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
| 2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
| 2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
| 2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
| 2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
| 2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
| 2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
| 2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
| 2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
| 2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(86) |
Aug
(51) |
Sep
(65) |
Oct
(91) |
Nov
(72) |
Dec
(86) |
| 2026 |
Jan
(75) |
Feb
(33) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(3) |
2
|
|
3
(6) |
4
(7) |
5
(10) |
6
(2) |
7
(4) |
8
(4) |
9
(1) |
|
10
(8) |
11
(9) |
12
(8) |
13
(1) |
14
(6) |
15
(4) |
16
(7) |
|
17
(5) |
18
(2) |
19
(2) |
20
(2) |
21
|
22
(2) |
23
(7) |
|
24
(8) |
25
(1) |
26
(7) |
27
(3) |
28
(3) |
29
(2) |
|
|
From: <del...@us...> - 2008-02-29 11:46:21
|
Revision: 7460
http://exist.svn.sourceforge.net/exist/?rev=7460&view=rev
Author: deliriumsky
Date: 2008-02-29 03:46:19 -0800 (Fri, 29 Feb 2008)
Log Message:
-----------
[bugfix] some months can have 5 weeks - its true! February 2008 has 5 Thursdays
Modified Paths:
--------------
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java 2008-02-29 07:40:36 UTC (rev 7459)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java 2008-02-29 11:46:19 UTC (rev 7460)
@@ -46,7 +46,7 @@
public final static FunctionSignature signature =
new FunctionSignature(
new QName("date-for", DateTimeModule.NAMESPACE_URI, DateTimeModule.PREFIX),
- "Returns the date for a given set of parameters. $a the year of interest. $b the month of interest (1 = January, 12 = December). $c The week in the month of interest (1 = first week, 4 = last week). $d The day in the week of interest (1 = Sunday, 7 = Saturday).",
+ "Returns the date for a given set of parameters. $a the year of interest. $b the month of interest (1 = January, 12 = December). $c The week in the month of interest (1 = first week, 4 or 5 = last week). $d The day in the week of interest (1 = Sunday, 7 = Saturday).",
new SequenceType[] {
new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
@@ -67,16 +67,17 @@
int weekInMonth = ((IntegerValue)args[2].itemAt(0)).getInt();
int dayInWeek = ((IntegerValue)args[3].itemAt(0)).getInt();
- //TODO: check bounds of supplied parameters
+ //check bounds of supplied parameters
if(monthOfInterest < 1 || monthOfInterest > 12)
throw new XPathException("The month of interest must be between 1 and 12");
- if(weekInMonth < 1 || weekInMonth > 4)
- throw new XPathException("The week in the month of interest must be between 1 and 4");
+ if(weekInMonth < 1 || weekInMonth > 5)
+ throw new XPathException("The week in the month of interest must be between 1 and 5");
if(dayInWeek < 1 || dayInWeek > 7)
throw new XPathException("The day in the week of interest must be between 1 and 7");
-
+
+ //create date
GregorianCalendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, yearOfInterest);
cal.set(Calendar.MONTH, monthOfInterest - 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-29 07:40:51
|
Revision: 7459
http://exist.svn.sourceforge.net/exist/?rev=7459&view=rev
Author: pkaminsk2
Date: 2008-02-28 23:40:36 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
Added QueryService.run() to let clients more easily take advantage of XQuery update extensions.
Modified Paths:
--------------
trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2008-02-28 17:03:01 UTC (rev 7458)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2008-02-29 07:40:36 UTC (rev 7459)
@@ -181,6 +181,17 @@
return executeQuery(query, null, params);
}
+ /**
+ * Run the given query, ignoring the results. Useful for running update "queries" --
+ * see eXist's XQuery Update Extensions.
+ * @see http://exist-db.org/update_ext.html
+ * @param query the query to run
+ * @param params parameters to the query, will be substituted for $_1, $_2, etc.
+ */
+ public void run(String query, Object... params) {
+ executeQuery(query, null, params);
+ }
+
private interface WrapperFactory {
Function createWrapper(XQueryContext context);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2008-02-28 17:03:12
|
Revision: 7458
http://exist.svn.sourceforge.net/exist/?rev=7458&view=rev
Author: deliriumsky
Date: 2008-02-28 09:03:01 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
[feature] added datetime:date-for() very useful for complex date calculations such as recurring schedules. Designed to complement datetime:day-in-week() and datetime:week-in-month()
Modified Paths:
--------------
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateTimeModule.java
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateTimeModule.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateTimeModule.java 2008-02-28 16:59:01 UTC (rev 7457)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateTimeModule.java 2008-02-28 17:03:01 UTC (rev 7458)
@@ -43,7 +43,8 @@
new FunctionDef(DaysInMonthFunction.signature, DaysInMonthFunction.class),
new FunctionDef(FormatDateTimeFunction.signature, FormatDateTimeFunction.class),
new FunctionDef(FormatDateFunction.signature, FormatDateFunction.class),
- new FunctionDef(FormatTimeFunction.signature, FormatTimeFunction.class)
+ new FunctionDef(FormatTimeFunction.signature, FormatTimeFunction.class),
+ new FunctionDef(DateForFunction.signature, DateForFunction.class)
};
public DateTimeModule() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2008-02-28 16:59:11
|
Revision: 7457
http://exist.svn.sourceforge.net/exist/?rev=7457&view=rev
Author: deliriumsky
Date: 2008-02-28 08:59:01 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
[feature] added datetime:date-for() very useful for complex date calculations such as recurring schedules. Designed to complement datetime:day-in-week() and datetime:week-in-month()
Added Paths:
-----------
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java
Added: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java (rev 0)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java 2008-02-28 16:59:01 UTC (rev 7457)
@@ -0,0 +1,88 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-03 Wolfgang M. Meier
+ * wol...@ex...
+ * 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.xquery.modules.datetime;
+
+import org.exist.dom.QName;
+import org.exist.xquery.BasicFunction;
+import org.exist.xquery.Cardinality;
+import org.exist.xquery.FunctionSignature;
+import org.exist.xquery.XPathException;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.DateValue;
+import org.exist.xquery.value.IntegerValue;
+import org.exist.xquery.value.Sequence;
+import org.exist.xquery.value.SequenceType;
+import org.exist.xquery.value.TimeUtils;
+import org.exist.xquery.value.Type;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+/**
+ * @author Adam Retter <ada...@de...>
+ */
+public class DateForFunction extends BasicFunction {
+
+ public final static FunctionSignature signature =
+ new FunctionSignature(
+ new QName("date-for", DateTimeModule.NAMESPACE_URI, DateTimeModule.PREFIX),
+ "Returns the date for a given set of parameters. $a the year of interest. $b the month of interest (1 = January, 12 = December). $c The week in the month of interest (1 = first week, 4 = last week). $d The day in the week of interest (1 = Sunday, 7 = Saturday).",
+ new SequenceType[] {
+ new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
+ },
+ new SequenceType(Type.DATE, Cardinality.EXACTLY_ONE));
+
+ public DateForFunction(XQueryContext context)
+ {
+ super(context, signature);
+ }
+
+ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException
+ {
+ int yearOfInterest = ((IntegerValue)args[0].itemAt(0)).getInt();
+ int monthOfInterest = ((IntegerValue)args[1].itemAt(0)).getInt();
+ int weekInMonth = ((IntegerValue)args[2].itemAt(0)).getInt();
+ int dayInWeek = ((IntegerValue)args[3].itemAt(0)).getInt();
+
+ //TODO: check bounds of supplied parameters
+ if(monthOfInterest < 1 || monthOfInterest > 12)
+ throw new XPathException("The month of interest must be between 1 and 12");
+
+ if(weekInMonth < 1 || weekInMonth > 4)
+ throw new XPathException("The week in the month of interest must be between 1 and 4");
+
+ if(dayInWeek < 1 || dayInWeek > 7)
+ throw new XPathException("The day in the week of interest must be between 1 and 7");
+
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.set(Calendar.YEAR, yearOfInterest);
+ cal.set(Calendar.MONTH, monthOfInterest - 1);
+ cal.set(Calendar.WEEK_OF_MONTH, weekInMonth);
+ cal.set(Calendar.DAY_OF_WEEK, dayInWeek);
+
+ return new DateValue(TimeUtils.getInstance().newXMLGregorianCalendar(cal));
+ }
+}
Property changes on: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/datetime/DateForFunction.java
___________________________________________________________________
Name: svn:keywords
+ HeadURL LastChangedRevision LastChangedDate LastChangedBy Id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2008-02-28 10:29:53
|
Revision: 7456
http://exist.svn.sourceforge.net/exist/?rev=7456&view=rev
Author: brihaye
Date: 2008-02-28 02:29:50 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
[improvement] improved logging when using a start value during a non-ordered index lookup
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyDocuments.java
trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyOccurrences.java
trunk/eXist/src/org/exist/xquery/functions/util/IndexKeys.java
Modified: trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyDocuments.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyDocuments.java 2008-02-27 22:06:06 UTC (rev 7455)
+++ trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyDocuments.java 2008-02-28 10:29:50 UTC (rev 7456)
@@ -101,7 +101,7 @@
if (indexWorker instanceof OrderedValuesIndex)
hints.put(OrderedValuesIndex.START_VALUE, args[1]);
else
- LOG.info(indexWorker + " isn't an instance of org.exist.indexing.OrderedIndexWorker. " + args[1] + " ignored." );
+ LOG.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );
Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
if (occur.length == 0)
result= Sequence.EMPTY_SEQUENCE;
Modified: trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyOccurrences.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyOccurrences.java 2008-02-27 22:06:06 UTC (rev 7455)
+++ trunk/eXist/src/org/exist/xquery/functions/util/IndexKeyOccurrences.java 2008-02-28 10:29:50 UTC (rev 7456)
@@ -102,7 +102,7 @@
if (indexWorker instanceof OrderedValuesIndex)
hints.put(OrderedValuesIndex.START_VALUE, args[1]);
else
- LOG.info(indexWorker + " isn't an instance of org.exist.indexing.OrderedIndexWorker. " + args[1] + " ignored." );
+ LOG.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );
Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
if (occur.length == 0)
result= Sequence.EMPTY_SEQUENCE;
Modified: trunk/eXist/src/org/exist/xquery/functions/util/IndexKeys.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/util/IndexKeys.java 2008-02-27 22:06:06 UTC (rev 7455)
+++ trunk/eXist/src/org/exist/xquery/functions/util/IndexKeys.java 2008-02-28 10:29:50 UTC (rev 7456)
@@ -125,7 +125,7 @@
if (indexWorker instanceof OrderedValuesIndex)
hints.put(OrderedValuesIndex.START_VALUE, args[1]);
else
- LOG.info(indexWorker + " isn't an instance of org.exist.indexing.OrderedIndexWorker. " + args[1] + " ignored." );
+ LOG.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );
Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
//TODO : add an extra argument to pass the END_VALUE ?
int len = (occur.length > max ? max : occur.length);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2008-02-27 22:06:20
|
Revision: 7455
http://exist.svn.sourceforge.net/exist/?rev=7455&view=rev
Author: dizzzz
Date: 2008-02-27 14:06:06 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
[ingnore] Cleanup of logging ; removed stacktrace for missing module. message should be sufficient.
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/XQueryContext.java
Modified: trunk/eXist/src/org/exist/xquery/XQueryContext.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/XQueryContext.java 2008-02-27 20:52:07 UTC (rev 7454)
+++ trunk/eXist/src/org/exist/xquery/XQueryContext.java 2008-02-27 22:06:06 UTC (rev 7455)
@@ -2477,7 +2477,7 @@
// Note: can't throw an exception here since this would create
// problems with test cases and jar dependencies
LOG.warn("Configuration problem: failed to load class for module " +
- uri + "; class: " + clazz, e);
+ uri + "; class: " + clazz + "; message: " + e.getMessage());
}
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2008-02-27 20:52:12
|
Revision: 7454
http://exist.svn.sourceforge.net/exist/?rev=7454&view=rev
Author: dizzzz
Date: 2008-02-27 12:52:07 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
[update] Refactored validation stuff again. validation:validate() uses xerces for xsd/dtd validation and oNVDL/jing for schematron/relaxng and nvdl. Thnx to the work of the engineers of oxygenxml editor
Modified Paths:
--------------
trunk/eXist/src/org/exist/validation/Validator.java
trunk/eXist/src/org/exist/validation/service/LocalValidationService.java
trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java
trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java
trunk/eXist/webapp/validation.xml
Modified: trunk/eXist/src/org/exist/validation/Validator.java
===================================================================
--- trunk/eXist/src/org/exist/validation/Validator.java 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/src/org/exist/validation/Validator.java 2008-02-27 20:52:07 UTC (rev 7454)
@@ -3,12 +3,12 @@
* Copyright (C) 2001-07 The eXist Project
* http://exist-db.org
*
- * This program is free software; you can redistribute it and/or
+ * This program stream 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,
+ * This program stream 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.
@@ -26,10 +26,9 @@
import com.thaiopensource.validate.ValidateProperty;
import com.thaiopensource.validate.ValidationDriver;
import com.thaiopensource.validate.rng.CompactSchemaReader;
-import java.io.IOException;
+
import java.io.InputStream;
-import java.util.logging.Level;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -65,7 +64,9 @@
private eXistXMLCatalogResolver systemCatalogResolver = null;
/**
- * Setup Validator object with brokerpool as centre.
+ * Setup Validator object with brokerpool as db connection.
+ *
+ * @param pool Brokerpool
*/
public Validator(BrokerPool pool) {
logger.info("Initializing Validator.");
@@ -84,55 +85,60 @@
}
// setup grammar brokerPool
- grammarPool = (GrammarPool) config.getProperty(XMLReaderObjectFactory.GRAMMER_POOL);
+ grammarPool = (GrammarPool)
+ config.getProperty(XMLReaderObjectFactory.GRAMMER_POOL);
// setup system wide catalog resolver
- systemCatalogResolver = (eXistXMLCatalogResolver) config.getProperty(XMLReaderObjectFactory.CATALOG_RESOLVER);
+ systemCatalogResolver = (eXistXMLCatalogResolver)
+ config.getProperty(XMLReaderObjectFactory.CATALOG_RESOLVER);
}
-//// /**
-//// * Validate XML data using system catalog. XSD and DTD only.
-//// *
-//// * @param stream XML input.
-//// * @return Validation report containing all validation info.
-//// */
-//// public ValidationReport validate(InputStream stream) {
-//// return validate(stream, null);
-//// }
-////
-//// /**
-//// * Validate XML data from reader using specified grammar.
-//// *
-//// * @param grammarPath User supplied path to grammar.
-//// * @param stream XML input.
-//// * @return Validation report containing all validation info.
-//// */
-//// public ValidationReport validate(InputStream stream, String grammarPath) {
-////
-//// // repair path to local resource
-//// if(grammarPath != null && grammarPath.startsWith("/")){
-//// grammarPath = "xmldb:exist://" + grammarPath;
-//// }
-////
-//// if(grammarPath != null &&
-//// (grammarPath.endsWith(".rng") || grammarPath.endsWith(".rnc") ||
-//// grammarPath.endsWith(".onvl") || grammarPath.endsWith(".sch"))){
-//// return validateJing(stream, grammarPath);
-//// } else {
-//// return validateParse(stream, grammarPath);
-//// }
-////
-//// }
+ /**
+ * Validate XML data using system catalog. XSD and DTD only.
+ *
+ * @param stream XML input.
+ * @return Validation report containing all validation info.
+ */
+ public ValidationReport validate(InputStream stream) {
+ return validate(stream, null);
+ }
+
+ /**
+ * Validate XML data from reader using specified grammar.
+ *
+ * @param grammarUrl User supplied path to grammar.
+ * @param stream XML input.
+ * @return Validation report containing all validation info.
+ */
+ public ValidationReport validate(InputStream stream, String grammarUrl) {
+ // repair path to local resource
+ if(grammarUrl != null && grammarUrl.startsWith("/")){
+ grammarUrl = "xmldb:exist://" + grammarUrl;
+ }
+
+ if(grammarUrl != null &&
+ (grammarUrl.endsWith(".rng") || grammarUrl.endsWith(".rnc") ||
+ grammarUrl.endsWith(".nvdl") || grammarUrl.endsWith(".sch"))){
+ // Validate with Jing
+ return validateJing(stream, grammarUrl);
+
+ } else {
+ // Validate with Xerces
+ return validateParse(stream, grammarUrl);
+ }
+
+ }
+
/**
* Validate XML data from reader using specified grammar with Jing.
*
- * @param grammarPath User supplied path to grammar.
- * @param stream XML input.
+ * @param stream XML input document.
+ * @param grammarUrl User supplied path to grammar.
* @return Validation report containing all validation info.
*/
- public ValidationReport validateJing(InputStream is, String grammarUrl) {
+ public ValidationReport validateJing(InputStream stream, String grammarUrl) {
ValidationReport report = new ValidationReport();
try {
@@ -153,7 +159,7 @@
driver.loadSchema(new InputSource(grammarUrl));
// Validate XML instance
- driver.validate(new InputSource(is));
+ driver.validate(new InputSource(stream));
} catch(ExistIOException ex) {
logger.error(ex.getCause());
@@ -182,11 +188,11 @@
/**
* Validate XML data from reader using specified grammar.
*
- * @param grammarPath User supplied path to grammar.
+ * @param grammarUrl User supplied path to grammar.
* @param stream XML input.
* @return Validation report containing all validation info.
*/
- public ValidationReport validateParse(InputStream stream, String grammarPath) {
+ public ValidationReport validateParse(InputStream stream, String grammarUrl) {
logger.debug("Start validation.");
@@ -198,32 +204,32 @@
XMLReader xmlReader = getXMLReader(contenthandler, report);
- if(grammarPath == null){
+ if(grammarUrl == null){
// Scenario 1 : no params - use system catalog
logger.debug("Validation using system catalog.");
xmlReader.setProperty(XMLReaderObjectFactory.PROPERTIES_ENTITYRESOLVER, systemCatalogResolver);
- } else if(grammarPath.endsWith(".xml")){
+ } else if(grammarUrl.endsWith(".xml")){
// Scenario 2 : path to catalog (xml)
- logger.debug("Validation using user specified catalog '" + grammarPath + "'.");
+ logger.debug("Validation using user specified catalog '" + grammarUrl + "'.");
eXistXMLCatalogResolver resolver = new eXistXMLCatalogResolver();
- resolver.setCatalogList(new String[]{grammarPath});
+ resolver.setCatalogList(new String[]{grammarUrl});
xmlReader.setProperty(XMLReaderObjectFactory.PROPERTIES_ENTITYRESOLVER, resolver);
- } else if(grammarPath.endsWith("/")){
+ } else if(grammarUrl.endsWith("/")){
// Scenario 3 : path to collection ("/"): search.
- logger.debug("Validation using searched grammar, start from '" + grammarPath + "'.");
- SearchResourceResolver resolver = new SearchResourceResolver(grammarPath, brokerPool);
+ logger.debug("Validation using searched grammar, start from '" + grammarUrl + "'.");
+ SearchResourceResolver resolver = new SearchResourceResolver(grammarUrl, brokerPool);
xmlReader.setProperty(XMLReaderObjectFactory.PROPERTIES_ENTITYRESOLVER, resolver);
} else {
// Scenario 4 : path to grammar (xsd, dtd) specified.
- logger.debug("Validation using specified grammar '" + grammarPath + "'.");
- AnyUriResolver resolver = new AnyUriResolver(grammarPath);
+ logger.debug("Validation using specified grammar '" + grammarUrl + "'.");
+ AnyUriResolver resolver = new AnyUriResolver(grammarUrl);
xmlReader.setProperty(XMLReaderObjectFactory.PROPERTIES_ENTITYRESOLVER, resolver);
}
Modified: trunk/eXist/src/org/exist/validation/service/LocalValidationService.java
===================================================================
--- trunk/eXist/src/org/exist/validation/service/LocalValidationService.java 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/src/org/exist/validation/service/LocalValidationService.java 2008-02-27 20:52:07 UTC (rev 7454)
@@ -98,9 +98,9 @@
// Perform validation
ValidationReport report = null;
if(grammarPath==null){
- report = validator.validateParse(is); // TODO Dizzz check which method
+ report = validator.validate(is);
} else {
- report = validator.validateParse(is, grammarPath);
+ report = validator.validate(is, grammarPath);
}
Modified: trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java
===================================================================
--- trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java 2008-02-27 20:52:07 UTC (rev 7454)
@@ -3896,7 +3896,7 @@
InputStream is = new EmbeddedInputStream( new XmldbURL(docUri) );
// Perform validation
- ValidationReport report = validator.validateParse(is); // TODO DIZ check method
+ ValidationReport report = validator.validate(is);
// Return validation result
isValid = report.isValid();
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2008-02-27 20:52:07 UTC (rev 7454)
@@ -61,21 +61,18 @@
private static final String simpleFunctionTxt=
"Validate document specified by $a. " +
"$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
- "The grammar files are resolved using the global catalog file(s).";
+ "The grammar files (DTD, XML Schema) are resolved using the global "+
+ "catalog file(s).";
private static final String extendedFunctionTxt=
"Validate document specified by $a using $b. "+
"$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
- "$b can point to an OASIS catalog file, a grammar (xml schema only) "+
- "or a collection (path ends with '/').";
+ "$b can point to an OASIS catalog file (.xml), "+
+ "a collection (path ends with '/') or a grammar document. "+
+ "Supported grammar documents extensions are \".dtd\" \".xsd\" "+
+ "\".rng\" \".rnc\" \".sch\" and \".nvdl\".";
+
- private static final String jingFunctionTxt=
- "Validate document specified by $a using $b with jing. "+
- "$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
- "$b points to a grammar document with document name extension "+
- ".dtd, xsd, .ndvl (Namespace-based Validation Dispatching Language), "+
- ".rng/.rnc (RelaxNG/Compact notation) or .sch (Schematron).";
-
private final Validator validator;
private final BrokerPool brokerPool;
@@ -122,30 +119,8 @@
new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
- ),
-
- new FunctionSignature(
- new QName("jing", ValidationModule.NAMESPACE_URI,
- ValidationModule.PREFIX),
- jingFunctionTxt,
- new SequenceType[]{
- new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
- ),
-
- new FunctionSignature(
- new QName("jing-report", ValidationModule.NAMESPACE_URI,
- ValidationModule.PREFIX),
- jingFunctionTxt+" A simple report is returned.",
- new SequenceType[]{
- new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
)
-
+
};
@@ -156,6 +131,7 @@
}
/**
+ * @throws org.exist.xquery.XPathException
* @see BasicFunction#eval(Sequence[], Sequence)
*/
public Sequence eval(Sequence[] args, Sequence contextSequence)
@@ -191,38 +167,23 @@
throw new XPathException(getASTNode(), "wrong item type " + Type.getTypeName(args[0].getItemType()));
}
-
- if(isCalledAs("validate") || isCalledAs("validate-report")){
- // Perform validation using xerces SAX parsing
- if(args.length == 1){
- // Validate using system catalog
- vr = validator.validateParse(is);
- } else {
- // Validate using resource speciefied in second parameter
- String url = args[1].getStringValue();
+ if(args.length == 1) {
+ // Validate using system catalog
+ vr=validator.validate(is);
- if(url.startsWith("/")){
- url = "xmldb:exist://" + url;
- }
+ } else {
+ // Validate using resource speciefied in second parameter
+ String url=args[1].getStringValue();
- vr = validator.validateParse(is, url);
+ if(url.startsWith("/")) {
+ url="xmldb:exist://" + url;
}
-
- } else if(isCalledAs("jing") || isCalledAs("jing-report")){
- // Perform validation using JING
- String url = args[1].getStringValue();
- if(url.startsWith("/")){
- url = "xmldb:exist://" + url;
- }
- vr = validator.validateJing(is, url);
-
- } else {
- // This should not happen
- throw new XPathException("Validaton function not found");
+ vr=validator.validate(is, url);
}
+
} catch (MalformedURLException ex) {
LOG.error(ex);
throw new XPathException(getASTNode(), "Invalid resource URI", ex);
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java 2008-02-27 20:52:07 UTC (rev 7454)
@@ -40,8 +40,6 @@
new FunctionDef(Validation.signatures[1], Validation.class),
new FunctionDef(Validation.signatures[2], Validation.class),
new FunctionDef(Validation.signatures[3], Validation.class),
- new FunctionDef(Validation.signatures[4], Validation.class),
- new FunctionDef(Validation.signatures[5], Validation.class),
new FunctionDef(GrammarTooling.signatures[0], GrammarTooling.class),
new FunctionDef(GrammarTooling.signatures[1], GrammarTooling.class)
};
Modified: trunk/eXist/webapp/validation.xml
===================================================================
--- trunk/eXist/webapp/validation.xml 2008-02-27 01:11:51 UTC (rev 7453)
+++ trunk/eXist/webapp/validation.xml 2008-02-27 20:52:07 UTC (rev 7454)
@@ -201,7 +201,7 @@
<para>an OASIS catalog xml-file (uri ends with ".xml")</para>
</listitem>
<listitem>
- <para> a grammar file (uri ends with ".xsd" or ".dtd")</para>
+ <para> a grammar file (see below for supported list of grammar types.)</para>
</listitem>
<listitem>
<para>a collection (uri ends with "/") inside the database; XSDs
@@ -216,6 +216,8 @@
</listitem>
</varlistentry>
</variablelist>
+ <para>Supported grammar documents are DTD (".dtd"), XML Schema (".xsd") RelaxNG/compact (".rng"/".rnc"),
+ Schematron (.sch) and Namespace-based Validation Dispatching Language (".nvdl").</para>
<example>
<title>Validation report</title>
@@ -367,6 +369,11 @@
store XML instance documents and grammar documents in seperate
collections.</para>
</listitem>
+ <listitem>
+ <para>The explicit validation is performed by
+ <a href="http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html">Xerces</a>
+ (XML schema, DTD) and by <a href="http://www.oxygenxml.com/onvdl.html">oNVDL</a> - oXygen XML NVDL implementation based on Jing (RelaxNG, Schematron and Namespace-based Validation Dispatching Language)</para>
+ </listitem>
</itemizedlist>
</para>
</section>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-27 01:11:54
|
Revision: 7453
http://exist.svn.sourceforge.net/exist/?rev=7453&view=rev
Author: pkaminsk2
Date: 2008-02-26 17:11:51 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Fixed idref() to not split arguments on spaces as per spec.
Added some idref() tests.
Fixed memtree serialization code to stop throwing exceptions when encountering referenced attributes.
Fixed the XQTS wrapper to catch "late" exceptions thrown when inserting the result; this used to crash the entire run.
Modified Paths:
--------------
trunk/eXist/src/org/exist/memtree/DocumentImpl.java
trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java
trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java
trunk/eXist/webapp/xqts/xqts.xql
Modified: trunk/eXist/src/org/exist/memtree/DocumentImpl.java
===================================================================
--- trunk/eXist/src/org/exist/memtree/DocumentImpl.java 2008-02-26 21:26:57 UTC (rev 7452)
+++ trunk/eXist/src/org/exist/memtree/DocumentImpl.java 2008-02-27 01:11:51 UTC (rev 7453)
@@ -818,7 +818,7 @@
serializer.reset();
serializer.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");
serializer.setReceiver(receiver);
- serializer.toReceiver(document.references[document.alpha[nr]], false);
+ serializer.toReceiver(document.references[document.alpha[nr]], false, false);
} else {
receiver.addReferenceNode(document.references[document.alpha[nr]]);
}
@@ -1027,7 +1027,7 @@
document.alphaLen[nr]);
break;
case NodeImpl.REFERENCE_NODE:
- serializer.toReceiver(document.references[document.alpha[nr]], true);
+ serializer.toReceiver(document.references[document.alpha[nr]], true, false);
break;
}
}
Modified: trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java 2008-02-26 21:26:57 UTC (rev 7452)
+++ trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java 2008-02-27 01:11:51 UTC (rev 7453)
@@ -110,26 +110,14 @@
else
docs = contextSequence.toNodeSet().getDocumentSet();
- for(SequenceIterator i = idrefval.iterate(); i.hasNext(); ) {
- nextId = i.nextItem().getStringValue();
- if (nextId.length() == 0)
- continue;
- if(nextId.indexOf(" ") != Constants.STRING_NOT_FOUND) {
- // parse idrefs
- StringTokenizer tok = new StringTokenizer(nextId, " ");
- while(tok.hasMoreTokens()) {
- nextId = tok.nextToken();
- if(XMLChar.isValidNCName(nextId)) {
- getIdRef((NodeSet)result, docs, nextId);
- }
- }
- } else {
- if(XMLChar.isValidNCName(nextId)) {
- getIdRef((NodeSet)result, docs, nextId);
- }
- }
- }
- }
+ for (SequenceIterator i = idrefval.iterate(); i.hasNext();) {
+ nextId = i.nextItem().getStringValue();
+ if (nextId.length() == 0) continue;
+ if (XMLChar.isValidNCName(nextId)) {
+ getIdRef((NodeSet) result, docs, nextId);
+ }
+ }
+ }
if (context.getProfiler().isEnabled())
context.getProfiler().end(this, "", result);
Modified: trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java 2008-02-26 21:26:57 UTC (rev 7452)
+++ trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java 2008-02-27 01:11:51 UTC (rev 7453)
@@ -1608,6 +1608,16 @@
queryAndAssert(queryService, "/id('foo')", 0, null);
}
+ public void testIdRefs() throws XMLDBException {
+ XQueryService service =
+ storeXMLStringAndGetQueryService("ids.xml", ids);
+
+ queryResource(service, "ids.xml", "/idref('id2')", 1);
+ queryResource(service, "ids.xml", "/idref('id1')", 2);
+ queryResource(service, "ids.xml", "/idref(('id2', 'id1'))", 3);
+ queryResource(service, "ids.xml", "<results>{/idref('id2')}</results>", 1);
+ }
+
public void testExternalVars() {
try {
XQueryService service =
Modified: trunk/eXist/webapp/xqts/xqts.xql
===================================================================
--- trunk/eXist/webapp/xqts/xqts.xql 2008-02-26 21:26:57 UTC (rev 7452)
+++ trunk/eXist/webapp/xqts/xqts.xql 2008-02-27 01:11:51 UTC (rev 7453)
@@ -432,7 +432,13 @@
$resultRoot as element()?) as empty() {
let $result := xqts:execute-test-case($case)
return
- update insert $result into $resultRoot,
+ util:catch(
+ "java.lang.Exception",
+ update insert $result into $resultRoot,
+ update insert <test-case name="{$case/@name}" result="fail" dateRun="{util:system-time()}" print="unhandled-error">
+ <exception>Caught late exception while inserting result: {$util:exception-message}</exception>
+ </test-case> into $resultRoot
+ ),
let $added := $resultRoot/test-case[@name = $case/@name]
let $log :=
if (fn:empty($added)) then
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-26 21:27:06
|
Revision: 7452
http://exist.svn.sourceforge.net/exist/?rev=7452&view=rev
Author: wolfgang_m
Date: 2008-02-26 13:26:57 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
[ignore] merged rev. 7440 to 7450
Modified Paths:
--------------
branches/eXist-memproc/src/org/exist/atom/modules/AtomProtocol.java
branches/eXist-memproc/src/org/exist/http/urlrewrite/XQueryURLRewrite.java
branches/eXist-memproc/src/org/exist/storage/ElementValue.java
branches/eXist-memproc/src/org/exist/storage/NativeBroker.java
branches/eXist-memproc/src/org/exist/storage/NativeElementIndex.java
branches/eXist-memproc/src/org/exist/storage/NativeValueIndex.java
branches/eXist-memproc/src/org/exist/xquery/functions/FunId.java
branches/eXist-memproc/src/org/exist/xquery/functions/FunIdRef.java
branches/eXist-memproc/src/org/exist/xquery/value/StringValue.java
Modified: branches/eXist-memproc/src/org/exist/atom/modules/AtomProtocol.java
===================================================================
--- branches/eXist-memproc/src/org/exist/atom/modules/AtomProtocol.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/atom/modules/AtomProtocol.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -478,13 +478,14 @@
if (DOM.findChild(root,Atom.NAMESPACE_STRING,"title")==null) {
throw new BadRequestException("The feed metadata sent does not contain a title.");
}
-
- TransactionManager transact = broker.getBrokerPool().getTransactionManager();
- Txn transaction = transact.beginTransaction();
+ if (!feedDoc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) {
+ throw new PermissionDeniedException("Permission denied to update feed " + collection.getURI());
+ }
+ TransactionManager transact = broker.getBrokerPool().getTransactionManager();
+ Txn transaction = transact.beginTransaction();
try {
feedDoc.getUpdateLock().acquire(Lock.WRITE_LOCK);
-
ElementImpl feedRoot = (ElementImpl)feedDoc.getDocumentElement();
// Modify the feed by merging the new feed-level elements
Modified: branches/eXist-memproc/src/org/exist/http/urlrewrite/XQueryURLRewrite.java
===================================================================
--- branches/eXist-memproc/src/org/exist/http/urlrewrite/XQueryURLRewrite.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/http/urlrewrite/XQueryURLRewrite.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -30,6 +30,7 @@
import org.exist.xquery.functions.request.RequestModule;
import org.exist.xquery.functions.response.ResponseModule;
import org.exist.xquery.functions.session.SessionModule;
+import org.exist.xquery.Constants;
import org.exist.Namespaces;
import org.exist.http.servlets.HttpRequestWrapper;
import org.exist.http.servlets.HttpResponseWrapper;
@@ -295,11 +296,19 @@
if (!(f.canRead() && f.isFile()))
throw new ServletException("Cannot read XQuery source from " + f.getAbsolutePath());
FileSource source = new FileSource(f, "UTF-8", true);
+
+ // Find correct module load path
+ String requestPath = request.getRequestURI();
+ int p = requestPath.lastIndexOf("/");
+ if(p != Constants.STRING_NOT_FOUND)
+ requestPath = requestPath.substring(0, p);
+ String moduleLoadPath = config.getServletContext().getRealPath(requestPath.substring(request.getContextPath().length()));
try {
// Prepare and execute the XQuery
Collection collection = DatabaseManager.getCollection(collectionURI.toString(), user, password);
XQueryService service = (XQueryService) collection.getService("XQueryService", "1.0");
if(!((CollectionImpl)collection).isRemoteCollection()) {
+ service.setModuleLoadPath(moduleLoadPath);
service.declareVariable(RequestModule.PREFIX + ":request", new HttpRequestWrapper(request, "UTF-8", "UTF-8"));
service.declareVariable(ResponseModule.PREFIX + ":response", new HttpResponseWrapper(response));
service.declareVariable(SessionModule.PREFIX + ":session", new HttpSessionWrapper(request.getSession()));
Modified: branches/eXist-memproc/src/org/exist/storage/ElementValue.java
===================================================================
--- branches/eXist-memproc/src/org/exist/storage/ElementValue.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/storage/ElementValue.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -36,9 +36,6 @@
public static final byte UNKNOWN = -1;
public static final byte ELEMENT = 0;
public static final byte ATTRIBUTE = 1;
- public static final byte ATTRIBUTE_ID = 2;
- public static final byte ATTRIBUTE_IDREF = 3;
- public static final byte ATTRIBUTE_IDREFS = 4;
public static int LENGTH_TYPE = 1; //sizeof byte
@@ -103,26 +100,15 @@
StringBuffer buf = new StringBuffer();
buf.append("Collection id : " + ByteConversion.byteToInt(data, OFFSET_COLLECTION_ID));
if (len > OFFSET_COLLECTION_ID) {
- buf.append(" Type : " + type[data[OFFSET_TYPE]]);
- if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_ID) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" id : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } else if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_IDREF) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" idref : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_IDREFS) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" idrefs : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } else {
- if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE + SymbolTable.LENGTH_LOCAL_NAME)
- buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
- else if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE +
- SymbolTable.LENGTH_LOCAL_NAME + SymbolTable.LENGTH_NS_URI) {
- buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
- buf.append(" NSSymbol id : " + ByteConversion.byteToShort(data, OFFSET_NSSYMBOL));
- } else
- buf.append("Invalid data length !!!");
- }
+ buf.append(" Type : " + type[data[OFFSET_TYPE]]);
+ if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE + SymbolTable.LENGTH_LOCAL_NAME)
+ buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
+ else if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE +
+ SymbolTable.LENGTH_LOCAL_NAME + SymbolTable.LENGTH_NS_URI) {
+ buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
+ buf.append(" NSSymbol id : " + ByteConversion.byteToShort(data, OFFSET_NSSYMBOL));
+ } else
+ buf.append("Invalid data length !!!");
}
return buf.toString();
}
Modified: branches/eXist-memproc/src/org/exist/storage/NativeBroker.java
===================================================================
--- branches/eXist-memproc/src/org/exist/storage/NativeBroker.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/storage/NativeBroker.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -57,6 +57,7 @@
import org.exist.util.*;
import org.exist.xmldb.XmldbURI;
import org.exist.xquery.TerminatedException;
+import org.exist.xquery.value.Type;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Node;
@@ -65,9 +66,7 @@
import javax.xml.stream.XMLStreamException;
import java.io.*;
import java.text.NumberFormat;
-import java.util.Iterator;
-import java.util.Observer;
-import java.util.Stack;
+import java.util.*;
/**
* Main class for the native XML storage backend.
@@ -2448,33 +2447,37 @@
//Strange : does it mean that the node is added 2 times under 2 different identities ?
- // if the attribute has type ID, store the ID-value
- // to the element index as well
- if (((AttrImpl) node).getType() == AttrImpl.ID) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_ID);
- elementIndex.addNode(qname, p);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREF) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_IDREF);
- elementIndex.addNode(qname, p);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREFS) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_IDREFS);
- elementIndex.addNode(qname, p);
- }
+ AttrImpl attr;
+ attr = (AttrImpl) node;
+ switch(attr.getType()) {
+ case AttrImpl.ID:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREF:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREFS:
+ valueIndex.setDocument(doc);
+ StringTokenizer tokenizer = new StringTokenizer(attr.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ valueIndex.storeAttribute(attr, tokenizer.nextToken(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ }
+ break;
+ default:
+ // do nothing special
+ }
- GeneralRangeIndexSpec spec2 = doc.getCollection().getIndexByPathConfiguration(this, currentPath);
+ RangeIndexSpec spec2 = doc.getCollection().getIndexByPathConfiguration(this, currentPath);
if(spec2 != null) {
valueIndex.setDocument(doc);
- valueIndex.storeAttribute((AttrImpl) node, null, NativeValueIndex.WITHOUT_PATH, spec2, false);
+ valueIndex.storeAttribute(attr, null, NativeValueIndex.WITHOUT_PATH, spec2, false);
}
qnSpec = doc.getCollection().getIndexByQNameConfiguration(this, qname);
if (qnSpec != null) {
valueIndex.setDocument(doc);
- valueIndex.storeAttribute((AttrImpl) node, null, NativeValueIndex.WITHOUT_PATH, qnSpec, false);
+ valueIndex.storeAttribute(attr, null, NativeValueIndex.WITHOUT_PATH, qnSpec, false);
}
currentPath.removeLastComponent();
@@ -2974,28 +2977,26 @@
if (mode != MODE_REMOVE)
elementIndex.addNode(qname, tempProxy);
- // --move to-- NativeElementIndex
- // TODO : elementIndex.storeAttribute(node, currentPath, index);
- // if the attribute has type ID, store the ID-value
- // to the element index as well
- if (((AttrImpl) node).getType() == AttrImpl.ID) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_ID);
- elementIndex.addNode(qname, tempProxy);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREF) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_IDREF);
- elementIndex.addNode(qname, tempProxy);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREFS) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_IDREFS);
- elementIndex.addNode(qname, tempProxy);
- }
+ AttrImpl attr = (AttrImpl) node;
+ switch(attr.getType()) {
+ case AttrImpl.ID:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ break;
+ case AttrImpl.IDREF:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ break;
+ case AttrImpl.IDREFS:
+ valueIndex.setDocument(doc);
+ StringTokenizer tokenizer = new StringTokenizer(attr.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ valueIndex.storeAttribute(attr, tokenizer.nextToken(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ }
+ break;
+ default:
+ // do nothing special
+ }
if (currentPath != null)
currentPath.removeLastComponent();
Modified: branches/eXist-memproc/src/org/exist/storage/NativeElementIndex.java
===================================================================
--- branches/eXist-memproc/src/org/exist/storage/NativeElementIndex.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/storage/NativeElementIndex.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -817,9 +817,6 @@
private short getIndexType(byte type) {
switch (type) {
- case ElementValue.ATTRIBUTE_ID : //is this correct ? -pb
- case ElementValue.ATTRIBUTE_IDREF : //is this correct ? -pb
- case ElementValue.ATTRIBUTE_IDREFS : //is this correct ? -pb
case ElementValue.ATTRIBUTE :
return Node.ATTRIBUTE_NODE;
case ElementValue.ELEMENT :
@@ -993,22 +990,14 @@
}
private Value computeTypedKey(byte type, int collectionId, QName qname) {
- if (type == ElementValue.ATTRIBUTE_ID) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } else if (type == ElementValue.ATTRIBUTE_IDREF) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } if (type == ElementValue.ATTRIBUTE_IDREFS) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } else {
- final SymbolTable symbols = broker.getBrokerPool().getSymbols();
- short sym = symbols.getSymbol(qname.getLocalName());
- //TODO : should we truncate the key ?
- //TODO : beware of the polysemy for getPrefix == null
- //if (qname.getPrefix() == null)
- // return new ElementValue(type, collectionId, sym);
- short nsSym = symbols.getNSSymbol(qname.getNamespaceURI());
- return new ElementValue(type, collectionId, sym, nsSym);
- }
+ final SymbolTable symbols = broker.getBrokerPool().getSymbols();
+ short sym = symbols.getSymbol(qname.getLocalName());
+ //TODO : should we truncate the key ?
+ //TODO : beware of the polysemy for getPrefix == null
+ //if (qname.getPrefix() == null)
+ // return new ElementValue(type, collectionId, sym);
+ short nsSym = symbols.getNSSymbol(qname.getNamespaceURI());
+ return new ElementValue(type, collectionId, sym, nsSym);
}
private static boolean containsNode(List list, NodeId nodeId) {
Modified: branches/eXist-memproc/src/org/exist/storage/NativeValueIndex.java
===================================================================
--- branches/eXist-memproc/src/org/exist/storage/NativeValueIndex.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/storage/NativeValueIndex.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -213,6 +213,10 @@
* @param node The attribute
*/
public void storeAttribute(AttrImpl node, NodePath currentPath, int indexingHint, RangeIndexSpec spec, boolean remove) {
+ storeAttribute(node, node.getValue(), currentPath, indexingHint, spec.getType(), spec.getQName() == null ? IDX_GENERIC : IDX_QNAME, remove);
+ }
+
+ public void storeAttribute(AttrImpl node, String value, NodePath currentPath, int indexingHint, int xpathType, byte indexType, boolean remove) {
//Return early
if (indexingHint != WITHOUT_PATH)
return;
@@ -221,12 +225,11 @@
node.getDocId() + "') differ !");
}
- AtomicValue atomic = convertToAtomic(spec.getType(), node.getValue());
+ AtomicValue atomic = convertToAtomic(xpathType, value);
//Ignore if the value can't be successfully atomized
//(this is logged elsewhere)
if(atomic == null)
return;
- int indexType = spec.getQName() == null ? IDX_GENERIC : IDX_QNAME;
Object key;
if (indexType == IDX_QNAME) {
key = new QNameKey(node.getQName(), atomic);
@@ -850,11 +853,16 @@
* @param value
* @return <code>null</null> if atomization fails or if the atomic value is not indexable.
* Should we throw an exception instead ? -pb
+ * @throws XPathException
*/
private AtomicValue convertToAtomic(int xpathType, String value) {
AtomicValue atomic;
if (Type.subTypeOf(xpathType, Type.STRING)) {
- atomic = new StringValue(value);
+ try {
+ atomic = new StringValue(value, xpathType);
+ } catch (XPathException e) {
+ return null;
+ }
} else {
try {
atomic = new StringValue(value).convertTo(xpathType);
@@ -1232,6 +1240,23 @@
storeAttribute(attrib, path, NativeValueIndex.WITHOUT_PATH, rSpec, false);
if (qSpec != null)
storeAttribute(attrib, path, NativeValueIndex.WITHOUT_PATH, qSpec, false);
+
+ switch(attrib.getType()) {
+ case AttrImpl.ID:
+ storeAttribute(attrib, attrib.getValue(), path, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREF:
+ storeAttribute(attrib, attrib.getValue(), path, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREFS:
+ StringTokenizer tokenizer = new StringTokenizer(attrib.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ storeAttribute(attrib, tokenizer.nextToken(), path, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ }
+ break;
+ default:
+ // do nothing special
+ }
super.attribute(transaction, attrib, path);
}
Modified: branches/eXist-memproc/src/org/exist/xquery/functions/FunId.java
===================================================================
--- branches/eXist-memproc/src/org/exist/xquery/functions/FunId.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/xquery/functions/FunId.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -48,6 +48,7 @@
import org.exist.xquery.value.SequenceType;
import org.exist.xquery.value.Type;
import org.exist.xquery.value.ValueSequence;
+import org.exist.xquery.value.StringValue;
import org.w3c.dom.Node;
import java.util.Iterator;
@@ -157,20 +158,18 @@
while(tok.hasMoreTokens()) {
nextId = tok.nextToken();
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
if (processInMem)
getId(result, contextSequence, nextId);
else
- getId((NodeSet)result, docs, id);
+ getId((NodeSet)result, docs, nextId);
}
}
} else {
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- if (processInMem)
+ if (processInMem)
getId(result, contextSequence, nextId);
else
- getId((NodeSet)result, docs, id);
+ getId((NodeSet)result, docs, nextId);
}
}
}
@@ -183,9 +182,8 @@
}
- private void getId(NodeSet result, DocumentSet docs, QName id) {
- NodeSet attribs = (NodeSet) context.getBroker().getElementIndex().findElementsByTagName(
- ElementValue.ATTRIBUTE_ID, docs, id, null);
+ private void getId(NodeSet result, DocumentSet docs, String id) throws XPathException {
+ NodeSet attribs = context.getBroker().getValueIndex().find(Constants.EQ, docs, null, -1, null, new StringValue(id, Type.ID));
NodeProxy n, p;
for (Iterator i = attribs.iterator(); i.hasNext();) {
n = (NodeProxy) i.next();
Modified: branches/eXist-memproc/src/org/exist/xquery/functions/FunIdRef.java
===================================================================
--- branches/eXist-memproc/src/org/exist/xquery/functions/FunIdRef.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/xquery/functions/FunIdRef.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -46,6 +46,7 @@
import org.exist.xquery.value.SequenceType;
import org.exist.xquery.value.Type;
import org.exist.xquery.value.ValueSequence;
+import org.exist.xquery.value.StringValue;
import java.util.Iterator;
import java.util.Set;
@@ -154,20 +155,18 @@
while(tok.hasMoreTokens()) {
nextId = tok.nextToken();
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- if (processInMem)
+ if (processInMem)
getIdRef(result, contextSequence, nextId);
else
- getIdRef((NodeSet)result, docs, id);
+ getIdRef((NodeSet)result, docs, nextId);
}
}
} else {
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- if (processInMem)
+ if (processInMem)
getIdRef(result, contextSequence, nextId);
else
- getIdRef((NodeSet)result, docs, id);
+ getIdRef((NodeSet)result, docs, nextId);
}
}
}
@@ -180,11 +179,9 @@
}
- private void getIdRef(NodeSet result, DocumentSet docs, QName id) {
- //TODO : work with IDREFS as well ; tokenize them then test against the id
- NodeSet attribs = context.getBroker().getElementIndex().findElementsByTagName(
- ElementValue.ATTRIBUTE_IDREF, docs, id, null);
- NodeProxy n, p;
+ private void getIdRef(NodeSet result, DocumentSet docs, String id) throws XPathException {
+ NodeSet attribs = context.getBroker().getValueIndex().find(Constants.EQ, docs, null, -1, null, new StringValue(id, Type.IDREF));
+ NodeProxy n;
for (Iterator i = attribs.iterator(); i.hasNext();) {
n = (NodeProxy) i.next();
result.add(n);
@@ -204,4 +201,4 @@
}
}
}
-}
+}
\ No newline at end of file
Modified: branches/eXist-memproc/src/org/exist/xquery/value/StringValue.java
===================================================================
--- branches/eXist-memproc/src/org/exist/xquery/value/StringValue.java 2008-02-26 21:23:01 UTC (rev 7451)
+++ branches/eXist-memproc/src/org/exist/xquery/value/StringValue.java 2008-02-26 21:26:57 UTC (rev 7452)
@@ -654,7 +654,8 @@
*/
public int compareTo(Object o) {
AtomicValue other = (AtomicValue)o;
- if(Type.subTypeOf(other.getType(), Type.STRING))
+// if(Type.subTypeOf(other.getType(), Type.STRING))
+ if (getType() == other.getType())
return value.compareTo(((StringValue)other).value);
else
return getType() > other.getType() ? 1 : -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2008-02-26 21:23:14
|
Revision: 7451
http://exist.svn.sourceforge.net/exist/?rev=7451&view=rev
Author: dizzzz
Date: 2008-02-26 13:23:01 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
[refactor] updated validation code. Separated the jing validator stuff. Need to discuss what is better. jing/DTD validation fails at this moment.
Modified Paths:
--------------
trunk/eXist/src/org/exist/validation/Validator.java
trunk/eXist/src/org/exist/validation/service/LocalValidationService.java
trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java
trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java
Modified: trunk/eXist/src/org/exist/validation/Validator.java
===================================================================
--- trunk/eXist/src/org/exist/validation/Validator.java 2008-02-26 20:56:32 UTC (rev 7450)
+++ trunk/eXist/src/org/exist/validation/Validator.java 2008-02-26 21:23:01 UTC (rev 7451)
@@ -90,8 +90,49 @@
systemCatalogResolver = (eXistXMLCatalogResolver) config.getProperty(XMLReaderObjectFactory.CATALOG_RESOLVER);
}
+
+//// /**
+//// * Validate XML data using system catalog. XSD and DTD only.
+//// *
+//// * @param stream XML input.
+//// * @return Validation report containing all validation info.
+//// */
+//// public ValidationReport validate(InputStream stream) {
+//// return validate(stream, null);
+//// }
+////
+//// /**
+//// * Validate XML data from reader using specified grammar.
+//// *
+//// * @param grammarPath User supplied path to grammar.
+//// * @param stream XML input.
+//// * @return Validation report containing all validation info.
+//// */
+//// public ValidationReport validate(InputStream stream, String grammarPath) {
+////
+//// // repair path to local resource
+//// if(grammarPath != null && grammarPath.startsWith("/")){
+//// grammarPath = "xmldb:exist://" + grammarPath;
+//// }
+////
+//// if(grammarPath != null &&
+//// (grammarPath.endsWith(".rng") || grammarPath.endsWith(".rnc") ||
+//// grammarPath.endsWith(".onvl") || grammarPath.endsWith(".sch"))){
+//// return validateJing(stream, grammarPath);
+//// } else {
+//// return validateParse(stream, grammarPath);
+//// }
+////
+//// }
- private ValidationReport validateRelaxNG(InputStream is, String grammarUrl) {
+ /**
+ * Validate XML data from reader using specified grammar with Jing.
+ *
+ * @param grammarPath User supplied path to grammar.
+ * @param stream XML input.
+ * @return Validation report containing all validation info.
+ */
+ public ValidationReport validateJing(InputStream is, String grammarUrl) {
ValidationReport report = new ValidationReport();
try {
@@ -134,8 +175,8 @@
* @param stream XML input.
* @return Validation report containing all validation info.
*/
- public ValidationReport validate(InputStream stream) {
- return validate(stream, null);
+ public ValidationReport validateParse(InputStream stream) {
+ return validateParse(stream, null);
}
/**
@@ -145,25 +186,8 @@
* @param stream XML input.
* @return Validation report containing all validation info.
*/
- public ValidationReport validate(InputStream stream, String grammarPath) {
+ public ValidationReport validateParse(InputStream stream, String grammarPath) {
- // repair path to local resource
- if(grammarPath != null && grammarPath.startsWith("/")){
- grammarPath = "xmldb:exist://" + grammarPath;
- }
-
- if(grammarPath != null &&
- (grammarPath.endsWith(".rng") || grammarPath.endsWith(".rnc") ||
- grammarPath.endsWith(".onvl") || grammarPath.endsWith(".sch"))){
- return validateRelaxNG(stream, grammarPath);
- } else {
- return validateDefault(stream, grammarPath);
- }
-
- }
-
- private ValidationReport validateDefault(InputStream stream, String grammarPath) {
-
logger.debug("Start validation.");
ValidationReport report = new ValidationReport();
Modified: trunk/eXist/src/org/exist/validation/service/LocalValidationService.java
===================================================================
--- trunk/eXist/src/org/exist/validation/service/LocalValidationService.java 2008-02-26 20:56:32 UTC (rev 7450)
+++ trunk/eXist/src/org/exist/validation/service/LocalValidationService.java 2008-02-26 21:23:01 UTC (rev 7451)
@@ -98,9 +98,9 @@
// Perform validation
ValidationReport report = null;
if(grammarPath==null){
- report = validator.validate(is);
+ report = validator.validateParse(is); // TODO Dizzz check which method
} else {
- report = validator.validate(is, grammarPath);
+ report = validator.validateParse(is, grammarPath);
}
Modified: trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java
===================================================================
--- trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java 2008-02-26 20:56:32 UTC (rev 7450)
+++ trunk/eXist/src/org/exist/xmlrpc/RpcConnection.java 2008-02-26 21:23:01 UTC (rev 7451)
@@ -3880,7 +3880,7 @@
*/
public boolean isValid(User user, XmldbURI docUri)
throws PermissionDeniedException, Exception{
- boolean retVal=false;
+ boolean isValid=false;
DBBroker broker = null;
try {
@@ -3896,10 +3896,10 @@
InputStream is = new EmbeddedInputStream( new XmldbURL(docUri) );
// Perform validation
- ValidationReport veh = validator.validate(is);
+ ValidationReport report = validator.validateParse(is); // TODO DIZ check method
// Return validation result
- retVal = veh.isValid();
+ isValid = report.isValid();
} catch (Exception e) {
LOG.debug(e);
@@ -3907,7 +3907,8 @@
} finally {
brokerPool.release(broker);
}
- return retVal;
+
+ return isValid;
}
/**
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2008-02-26 20:56:32 UTC (rev 7450)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2008-02-26 21:23:01 UTC (rev 7451)
@@ -67,8 +67,15 @@
"Validate document specified by $a using $b. "+
"$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
"$b can point to an OASIS catalog file, a grammar (xml schema only) "+
- "or a collection (path ends with '/')";
+ "or a collection (path ends with '/').";
+ private static final String jingFunctionTxt=
+ "Validate document specified by $a using $b with jing. "+
+ "$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
+ "$b points to a grammar document with document name extension "+
+ ".dtd, xsd, .ndvl (Namespace-based Validation Dispatching Language), "+
+ ".rng/.rnc (RelaxNG/Compact notation) or .sch (Schematron).";
+
private final Validator validator;
private final BrokerPool brokerPool;
@@ -115,6 +122,28 @@
new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
+ ),
+
+ new FunctionSignature(
+ new QName("jing", ValidationModule.NAMESPACE_URI,
+ ValidationModule.PREFIX),
+ jingFunctionTxt,
+ new SequenceType[]{
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
+ ),
+
+ new FunctionSignature(
+ new QName("jing-report", ValidationModule.NAMESPACE_URI,
+ ValidationModule.PREFIX),
+ jingFunctionTxt+" A simple report is returned.",
+ new SequenceType[]{
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
)
};
@@ -162,20 +191,36 @@
throw new XPathException(getASTNode(), "wrong item type " + Type.getTypeName(args[0].getItemType()));
}
- // Perform validation
- if (args.length == 1) {
- // Validate using system catalog
- vr = validator.validate(is);
+
+ if(isCalledAs("validate") || isCalledAs("validate-report")){
+ // Perform validation using xerces SAX parsing
+ if(args.length == 1){
+ // Validate using system catalog
+ vr = validator.validateParse(is);
- } else {
- // Validate using resource speciefied in second parameter
+ } else {
+ // Validate using resource speciefied in second parameter
+ String url = args[1].getStringValue();
+
+ if(url.startsWith("/")){
+ url = "xmldb:exist://" + url;
+ }
+
+ vr = validator.validateParse(is, url);
+ }
+
+ } else if(isCalledAs("jing") || isCalledAs("jing-report")){
+ // Perform validation using JING
String url = args[1].getStringValue();
- if (url.startsWith("/")) {
+ if(url.startsWith("/")){
url = "xmldb:exist://" + url;
}
-
- vr = validator.validate(is, url);
+ vr = validator.validateJing(is, url);
+
+ } else {
+ // This should not happen
+ throw new XPathException("Validaton function not found");
}
} catch (MalformedURLException ex) {
@@ -200,17 +245,18 @@
}
// Create response
- if (isCalledAs("validate")) {
+ if (isCalledAs("validate") || isCalledAs("jing")) {
Sequence result = new ValueSequence();
result.add(new BooleanValue(vr.isValid()));
return result;
- } else if (isCalledAs("validate-report")) {
+ } else if (isCalledAs("validate-report") || isCalledAs("jing-report")) {
MemTreeBuilder builder = context.getDocumentBuilder();
NodeImpl result = writeReport(vr, builder);
return result;
}
+
// Oops
LOG.error("invoked with wrong function name");
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java 2008-02-26 20:56:32 UTC (rev 7450)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/ValidationModule.java 2008-02-26 21:23:01 UTC (rev 7451)
@@ -40,6 +40,8 @@
new FunctionDef(Validation.signatures[1], Validation.class),
new FunctionDef(Validation.signatures[2], Validation.class),
new FunctionDef(Validation.signatures[3], Validation.class),
+ new FunctionDef(Validation.signatures[4], Validation.class),
+ new FunctionDef(Validation.signatures[5], Validation.class),
new FunctionDef(GrammarTooling.signatures[0], GrammarTooling.class),
new FunctionDef(GrammarTooling.signatures[1], GrammarTooling.class)
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-26 20:56:37
|
Revision: 7450
http://exist.svn.sourceforge.net/exist/?rev=7450&view=rev
Author: wolfgang_m
Date: 2008-02-26 12:56:32 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
[bugfix] properly set module load path on the XQuery which is executed for rewriting the URL.
Modified Paths:
--------------
trunk/eXist/src/org/exist/http/urlrewrite/XQueryURLRewrite.java
Modified: trunk/eXist/src/org/exist/http/urlrewrite/XQueryURLRewrite.java
===================================================================
--- trunk/eXist/src/org/exist/http/urlrewrite/XQueryURLRewrite.java 2008-02-26 20:08:54 UTC (rev 7449)
+++ trunk/eXist/src/org/exist/http/urlrewrite/XQueryURLRewrite.java 2008-02-26 20:56:32 UTC (rev 7450)
@@ -30,6 +30,7 @@
import org.exist.xquery.functions.request.RequestModule;
import org.exist.xquery.functions.response.ResponseModule;
import org.exist.xquery.functions.session.SessionModule;
+import org.exist.xquery.Constants;
import org.exist.Namespaces;
import org.exist.http.servlets.HttpRequestWrapper;
import org.exist.http.servlets.HttpResponseWrapper;
@@ -295,11 +296,19 @@
if (!(f.canRead() && f.isFile()))
throw new ServletException("Cannot read XQuery source from " + f.getAbsolutePath());
FileSource source = new FileSource(f, "UTF-8", true);
+
+ // Find correct module load path
+ String requestPath = request.getRequestURI();
+ int p = requestPath.lastIndexOf("/");
+ if(p != Constants.STRING_NOT_FOUND)
+ requestPath = requestPath.substring(0, p);
+ String moduleLoadPath = config.getServletContext().getRealPath(requestPath.substring(request.getContextPath().length()));
try {
// Prepare and execute the XQuery
Collection collection = DatabaseManager.getCollection(collectionURI.toString(), user, password);
XQueryService service = (XQueryService) collection.getService("XQueryService", "1.0");
if(!((CollectionImpl)collection).isRemoteCollection()) {
+ service.setModuleLoadPath(moduleLoadPath);
service.declareVariable(RequestModule.PREFIX + ":request", new HttpRequestWrapper(request, "UTF-8", "UTF-8"));
service.declareVariable(ResponseModule.PREFIX + ":response", new HttpResponseWrapper(response));
service.declareVariable(SessionModule.PREFIX + ":session", new HttpSessionWrapper(request.getSession()));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-26 20:08:59
|
Revision: 7449
http://exist.svn.sourceforge.net/exist/?rev=7449&view=rev
Author: wolfgang_m
Date: 2008-02-26 12:08:54 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
The AtomicWiki project was moved to
http://code.google.com/p/atomicwiki/
Removed Paths:
-------------
trunk/AtomicWiki/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Bri...@no...> - 2008-02-26 16:28:12
|
<FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=2><P style="MARGIN: 0px">We are using Intalio BPMN designer/server to retrieve documents and store documents in the eXist database. I am unable to successfully store a document using the admin web service provided by eXist. I am able to retrieve a document, but not send one. The documentation states that the document is sent in base64Binary encoding to prevent conflict with the SOAP transport protocol. Does this mean that the input parameter element ("data") has to be in base64Binary and if so, how do we get an xml document encoded into base64Binary? Is there another method/operation provided by eXist to do this? </P><P style="MARGIN: 0px"> </P><P style="MARGIN: 0px">Do we have to create another web service that takes the xml document and encodes it into base64Binary? If so, I was attempting to generate another web service using axis2 commons-codec-1..3.jar to generate the wsdl using eclipse java2wsdl and then create the service archive file (.aar) using the Eclipse Service Archiver plugin. I successfully deployed the web service in Axis2, dropped the wsdl in our BPMN designer and attempted to access this web service to encode and then hand off the encoded message to eXist. But again, this is not working.</P><P style="MARGIN: 0px"> </P><P style="MARGIN: 0px">Any help would be appreciated. I am stuck on this base64Binary encoding and I have a feeling that there is a very simple solution. Thank you.</P></FONT>
|
|
From: <wol...@us...> - 2008-02-26 08:52:00
|
Revision: 7448
http://exist.svn.sourceforge.net/exist/?rev=7448&view=rev
Author: wolfgang_m
Date: 2008-02-26 00:51:57 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
[bugfix] fixed script that displays latest changes
Modified Paths:
--------------
trunk/AtomicWiki/data/latestFeeds.xql
Modified: trunk/AtomicWiki/data/latestFeeds.xql
===================================================================
--- trunk/AtomicWiki/data/latestFeeds.xql 2008-02-26 07:08:09 UTC (rev 7447)
+++ trunk/AtomicWiki/data/latestFeeds.xql 2008-02-26 08:51:57 UTC (rev 7448)
@@ -14,9 +14,9 @@
let $feedPath := if (string-length($feed) eq 0) then $feed else concat('/', $feed)
let $url :=
if ($entry/wiki:id) then
- concat("/wiki", $feedPath, "/", $entry/wiki:id)
+ concat(atom:get-html-uri(), $feed, "/", $entry/wiki:id)
else
- concat("/wiki", $feedPath, "/?id=", $entry/atom:id)
+ concat(atom:get-html-uri(), $feed, "/?id=", $entry/atom:id)
return
<div class="entry-list-entry">
<div class="date">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-26 07:08:12
|
Revision: 7447
http://exist.svn.sourceforge.net/exist/?rev=7447&view=rev
Author: pkaminsk2
Date: 2008-02-25 23:08:09 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
[bugfix] Fixes bug 1900638 by shifting ID and IDREF indexing from the element index to the value index.
Modified Paths:
--------------
trunk/eXist/src/org/exist/storage/ElementValue.java
trunk/eXist/src/org/exist/storage/NativeBroker.java
trunk/eXist/src/org/exist/storage/NativeElementIndex.java
trunk/eXist/src/org/exist/storage/NativeValueIndex.java
trunk/eXist/src/org/exist/xquery/functions/FunId.java
trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java
trunk/eXist/src/org/exist/xquery/value/StringValue.java
Modified: trunk/eXist/src/org/exist/storage/ElementValue.java
===================================================================
--- trunk/eXist/src/org/exist/storage/ElementValue.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/storage/ElementValue.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -36,9 +36,6 @@
public static final byte UNKNOWN = -1;
public static final byte ELEMENT = 0;
public static final byte ATTRIBUTE = 1;
- public static final byte ATTRIBUTE_ID = 2;
- public static final byte ATTRIBUTE_IDREF = 3;
- public static final byte ATTRIBUTE_IDREFS = 4;
public static int LENGTH_TYPE = 1; //sizeof byte
@@ -103,26 +100,15 @@
StringBuffer buf = new StringBuffer();
buf.append("Collection id : " + ByteConversion.byteToInt(data, OFFSET_COLLECTION_ID));
if (len > OFFSET_COLLECTION_ID) {
- buf.append(" Type : " + type[data[OFFSET_TYPE]]);
- if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_ID) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" id : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } else if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_IDREF) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" idref : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } if (data[OFFSET_TYPE] == ElementValue.ATTRIBUTE_IDREFS) {
- //untested 4 is strange (would have expected 3, i.e. OFFSET_ID_STRING_VALUE)
- buf.append(" idrefs : " + UTF8.decode(data, 4, data.length - (Collection.LENGTH_COLLECTION_ID + LENGTH_TYPE)));
- } else {
- if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE + SymbolTable.LENGTH_LOCAL_NAME)
- buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
- else if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE +
- SymbolTable.LENGTH_LOCAL_NAME + SymbolTable.LENGTH_NS_URI) {
- buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
- buf.append(" NSSymbol id : " + ByteConversion.byteToShort(data, OFFSET_NSSYMBOL));
- } else
- buf.append("Invalid data length !!!");
- }
+ buf.append(" Type : " + type[data[OFFSET_TYPE]]);
+ if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE + SymbolTable.LENGTH_LOCAL_NAME)
+ buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
+ else if (len == Collection.LENGTH_COLLECTION_ID + ElementValue.LENGTH_TYPE +
+ SymbolTable.LENGTH_LOCAL_NAME + SymbolTable.LENGTH_NS_URI) {
+ buf.append(" Symbol id : " + ByteConversion.byteToShort(data, OFFSET_SYMBOL));
+ buf.append(" NSSymbol id : " + ByteConversion.byteToShort(data, OFFSET_NSSYMBOL));
+ } else
+ buf.append("Invalid data length !!!");
}
return buf.toString();
}
Modified: trunk/eXist/src/org/exist/storage/NativeBroker.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeBroker.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/storage/NativeBroker.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -57,6 +57,7 @@
import org.exist.util.*;
import org.exist.xmldb.XmldbURI;
import org.exist.xquery.TerminatedException;
+import org.exist.xquery.value.Type;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Node;
@@ -65,9 +66,7 @@
import javax.xml.stream.XMLStreamException;
import java.io.*;
import java.text.NumberFormat;
-import java.util.Iterator;
-import java.util.Observer;
-import java.util.Stack;
+import java.util.*;
/**
* Main class for the native XML storage backend.
@@ -2448,33 +2447,37 @@
//Strange : does it mean that the node is added 2 times under 2 different identities ?
- // if the attribute has type ID, store the ID-value
- // to the element index as well
- if (((AttrImpl) node).getType() == AttrImpl.ID) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_ID);
- elementIndex.addNode(qname, p);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREF) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_IDREF);
- elementIndex.addNode(qname, p);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREFS) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- qname.setNameType(ElementValue.ATTRIBUTE_IDREFS);
- elementIndex.addNode(qname, p);
- }
+ AttrImpl attr;
+ attr = (AttrImpl) node;
+ switch(attr.getType()) {
+ case AttrImpl.ID:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREF:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREFS:
+ valueIndex.setDocument(doc);
+ StringTokenizer tokenizer = new StringTokenizer(attr.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ valueIndex.storeAttribute(attr, tokenizer.nextToken(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ }
+ break;
+ default:
+ // do nothing special
+ }
- GeneralRangeIndexSpec spec2 = doc.getCollection().getIndexByPathConfiguration(this, currentPath);
+ RangeIndexSpec spec2 = doc.getCollection().getIndexByPathConfiguration(this, currentPath);
if(spec2 != null) {
valueIndex.setDocument(doc);
- valueIndex.storeAttribute((AttrImpl) node, null, NativeValueIndex.WITHOUT_PATH, spec2, false);
+ valueIndex.storeAttribute(attr, null, NativeValueIndex.WITHOUT_PATH, spec2, false);
}
qnSpec = doc.getCollection().getIndexByQNameConfiguration(this, qname);
if (qnSpec != null) {
valueIndex.setDocument(doc);
- valueIndex.storeAttribute((AttrImpl) node, null, NativeValueIndex.WITHOUT_PATH, qnSpec, false);
+ valueIndex.storeAttribute(attr, null, NativeValueIndex.WITHOUT_PATH, qnSpec, false);
}
currentPath.removeLastComponent();
@@ -2974,28 +2977,26 @@
if (mode != MODE_REMOVE)
elementIndex.addNode(qname, tempProxy);
- // --move to-- NativeElementIndex
- // TODO : elementIndex.storeAttribute(node, currentPath, index);
- // if the attribute has type ID, store the ID-value
- // to the element index as well
- if (((AttrImpl) node).getType() == AttrImpl.ID) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_ID);
- elementIndex.addNode(qname, tempProxy);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREF) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_IDREF);
- elementIndex.addNode(qname, tempProxy);
- }
- if (((AttrImpl) node).getType() == AttrImpl.IDREFS) {
- qname = new QName(((AttrImpl) node).getValue(), "", null);
- //LOG.debug("found ID: " + qname.getLocalName());
- qname.setNameType(ElementValue.ATTRIBUTE_IDREFS);
- elementIndex.addNode(qname, tempProxy);
- }
+ AttrImpl attr = (AttrImpl) node;
+ switch(attr.getType()) {
+ case AttrImpl.ID:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ break;
+ case AttrImpl.IDREF:
+ valueIndex.setDocument(doc);
+ valueIndex.storeAttribute(attr, attr.getValue(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ break;
+ case AttrImpl.IDREFS:
+ valueIndex.setDocument(doc);
+ StringTokenizer tokenizer = new StringTokenizer(attr.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ valueIndex.storeAttribute(attr, tokenizer.nextToken(), currentPath, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, mode == MODE_REMOVE);
+ }
+ break;
+ default:
+ // do nothing special
+ }
if (currentPath != null)
currentPath.removeLastComponent();
Modified: trunk/eXist/src/org/exist/storage/NativeElementIndex.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeElementIndex.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/storage/NativeElementIndex.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -817,9 +817,6 @@
private short getIndexType(byte type) {
switch (type) {
- case ElementValue.ATTRIBUTE_ID : //is this correct ? -pb
- case ElementValue.ATTRIBUTE_IDREF : //is this correct ? -pb
- case ElementValue.ATTRIBUTE_IDREFS : //is this correct ? -pb
case ElementValue.ATTRIBUTE :
return Node.ATTRIBUTE_NODE;
case ElementValue.ELEMENT :
@@ -993,22 +990,14 @@
}
private Value computeTypedKey(byte type, int collectionId, QName qname) {
- if (type == ElementValue.ATTRIBUTE_ID) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } else if (type == ElementValue.ATTRIBUTE_IDREF) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } if (type == ElementValue.ATTRIBUTE_IDREFS) {
- return new ElementValue(type, collectionId, qname.getLocalName());
- } else {
- final SymbolTable symbols = broker.getBrokerPool().getSymbols();
- short sym = symbols.getSymbol(qname.getLocalName());
- //TODO : should we truncate the key ?
- //TODO : beware of the polysemy for getPrefix == null
- //if (qname.getPrefix() == null)
- // return new ElementValue(type, collectionId, sym);
- short nsSym = symbols.getNSSymbol(qname.getNamespaceURI());
- return new ElementValue(type, collectionId, sym, nsSym);
- }
+ final SymbolTable symbols = broker.getBrokerPool().getSymbols();
+ short sym = symbols.getSymbol(qname.getLocalName());
+ //TODO : should we truncate the key ?
+ //TODO : beware of the polysemy for getPrefix == null
+ //if (qname.getPrefix() == null)
+ // return new ElementValue(type, collectionId, sym);
+ short nsSym = symbols.getNSSymbol(qname.getNamespaceURI());
+ return new ElementValue(type, collectionId, sym, nsSym);
}
private static boolean containsNode(List list, NodeId nodeId) {
Modified: trunk/eXist/src/org/exist/storage/NativeValueIndex.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeValueIndex.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/storage/NativeValueIndex.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -213,6 +213,10 @@
* @param node The attribute
*/
public void storeAttribute(AttrImpl node, NodePath currentPath, int indexingHint, RangeIndexSpec spec, boolean remove) {
+ storeAttribute(node, node.getValue(), currentPath, indexingHint, spec.getType(), spec.getQName() == null ? IDX_GENERIC : IDX_QNAME, remove);
+ }
+
+ public void storeAttribute(AttrImpl node, String value, NodePath currentPath, int indexingHint, int xpathType, byte indexType, boolean remove) {
//Return early
if (indexingHint != WITHOUT_PATH)
return;
@@ -221,12 +225,11 @@
node.getDocId() + "') differ !");
}
- AtomicValue atomic = convertToAtomic(spec.getType(), node.getValue());
+ AtomicValue atomic = convertToAtomic(xpathType, value);
//Ignore if the value can't be successfully atomized
//(this is logged elsewhere)
if(atomic == null)
return;
- int indexType = spec.getQName() == null ? IDX_GENERIC : IDX_QNAME;
Object key;
if (indexType == IDX_QNAME) {
key = new QNameKey(node.getQName(), atomic);
@@ -850,11 +853,16 @@
* @param value
* @return <code>null</null> if atomization fails or if the atomic value is not indexable.
* Should we throw an exception instead ? -pb
+ * @throws XPathException
*/
private AtomicValue convertToAtomic(int xpathType, String value) {
AtomicValue atomic;
if (Type.subTypeOf(xpathType, Type.STRING)) {
- atomic = new StringValue(value);
+ try {
+ atomic = new StringValue(value, xpathType);
+ } catch (XPathException e) {
+ return null;
+ }
} else {
try {
atomic = new StringValue(value).convertTo(xpathType);
@@ -1232,6 +1240,23 @@
storeAttribute(attrib, path, NativeValueIndex.WITHOUT_PATH, rSpec, false);
if (qSpec != null)
storeAttribute(attrib, path, NativeValueIndex.WITHOUT_PATH, qSpec, false);
+
+ switch(attrib.getType()) {
+ case AttrImpl.ID:
+ storeAttribute(attrib, attrib.getValue(), path, NativeValueIndex.WITHOUT_PATH, Type.ID, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREF:
+ storeAttribute(attrib, attrib.getValue(), path, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ break;
+ case AttrImpl.IDREFS:
+ StringTokenizer tokenizer = new StringTokenizer(attrib.getValue(), " ");
+ while (tokenizer.hasMoreTokens()) {
+ storeAttribute(attrib, tokenizer.nextToken(), path, NativeValueIndex.WITHOUT_PATH, Type.IDREF, NativeValueIndex.IDX_GENERIC, false);
+ }
+ break;
+ default:
+ // do nothing special
+ }
super.attribute(transaction, attrib, path);
}
Modified: trunk/eXist/src/org/exist/xquery/functions/FunId.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/FunId.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/xquery/functions/FunId.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -121,14 +121,12 @@
while(tok.hasMoreTokens()) {
nextId = tok.nextToken();
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- getId((NodeSet)result, docs, id);
+ getId((NodeSet)result, docs, nextId);
}
}
} else {
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- getId((NodeSet)result, docs, id);
+ getId((NodeSet)result, docs, nextId);
}
}
}
@@ -141,9 +139,8 @@
}
- private void getId(NodeSet result, DocumentSet docs, QName id) {
- NodeSet attribs = (NodeSet) context.getBroker().getElementIndex().findElementsByTagName(
- ElementValue.ATTRIBUTE_ID, docs, id, null);
+ private void getId(NodeSet result, DocumentSet docs, String id) throws XPathException {
+ NodeSet attribs = context.getBroker().getValueIndex().find(Constants.EQ, docs, null, -1, null, new StringValue(id, Type.ID));
NodeProxy n, p;
for (Iterator i = attribs.iterator(); i.hasNext();) {
n = (NodeProxy) i.next();
Modified: trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/xquery/functions/FunIdRef.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -120,14 +120,12 @@
while(tok.hasMoreTokens()) {
nextId = tok.nextToken();
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- getIdRef((NodeSet)result, docs, id);
+ getIdRef((NodeSet)result, docs, nextId);
}
}
} else {
if(XMLChar.isValidNCName(nextId)) {
- QName id = new QName(nextId, "", null);
- getIdRef((NodeSet)result, docs, id);
+ getIdRef((NodeSet)result, docs, nextId);
}
}
}
@@ -140,11 +138,9 @@
}
- private void getIdRef(NodeSet result, DocumentSet docs, QName id) {
- //TODO : work with IDREFS as well ; tokenize them then test against the id
- NodeSet attribs = (NodeSet) context.getBroker().getElementIndex().findElementsByTagName(
- ElementValue.ATTRIBUTE_IDREF, docs, id, null);
- NodeProxy n, p;
+ private void getIdRef(NodeSet result, DocumentSet docs, String id) throws XPathException {
+ NodeSet attribs = context.getBroker().getValueIndex().find(Constants.EQ, docs, null, -1, null, new StringValue(id, Type.IDREF));
+ NodeProxy n;
for (Iterator i = attribs.iterator(); i.hasNext();) {
n = (NodeProxy) i.next();
result.add(n);
Modified: trunk/eXist/src/org/exist/xquery/value/StringValue.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/value/StringValue.java 2008-02-25 22:13:12 UTC (rev 7446)
+++ trunk/eXist/src/org/exist/xquery/value/StringValue.java 2008-02-26 07:08:09 UTC (rev 7447)
@@ -654,7 +654,8 @@
*/
public int compareTo(Object o) {
AtomicValue other = (AtomicValue)o;
- if(Type.subTypeOf(other.getType(), Type.STRING))
+// if(Type.subTypeOf(other.getType(), Type.STRING))
+ if (getType() == other.getType())
return value.compareTo(((StringValue)other).value);
else
return getType() > other.getType() ? 1 : -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-25 22:13:18
|
Revision: 7446
http://exist.svn.sourceforge.net/exist/?rev=7446&view=rev
Author: wolfgang_m
Date: 2008-02-25 14:13:12 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
[bugfix] fixed the concurrency issue which caused the infamous (and usually fatal) "document id and proxy id differ" exceptions.
Previous backport of rev. 7431 was incomplete due to a recent redesign of the DocumentSet class.
Modified Paths:
--------------
branches/eXist-stable-1.2/src/org/exist/dom/DocumentSet.java
Modified: branches/eXist-stable-1.2/src/org/exist/dom/DocumentSet.java
===================================================================
--- branches/eXist-stable-1.2/src/org/exist/dom/DocumentSet.java 2008-02-24 22:12:44 UTC (rev 7445)
+++ branches/eXist-stable-1.2/src/org/exist/dom/DocumentSet.java 2008-02-25 22:13:12 UTC (rev 7446)
@@ -108,7 +108,8 @@
continue;
if(broker == null || !checkPermissions ||
doc.getPermissions().validate(broker.getUser(), Permission.READ)) {
- doc.setBroker(broker);
+ // WM: we don't have a lock on the document, so we should not change its broker:
+ // doc.setBroker(broker);
put(doc.getDocId(), doc);
}
}
@@ -134,11 +135,12 @@
if (doc == null)
continue;
if (doc.getPermissions().validate(broker.getUser(), Permission.WRITE)) {
- doc.setBroker(broker);
lock = doc.getUpdateLock();
lock.acquire(Lock.WRITE_LOCK);
put(doc.getDocId(), doc);
+ // we now have a lock on the doc, change its broker
+ doc.setBroker(broker);
lockMap.add(doc);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-24 22:12:54
|
Revision: 7445
http://exist.svn.sourceforge.net/exist/?rev=7445&view=rev
Author: wolfgang_m
Date: 2008-02-24 14:12:44 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
[ignore] ircbot should try to reconnect after connection to server is lost.
Modified Paths:
--------------
trunk/eXist/tools/ircbot/src/org/exist/irc/XBot.java
Modified: trunk/eXist/tools/ircbot/src/org/exist/irc/XBot.java
===================================================================
--- trunk/eXist/tools/ircbot/src/org/exist/irc/XBot.java 2008-02-24 20:17:50 UTC (rev 7444)
+++ trunk/eXist/tools/ircbot/src/org/exist/irc/XBot.java 2008-02-24 22:12:44 UTC (rev 7445)
@@ -1,17 +1,5 @@
package org.exist.irc;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
import org.exist.security.Permission;
import org.exist.security.PermissionFactory;
import org.exist.xmldb.UserManagementService;
@@ -32,6 +20,17 @@
import org.xmldb.api.modules.XPathQueryService;
import org.xmldb.api.modules.XUpdateQueryService;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Implements a simple IRC drone, which logs IRC events to a collection in an eXist database.
* One log file is created every day. Messages are appended using XUpdate.
@@ -65,8 +64,10 @@
private final static String URL_REGEX =
"((http|ftp)s{0,1}://[\\-\\.\\,/\\%\\~\\=\\@\\_\\&\\:\\?\\#a-zA-Z0-9]*[/\\=\\#a-zA-Z0-9])";
-
- // these commands may be passed in a private message to the bot
+
+ private final static int MAX_CONNECT_ATTEMPTS = 50;
+
+ // these commands may be passed in a private message to the bot
private final Command[] commands = {
new HelpCommand(),
new QuitCommand(),
@@ -82,8 +83,10 @@
private Pattern urlPattern;
private Matcher matcher = null;
-
- public XBot() throws IrcException {
+
+ private boolean disconnect = false;
+
+ public XBot() throws IrcException {
super();
File f = new File("xbot.properties");
@@ -110,21 +113,44 @@
*/
public void connect() throws IrcException, IOException {
log("Connecting to " + properties.getProperty("irc.server"));
- boolean connected = false;
+ attemptConnect();
+ }
+
+ protected void onDisconnect() {
+ if (disconnect)
+ return;
+ log("We were disconnected from the server. Trying to reconnect ...");
+ try {
+ attemptConnect();
+ } catch (IrcException e) {
+ log("Reconnect failed. Giving up.");
+ }
+ }
+
+ protected void attemptConnect() throws IrcException {
+ int attempts = 0;
+ boolean connected = false;
while (!connected) {
- try {
+ ++attempts;
+ try {
connect(properties.getProperty("irc.server"));
connected = true;
} catch (NickAlreadyInUseException e) {
this.setName(this.getName() + '_');
- }
- }
+ } catch (IOException e) {
+ log("Failed to connect. Reason: " + e.getMessage());
+ }
+ if (attempts == MAX_CONNECT_ATTEMPTS) {
+ log("Reached max connection attempts. Giving up.");
+ return;
+ }
+ }
log("Join channel: " + properties.getProperty("irc.channel"));
joinChannel(properties.getProperty("irc.channel"));
sendMessage("NickServ", "IDENTIFY " + properties.getProperty("irc.password"));
- }
-
- /**
+ }
+
+ /**
* Callback method called after a user has joined the channel.
*/
protected void onJoin(String channel, String sender, String login, String hostname) {
@@ -138,8 +164,9 @@
log("An error occurred: " + e.getMessage());
}
}
-
- /**
+
+
+ /**
* Callback method: a user has parted.
*/
protected void onPart(String channel, String sender, String login, String hostname) {
@@ -361,7 +388,8 @@
sendMessage(target, "Wrong password specified!");
return;
}
- quitServer("Even a bot needs to rest sometimes...");
+ disconnect = true;
+ quitServer("Even a bot needs to rest sometimes...");
System.exit(0);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-24 20:17:52
|
Revision: 7444
http://exist.svn.sourceforge.net/exist/?rev=7444&view=rev
Author: wolfgang_m
Date: 2008-02-24 12:17:50 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
[feature] added link to remove a feed
Modified Paths:
--------------
trunk/AtomicWiki/webapp/atom.xql
trunk/AtomicWiki/webapp/index.xql
trunk/AtomicWiki/webapp/scripts/blog.js
Modified: trunk/AtomicWiki/webapp/atom.xql
===================================================================
--- trunk/AtomicWiki/webapp/atom.xql 2008-02-24 19:08:41 UTC (rev 7443)
+++ trunk/AtomicWiki/webapp/atom.xql 2008-02-24 20:17:50 UTC (rev 7444)
@@ -152,6 +152,12 @@
$response
};
+declare function atom:delete-feed($credentials as xs:string+, $feed as xs:string) {
+ let $uri := xs:anyURI(concat(atom:get-atom-uri(), '/edit/', $feed))
+ return
+ httpclient:delete($uri, false(), atom:get-headers($credentials))
+};
+
declare function atom:module-imports() as xs:string {
let $imports :=
for $module in doc("/db/atom/configuration.xml")//extensions/module
@@ -226,6 +232,8 @@
atom:put($credentials, $feedCol, $id, atom:get-data($credentials[1]))
else if ($action eq 'delete') then
atom:delete($credentials, $feedCol, $id)
+ else if ($action eq 'delete-feed') then
+ atom:delete-feed($credentials, $feedCol)
else if ($action eq 'create-feed') then
atom:create-feed($credentials, $feedCol)
else if ($action eq 'edit-feed') then
Modified: trunk/AtomicWiki/webapp/index.xql
===================================================================
--- trunk/AtomicWiki/webapp/index.xql 2008-02-24 19:08:41 UTC (rev 7443)
+++ trunk/AtomicWiki/webapp/index.xql 2008-02-24 20:17:50 UTC (rev 7444)
@@ -30,9 +30,13 @@
<div class="head">Edit</div>
<ul>
<li>
- <a title="add an entry to the current feed" href="?action=new">Add Entry</a>
+ <a title="add an entry to the current feed" href="?action=new">Add Entry to Feed</a>
</li>
<li>
+ <a id="delete-feed" title="remove the current feed"
+ href="?action=delete-feed">Delete Current Feed</a>
+ </li>
+ <li>
<a href="#" id="upload-images">Upload Attachments</a>
</li>
<li><a href="?action=logout">Logout</a></li>
@@ -43,7 +47,7 @@
<div class="sidemenu">
<div class="head">Login</div>
<div class="login">
- <form method="GET">
+ <form method="POST">
<table width="100%">
<tr>
<td class="label">User:</td>
@@ -71,7 +75,7 @@
declare function blog:navigation($path as xs:string) as element() {
<span id="menu">
- <a href="/wiki/">ROOT</a> /
+ <a href="{atom:get-html-uri()}">ROOT</a> /
{
let $steps := tokenize($path, '/')
for $step at $p in $steps
@@ -396,7 +400,7 @@
($user, $pass)
let $credentials as xs:string+ := if (exists($loginStatus)) then $loginStatus else ('guest', 'guest')
let $updates :=
- if ($action = ('update', 'delete', 'create', 'create-feed', 'edit-feed')) then
+ if ($action = ('update', 'delete', 'create', 'create-feed', 'edit-feed', 'delete-feed')) then
atom:process($credentials, $action, $path, $id)
else
()
Modified: trunk/AtomicWiki/webapp/scripts/blog.js
===================================================================
--- trunk/AtomicWiki/webapp/scripts/blog.js 2008-02-24 19:08:41 UTC (rev 7443)
+++ trunk/AtomicWiki/webapp/scripts/blog.js 2008-02-24 20:17:50 UTC (rev 7444)
@@ -31,11 +31,9 @@
dp.SyntaxHighlighter.HighlightAll('code');
- var deleteLinks = Dom.getElementsByClassName('del_entry');
- for (var i = 0; i < deleteLinks.length; i++) {
- Event.addListener(deleteLinks[i], 'click', confirmDelete);
- }
-
+ Event.addListener(Dom.getElementsByClassName('del_entry'), 'click', confirmDelete);
+ Event.addListener('delete-feed', 'click', confirmDelete);
+
Event.addListener('create-feed-form', 'submit', function () {
window.location = location.pathname + '/' + document.forms['create-feed'].elements['add-feed'].value;
});
@@ -113,7 +111,12 @@
Event.stopEvent(ev);
var link = Event.getTarget(ev);
var href = link.href;
-
+ var msg;
+ if (link.id == 'delete-feed')
+ msg = 'Are you sure you want to delete the entire feed, including all ' +
+ 'entries it contains?';
+ else
+ msg = 'Are you sure you want to delete this entry?';
var dialog = new YAHOO.widget.SimpleDialog(Dom.generateId(), {
width: '20em',
fixedcenter: true,
@@ -128,7 +131,7 @@
];
dialog.cfg.queueProperty("buttons", buttons);
dialog.setHeader('Confirm Delete');
- dialog.setBody('Are you sure you want to delete this entry?');
+ dialog.setBody(msg);
dialog.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_WARN);
dialog.render(document.body);
dialog.show();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-24 19:08:44
|
Revision: 7443
http://exist.svn.sourceforge.net/exist/?rev=7443&view=rev
Author: pkaminsk2
Date: 2008-02-24 11:08:41 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
Resource.query() will now only reuse QueryService if it's still fresh, to avoid accidentally inheriting tweaks made to it elsewhere.
Modified Paths:
--------------
trunk/eXist/extensions/fluent/src/org/exist/fluent/NamespaceMap.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/Resource.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/NamespaceMap.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/NamespaceMap.java 2008-02-24 18:57:49 UTC (rev 7442)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/NamespaceMap.java 2008-02-24 19:08:41 UTC (rev 7443)
@@ -198,6 +198,17 @@
return all;
}
+ /**
+ * Return whether this namespace map contains no bindings other than inherited
+ * ones.
+ *
+ * @return <code>true</code> if this namespace map is empty except for possible
+ * inherited bindings, <code>false</code> otherwise
+ */
+ public boolean isFresh() {
+ return map == null || map.isEmpty();
+ }
+
@Override public boolean equals(Object o) {
if (!(o instanceof NamespaceMap)) return false;
return getCombinedMap().equals(((NamespaceMap) o).getCombinedMap());
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2008-02-24 18:57:49 UTC (rev 7442)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2008-02-24 19:08:41 UTC (rev 7443)
@@ -54,6 +54,10 @@
this.db = null;
}
+ boolean isFresh() {
+ return !presub && bindings.isEmpty() && (namespaceBindings == null || namespaceBindings.isFresh());
+ }
+
static final QueryService NULL = new QueryService() {
@Override protected ItemList executeQuery(String query, WrapperFactory wrappeFactory, Object[] params) {
return ItemList.NULL;
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Resource.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Resource.java 2008-02-24 18:57:49 UTC (rev 7442)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Resource.java 2008-02-24 19:08:41 UTC (rev 7443)
@@ -25,7 +25,7 @@
* @return a query service with this object as context
*/
public QueryService query() {
- if (query == null) {
+ if (query == null || !query.isFresh()) {
query = createQueryService();
if (query == null) {
Sequence seq = convertToSequence();
Modified: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java 2008-02-24 18:57:49 UTC (rev 7442)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java 2008-02-24 19:08:41 UTC (rev 7443)
@@ -357,6 +357,13 @@
c1.documents().build(Name.create("original")).elem("test").end("test").commit();
c1.query().single("/test");
}
+
+ @Test public void queryGetFreshService() {
+ Folder c1 = db.createFolder("/c1");
+ c1.documents().build(Name.create("original")).namespace("", "foo").elem("test").end("test").commit();
+ c1.query().namespace("", "foo").single("/test");
+ assertFalse(c1.query().exists("/test")); // namespace bindings not propagated from previous query
+ }
@Test public void queryBaseUri() {
Folder c1 = db.createFolder("/c1");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-24 18:57:51
|
Revision: 7442
http://exist.svn.sourceforge.net/exist/?rev=7442&view=rev
Author: pkaminsk2
Date: 2008-02-24 10:57:49 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
Changed catch(Exception) to catch individual exceptions instead.
Modified Paths:
--------------
trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java 2008-02-24 17:47:24 UTC (rev 7441)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java 2008-02-24 18:57:49 UTC (rev 7442)
@@ -3,6 +3,7 @@
import java.io.*;
import java.util.*;
+import org.exist.EXistException;
import org.exist.collections.*;
import org.exist.collections.Collection;
import org.exist.collections.triggers.TriggerException;
@@ -15,6 +16,7 @@
import org.exist.xquery.XPathException;
import org.exist.xquery.value.*;
import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
/**
@@ -300,8 +302,18 @@
changeLock(Lock.NO_LOCK);
handle.store(tx.tx, broker, info, node, false);
commit();
- } catch (Exception e) {
+ } catch (EXistException e) {
throw new DatabaseException(e);
+ } catch (PermissionDeniedException e) {
+ throw new DatabaseException(e);
+ } catch (TriggerException e) {
+ throw new DatabaseException(e);
+ } catch (SAXException e) {
+ throw new DatabaseException(e);
+ } catch (LockException e) {
+ throw new DatabaseException(e);
+ } catch (IOException e) {
+ throw new DatabaseException(e);
} finally {
release();
}
@@ -337,10 +349,18 @@
changeLock(Lock.NO_LOCK);
handle.store(tx.tx, broker, info, source.toInputSource(), false);
commit();
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
+ } catch (EXistException e) {
throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (PermissionDeniedException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (TriggerException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (SAXException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (LockException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (IOException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
} finally {
release();
}
@@ -363,13 +383,19 @@
InputStream inputStream = source.toInputStream();
try {
handle.addBinaryResource(tx.tx, broker, XmldbURI.create(name.get()), inputStream, null, source.getLength());
+ } catch (EXistException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (PermissionDeniedException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (LockException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
+ } catch (TriggerException e) {
+ throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
} finally {
inputStream.close();
}
commit();
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
+ } catch (IOException e) {
throw new DatabaseException("failed to create document '" + name + "' from source " + source, e);
} finally {
release();
@@ -840,8 +866,12 @@
broker.moveCollection(tx.tx, handle, destination.handle, XmldbURI.create(name.get()));
}
commit();
- } catch (Exception e) {
+ } catch (PermissionDeniedException e) {
throw new DatabaseException(e);
+ } catch (LockException e) {
+ throw new DatabaseException(e);
+ } catch (IOException e) {
+ throw new DatabaseException(e);
} finally {
destination.release();
}
@@ -998,13 +1028,17 @@
transact(Lock.WRITE_LOCK);
try {
if (dimpl instanceof BinaryDocument) {
- handle.removeBinaryResource(tx.tx, broker, dimpl);
+ handle.removeBinaryResource(tx.tx, broker, dimpl.getFileURI());
} else {
handle.removeXMLResource(tx.tx, broker, dimpl.getFileURI());
}
commit();
- } catch (Exception e) {
+ } catch (PermissionDeniedException e) {
throw new DatabaseException(e);
+ } catch (LockException e) {
+ throw new DatabaseException(e);
+ } catch (TriggerException e) {
+ throw new DatabaseException(e);
} finally {
release();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-24 17:47:29
|
Revision: 7441
http://exist.svn.sourceforge.net/exist/?rev=7441&view=rev
Author: wolfgang_m
Date: 2008-02-24 09:47:24 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
[bugfix] check user permissions before updating feed metadata.
Modified Paths:
--------------
trunk/eXist/src/org/exist/atom/modules/AtomProtocol.java
Modified: trunk/eXist/src/org/exist/atom/modules/AtomProtocol.java
===================================================================
--- trunk/eXist/src/org/exist/atom/modules/AtomProtocol.java 2008-02-24 17:45:11 UTC (rev 7440)
+++ trunk/eXist/src/org/exist/atom/modules/AtomProtocol.java 2008-02-24 17:47:24 UTC (rev 7441)
@@ -478,13 +478,14 @@
if (DOM.findChild(root,Atom.NAMESPACE_STRING,"title")==null) {
throw new BadRequestException("The feed metadata sent does not contain a title.");
}
-
- TransactionManager transact = broker.getBrokerPool().getTransactionManager();
- Txn transaction = transact.beginTransaction();
+ if (!feedDoc.getPermissions().validate(broker.getUser(), Permission.UPDATE)) {
+ throw new PermissionDeniedException("Permission denied to update feed " + collection.getURI());
+ }
+ TransactionManager transact = broker.getBrokerPool().getTransactionManager();
+ Txn transaction = transact.beginTransaction();
try {
feedDoc.getUpdateLock().acquire(Lock.WRITE_LOCK);
-
ElementImpl feedRoot = (ElementImpl)feedDoc.getDocumentElement();
// Modify the feed by merging the new feed-level elements
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-24 17:45:14
|
Revision: 7440
http://exist.svn.sourceforge.net/exist/?rev=7440&view=rev
Author: wolfgang_m
Date: 2008-02-24 09:45:11 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
[feature] feed title and subtitle can now be edited inline
Modified Paths:
--------------
trunk/AtomicWiki/webapp/atom.xql
trunk/AtomicWiki/webapp/dispatcher.xql
trunk/AtomicWiki/webapp/index.xql
trunk/AtomicWiki/webapp/scripts/blog.js
trunk/AtomicWiki/webapp/styles/default.css
Modified: trunk/AtomicWiki/webapp/atom.xql
===================================================================
--- trunk/AtomicWiki/webapp/atom.xql 2008-02-24 00:35:36 UTC (rev 7439)
+++ trunk/AtomicWiki/webapp/atom.xql 2008-02-24 17:45:11 UTC (rev 7440)
@@ -137,6 +137,21 @@
return $response
};
+declare function atom:edit-feed($credentials as xs:string+, $feed as xs:string) {
+ let $subtitle := request:get-parameter('subtitle', ())
+ let $feedData :=
+ <feed xmlns="http://www.w3.org/2005/Atom">
+ <title>{request:get-parameter('title', '')}</title>
+ { if ($subtitle) then <subtitle>{$subtitle}</subtitle> else ()}
+ </feed>
+ let $uri := xs:anyURI(concat(atom:get-atom-uri(), '/edit/', $feed))
+ let $response :=
+ httpclient:put($uri, $feedData, false(), atom:get-headers($credentials))
+ let $debug := util:log("DEBUG", ("Creating new feed: ", $response))
+ return
+ $response
+};
+
declare function atom:module-imports() as xs:string {
let $imports :=
for $module in doc("/db/atom/configuration.xml")//extensions/module
@@ -213,6 +228,8 @@
atom:delete($credentials, $feedCol, $id)
else if ($action eq 'create-feed') then
atom:create-feed($credentials, $feedCol)
+ else if ($action eq 'edit-feed') then
+ atom:edit-feed($credentials, $feedCol)
else
atom:post($credentials, xs:anyURI(concat(atom:get-atom-uri(), '/edit/', $feedCol)), atom:get-data($credentials[1]))
};
\ No newline at end of file
Modified: trunk/AtomicWiki/webapp/dispatcher.xql
===================================================================
--- trunk/AtomicWiki/webapp/dispatcher.xql 2008-02-24 00:35:36 UTC (rev 7439)
+++ trunk/AtomicWiki/webapp/dispatcher.xql 2008-02-24 17:45:11 UTC (rev 7440)
@@ -26,7 +26,7 @@
let $debug := util:log("DEBUG", ("URI: ", $uri, ' Action: ', $action,
' Servlet-Context: ', $context))
return
- if (matches($uri, "/(xmlrpc|rest|atom/|scripts|styles|assets|images|logo.jpg)")) then
+ if (matches($uri, "/(xmlrpc|rest|atom/|webdav|scripts|styles|assets|images|logo.jpg)")) then
<exist:ignore>
<exist:cache-control cache="yes"/>
</exist:ignore>
Modified: trunk/AtomicWiki/webapp/index.xql
===================================================================
--- trunk/AtomicWiki/webapp/index.xql 2008-02-24 00:35:36 UTC (rev 7439)
+++ trunk/AtomicWiki/webapp/index.xql 2008-02-24 17:45:11 UTC (rev 7440)
@@ -30,7 +30,7 @@
<div class="head">Edit</div>
<ul>
<li>
- <a href="?action=new">New Entry</a>
+ <a title="add an entry to the current feed" href="?action=new">Add Entry</a>
</li>
<li>
<a href="#" id="upload-images">Upload Attachments</a>
@@ -93,8 +93,12 @@
return
if (collection($collName)) then
<div>
- <p>The requested page does not exist. However, the following sub-feeds are available:</p>
- <h2>Sub-feeds</h2>
+ <p>The requested page does not exist: no feed is associated with
+ this URL. If you are logged in, you can create a feed for this URL
+ below.</p>
+
+ <h2>Child Paths</h2>
+ <p>The following feeds exist below the current path:</p>
<ul xmlns="http://www.w3.org/1999/xhtml">
{
for $child in xdb:get-child-collections($collName)
@@ -110,7 +114,12 @@
{
if (exists($login)) then
<div class="form">
- <h2>Create New Page Or Feed</h2>
+ <h2>Create New Page/Feed</h2>
+ <p>Enter a title and click "Create" to associate a new atom feed
+ with the current URL. You can either create a single wiki page
+ or a blog. The only difference is that a wiki page has just one
+ main entry, while a blog has many entries which are ordered
+ chronologically.</p>
<form>
<label for="type">Type</label>
<select name="type">
@@ -357,6 +366,21 @@
blog:filter-body($node, $action, $path, $loginStatus, $data)
};
+declare function blog:render-titles($feed as element(atom:feed)?, $path as xs:string,
+ $loginStatus as xs:string*) {
+ if (exists($loginStatus) and exists($feed)) then (
+ <h1><input class="entrytitle editable" id="e_title" name="e_title"
+ value="{$feed/atom:title/text()}"/></h1>,
+ <h2><input class="entrytitle editable" id="e_subtitle" name="e_subtitle"
+ value="{$feed/atom:subtitle/text()}"/></h2>
+ ) else (
+ <h1>
+ {if ($feed) then $feed/atom:title/text() else $path}
+ </h1>,
+ <h2>{$feed/atom:subtitle/text()}</h2>
+ )
+};
+
let $action := request:get-parameter("action", ())
let $id := request:get-parameter("id", ())
let $path := request:get-parameter("feed", ())
@@ -372,7 +396,7 @@
($user, $pass)
let $credentials as xs:string+ := if (exists($loginStatus)) then $loginStatus else ('guest', 'guest')
let $updates :=
- if ($action = ('update', 'delete', 'create', 'create-feed')) then
+ if ($action = ('update', 'delete', 'create', 'create-feed', 'edit-feed')) then
atom:process($credentials, $action, $path, $id)
else
()
@@ -416,10 +440,7 @@
</a>
<div id="navbar">
{ blog:navigation($path) }
- <h1>
- {if ($feed) then $feed/atom:title/text() else $path}
- </h1>
- <h2>{$feed/atom:subtitle/text()}</h2>
+ { blog:render-titles($feed, $path, $loginStatus) }
</div>
</div>
<div id="bd">
Modified: trunk/AtomicWiki/webapp/scripts/blog.js
===================================================================
--- trunk/AtomicWiki/webapp/scripts/blog.js 2008-02-24 00:35:36 UTC (rev 7439)
+++ trunk/AtomicWiki/webapp/scripts/blog.js 2008-02-24 17:45:11 UTC (rev 7440)
@@ -1,6 +1,8 @@
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
+var statusInd;
+
// the feed currently displayed
var feed = '';
@@ -10,6 +12,10 @@
}, 'meta', document);
if (feedMeta.length > 0) feed = feedMeta[0].getAttribute('content');
+ initActivityIndicator();
+ new Editable('e_title').change.subscribe(modifyFeed);
+ new Editable('e_subtitle').change.subscribe(modifyFeed);
+
if (document.getElementById('edit-tabs'))
new BlogEditor();
@@ -25,13 +31,6 @@
dp.SyntaxHighlighter.HighlightAll('code');
- //var toggles = Dom.getElementsByClassName('box-toggle');
- //for (var i = 0; i < toggles.length; i++) {
- //var body = Dom.getElementsByClassName('body', 'div', toggles[i].parentNode.parentNode)[0];
- //Dom.setStyle(body, 'display', 'none');
- //Event.addListener(toggles[i], 'click', toggleBox);
- //}
-
var deleteLinks = Dom.getElementsByClassName('del_entry');
for (var i = 0; i < deleteLinks.length; i++) {
Event.addListener(deleteLinks[i], 'click', confirmDelete);
@@ -40,8 +39,37 @@
Event.addListener('create-feed-form', 'submit', function () {
window.location = location.pathname + '/' + document.forms['create-feed'].elements['add-feed'].value;
});
+
+
});
+function modifyFeed(type, args) {
+ reportActivity('Changing feed title');
+ var callback = {
+ success: function (response) {
+ endActivity();
+ if (response.status != 204) {
+ reportError("Server reported an error while changing feed title: " + response.status);
+ }
+ },
+ failure: function (response) {
+ endActivity();
+ if (response.status == 401) {
+ reportError("Permission denied. You are not authorized to change this feed.");
+ } else
+ reportError("Server reported an error while changing feed title: " + response.responseText);
+ this.resetValue();
+ },
+ scope: this
+ };
+ var path = location.pathname;
+ if (path.charAt(path.length - 1) != '/')
+ path = path.replace(/^(.*)\/[^\/]+/, '$1/');
+ var params = 'action=edit-feed&quiet=true&title=' + document.getElementById('e_title').value +
+ '&subtitle=' + document.getElementById('e_subtitle').value;
+ YAHOO.util.Connect.asyncRequest('POST', path, callback, params);
+}
+
function toggleBox(ev) {
Event.stopEvent(ev);
var link = Event.getTarget(ev);
@@ -61,6 +89,26 @@
}
}
+function initActivityIndicator() {
+ statusInd = document.createElement('div');
+ statusInd.className = 'status-indicator';
+ statusInd.style.position = 'absolute';
+ statusInd.style.top = '0';
+ statusInd.style.right = '0';
+ statusInd.style.display = 'none';
+ document.body.appendChild(statusInd);
+}
+
+function reportActivity(message) {
+ Dom.setStyle(statusInd, 'display', '');
+ statusInd.innerHTML = message;
+}
+
+function endActivity() {
+ Dom.setStyle(statusInd, 'display', 'none');
+ statusInd.innerHTML = '';
+}
+
function confirmDelete(ev) {
Event.stopEvent(ev);
var link = Event.getTarget(ev);
@@ -821,19 +869,23 @@
var txt = document.createTextNode(this.input.value.length == 0 ? 'Click to edit' : this.input.value);
this.span.appendChild(txt);
- this.close = document.createElement('span');
- this.close.className = 'editable-close';
- Dom.setStyle(this.close, 'display', 'none');
- txt = document.createTextNode('Close');
- this.close.appendChild(txt);
+ this.toggle = document.createElement('a');
+ this.toggle.href = '#';
+ this.toggle.className = 'editable-toggle';
+ txt = document.createTextNode('edit');
+ this.toggle.appendChild(txt);
div.appendChild(this.input);
- div.appendChild(this.close);
div.appendChild(this.span);
+ div.appendChild(this.toggle);
Event.addListener(this.span, 'click', this.toggleEditable, this, true);
- Event.addListener(this.close, 'click', this.toggleEditable, this, true);
+ Event.addListener(this.toggle, 'click', this.toggleEditable, this, true);
Event.addListener(this.input, 'keypress', this.keyPressed, this, true);
+
+ this.value = this.input.value;
+
+ this.change = new YAHOO.util.CustomEvent('content changed', this);
}
Editable.prototype.setValue = function (value) {
@@ -845,6 +897,10 @@
return this.input.value;
};
+Editable.prototype.resetValue = function () {
+ this.setValue(this.value);
+};
+
Editable.prototype.keyPressed = function (ev) {
var ch = Event.getCharCode(ev);
if (ch == 27 || ch == 10 || ch == 13) {
@@ -857,20 +913,26 @@
if (Dom.getStyle(this.input, 'display') == 'none') {
Dom.setStyle(this.span, 'display', 'none');
Dom.setStyle(this.input, 'display', '');
- Dom.setStyle(this.close, 'display', '');
+ this.toggle.innerHTML = 'close';
this.input.focus();
+ this.value = this.input.value;
} else {
this.span.innerHTML = this.input.value.length == 0 ? 'Click to edit' : this.input.value;
Dom.setStyle(this.span, 'display', '');
Dom.setStyle(this.input, 'display', 'none');
- Dom.setStyle(this.close, 'display', 'none');
+ this.toggle.innerHTML = 'edit';
+ YAHOO.log(this.input.value + ' -> ' + this.value);
+ if (this.input.value != this.value) {
+ YAHOO.log('Firing...');
+ this.change.fire(this.input.value);
+ }
}
};
function reportError(msg) {
YAHOO.log('error: ' + msg);
var dialog = new YAHOO.widget.SimpleDialog(Dom.generateId(), {
- width: '20em',
+ width: '300px',
fixedcenter: true,
effect: { effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25},
modal: true,
Modified: trunk/AtomicWiki/webapp/styles/default.css
===================================================================
--- trunk/AtomicWiki/webapp/styles/default.css 2008-02-24 00:35:36 UTC (rev 7439)
+++ trunk/AtomicWiki/webapp/styles/default.css 2008-02-24 17:45:11 UTC (rev 7440)
@@ -73,6 +73,12 @@
}
}
+.status-indicator {
+ background-color: red;
+ color: white;
+ padding: 5px;
+}
+
#weblog {
background-color: #F5F5FF;
margin-top: 5px;
@@ -352,12 +358,11 @@
font-size: 175%;
}
-span.editable-close {
- float: left;
- font-size: 75%;
+.editable-toggle {
+ font-size: 10px;
text-decoration: underline;
vertical-align: super;
- cursor: pointer;
+ margin-left: 1em;
}
.msgtoolbar {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-24 00:35:45
|
Revision: 7439
http://exist.svn.sourceforge.net/exist/?rev=7439&view=rev
Author: pkaminsk2
Date: 2008-02-23 16:35:36 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
Added test demonstrating bug when removing document containing elements with id's.
Modified Paths:
--------------
trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java
Modified: trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java 2008-02-24 00:33:36 UTC (rev 7438)
+++ trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java 2008-02-24 00:35:36 UTC (rev 7439)
@@ -216,6 +216,18 @@
}
}
+ public void testAddRemoveAddWithIds() {
+ try {
+ final String resourceID = "removeWithIds;1.xml";
+
+ addResource(resourceID, "<foo1 xml:id='f'/>");
+ removeDocument(resourceID);
+ addResource(resourceID, "<foo xml:id='f'/>");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
private void removeDocument(String id) {
try {
XMLResource resource = resourceForId(id);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pka...@us...> - 2008-02-24 00:33:43
|
Revision: 7438
http://exist.svn.sourceforge.net/exist/?rev=7438&view=rev
Author: pkaminsk2
Date: 2008-02-23 16:33:36 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
Added test demonstrating bug when removing document containing elements with id's.
Modified Paths:
--------------
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentTest.java
Modified: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentTest.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentTest.java 2008-02-23 20:56:44 UTC (rev 7437)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentTest.java 2008-02-24 00:33:36 UTC (rev 7438)
@@ -55,7 +55,23 @@
doc.query().single("/test");
assertEquals("/c2/original", doc.path());
}
+
+ @Test public void delete1() {
+ Folder c1 = db.createFolder("/c1");
+ XMLDocument doc = c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ doc.delete();
+ assertEquals(0, c1.documents().size());
+ }
+ @Test public void delete2() {
+ Folder c1 = db.createFolder("/c1");
+ XMLDocument doc1 = c1.documents().build(Name.create("doc1")).elem("test").attr("xml:id", "a").end("test").commit();
+ XMLDocument doc2 = c1.documents().build(Name.create("doc2")).elem("test2").attr("xml:id", "b").end("test2").commit();
+ doc1.delete();
+ doc2.delete();
+ assertEquals(0, c1.documents().size());
+ }
+
@Test public void convertToSequence() {
Folder c = db.createFolder("/top");
c.documents().build(Name.create("one")).elem("test").end("test").commit();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2008-02-23 20:56:46
|
Revision: 7437
http://exist.svn.sourceforge.net/exist/?rev=7437&view=rev
Author: wolfgang_m
Date: 2008-02-23 12:56:44 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
[feature] use new XQueryURLRewrite filter, fix generated links
[feature] body page layout and logo is now configurable
Modified Paths:
--------------
trunk/AtomicWiki/build.xml
trunk/AtomicWiki/etc/configuration.tmpl.xml
trunk/AtomicWiki/etc/configuration.xml
trunk/AtomicWiki/webapp/WEB-INF/web.xml
trunk/AtomicWiki/webapp/atom.xql
trunk/AtomicWiki/webapp/dispatcher.xql
trunk/AtomicWiki/webapp/index.xql
Added Paths:
-----------
trunk/AtomicWiki/etc/skin.xml
Modified: trunk/AtomicWiki/build.xml
===================================================================
--- trunk/AtomicWiki/build.xml 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/build.xml 2008-02-23 20:56:44 UTC (rev 7437)
@@ -16,6 +16,12 @@
<available file="${exist.home}/conf.xml" property="exist.home.found"/>
+ <path id="classpath.tools">
+ <fileset dir="${java.libs.tools}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
<path id="classpath.core">
<fileset dir="${java.libs.exist}">
<include name="*.jar"/>
@@ -26,12 +32,8 @@
</path>
<available classname="net.sf.saxon.TransformerFactoryImpl" property="saxon.available"
- classpathref="classpath.core"/>
+ classpathref="classpath.tools"/>
- <typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
- <classpath refid="classpath.core"/>
- </typedef>
-
<target name="exist-check" unless="exist.home.found">
<echo> Could not detect eXist installation. Please edit build.properties and set exist.home
to point to the eXist directory. </echo>
@@ -127,7 +129,13 @@
<target name="setup" description="Prepare the database" depends="configuration,init,store"> </target>
- <target xmlns:xdb="http://exist-db.org/ant" name="init">
+ <target name="antlibs">
+ <typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
+ <classpath refid="classpath.core"/>
+ </typedef>
+ </target>
+
+ <target xmlns:xdb="http://exist-db.org/ant" name="init" depends="antlibs">
<echo message="Wiki ROOT: ${wiki.root}"/>
<xdb:adduser uri="${xmldb.uri}/db" user="admin" password="${admin.password}"
name="${wiki.admin.user}" secret="${wiki.admin.password}"
@@ -175,7 +183,7 @@
mode="group=+write,+update,other=-write,-update"/>
</target>
- <target xmlns:xdb="http://exist-db.org/ant" name="store">
+ <target xmlns:xdb="http://exist-db.org/ant" name="store" depends="antlibs">
<xdb:store uri="${xmldb.uri}/db/atom" user="${wiki.admin.user}" password="${wiki.admin.password}"
createcollection="true">
<fileset dir="${web.dir}/styles">
@@ -190,6 +198,7 @@
<xdb:store uri="${xmldb.uri}/db/atom" user="${wiki.admin.user}" password="${wiki.admin.password}" createcollection="true">
<fileset dir="etc">
<include name="configuration.xml"/>
+ <include name="skin.xml"/>
</fileset>
</xdb:store>
</target>
@@ -232,7 +241,7 @@
<get src="http://prdownloads.sourceforge.net/saxon/saxonb8-9-0-3j.zip"
dest="${java.libs.tools}/saxon.zip" verbose="true"/>
- <unzip src="${java.libs.tools}/saxon.zip" dest="${lib.endorsed}">
+ <unzip src="${java.libs.tools}/saxon.zip" dest="${java.libs.tools}">
<patternset>
<include name="**/saxon8.jar"/>
<include name="**/saxon8-dom.jar"/>
Modified: trunk/AtomicWiki/etc/configuration.tmpl.xml
===================================================================
--- trunk/AtomicWiki/etc/configuration.tmpl.xml 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/etc/configuration.tmpl.xml 2008-02-23 20:56:44 UTC (rev 7437)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration base-uri="http://localhost:8000"
- atom-uri="atom" html-uri="wiki">
+ atom-uri="atom" html-uri="">
<admin user="@user@" password="@password@"/>
<root>/db/wiki</root>
<extensions default-prefix="wikiext">
Modified: trunk/AtomicWiki/etc/configuration.xml
===================================================================
--- trunk/AtomicWiki/etc/configuration.xml 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/etc/configuration.xml 2008-02-23 20:56:44 UTC (rev 7437)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration base-uri="http://localhost:8000"
- atom-uri="atom" html-uri="wiki">
+ atom-uri="atom" html-uri="">
<admin user="blogadmin" password="atom"/>
<root>/db/wiki</root>
<extensions default-prefix="wikiext">
<module path="wiki.xqm" namespace="http://exist-db.org/NS/wiki" prefix="wikiext"/>
</extensions>
-</configuration>
+</configuration>
\ No newline at end of file
Added: trunk/AtomicWiki/etc/skin.xml
===================================================================
--- trunk/AtomicWiki/etc/skin.xml (rev 0)
+++ trunk/AtomicWiki/etc/skin.xml 2008-02-23 20:56:44 UTC (rev 7437)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wiki:skin xmlns:wiki="http://exist-db.org/xquery/wiki">
+ <wiki:logo alt="eXist Logo" link="http://exist-db.org">logo.jpg</wiki:logo>
+ <wiki:stylesheet>styles/default.css</wiki:stylesheet>
+ <wiki:body xmlns="http://www.w3.org/1999/xhtml">
+ <div id="yui-main">
+ <div class="yui-b">
+ <div class="yui-ge">
+ <div class="yui-u">
+ <wiki:edit-menu/>
+ <wiki:create-box feed="util" entry="MarkupHelp" collapsible="true"/>
+ </div>
+ <div id="weblog" class="yui-u first">
+ <div class="weblog-content">
+ <wiki:entries/>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="yui-b">
+ <wiki:create-box feed="util" entry="MainLinks" collapsible="false"/>
+ <wiki:create-box feed="util" entry="LatestPosts" collapsible="false"/>
+ <wiki:subscribe-link/>
+ </div>
+ </wiki:body>
+</wiki:skin>
\ No newline at end of file
Modified: trunk/AtomicWiki/webapp/WEB-INF/web.xml
===================================================================
--- trunk/AtomicWiki/webapp/WEB-INF/web.xml 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/webapp/WEB-INF/web.xml 2008-02-23 20:56:44 UTC (rev 7437)
@@ -32,6 +32,15 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <filter>
+ <filter-name>XQueryURLRewrite</filter-name>
+ <filter-class>org.exist.http.urlrewrite.XQueryURLRewrite</filter-class>
+
+ <init-param>
+ <param-name>xquery</param-name>
+ <param-value>dispatcher.xql</param-value>
+ </init-param>
+ </filter>
<!--
RpcServlet provides XML-RPC access to eXist
@@ -116,16 +125,6 @@
<param-value>UTF-8</param-value>
</init-param>
</servlet>
-
- <servlet>
- <servlet-name>RedirectorServlet</servlet-name>
- <servlet-class>org.exist.http.servlets.RedirectorServlet</servlet-class>
-
- <init-param>
- <param-name>xquery</param-name>
- <param-value>dispatcher.xql</param-value>
- </init-param>
- </servlet>
<servlet>
<servlet-name>AtomServlet</servlet-name>
@@ -148,6 +147,11 @@
<!-- ====================== URL space mappings ======================= -->
+ <filter-mapping>
+ <filter-name>XQueryURLRewrite</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
<!-- XMLRPC -->
<servlet-mapping>
<servlet-name>org.exist.xmlrpc.RpcServlet</servlet-name>
@@ -188,11 +192,6 @@
<url-pattern>/atom/*</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>RedirectorServlet</servlet-name>
- <url-pattern>/wiki/*</url-pattern>
- </servlet-mapping>
-
<!-- Java Webstart -->
<servlet-mapping>
<servlet-name>jnlp</servlet-name>
Modified: trunk/AtomicWiki/webapp/atom.xql
===================================================================
--- trunk/AtomicWiki/webapp/atom.xql 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/webapp/atom.xql 2008-02-23 20:56:44 UTC (rev 7437)
@@ -51,6 +51,10 @@
resolve-uri($config/@atom-uri, $config/@base-uri)
};
+declare function atom:get-skin() as element() {
+ doc("/db/atom/configuration.xml")/configuration/skin
+};
+
declare function atom:get-admin-user() as xs:string+ {
let $admin := doc("/db/atom/configuration.xml")/configuration/admin
return
@@ -144,12 +148,11 @@
};
declare function atom:call-function($path as xs:string, $macro as element(wiki:macro)) {
- let $context := (
- <wiki:context path="{$path}" collection="{concat(atom:wiki-root(), $path)}">
- { $macro/wiki:params/wiki:param }
- <wiki:content>{$macro/text()}</wiki:content>
- </wiki:context>
- )/self::wiki:context
+ let $context :=
+ <wiki:context path="{$path}" collection="{concat(atom:wiki-root(), $path)}">
+ { $macro/wiki:params/wiki:param }
+ <wiki:content>{$macro/text()}</wiki:content>
+ </wiki:context>
let $name := $macro/@name
let $funcName :=
if (not(contains($name, ':'))) then
@@ -172,11 +175,6 @@
let $uri :=
if (matches($href, "^\w+:")) then
$href
- else if (request:get-attribute("org.exist.forward.servlet-path")) then
- if (starts-with($href, '/')) then
- resolve-uri(concat('.', $href), request:get-attribute("org.exist.forward.servlet-path"))
- else
- concat(request:get-attribute("org.exist.forward.servlet-path"), '/', $path, '/', $href)
else
if (starts-with($href, '/')) then
resolve-uri(concat('.', $href), atom:get-html-uri())
Modified: trunk/AtomicWiki/webapp/dispatcher.xql
===================================================================
--- trunk/AtomicWiki/webapp/dispatcher.xql 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/webapp/dispatcher.xql 2008-02-23 20:56:44 UTC (rev 7437)
@@ -5,8 +5,7 @@
import module namespace atom="http://www.w3.org/2005/Atom" at "webapp/atom.xql";
import module namespace text="http://exist-db.org/xquery/text";
-declare function exist:extract-feed() {
- let $path := request:get-path-info()
+declare function exist:extract-feed($path as xs:string) {
let $path1 :=
if (starts-with($path, '/')) then substring($path, 2) else $path
return
@@ -17,40 +16,43 @@
if (not(ends-with($path, '/'))) then
subsequence(text:groups($path, '^/?(.*)/([^/]+)$'), 2)
else
- exist:extract-feed()
+ exist:extract-feed($path)
};
let $uri := request:get-uri()
-let $path := request:get-path-info()
let $action := request:get-parameter('action', ())[1]
let $addFeed := request:get-parameter('add-feed', ())
let $context := request:get-context-path()
-let $debug := util:log("DEBUG", ("URI: ", $uri, " PathInfo: ", $path, ' Action: ', $action,
+let $debug := util:log("DEBUG", ("URI: ", $uri, ' Action: ', $action,
' Servlet-Context: ', $context))
return
- if (ends-with($uri, 'upload.xql')) then
+ if (matches($uri, "/(xmlrpc|rest|atom/|scripts|styles|assets|images|logo.jpg)")) then
+ <exist:ignore>
+ <exist:cache-control cache="yes"/>
+ </exist:ignore>
+ else if (ends-with($uri, 'upload.xql')) then
<exist:dispatch path="{$context}/upload.xql"/>
else if ($addFeed) then
<exist:dispatch redirect="{replace($uri, '^(.*/)[^/]*$', '$1')}{$addFeed}/"/>
else if ($action eq 'preview') then
<exist:dispatch path="{$context}/preview.xql">
- <exist:add-parameter name="feed" value="{exist:extract-page($path)[1]}"/>
+ <exist:add-parameter name="feed" value="{exist:extract-page($uri)[1]}"/>
</exist:dispatch>
else if ($action = ('store-comment', 'load-comment')) then
<exist:dispatch path="{$context}/comment.xql">
- <exist:add-parameter name="feed" value="{exist:extract-feed()}"/>
+ <exist:add-parameter name="feed" value="{exist:extract-feed($uri)}"/>
</exist:dispatch>
else if (ends-with($uri, '.xql')) then
- <exist:dispatch path="{$context}/{replace($path, '.*/([^/]+)$', '$1')}"/>
+ <exist:dispatch path="{$context}/{replace($uri, '.*/([^/]+)$', '$1')}"/>
else if (matches($uri, "\.\w+\??")) then
- if (matches($path, "/(styles|images)/")) then
- <exist:dispatch path="{$context}/{replace($path, '^.*/((styles|images)/.*)$', '$1')}"/>
+ if (matches($uri, "/(styles|images)/")) then
+ <exist:dispatch path="{$context}/{replace($uri, '^.*/((styles|images)/.*)$', '$1')}"/>
else
- let $relPath := if (starts-with($path, "/")) then substring($path, 2) else $path
+ let $relPath := if (starts-with($uri, "/")) then substring($uri, 2) else $uri
return
<exist:dispatch path="{$context}/rest{atom:wiki-root()}{$relPath}" />
else
- let $params := exist:extract-page($path)
+ let $params := exist:extract-page($uri)
return
if (count($params) eq 2) then
<exist:dispatch path="{$context}/index.xql">
@@ -59,5 +61,5 @@
</exist:dispatch>
else
<exist:dispatch path="{$context}/index.xql">
- <exist:add-parameter name="feed" value="{exist:extract-feed()}"/>
+ <exist:add-parameter name="feed" value="{exist:extract-feed($uri)}"/>
</exist:dispatch>
\ No newline at end of file
Modified: trunk/AtomicWiki/webapp/index.xql
===================================================================
--- trunk/AtomicWiki/webapp/index.xql 2008-02-23 20:50:07 UTC (rev 7436)
+++ trunk/AtomicWiki/webapp/index.xql 2008-02-23 20:56:44 UTC (rev 7437)
@@ -21,6 +21,9 @@
import module namespace wiki="http://exist-db.org/xquery/wiki"
at "java:org.exist.xquery.modules.wiki.WikiModule";
+declare variable $CONFIG_LOGO := doc('/db/atom/skin.xml')/wiki:skin/wiki:logo;
+declare variable $CONFIG_STYLE := doc('/db/atom/skin.xml')/wiki:skin/wiki:stylesheet/text();
+
declare function blog:sidemenu($loginStatus as xs:string*) {
if (exists($loginStatus)) then
<div class="sidemenu">
@@ -73,7 +76,7 @@
let $steps := tokenize($path, '/')
for $step at $p in $steps
return
- (<a href="/wiki/{string-join(subsequence($steps, 1, $p), '/')}/">{$step}</a>, " / ")
+ (<a href="{atom:get-html-uri()}{string-join(subsequence($steps, 1, $p), '/')}/">{$step}</a>, " / ")
}
<form style="display: inline">
<input type="text" name="add-feed" style="width: 75px"/>
@@ -312,11 +315,48 @@
<param name="hashKey" value="{ceiling(math:random() * 100000)}"/>
<param name="editable" value="{$loginStatus}"/>
<param name="uri" value="{request:get-attribute('org.exist.forward.request-uri')}"/>
+ <param name="context" value="{request:get-context-path()}"/>
</parameters>
)
else ()
};
+declare function blog:filter-body($node as node(), $action as xs:string?, $path as xs:string,
+ $loginStatus as xs:string*, $data as node()*) as node()* {
+ typeswitch ($node)
+ case element(wiki:edit-menu) return
+ blog:sidemenu($loginStatus)
+ case element(wiki:create-box) return
+ blog:create-box($node/@feed, $node/@entry, $node/@collapsible)
+ case element(wiki:entries) return
+ blog:render($action, $path, $loginStatus, $data)
+ case element(wiki:subscribe-link) return
+ <div class="subscribe">
+ {
+ let $context := request:get-context-path()
+ let $wikiLink := concat(substring-after(atom:wiki-root(), '/db'), $path)
+ return
+ <a href="{$context}/atom/feeds{$wikiLink}/">
+ <img src="{$context}/images/feed-icon-28x28.png"/>
+ </a>
+ }
+ </div>
+ case element() return
+ element { node-name($node) } {
+ $node/@*,
+ for $child in $node/node() return blog:filter-body($child, $action, $path, $loginStatus, $data)
+ }
+ default return
+ $node
+};
+
+declare function blog:create-body($action as xs:string?, $path as xs:string,
+ $loginStatus as xs:string*, $data as node()*) as node()* {
+ for $node in doc('/db/atom/skin.xml')/wiki:skin/wiki:body/*
+ return
+ blog:filter-body($node, $action, $path, $loginStatus, $data)
+};
+
let $action := request:get-parameter("action", ())
let $id := request:get-parameter("id", ())
let $path := request:get-parameter("feed", ())
@@ -364,14 +404,16 @@
<link rel="stylesheet" type="text/css" href="{$context}/assets/skins/sam/tabview.css"/>
<link type="text/css" href="{$context}/styles/SyntaxHighlighter.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="{$context}/styles/niftyCorners.css"/>
- <link rel="stylesheet" type="text/css" href="{$context}/styles/default.css"/>
+ <link rel="stylesheet" type="text/css" href="{$context}/{$CONFIG_STYLE}"/>
<script type="text/javascript" src="{$context}/scripts/utilities.js"/>
</head>
<body class="yui-skin-sam">
<div id="doc3" class="yui-t1">
<div id="page-head" class="hd">
- <a href="#"><img title="eXist" src="{$context}/logo.jpg"/></a>
+ <a href="{$CONFIG_LOGO/@link}">
+ <img alt="{$CONFIG_LOGO/@alt}" src="{$context}/{$CONFIG_LOGO}"/>
+ </a>
<div id="navbar">
{ blog:navigation($path) }
<h1>
@@ -381,35 +423,7 @@
</div>
</div>
<div id="bd">
- <div id="yui-main">
- <div class="yui-b">
- <div class="yui-ge">
- <div class="yui-u">
- { blog:sidemenu($loginStatus) }
- { blog:create-box("util", "MarkupHelp", true()) }
-
- </div>
- <div id="weblog" class="yui-u first">
- <div class="weblog-content">
- { blog:render($action, $path, $loginStatus, $data) }
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="yui-b">
- { blog:create-box("util", "MainLinks", false()) }
- { blog:create-box("util", "LatestPosts", false()) }
- <div class="subscribe">
- {
- let $wikiLink := concat(substring-after(atom:wiki-root(), '/db'), $path)
- return
- <a href="{request:get-context-path()}/atom/feeds{$wikiLink}/">
- <img src="{$context}/images/feed-icon-28x28.png"/>
- </a>
- }
- </div>
- </div>
+ { blog:create-body($action, $path, $loginStatus, $data) }
</div>
<div id="ft">AtomicWiki 0.1 dev $Id$</div>
</div>
@@ -428,8 +442,8 @@
<script type="text/javascript" src="{$context}/scripts/syntax/shBrushXQuery.js"/-->
<script type="text/javascript" src="{$context}/scripts/logger-min.js"/>
<script type="text/javascript" src="{$context}/scripts/container-min.js"/>
- <script type="text/javascript" src="{$context}/scripts/button-beta-min.js"/>
- <script type="text/javascript" src="{$context}/scripts/tabview-min.js"></script>
+ <script type="text/javascript" src="{$context}/scripts/button-min.js"/>
+ <script type="text/javascript" src="{$context}/scripts/tabview-min.js"/>
<script type="text/javascript" src="{$context}/scripts/blog.js"/>
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|