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
(18) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(5) |
2
(5) |
3
(8) |
4
(8) |
5
(6) |
6
|
|
7
(2) |
8
(3) |
9
(7) |
10
(2) |
11
(2) |
12
(12) |
13
(1) |
|
14
(3) |
15
(5) |
16
(3) |
17
(4) |
18
(5) |
19
(24) |
20
(2) |
|
21
(11) |
22
(10) |
23
(3) |
24
(4) |
25
(5) |
26
(5) |
27
(7) |
|
28
(11) |
29
(8) |
30
(8) |
31
(3) |
|
|
|
|
From: <ch...@us...> - 2007-10-31 21:35:27
|
Revision: 6831
http://exist.svn.sourceforge.net/exist/?rev=6831&view=rev
Author: chaeron
Date: 2007-10-31 14:35:25 -0700 (Wed, 31 Oct 2007)
Log Message:
-----------
Fixed incorrect getting of logged in user, so that if you use xmldb:login to change the active user, it will get picked up by the scheduler extension functions correctly.
Modified Paths:
--------------
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/DeleteScheduledJob.java
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/PauseScheduledJob.java
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ResumeScheduledJob.java
trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ScheduleFunctions.java
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/DeleteScheduledJob.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/DeleteScheduledJob.java 2007-10-31 13:58:52 UTC (rev 6830)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/DeleteScheduledJob.java 2007-10-31 21:35:25 UTC (rev 6831)
@@ -50,7 +50,6 @@
public class DeleteScheduledJob extends BasicFunction
{
private Scheduler scheduler = null;
- private User user = null;
public final static FunctionSignature signature =
new FunctionSignature(
@@ -71,8 +70,7 @@
{
super(context, signature);
- scheduler = context.getBroker().getBrokerPool().getScheduler();
- user = context.getUser();
+ scheduler = context.getBroker().getBrokerPool().getScheduler();
}
/**
@@ -89,6 +87,8 @@
{
String jobName = args[0].getStringValue();
+ User user = context.getUser();
+
//Check if the user is a DBA
if(!user.hasDbaRole())
{
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java 2007-10-31 13:58:52 UTC (rev 6830)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java 2007-10-31 21:35:25 UTC (rev 6831)
@@ -57,7 +57,6 @@
public class GetScheduledJobs extends BasicFunction
{
private Scheduler scheduler = null;
- private User user = null;
public final static FunctionSignature signature =
new FunctionSignature(
@@ -76,7 +75,6 @@
super( context, signature );
scheduler = context.getBroker().getBrokerPool().getScheduler();
- user = context.getUser();
}
/**
@@ -91,6 +89,7 @@
*/
public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
{
+ User user = context.getUser();
boolean userhasDBARole = user.hasDbaRole();
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/PauseScheduledJob.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/PauseScheduledJob.java 2007-10-31 13:58:52 UTC (rev 6830)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/PauseScheduledJob.java 2007-10-31 21:35:25 UTC (rev 6831)
@@ -50,7 +50,6 @@
public class PauseScheduledJob extends BasicFunction
{
private Scheduler scheduler = null;
- private User user = null;
public final static FunctionSignature signature =
new FunctionSignature(
@@ -72,7 +71,6 @@
super(context, signature);
scheduler = context.getBroker().getBrokerPool().getScheduler();
- user = context.getUser();
}
/**
@@ -89,6 +87,8 @@
{
String jobName = args[0].getStringValue();
+ User user = context.getUser();
+
//Check if the user is a DBA
if(!user.hasDbaRole())
{
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ResumeScheduledJob.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ResumeScheduledJob.java 2007-10-31 13:58:52 UTC (rev 6830)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ResumeScheduledJob.java 2007-10-31 21:35:25 UTC (rev 6831)
@@ -50,7 +50,6 @@
public class ResumeScheduledJob extends BasicFunction
{
private Scheduler scheduler = null;
- private User user = null;
public final static FunctionSignature signature =
new FunctionSignature(
@@ -72,7 +71,6 @@
super(context, signature);
scheduler = context.getBroker().getBrokerPool().getScheduler();
- user = context.getUser();
}
/**
@@ -89,6 +87,8 @@
{
String jobName = args[0].getStringValue();
+ User user = context.getUser();
+
//Check if the user is a DBA
if(!user.hasDbaRole())
{
Modified: trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ScheduleFunctions.java
===================================================================
--- trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ScheduleFunctions.java 2007-10-31 13:58:52 UTC (rev 6830)
+++ trunk/eXist/extensions/modules/src/org/exist/xquery/modules/scheduler/ScheduleFunctions.java 2007-10-31 21:35:25 UTC (rev 6831)
@@ -52,7 +52,6 @@
public class ScheduleFunctions extends BasicFunction
{
private Scheduler scheduler = null;
- private User user = null;
public final static FunctionSignature [] signatures = {
new FunctionSignature(
@@ -86,7 +85,6 @@
super(context, signature);
scheduler = context.getBroker().getBrokerPool().getScheduler();
- user = context.getUser();
}
/**
@@ -104,6 +102,8 @@
String resource = args[0].getStringValue();
String cronExpression = args[1].getStringValue();
+ User user = context.getUser();
+
//Check if the user is a DBA
if(!user.hasDbaRole())
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-31 13:59:00
|
Revision: 6830
http://exist.svn.sourceforge.net/exist/?rev=6830&view=rev
Author: brihaye
Date: 2007-10-31 06:58:52 -0700 (Wed, 31 Oct 2007)
Log Message:
-----------
Fixed use of QNames when no QName index is defined (fallback to generic one). To be improved later.
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-31 08:38:08 UTC (rev 6829)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-31 13:58:52 UTC (rev 6830)
@@ -1020,14 +1020,23 @@
final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
final Lock lock = index.db.getLock();
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
- final int collectionId = ((Collection) iter.next()).getId();
+ Collection collection = (Collection) iter.next();
+ final int collectionId = collection.getId();
+ boolean hasQNamedIndex = false;
+ IndexSpec idxConf = collection.getIndexConfiguration(context.getBroker());
+ if (idxConf != null) {
+ FTIndexConfig config = (FTIndexConfig)idxConf.getCustomIndexSpec(FTIndex.ID);
+ if (config != null) {
+ hasQNamedIndex = !config.qnameSpecs.isEmpty();
+ }
+ }
//No QName hints ; try to get the defined indexes for this collection
if (qnames == null || qnames.isEmpty())
qnames = getIndexesOnQnames(context.getBroker(), docs);
else {
//We somehow would like to work on an intersection of the defined QNames and of the passed QNames
}
- if (qnames != null) {
+ if (qnames != null && !qnames.isEmpty() && hasQNamedIndex) {
for (int q = 0; q < qnames.size(); q++) {
QName qname = (QName)qnames.get(q);
IndexQuery query = null;
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-31 08:38:08 UTC (rev 6829)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-31 13:58:52 UTC (rev 6830)
@@ -376,7 +376,12 @@
FTIndexWorker index = (FTIndexWorker)
context.getBroker().getIndexController().getWorkerByIndexId(FTIndex.ID);
NodeSet hits[] = new NodeSet[terms.size()];
- Map hints = new HashMap();
+ Map hints = new HashMap();
+ List qnames = new ArrayList();
+ if (qname != null) {
+ qnames.add(qname);
+ hints.put(FTIndexWorker.QNAMES_KEY, qnames);
+ }
TermMatcher matcher;
for (int k = 0; k < terms.size(); k++) {
String token = (String) terms.get(k);
@@ -408,8 +413,7 @@
throw new XPathException(e);
}
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
- hints.put(FTIndexWorker.START_VALUE, token);
- hints.put(FTIndexWorker.QNAMES_KEY, qname);
+ hints.put(FTIndexWorker.START_VALUE, token);
hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.SEARCH_EXACT);
//hits[k] = index.searchExact(context, contextId, docs, contextSet, axis, hints);
hits[k] = index.search2(context, contextId, docs, contextSet, axis, hints);
@@ -442,8 +446,7 @@
throw new XPathException(e);
}
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
- hints.put(FTIndexWorker.START_VALUE, start);
- hints.put(FTIndexWorker.QNAMES_KEY, qname);
+ hints.put(FTIndexWorker.START_VALUE, start);
hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.GET_NODES);
//hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, hints);
hits[k] = index.search2(context, contextId, docs, contextSet, axis, hints);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-31 08:38:11
|
Revision: 6829
http://exist.svn.sourceforge.net/exist/?rev=6829&view=rev
Author: brihaye
Date: 2007-10-31 01:38:08 -0700 (Wed, 31 Oct 2007)
Log Message:
-----------
Unified search methods. Now... time for test cases.
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 19:42:20 UTC (rev 6828)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-31 08:38:08 UTC (rev 6829)
@@ -105,6 +105,11 @@
private static final Logger LOG = Logger.getLogger(FTIndexWorker.class);
public static final String TOKEN_MATCHER = "token_matcher";
+ public static final String KEY_SEARCH_TYPE = "search_type";
+ //Legacy names
+ public static final String GET_NODES = "get_nodes";
+ public static final String SEARCH = "search";
+ public static final String SEARCH_EXACT = "search_exact";
//private final static String INDEX_ELEMENT = "fulltext";
private final static String INDEX_ELEMENT = "ftindex";
@@ -431,16 +436,16 @@
final int collectionId = ((Collection) i.next()).getId();
final IndexQuery query;
if (start == null) {
- Value startRef = new FTQNamedTokenKey(collectionId);
+ FTQNamedTokenKey startRef = new FTQNamedTokenKey(collectionId);
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else if (end == null) {
- Value startRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
+ FTQNamedTokenKey startRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
context.getBroker().getSymbols(), ((StringValue)start).getStringValue().toLowerCase());
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else {
- Value startRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
+ FTQNamedTokenKey startRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
context.getBroker().getSymbols(), ((StringValue)start).getStringValue().toLowerCase());
- Value endRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
+ FTQNamedTokenKey endRef = new FTQNamedTokenKey(collectionId, (QName)qnames.get(q),
context.getBroker().getSymbols(), ((StringValue)end).getStringValue().toLowerCase());
query = new IndexQuery(IndexQuery.BW, startRef, endRef);
}
@@ -466,14 +471,14 @@
final int collectionId = ((Collection) i.next()).getId();
final IndexQuery query;
if (start == null) {
- Value startRef = new FTGenericTokenKey(collectionId);
+ FTGenericTokenKey startRef = new FTGenericTokenKey(collectionId);
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else if (end == null) {
- Value startRef = new FTGenericTokenKey(collectionId, ((StringValue)start).getStringValue().toLowerCase());
+ FTGenericTokenKey startRef = new FTGenericTokenKey(collectionId, ((StringValue)start).getStringValue().toLowerCase());
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else {
- Value startRef = new FTGenericTokenKey(collectionId, ((StringValue)start).getStringValue().toLowerCase());
- Value endRef = new FTGenericTokenKey(collectionId, ((StringValue)end).getStringValue().toLowerCase());
+ FTGenericTokenKey startRef = new FTGenericTokenKey(collectionId, ((StringValue)start).getStringValue().toLowerCase());
+ FTGenericTokenKey endRef = new FTGenericTokenKey(collectionId, ((StringValue)end).getStringValue().toLowerCase());
query = new IndexQuery(IndexQuery.BW, startRef, endRef);
}
try {
@@ -496,6 +501,7 @@
return (Occurrences[]) cb.occurrences.values().toArray(result);
}
+ /*
public NodeSet getNodes(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
Map hints) throws TerminatedException {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
@@ -575,8 +581,10 @@
}
}
return result;
- }
+ }
+ */
+ /*
public NodeSet search(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, Map hints)
throws TerminatedException {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
@@ -601,7 +609,7 @@
QName qname = (QName)qnames.get(q);
FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
if (LOG.isTraceEnabled())
- LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
+ LOG.trace("Index lookup by QName: " + qname);
//TODO : revisit, particularly for the right truncature ; we match have several strategies there
IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
try {
@@ -641,8 +649,10 @@
}
}
return result;
- }
+ }
+ */
+ /*
//TODO : remove this method ; replace with search() when the start key and the end key would be the same ones
public NodeSet searchExact(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
Map hints) throws TerminatedException {
@@ -654,6 +664,7 @@
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
+ final Lock lock = index.db.getLock();
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final Collection collection = (Collection) iter.next();
final int collectionId = collection.getId();
@@ -665,16 +676,16 @@
}
if (qnames != null) {
for (int q = 0; q < qnames.size(); q++) {
- QName qname = (QName)qnames.get(q);
- Value key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ QName qname = (QName)qnames.get(q);
+ FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
if (LOG.isTraceEnabled())
- LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
- final Lock lock = index.db.getLock();
+ LOG.trace("Index lookup by QName: " + qname);
+ IndexQuery query = new IndexQuery(IndexQuery.EQ, key);
try {
lock.acquire(Lock.READ_LOCK);
//SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
- index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
+ index.db.query(query, cb);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -687,13 +698,13 @@
}
} else {
//TODO : check if we have some pathes defined. If no, return early
- Value key = new FTGenericTokenKey(collectionId, (String)start);
- final Lock lock = index.db.getLock();
+ FTGenericTokenKey key = new FTGenericTokenKey(collectionId, (String)start);
+ IndexQuery query = new IndexQuery(IndexQuery.EQ, key);
try {
lock.acquire(Lock.READ_LOCK);
//SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
- index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
+ index.db.query(query, cb);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -707,6 +718,7 @@
}
return result;
}
+ */
/*
private final class SearchExactCallback implements BTreeCallback {
@@ -995,6 +1007,110 @@
}
}
*/
+
+ public NodeSet search2(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
+ Map hints) throws TerminatedException {
+ List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
+ //Expects a String
+ Object start = hints == null ? null : hints.get(START_VALUE);
+ //Expects a String
+ //TODO : possibly use this key ?
+ Object end = hints == null ? null : hints.get(END_VALUE);
+ TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
+ final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
+ final Lock lock = index.db.getLock();
+ for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
+ final int collectionId = ((Collection) iter.next()).getId();
+ //No QName hints ; try to get the defined indexes for this collection
+ if (qnames == null || qnames.isEmpty())
+ qnames = getIndexesOnQnames(context.getBroker(), docs);
+ else {
+ //We somehow would like to work on an intersection of the defined QNames and of the passed QNames
+ }
+ if (qnames != null) {
+ for (int q = 0; q < qnames.size(); q++) {
+ QName qname = (QName)qnames.get(q);
+ IndexQuery query = null;
+ if (hints.get(KEY_SEARCH_TYPE).equals(GET_NODES)) {
+ //Compute a key for the token
+ FTQNamedTokenKey key;
+ if (start != null && ((String)start).length() > 0) {
+ key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ } else {
+ key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols());
+ }
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + qname);
+ //TODO : try to use the lefmost part of the matcher's expression
+ //eventually, extract the start (and end ?) value from it ?
+ query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
+ } else if (hints.get(KEY_SEARCH_TYPE).equals(SEARCH)) {
+ FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + qname);
+ //TODO : revisit, particularly for the right truncature ; we match have several strategies there
+ query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
+ } else if (hints.get(KEY_SEARCH_TYPE).equals(SEARCH_EXACT)) {
+ FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + qname);
+ query = new IndexQuery(IndexQuery.EQ, key);
+ }
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, (QName)qnames.get(q), matcher);
+ index.db.query(query, cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
+ } else {
+ IndexQuery query = null;
+ //TODO : check if we have some pathes defined. If no, return early
+ if (hints.get(KEY_SEARCH_TYPE).equals(GET_NODES)) {
+ //Compute a key for the token
+ FTGenericTokenKey key;
+ if (start != null && ((String)start).length() > 0) {
+ key = new FTGenericTokenKey(collectionId, (String)start);
+ } else {
+ key = new FTGenericTokenKey(collectionId);
+ }
+ //TODO : try to use the lefmost part of the mather's expression
+ query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
+ } else if (hints.get(KEY_SEARCH_TYPE).equals(SEARCH)) {
+ FTGenericTokenKey key = new FTGenericTokenKey(collectionId, (String)start);
+ //TODO : revisit, particularly for the right truncature ; we match have several strategies there
+ query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
+ } else if (hints.get(KEY_SEARCH_TYPE).equals(SEARCH_EXACT)) {
+ FTGenericTokenKey key = new FTGenericTokenKey(collectionId, (String)start);
+ query = new IndexQuery(IndexQuery.EQ, key); }
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
+ index.db.query(query, cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
+ }
+ return result;
+ }
private final class SearchCallback2 implements BTreeCallback {
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java 2007-10-30 19:42:20 UTC (rev 6828)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java 2007-10-31 08:38:08 UTC (rev 6829)
@@ -188,7 +188,9 @@
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
hints.put(FTIndexWorker.START_VALUE, token);
hints.put(FTIndexWorker.QNAMES_KEY, qnames);
- NodeSet nodes = index.search(context, getExpressionId(), docs, nodeSet, axis, hints);
+ hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.SEARCH);
+ //NodeSet nodes = index.search(context, getExpressionId(), docs, nodeSet, axis, hints);
+ NodeSet nodes = index.search2(context, getExpressionId(), docs, nodeSet, axis, hints);
if (LOG.isTraceEnabled())
LOG.trace("Found " + nodes.getLength() + " for " + token + " in " +
(System.currentTimeMillis() - start));
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 19:42:20 UTC (rev 6828)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-31 08:38:08 UTC (rev 6829)
@@ -92,13 +92,10 @@
matcher = new FuzzyMatcher(term, threshold);
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
//TODO : check this substring
- hints.put(FTIndexWorker.START_VALUE, term.substring(0, 1).toLowerCase());
- hits[k] =
- index.getNodes(
- context, contextId,
- nodes.getDocumentSet(),
- nodes, NodeSet.ANCESTOR,
- hints);
+ hints.put(FTIndexWorker.START_VALUE, term.substring(0, 1).toLowerCase());
+ hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.GET_NODES);
+ //hits[k] = index.getNodes(context, contextId, nodes.getDocumentSet(), nodes, NodeSet.ANCESTOR, hints);
+ hits[k] = index.search2(context, contextId, nodes.getDocumentSet(), nodes, NodeSet.ANCESTOR, hints);
}
}
return mergeResults(hits);
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 19:42:20 UTC (rev 6828)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-31 08:38:08 UTC (rev 6829)
@@ -409,8 +409,10 @@
}
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
hints.put(FTIndexWorker.START_VALUE, token);
- hints.put(FTIndexWorker.QNAMES_KEY, qname);
- hits[k] = index.searchExact(context, contextId, docs, contextSet, axis, hints);
+ hints.put(FTIndexWorker.QNAMES_KEY, qname);
+ hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.SEARCH_EXACT);
+ //hits[k] = index.searchExact(context, contextId, docs, contextSet, axis, hints);
+ hits[k] = index.search2(context, contextId, docs, contextSet, axis, hints);
break;
default :
//Return early
@@ -442,7 +444,9 @@
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
hints.put(FTIndexWorker.START_VALUE, start);
hints.put(FTIndexWorker.QNAMES_KEY, qname);
- hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, hints);
+ hints.put(FTIndexWorker.KEY_SEARCH_TYPE, FTIndexWorker.GET_NODES);
+ //hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, hints);
+ hits[k] = index.search2(context, contextId, docs, contextSet, axis, hints);
}
LOG.debug("Matches for " + token + ": " + hits[k].getLength());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-30 19:42:22
|
Revision: 6828
http://exist.svn.sourceforge.net/exist/?rev=6828&view=rev
Author: dizzzz
Date: 2007-10-30 12:42:20 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
Integrated fluent extention with build process. Run tests with "build.sh test-prepare test-fluent test-wrapup"
we'll need te optimize/refactor the tests. some fail.
Modified Paths:
--------------
trunk/eXist/build/scripts/junit.xml
trunk/eXist/extensions/fluent/build.xml
Modified: trunk/eXist/build/scripts/junit.xml
===================================================================
--- trunk/eXist/build/scripts/junit.xml 2007-10-30 15:28:12 UTC (rev 6827)
+++ trunk/eXist/build/scripts/junit.xml 2007-10-30 19:42:20 UTC (rev 6828)
@@ -191,6 +191,10 @@
<ant antfile="build.xml" dir="extensions/indexes" target="test"/>
</target>
+ <target name="test-fluent" depends="prepare-extensions">
+ <ant antfile="build.xml" dir="extensions/fluent" target="test"/>
+ </target>
+
<!-- Helper target for starting server -->
<target name="start-server">
<echo message="---------------------------------------"/>
Modified: trunk/eXist/extensions/fluent/build.xml
===================================================================
--- trunk/eXist/extensions/fluent/build.xml 2007-10-30 15:28:12 UTC (rev 6827)
+++ trunk/eXist/extensions/fluent/build.xml 2007-10-30 19:42:20 UTC (rev 6828)
@@ -5,6 +5,7 @@
<property name="test" value="./test"/>
<property name="javadoc" value="./javadoc"/>
<property name="top.dir" value="../.."/>
+ <property name="junit.index.reports" value="${top.dir}/test/junit/data"/>
<property name="build.compiler" value="modern"/>
@@ -39,10 +40,11 @@
</path>
- <target name="all" depends="jar,javadoc"/> <!-- ,test -->
+ <target name="all" depends="jar"/> <!-- ,javadoc -->
<target name="prepare">
<mkdir dir="${classes}"/>
+ <mkdir dir="${test}/classes"/>
</target>
<target name="compile" depends="prepare" unless="java14-only">
@@ -58,6 +60,19 @@
<path refid="classpath.core"/>
</classpath>
</javac>
+
+ <echo message="----------------------"/>
+ <echo message="Compiling fluent tests"/>
+ <echo message="----------------------"/>
+ <javac debug="${build.debug}" deprecation="${build.deprecation}"
+ destdir="${test}/classes" encoding="UTF-8"
+ optimize="${build.optimize}" srcdir="${test}/src"
+ source="1.5" target="1.5">
+ <classpath>
+ <path refid="classpath.core"/>
+ <path refid="classpath.jar"/>
+ </classpath>
+ </javac>
</target>
<target name="jar" depends="compile">
@@ -94,19 +109,6 @@
<target name="test" depends="compile">
<echo message="Running fluent extension tests"/>
- <mkdir dir="${test}/classes"/>
- <mkdir dir="${test}/reports/html"/>
- <mkdir dir="${test}/reports/data"/>
- <javac debug="${build.debug}" deprecation="${build.deprecation}"
- destdir="${test}/classes" encoding="UTF-8"
- optimize="${build.optimize}" srcdir="${test}/src"
- source="1.5" target="1.5">
- <classpath>
- <path refid="classpath.core"/>
- <path refid="classpath.jar"/>
- </classpath>
- </javac>
-
<junit haltonfailure="false" printsummary="yes" showoutput="${junit.output}"
maxmemory="${junit.forked.VM.maxmemory}">
<sysproperty key="exist.home" value="${basedir}"/>
@@ -119,7 +121,7 @@
<formatter type="plain"/>
<formatter type="xml"/>
- <batchtest fork="yes" todir="${test}/reports/data">
+ <batchtest fork="yes" todir="${junit.index.reports}">
<fileset dir="${test}/classes">
<include name="**/*Test.class"/>
</fileset>
@@ -127,12 +129,6 @@
</junit>
- <junitreport> <!-- todir="${test}/reports/html" -->
- <fileset dir="${test}/reports/data">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="${test}/reports/html"/>
- </junitreport>
</target>
<target name="clean">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-30 15:28:16
|
Revision: 6827
http://exist.svn.sourceforge.net/exist/?rev=6827&view=rev
Author: brihaye
Date: 2007-10-30 08:28:12 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
Every search method should now be able to work on Qname as well as generic indexes (purely theoretical though).
If no QName is passed by a preselection step, default to the available QName indexes. To be discussed and possibly improved though...
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 14:53:01 UTC (rev 6826)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 15:28:12 UTC (rev 6827)
@@ -394,15 +394,15 @@
* @param docs
* @return
*/
- private List getDefinedIndexes(DBBroker broker, DocumentSet docs) {
+ private List getIndexesOnQnames(DBBroker broker, DocumentSet docs) {
List indexes = new ArrayList(20);
for (Iterator i = docs.getCollectionIterator(); i.hasNext(); ) {
Collection collection = (Collection) i.next();
IndexSpec idxConf = collection.getIndexConfiguration(broker);
if (idxConf != null) {
- Map config = (Map) idxConf.getCustomIndexSpec(FTIndex.ID);
+ FTIndexConfig config = (FTIndexConfig)idxConf.getCustomIndexSpec(FTIndex.ID);
if (config != null) {
- for (Iterator ci = config.keySet().iterator(); ci.hasNext();) {
+ for (Iterator ci = config.qnameSpecs.iterator(); ci.hasNext();) {
QName qn = (QName) ci.next();
indexes.add(qn);
}
@@ -418,16 +418,13 @@
public Occurrences[] scanIndex(XQueryContext context, DocumentSet docs, NodeSet contextSet, Map hints) {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
- //Expects a StringValue (TODO : pass a string)
+ //Expects a StringValue (TODO : pass a lower-case ? string)
Object start = hints == null ? null : hints.get(START_VALUE);
- //Expects a StringValue (TODO : pass a string)
+ //Expects a StringValue (TODO : pass a lower case ? string)
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
final Lock lock = index.db.getLock();
- final IndexScanCallback cb = new IndexScanCallback(docs, contextSet, matcher, qnames != null);
- //TODO : Should we attempt the query on both index types ?
- //Not sure. Why provide QNAMES_KEY then ?
- //Well : qnames = getDefinedIndexes(context.getBroker(), docs) provides a very good one :-)
+ final IndexScanCallback cb = new IndexScanCallback(docs, contextSet, matcher, qnames != null);
if (qnames != null) {
for (int q = 0; q < qnames.size(); q++) {
for (Iterator i = docs.getCollectionIterator(); i.hasNext();) {
@@ -464,6 +461,7 @@
}
}
} else {
+ //TODO : check if we have some pathes defined. If no, return early
for (Iterator i = docs.getCollectionIterator(); i.hasNext();) {
final int collectionId = ((Collection) i.next()).getId();
final IndexQuery query;
@@ -510,22 +508,28 @@
final NodeSet result = new ExtArrayNodeSet();
final Lock lock = index.db.getLock();
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
- final int collectionId = ((Collection) iter.next()).getId();
+ final int collectionId = ((Collection) iter.next()).getId();
+ //No QName hints ; try to get the defined indexes for this collection
+ if (qnames == null || qnames.isEmpty())
+ qnames = getIndexesOnQnames(context.getBroker(), docs);
+ else {
+ //We somehow would like to work on an intersection of the defined QNames and of the passed QNames
+ }
if (qnames != null) {
for (int q = 0; q < qnames.size(); q++) {
QName qname = (QName)qnames.get(q);
//Compute a key for the token
- Value value;
+ Value key;
if (start != null && ((String)start).length() > 0) {
- value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
} else {
- value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols());
+ key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols());
}
if (LOG.isTraceEnabled())
LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
//TODO : try to use the lefmost part of the matcher's expression
//eventually, extract the start (and end ?) value from it ?
- IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, value);
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
try {
lock.acquire(Lock.READ_LOCK);
final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, (QName)qnames.get(q), matcher);
@@ -543,15 +547,16 @@
}
}
} else {
+ //TODO : check if we have some pathes defined. If no, return early
//Compute a key for the token
- Value value;
+ Value key;
if (start != null && ((String)start).length() > 0) {
- value = new FTGenericTokenKey(collectionId, (String)start);
+ key = new FTGenericTokenKey(collectionId, (String)start);
} else {
- value = new FTGenericTokenKey(collectionId);
+ key = new FTGenericTokenKey(collectionId);
}
//TODO : try to use the lefmost part of the mather's expression
- IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, value);
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
try {
lock.acquire(Lock.READ_LOCK);
final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
@@ -570,9 +575,8 @@
}
}
return result;
- }
+ }
- //TODO : use generic index as well : or, better ?, add a method for generic index
public NodeSet search(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, Map hints)
throws TerminatedException {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
@@ -582,14 +586,17 @@
//TODO : possibly use this key ?
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
- if (qnames == null || qnames.isEmpty())
- //TODO : mmmmh : that prevents the use of the generic index. See above.
- qnames = getDefinedIndexes(context.getBroker(), docs);
final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
final Lock lock = index.db.getLock();
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final int collectionId = ((org.exist.collections.Collection) iter.next()).getId();
- if (qnames != null) {
+ //No QName hints ; try to get the defined indexes for this collection
+ if (qnames == null || qnames.isEmpty())
+ qnames = getIndexesOnQnames(context.getBroker(), docs);
+ else {
+ //We somehow would like to work on an intersection of the defined QNames and of the passed QNames
+ }
+ if (qnames != null) {
for (int q = 0; q < qnames.size(); q++) {
QName qname = (QName)qnames.get(q);
FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
@@ -612,7 +619,8 @@
lock.release(Lock.READ_LOCK);
}
}
- } else {
+ } else {
+ //TODO : check if we have some pathes defined. If no, return early
FTGenericTokenKey key = new FTGenericTokenKey(collectionId, (String)start);
//TODO : revisit, particularly for the right truncature ; we match have several strategies there
IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
@@ -649,6 +657,12 @@
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final Collection collection = (Collection) iter.next();
final int collectionId = collection.getId();
+ //No QName hints ; try to get the defined indexes for this collection
+ if (qnames == null || qnames.isEmpty())
+ qnames = getIndexesOnQnames(context.getBroker(), docs);
+ else {
+ //We somehow would like to work on an intersection of the defined QNames and of the passed QNames
+ }
if (qnames != null) {
for (int q = 0; q < qnames.size(); q++) {
QName qname = (QName)qnames.get(q);
@@ -672,6 +686,7 @@
}
}
} else {
+ //TODO : check if we have some pathes defined. If no, return early
Value key = new FTGenericTokenKey(collectionId, (String)start);
final Lock lock = index.db.getLock();
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-30 14:53:03
|
Revision: 6826
http://exist.svn.sourceforge.net/exist/?rev=6826&view=rev
Author: dizzzz
Date: 2007-10-30 07:53:01 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
Updated junit tests
Modified Paths:
--------------
trunk/eXist/extensions/fluent/build.xml
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseEmptiesTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseHelper.java
Added Paths:
-----------
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemListTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ListenerManagerTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/NodeTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/QueryServiceTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentTest.java
Removed Paths:
-------------
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemListHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ListenerManagerHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/NodeHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/QueryServiceHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentHelper.java
Modified: trunk/eXist/extensions/fluent/build.xml
===================================================================
--- trunk/eXist/extensions/fluent/build.xml 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/build.xml 2007-10-30 14:53:01 UTC (rev 6826)
@@ -22,9 +22,12 @@
<fileset dir="${top.dir}/${tools.ant}/lib">
<include name="*.jar"/>
</fileset>
- <fileset dir="./lib">
+ <fileset dir="${top.dir}/${lib.extensions}">
<include name="*.jar"/>
</fileset>
+ <fileset dir="${top.dir}/extensions/fluent/lib">
+ <include name="*.jar"/>
+ </fileset>
<pathelement path="${top.dir}/exist.jar"/>
<pathelement path="${java.class.path}"/>
</path>
@@ -36,7 +39,7 @@
</path>
- <target name="all" depends="jar,javadoc"/> <!-- test -->
+ <target name="all" depends="jar,javadoc"/> <!-- ,test -->
<target name="prepare">
<mkdir dir="${classes}"/>
Modified: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseEmptiesTest.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseEmptiesTest.java 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseEmptiesTest.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -1,7 +1,5 @@
package org.exist.fluent;
-import junit.framework.TestCase;
-
import java.util.NoSuchElementException;
/**
Modified: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseHelper.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseHelper.java 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseHelper.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -1,15 +1,15 @@
package org.exist.fluent;
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.*;
-
import org.exist.security.PermissionDeniedException;
import org.exist.security.SecurityManager;
import org.exist.storage.DBBroker;
import org.exist.xmldb.XmldbURI;
import org.jmock.cglib.MockObjectTestCase;
+import java.io.File;
+import java.io.IOException;
+import java.lang.annotation.*;
+
/**
* A superclass for database unit tests. It takes care of starting up and clearing the database in
* its <code>setUp</code> method, and supports mocking with jMock. By default, the database
@@ -53,7 +53,11 @@
} finally {
tx.abortIfIncomplete();
db.releaseBroker(broker);
- }
+ }
}
+
+ @Override protected void tearDown() throws Exception {
+ Database.shutdown();
+ }
}
\ No newline at end of file
Deleted: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -1,27 +0,0 @@
-package org.exist.fluent;
-
-/**
- * Created by IntelliJ IDEA.
- * User: wessels
- * Date: Oct 29, 2007
- * Time: 8:46:20 PM
- * To change this template use File | Settings | File Templates.
- */
-public class DatabaseMiscHelper extends DatabaseHelper {
- public void testQueryDocs1() {
- Folder c1 = db.createFolder("/c1");
- XMLDocument d1 = c1.documents().build(Name.generate()).elem("test1").end("test1").commit();
- XMLDocument d2 = c1.documents().build(Name.generate()).elem("test2").end("test2").commit();
- c1.documents().build(Name.generate()).elem("test3").end("test3").commit();
- assertTrue(db.query(d1, d2).exists("/test1"));
- assertTrue(db.query(d1, d2).exists("/test2"));
- assertFalse(db.query(d1, d2).exists("/test3"));
- }
-
- public void testQueryBaseUri() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- assertFalse(db.query().single("doc-available('original')").booleanValue());
- assertTrue(db.query().single("doc-available('c1/original')").booleanValue());
- }
-}
Copied: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscTest.java (from rev 6823, trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java)
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscTest.java (rev 0)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscTest.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -0,0 +1,27 @@
+package org.exist.fluent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: wessels
+ * Date: Oct 29, 2007 {lib.endorsed}
+ * Time: 8:46:20 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class DatabaseMiscTest extends DatabaseHelper {
+ public void testQueryDocs1() {
+ Folder c1 = db.createFolder("/c1");
+ XMLDocument d1 = c1.documents().build(Name.generate()).elem("test1").end("test1").commit();
+ XMLDocument d2 = c1.documents().build(Name.generate()).elem("test2").end("test2").commit();
+ c1.documents().build(Name.generate()).elem("test3").end("test3").commit();
+ assertTrue(db.query(d1, d2).exists("/test1"));
+ assertTrue(db.query(d1, d2).exists("/test2"));
+ assertFalse(db.query(d1, d2).exists("/test3"));
+ }
+
+ public void testQueryBaseUri() {
+ Folder c1 = db.createFolder("/c1");
+ c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ assertFalse(db.query().single("doc-available('original')").booleanValue());
+ assertTrue(db.query().single("doc-available('c1/original')").booleanValue());
+ }
+}
Deleted: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -1,312 +0,0 @@
-package org.exist.fluent;
-
-import org.w3c.dom.*;
-import org.w3c.dom.Node;
-
-/**
- * Created by IntelliJ IDEA.
- * User: wessels
- * Date: Oct 29, 2007
- * Time: 8:48:19 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ElementBuilderHelper extends DatabaseHelper {
- public void testEmpty() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(org.w3c.dom.Node[] node) {fail("completed called"); return null;}
- });
- builder.commit();
- }
-
- public void testElemOnStack() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("blah").commit();
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testNoFragAllowed() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").elem("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testMismatchedEndSingle() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testMismatchedEndMultiple() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test2", "test3", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testElemAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.elem("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testAttrAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.attr("test2","blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testTextAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.text("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testAttrWithoutElem1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.attr("blah", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testAttrWithoutElem2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").attr("blah", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testTextWithoutElemNoFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.text("blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testTextWithoutElemNoFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").text("blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
-
- public void testTextWithoutElemFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- builder.text("blah").commit();
- }
-
- public void testTextWithoutElemFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- builder.elem("test").end("test").text("blah").commit();
- }
-
- public void testCommitOne() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {assertEquals(1, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); return null;}
- });
- builder.elem("test").end("test").commit();
- }
-
- public void testCommitFrag() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {assertEquals(2, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); assertEquals(Node.ELEMENT_NODE, nodes[1].getNodeType()); return null;}
- });
- builder.elem("test").end("test").elem("test2").end("test2").commit();
- }
-
- public void testStructure1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test/>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").end("test").commit();
- }
-
- public void testStructure2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test><test2/></test>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").elem("test2").end("test2").end("test").commit();
- }
-
- public void testStructure3() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test foo='bar'/>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attr("foo", "bar").end("test").commit();
- }
-
- public void testStructure4() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test>blah</test>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").text("blah").end("test").commit();
- }
-
- public void testStructure5() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test foo='bar'/>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attrIf(true, "foo", "bar").end("test").commit();
- }
-
- public void testStructure6() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test/>", ElementBuilderHelper.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attrIf(false, "foo", "bar").end("test").commit();
- }
-
- public void testFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(2, nodes.length);
- assertEquals("<test1/><test2/>", ElementBuilderHelper.toString(nodes[0]) + ElementBuilderHelper.toString(nodes[1]));
- return null;
- }
- });
- builder.elem("test1").end("test1").elem("test2").end("test2").commit();
- }
-
- public void testFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(2, nodes.length);
- assertEquals("blahfoo", ElementBuilderHelper.toString(nodes[0]) + ElementBuilderHelper.toString(nodes[1]));
- return null;
- }
- });
- builder.text("blah").text("foo").commit();
- }
-
- static String toString(Node node) {
- StringBuilder buf = new StringBuilder();
- toBuf(node, buf);
- return buf.toString();
- }
-
- private static void toBuf(Node node, StringBuilder buf) {
- switch (node.getNodeType()) {
-
- case Node.DOCUMENT_FRAGMENT_NODE: {
- NodeList children = node.getChildNodes();
- for (int i=0; i<children.getLength(); i++) toBuf(children.item(i), buf);
- break;
- }
-
- case Node.DOCUMENT_NODE:
- buf.append("<?xml version=\"1.0\" ?>");
- toBuf(((org.w3c.dom.Document) node).getDocumentElement(), buf);
- break;
-
- case Node.ELEMENT_NODE: {
- buf.append("<").append(node.getNodeName());
- NamedNodeMap attrs = node.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Node attr = attrs.item(i);
- buf.append(" ").append(attr.getNodeName()).append("='").append(attr.getNodeValue()).append("'");
- }
- NodeList children = node.getChildNodes();
- if (children.getLength() == 0) {
- buf.append("/>");
- } else {
- buf.append(">");
- for (int i = 0; i < children.getLength(); i++) toBuf(children.item(i), buf);
- buf.append("</").append(node.getNodeName()).append(">");
- }
- break;
- }
-
- case Node.ENTITY_REFERENCE_NODE:
- buf.append("&").append(node.getNodeName()).append(";");
- break;
-
- case Node.TEXT_NODE:
- buf.append(node.getNodeValue());
- break;
-
- default:
- throw new RuntimeException("can't deal with node type " + node.getNodeType());
- }
-
- }
-}
Copied: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderTest.java (from rev 6823, trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java)
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderTest.java (rev 0)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderTest.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -0,0 +1,313 @@
+package org.exist.fluent;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: wessels
+ * Date: Oct 29, 2007
+ * Time: 8:48:19 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ElementBuilderTest extends DatabaseHelper {
+ public void testEmpty() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(org.w3c.dom.Node[] node) {fail("completed called"); return null;}
+ });
+ builder.commit();
+ }
+
+ public void testElemOnStack() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("blah").commit();
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testNoFragAllowed() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("test").end("test").elem("test2");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testMismatchedEndSingle() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("test").end("test2");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testMismatchedEndMultiple() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("test").end("test2", "test3", "blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testElemAfterCommit() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {return null;}
+ });
+ try {
+ builder.elem("test").end("test").commit();
+ builder.elem("test2");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testAttrAfterCommit() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {return null;}
+ });
+ try {
+ builder.elem("test").end("test").commit();
+ builder.attr("test2","blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testTextAfterCommit() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {return null;}
+ });
+ try {
+ builder.elem("test").end("test").commit();
+ builder.text("test2");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testAttrWithoutElem1() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.attr("blah", "blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testAttrWithoutElem2() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("test").end("test").attr("blah", "blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testTextWithoutElemNoFrag1() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.text("blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testTextWithoutElemNoFrag2() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {fail("completed called"); return null;}
+ });
+ try {
+ builder.elem("test").end("test").text("blah");
+ fail();
+ } catch (IllegalStateException e) {
+ }
+ }
+
+ public void testTextWithoutElemFrag1() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {return null;}
+ });
+ builder.text("blah").commit();
+ }
+
+ public void testTextWithoutElemFrag2() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] node) {return null;}
+ });
+ builder.elem("test").end("test").text("blah").commit();
+ }
+
+ public void testCommitOne() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {assertEquals(1, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); return null;}
+ });
+ builder.elem("test").end("test").commit();
+ }
+
+ public void testCommitFrag() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {assertEquals(2, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); assertEquals(Node.ELEMENT_NODE, nodes[1].getNodeType()); return null;}
+ });
+ builder.elem("test").end("test").elem("test2").end("test2").commit();
+ }
+
+ public void testStructure1() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test/>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").end("test").commit();
+ }
+
+ public void testStructure2() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test><test2/></test>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").elem("test2").end("test2").end("test").commit();
+ }
+
+ public void testStructure3() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test foo='bar'/>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").attr("foo", "bar").end("test").commit();
+ }
+
+ public void testStructure4() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test>blah</test>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").text("blah").end("test").commit();
+ }
+
+ public void testStructure5() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test foo='bar'/>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").attrIf(true, "foo", "bar").end("test").commit();
+ }
+
+ public void testStructure6() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(1, nodes.length);
+ assertEquals("<test/>", ElementBuilderTest.toString(nodes[0]));
+ return null;
+ }
+ });
+ builder.elem("test").attrIf(false, "foo", "bar").end("test").commit();
+ }
+
+ public void testFrag1() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(2, nodes.length);
+ assertEquals("<test1/><test2/>", ElementBuilderTest.toString(nodes[0]) + ElementBuilderTest.toString(nodes[1]));
+ return null;
+ }
+ });
+ builder.elem("test1").end("test1").elem("test2").end("test2").commit();
+ }
+
+ public void testFrag2() {
+ ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new ElementBuilder.CompletedCallback<Object>() {
+ public Object completed(Node[] nodes) {
+ assertEquals(2, nodes.length);
+ assertEquals("blahfoo", ElementBuilderTest.toString(nodes[0]) + ElementBuilderTest.toString(nodes[1]));
+ return null;
+ }
+ });
+ builder.text("blah").text("foo").commit();
+ }
+
+ static String toString(Node node) {
+ StringBuilder buf = new StringBuilder();
+ toBuf(node, buf);
+ return buf.toString();
+ }
+
+ private static void toBuf(Node node, StringBuilder buf) {
+ switch (node.getNodeType()) {
+
+ case Node.DOCUMENT_FRAGMENT_NODE: {
+ NodeList children = node.getChildNodes();
+ for (int i=0; i<children.getLength(); i++) toBuf(children.item(i), buf);
+ break;
+ }
+
+ case Node.DOCUMENT_NODE:
+ buf.append("<?xml version=\"1.0\" ?>");
+ toBuf(((org.w3c.dom.Document) node).getDocumentElement(), buf);
+ break;
+
+ case Node.ELEMENT_NODE: {
+ buf.append("<").append(node.getNodeName());
+ NamedNodeMap attrs = node.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Node attr = attrs.item(i);
+ buf.append(" ").append(attr.getNodeName()).append("='").append(attr.getNodeValue()).append("'");
+ }
+ NodeList children = node.getChildNodes();
+ if (children.getLength() == 0) {
+ buf.append("/>");
+ } else {
+ buf.append(">");
+ for (int i = 0; i < children.getLength(); i++) toBuf(children.item(i), buf);
+ buf.append("</").append(node.getNodeName()).append(">");
+ }
+ break;
+ }
+
+ case Node.ENTITY_REFERENCE_NODE:
+ buf.append("&").append(node.getNodeName()).append(";");
+ break;
+
+ case Node.TEXT_NODE:
+ buf.append(node.getNodeValue());
+ break;
+
+ default:
+ throw new RuntimeException("can't deal with node type " + node.getNodeType());
+ }
+
+ }
+}
Deleted: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java 2007-10-30 14:20:26 UTC (rev 6825)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -1,375 +0,0 @@
-package org.exist.fluent;
-
-/**
- * Created by IntelliJ IDEA.
- * User: wessels
- * Date: Oct 29, 2007
- * Time: 8:49:39 PM
- * To change this template use File | Settings | File Templates.
- */
-public class FolderHelper extends DatabaseHelper {
- public void testCreateTop() {
- db.createFolder("/top");
- try {
- db.getFolder("/top");
- } catch (DatabaseException e) {
- fail(e.getMessage());
- }
- }
-
- public void testCreateNested() {
- db.createFolder("/top/nested");
- try {
- db.getFolder("/top/nested");
- } catch (DatabaseException e) {
- fail(e.getMessage());
- }
- }
-
- public void testGetRoot() {
- assertEquals("", db.getFolder("/").name());
- }
-
- public void testGetMissingTop1() {
- try {
- db.getFolder("/top");
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testGetMissingNested1() {
- try {
- db.getFolder("/top/nested");
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testDuplicate1() {
- Folder c1 = db.createFolder("/top");
- Folder c2 = c1.clone();
- assertEquals(c1.path(), c2.path());
- }
-
- public void testDuplicate2() {
- Folder c1 = db.createFolder("/top");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- Folder c2 = c1.clone();
- assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
- }
-
- public void testGetName1() {
- assertEquals("top", db.createFolder("/top").name());
- }
-
- public void testGetName2() {
- assertEquals("nested", db.createFolder("/top/nested").name());
- }
-
- public void testGetPath1() {
- assertEquals("/top", db.createFolder("/top").path());
- }
-
- public void testGetPath2() {
- assertEquals("/top/nested", db.createFolder("/top/nested").path());
- }
-
- public void testGetPath3() {
- assertEquals("/", db.createFolder("/").path());
- }
-
- public void testGetParent1() {
- assertEquals("/top", db.createFolder("/top/nested").parent().path());
- }
-
- public void testGetParent2() {
- try {
- db.getFolder("/").parent();
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testGetChild1() {
- db.createFolder("/top/nested");
- db.getFolder("/top").children().get("nested");
- }
-
- public void testGetChild2() {
- db.createFolder("/top/nested/more");
- db.getFolder("/top").children().get("nested/more");
- }
-
- public void testGetChild3() {
- db.createFolder("/top/nested");
- try {
- db.getFolder("/top").children().get("/nested");
- fail();
- } catch (IllegalArgumentException e) {
- }
- }
-
- public void testGetChild4() {
- db.createFolder("/top/nested");
- db.getFolder("/").children().get("top");
- }
-
- public void testGetChild5() {
- db.createFolder("/top/nested");
- Folder c1 = db.getFolder("/top");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- Folder c2 = c1.children().get("nested");
- assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
- }
-
- public void testNamespace1() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get("foo"));
- }
-
- public void testNamespace2() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("", "http://www.ideanest.com/");
- assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get(""));
- }
-
- public void testNamespace3() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().remove("foo");
- assertNull(c1.namespaceBindings().get("foo"));
- }
-
- public void testNamespace4() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().put("bar", "urn:blah");
- c1.namespaceBindings().remove("foo");
- assertNull(c1.namespaceBindings().get("foo"));
- assertEquals("urn:blah", c1.namespaceBindings().get("bar"));
- }
-
- public void testNamespace5() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().put("bar", "urn:blah");
- c1.namespaceBindings().clear();
- assertNull(c1.namespaceBindings().get("foo"));
- assertNull(c1.namespaceBindings().get("bar"));
- }
-
- public void testBuildDocument1() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
- assertEquals(1, c1.documents().size());
- }
-
- public void testBuildDocument2() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
- c1.documents().build(Name.overwrite("doc1")).elem("test2").end("test2").commit();
- assertEquals(1, c1.documents().size());
- }
-
- public void testBuildDocument3() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
- try {
- c1.documents().build(Name.create("doc1")).elem("test2").end("test2").commit();
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testBuildDocument4() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(1, c1.documents().size());
- }
-
- public void testBuildDocument5() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(2, c1.documents().size());
- }
-
- public void testSize1() {
- assertEquals(0, db.getFolder("/").documents().size());
- }
-
- public void testSize2() {
- Folder c1 = db.createFolder("/top/nested");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
- assertEquals(3, c1.documents().size());
- assertEquals(0, db.getFolder("/top").documents().size());
- }
-
- public void testChildrenSize1() {
- Folder c1 = db.createFolder("/top");
- assertEquals(0, c1.children().size());
- }
-
- public void testChildrenSize2() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- assertEquals(2, c1.children().size());
- }
-
- public void testChildrenSize3() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2").documents().build(Name.generate()).elem("test").end("test").commit();
- Folder c1 = db.getFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(2, c1.children().size());
- }
-
- public void testClear1() {
- Folder c1 = db.createFolder("/top");
- c1.clear();
- assertEquals(0, c1.documents().size());
- }
-
- public void testClear2() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.clear();
- assertEquals(0, c1.documents().size());
- }
-
- public void testClear3() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- c1.clear();
- assertEquals(0, c1.children().size());
- }
-
- public void testClear4() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested1/more");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.clear();
- assertEquals(0, c1.documents().size());
- assertEquals(0, c1.children().size());
- }
-
- public void testDelete1() {
- Folder c1 = db.createFolder("/top/nested");
- db.getFolder("/top/nested");
- c1.delete();
- try {
- db.getFolder("/top/nested");
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testDelete2() {
- db.createFolder("/top/nested/more");
- Folder c1 = db.getFolder("/top/nested");
- db.getFolder("/top/nested/more");
- c1.delete();
- try {
- db.getFolder("/top/nested/more");
- fail();
- } catch (DatabaseException e) {
- }
- }
-
- public void testGetDocument() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- Document d = c1.documents().get("original");
- assertNotNull(d);
- }
-
- public void testQuery1() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- c1.query().single("/test");
- }
-
- public void testQuery2() {
- Folder c1 = db.createFolder("/c1");
- c1.namespaceBindings().put("", "http://example.com");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- c1.query().single("/test");
- }
-
- public void testQueryBaseUri() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- assertTrue(c1.query().single("doc-available('original')").booleanValue());
- }
-
- public void testConvertToSequence() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- c1.documents().build(Name.create("one")).elem("test").end("test").commit();
- c1.children().create("sub").documents().build(Name.create("another")).elem("test").end("test").commit();
- assertEquals(0, c2.query().all("/test").size());
- assertEquals(2, c1.query().all("/test").size());
- assertEquals(2, c2.query().all("$_1/test", new Object[] {c1}).size());
- }
-
- public void testConvertDocumentsToSequence() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- c1.documents().build(Name.create("one")).elem("test").end("test").commit();
- c1.children().create("sub").documents().build(Name.create("another")).elem("test").end("test").commit();
- assertEquals(0, c2.query().all("/test").size());
- assertEquals(1, c2.query().all("$_1/test", new Object[] {c1.documents()}).size());
- }
-
- public void testMove1() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f = c1.children().create("f");
- f.move(c2, Name.keepCreate());
- assertEquals("/c2/f", f.path());
- assertEquals(c2, f.parent());
- }
-
- public void testMove2() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f = c1.children().create("f");
- f.move(c2, Name.create("g"));
- assertEquals("/c2/g", f.path());
- assertEquals(c2, f.parent());
- }
-
- public void testMove3() {
- Folder c1 = db.createFolder("/c1");
- Folder f = c1.children().create("f");
- f.move(f.parent(), Name.create("g"));
- assertEquals("/c1/g", f.path());
- assertEquals(c1, f.parent());
- }
-
- public void testCopy1() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f1 = c1.children().create("f");
- Folder f2 = f1.copy(c2, Name.keepCreate());
- assertEquals("/c1/f", f1.path());
- assertEquals(c1, f1.parent());
- assertEquals("/c2/f", f2.path());
- assertEquals(c2, f2.parent());
- }
-
- public void testCopy2() {
- Folder c1 = db.createFolder("/c1");
- Folder f1 = c1.children().create("f1");
- Folder f2 = f1.copy(f1.parent(), Name.create("f2"));
- assertEquals("/c1/f1", f1.path());
- assertEquals(c1, f1.parent());
- assertEquals("/c1/f2", f2.path());
- assertEquals(c1, f2.parent());
- }
-}
Copied: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java (from rev 6823, trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java)
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java (rev 0)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderTest.java 2007-10-30 14:53:01 UTC (rev 6826)
@@ -0,0 +1,375 @@
+package org.exist.fluent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: wessels
+ * Date: Oct 29, 2007
+ * Time: 8:49:39 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class FolderTest extends DatabaseHelper {
+ public void testCreateTop() {
+ db.createFolder("/top");
+ try {
+ db.getFolder("/top");
+ } catch (DatabaseException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testCreateNested() {
+ db.createFolder("/top/nested");
+ try {
+ db.getFolder("/top/nested");
+ } catch (DatabaseException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testGetRoot() {
+ assertEquals("", db.getFolder("/").name());
+ }
+
+ public void testGetMissingTop1() {
+ try {
+ db.getFolder("/top");
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testGetMissingNested1() {
+ try {
+ db.getFolder("/top/nested");
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testDuplicate1() {
+ Folder c1 = db.createFolder("/top");
+ Folder c2 = c1.clone();
+ assertEquals(c1.path(), c2.path());
+ }
+
+ public void testDuplicate2() {
+ Folder c1 = db.createFolder("/top");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ Folder c2 = c1.clone();
+ assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
+ }
+
+ public void testGetName1() {
+ assertEquals("top", db.createFolder("/top").name());
+ }
+
+ public void testGetName2() {
+ assertEquals("nested", db.createFolder("/top/nested").name());
+ }
+
+ public void testGetPath1() {
+ assertEquals("/top", db.createFolder("/top").path());
+ }
+
+ public void testGetPath2() {
+ assertEquals("/top/nested", db.createFolder("/top/nested").path());
+ }
+
+ public void testGetPath3() {
+ assertEquals("/", db.createFolder("/").path());
+ }
+
+ public void testGetParent1() {
+ assertEquals("/top", db.createFolder("/top/nested").parent().path());
+ }
+
+ public void testGetParent2() {
+ try {
+ db.getFolder("/").parent();
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testGetChild1() {
+ db.createFolder("/top/nested");
+ db.getFolder("/top").children().get("nested");
+ }
+
+ public void testGetChild2() {
+ db.createFolder("/top/nested/more");
+ db.getFolder("/top").children().get("nested/more");
+ }
+
+ public void testGetChild3() {
+ db.createFolder("/top/nested");
+ try {
+ db.getFolder("/top").children().get("/nested");
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ public void testGetChild4() {
+ db.createFolder("/top/nested");
+ db.getFolder("/").children().get("top");
+ }
+
+ public void testGetChild5() {
+ db.createFolder("/top/nested");
+ Folder c1 = db.getFolder("/top");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ Folder c2 = c1.children().get("nested");
+ assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
+ }
+
+ public void testNamespace1() {
+ Folder c1 = db.getFolder("/");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get("foo"));
+ }
+
+ public void testNamespace2() {
+ Folder c1 = db.getFolder("/");
+ c1.namespaceBindings().put("", "http://www.ideanest.com/");
+ assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get(""));
+ }
+
+ public void testNamespace3() {
+ Folder c1 = db.getFolder("/");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ c1.namespaceBindings().remove("foo");
+ assertNull(c1.namespaceBindings().get("foo"));
+ }
+
+ public void testNamespace4() {
+ Folder c1 = db.getFolder("/");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ c1.namespaceBindings().put("bar", "urn:blah");
+ c1.namespaceBindings().remove("foo");
+ assertNull(c1.namespaceBindings().get("foo"));
+ assertEquals("urn:blah", c1.namespaceBindings().get("bar"));
+ }
+
+ public void testNamespace5() {
+ Folder c1 = db.getFolder("/");
+ c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
+ c1.namespaceBindings().put("bar", "urn:blah");
+ c1.namespaceBindings().clear();
+ assertNull(c1.namespaceBindings().get("foo"));
+ assertNull(c1.namespaceBindings().get("bar"));
+ }
+
+ public void testBuildDocument1() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
+ assertEquals(1, c1.documents().size());
+ }
+
+ public void testBuildDocument2() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
+ c1.documents().build(Name.overwrite("doc1")).elem("test2").end("test2").commit();
+ assertEquals(1, c1.documents().size());
+ }
+
+ public void testBuildDocument3() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
+ try {
+ c1.documents().build(Name.create("doc1")).elem("test2").end("test2").commit();
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testBuildDocument4() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ assertEquals(1, c1.documents().size());
+ }
+
+ public void testBuildDocument5() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ assertEquals(2, c1.documents().size());
+ }
+
+ public void testSize1() {
+ assertEquals(0, db.getFolder("/").documents().size());
+ }
+
+ public void testSize2() {
+ Folder c1 = db.createFolder("/top/nested");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
+ assertEquals(3, c1.documents().size());
+ assertEquals(0, db.getFolder("/top").documents().size());
+ }
+
+ public void testChildrenSize1() {
+ Folder c1 = db.createFolder("/top");
+ assertEquals(0, c1.children().size());
+ }
+
+ public void testChildrenSize2() {
+ db.createFolder("/top/nested1");
+ db.createFolder("/top/nested2");
+ Folder c1 = db.getFolder("/top");
+ assertEquals(2, c1.children().size());
+ }
+
+ public void testChildrenSize3() {
+ db.createFolder("/top/nested1");
+ db.createFolder("/top/nested2").documents().build(Name.generate()).elem("test").end("test").commit();
+ Folder c1 = db.getFolder("/top");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ assertEquals(2, c1.children().size());
+ }
+
+ public void testClear1() {
+ Folder c1 = db.createFolder("/top");
+ c1.clear();
+ assertEquals(0, c1.documents().size());
+ }
+
+ public void testClear2() {
+ Folder c1 = db.createFolder("/top");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.clear();
+ assertEquals(0, c1.documents().size());
+ }
+
+ public void testClear3() {
+ db.createFolder("/top/nested1");
+ db.createFolder("/top/nested2");
+ Folder c1 = db.getFolder("/top");
+ c1.clear();
+ assertEquals(0, c1.children().size());
+ }
+
+ public void testClear4() {
+ db.createFolder("/top/nested1");
+ db.createFolder("/top/nested1/more");
+ db.createFolder("/top/nested2");
+ Folder c1 = db.getFolder("/top");
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.documents().build(Name.generate()).elem("test").end("test").commit();
+ c1.clear();
+ assertEquals(0, c1.documents().size());
+ assertEquals(0, c1.children().size());
+ }
+
+ public void testDelete1() {
+ Folder c1 = db.createFolder("/top/nested");
+ db.getFolder("/top/nested");
+ c1.delete();
+ try {
+ db.getFolder("/top/nested");
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testDelete2() {
+ db.createFolder("/top/nested/more");
+ Folder c1 = db.getFolder("/top/nested");
+ db.getFolder("/top/nested/more");
+ c1.delete();
+ try {
+ db.getFolder("/top/nested/more");
+ fail();
+ } catch (DatabaseException e) {
+ }
+ }
+
+ public void testGetDocument() {
+ Folder c1 = db.createFolder("/c1");
+ c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ Document d = c1.documents().get("original");
+ assertNotNull(d);
+ }
+
+ public void testQuery1() {
+ Folder c1 = db.createFolder("/c1");
+ c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ c1.query().single("/test");
+ }
+
+ public void testQuery2() {
+ Folder c1 = db.createFolder("/c1");
+ c1.namespaceBindings().put("", "http://example.com");
+ c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ c1.query().single("/test");
+ }
+
+ public void testQueryBaseUri() {
+ Folder c1 = db.createFolder("/c1");
+ c1.documents().build(Name.create("original")).elem("test").end("test").commit();
+ assertTrue(c1.query().single("doc-available('original')").booleanValue());
+ }
+
+ public void testConvertToSequence() {
+ Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
+ c1.documents().build(Name.create("one")).elem("test").end("test").commit();
+ c1.children().create("sub").documents().build(Name.create("another")).elem("test").end("test").commit();
+ assertEquals(0, c2.query().all("/test").size());
+ assertEquals(2, c1.query().all("/test").size());
+ assertEquals(2, c2.query().all("$_1/test", new Object[] {c1}).size());
+ }
+
+ public void testConvertDocumentsToSequ...
[truncated message content] |
|
From: <br...@us...> - 2007-10-30 14:20:27
|
Revision: 6825
http://exist.svn.sourceforge.net/exist/?rev=6825&view=rev
Author: brihaye
Date: 2007-10-30 07:20:26 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
unification of search methods ; one more step
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 14:13:09 UTC (rev 6824)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 14:20:26 UTC (rev 6825)
@@ -34,7 +34,6 @@
import javax.xml.stream.XMLStreamReader;
import org.apache.log4j.Logger;
-import org.exist.EXistException;
import org.exist.collections.Collection;
import org.exist.dom.AttrImpl;
import org.exist.dom.DocumentImpl;
@@ -60,7 +59,6 @@
import org.exist.indexing.fulltext.analysis.TextToken;
import org.exist.indexing.fulltext.utils.FTGenericTokenKey;
import org.exist.indexing.fulltext.utils.FTQNamedTokenKey;
-import org.exist.indexing.fulltext.utils.RegexMatcher;
import org.exist.indexing.fulltext.utils.TermMatcher;
import org.exist.numbering.NodeId;
import org.exist.stax.EmbeddedXMLStreamReader;
@@ -420,9 +418,9 @@
public Occurrences[] scanIndex(XQueryContext context, DocumentSet docs, NodeSet contextSet, Map hints) {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
- //Expects a StringValue
+ //Expects a StringValue (TODO : pass a string)
Object start = hints == null ? null : hints.get(START_VALUE);
- //Expects a StringValue
+ //Expects a StringValue (TODO : pass a string)
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
final Lock lock = index.db.getLock();
@@ -500,9 +498,8 @@
return (Occurrences[]) cb.occurrences.values().toArray(result);
}
- public NodeSet getNodes(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, QName qname,
- Map hints) throws TerminatedException {
- //TODO : use this key
+ public NodeSet getNodes(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
+ Map hints) throws TerminatedException {
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
//Expects a String
Object start = hints == null ? null : hints.get(START_VALUE);
@@ -510,45 +507,66 @@
//TODO : possibly use this key ?
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
- if (LOG.isTraceEnabled() && qname != null)
- LOG.trace("Index lookup by QName: " + qname);
- final NodeSet result = new ExtArrayNodeSet();
- final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
- final Lock lock = index.db.getLock();
- for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
- final int collectionId = ((Collection) iter.next()).getId();
- //Compute a key for the token
- Value value;
- if (start != null && ((String)start).length() > 0) {
- //TODO : case conversion should be handled by the tokenizer -pb
- if (qname == null) {
- //See above for the problems it may raise...
+ final NodeSet result = new ExtArrayNodeSet();
+ final Lock lock = index.db.getLock();
+ for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
+ final int collectionId = ((Collection) iter.next()).getId();
+ if (qnames != null) {
+ for (int q = 0; q < qnames.size(); q++) {
+ QName qname = (QName)qnames.get(q);
+ //Compute a key for the token
+ Value value;
+ if (start != null && ((String)start).length() > 0) {
+ value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ } else {
+ value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols());
+ }
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
+ //TODO : try to use the lefmost part of the matcher's expression
+ //eventually, extract the start (and end ?) value from it ?
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, value);
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, (QName)qnames.get(q), matcher);
+ index.db.query(query, cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
+ } else {
+ //Compute a key for the token
+ Value value;
+ if (start != null && ((String)start).length() > 0) {
value = new FTGenericTokenKey(collectionId, (String)start);
- } else {
- value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
- }
- } else {
- if (qname == null) {
- value = new FTGenericTokenKey(collectionId);
- } else {
- value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols());
- }
- }
- //TODO : try to use the lefmost part of the mather's expression
- IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, value);
- try {
- lock.acquire(Lock.READ_LOCK);
- index.db.query(query, cb);
- } catch (LockException e) {
- LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
- } catch (BTreeException e) {
- LOG.error(e.getMessage(), e);
- //TODO return null ? rethrow ? -pb
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- //TODO return null ? rethrow ? -pb
- } finally {
- lock.release(Lock.READ_LOCK);
+ } else {
+ value = new FTGenericTokenKey(collectionId);
+ }
+ //TODO : try to use the lefmost part of the mather's expression
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, value);
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ final SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
+ index.db.query(query, cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ //TODO return null ? rethrow ? -pb
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
}
}
return result;
@@ -567,20 +585,42 @@
if (qnames == null || qnames.isEmpty())
//TODO : mmmmh : that prevents the use of the generic index. See above.
qnames = getDefinedIndexes(context.getBroker(), docs);
- final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
+ final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
+ final Lock lock = index.db.getLock();
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final int collectionId = ((org.exist.collections.Collection) iter.next()).getId();
- for (int i = 0; i < qnames.size(); i++) {
- QName qname = (QName) qnames.get(i);
- //TODO : use generic index as well according to the collection's configuration
- FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
- final Lock lock = index.db.getLock();
+ if (qnames != null) {
+ for (int q = 0; q < qnames.size(); q++) {
+ QName qname = (QName)qnames.get(q);
+ FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
+ //TODO : revisit, particularly for the right truncature ; we match have several strategies there
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ //SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
+ index.db.query(query, cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (IOException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
+ } else {
+ FTGenericTokenKey key = new FTGenericTokenKey(collectionId, (String)start);
+ //TODO : revisit, particularly for the right truncature ; we match have several strategies there
+ IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, key);
try {
lock.acquire(Lock.READ_LOCK);
//SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
- SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
- //TODO : revisit, particularly for the right truncature ; we match have several strategies there
- index.db.query(new IndexQuery(IndexQuery.TRUNC_RIGHT, key), cb);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
+ index.db.query(query, cb);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -590,7 +630,7 @@
} finally {
lock.release(Lock.READ_LOCK);
}
- }
+ }
}
return result;
}
@@ -598,41 +638,57 @@
//TODO : remove this method ; replace with search() when the start key and the end key would be the same ones
public NodeSet searchExact(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
Map hints) throws TerminatedException {
- List qname = hints == null ? null : (List)hints.get(QNAMES_KEY);
+ List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
//Expects a String
Object start = hints == null ? null : hints.get(START_VALUE);
//Expects a String
//TODO : possibly use this key ?
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
- final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
+ final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final Collection collection = (Collection) iter.next();
- final int collectionId = collection.getId();
- Value key;
- if (qname == null)
- //TODO : check that the collecion is generic indexed ?
- key = new FTGenericTokenKey(collectionId, (String)start);
- else {
- //TODO : check that the collecion is qname indexed ?
- key = new FTQNamedTokenKey(collectionId, (QName)qname.get(0), context.getBroker().getSymbols(), (String)start);
-// LOG.debug("Using qname: " + qname.toString() + " " + key.dump() + " '" + key.toString() + "'");
- }
- final Lock lock = index.db.getLock();
- try {
- lock.acquire(Lock.READ_LOCK);
- //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
- SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, (QName)qname.get(0), matcher);
- index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
- } catch (LockException e) {
- LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
- } catch (IOException e) {
- LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
- } catch (BTreeException e) {
- LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
- } finally {
- lock.release(Lock.READ_LOCK);
- }
+ final int collectionId = collection.getId();
+ if (qnames != null) {
+ for (int q = 0; q < qnames.size(); q++) {
+ QName qname = (QName)qnames.get(q);
+ Value key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
+ if (LOG.isTraceEnabled())
+ LOG.trace("Index lookup by QName: " + (QName)qnames.get(q));
+ final Lock lock = index.db.getLock();
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
+ index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (IOException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
+ } else {
+ Value key = new FTGenericTokenKey(collectionId, (String)start);
+ final Lock lock = index.db.getLock();
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, null, matcher);
+ index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
+ } catch (LockException e) {
+ LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
+ } catch (IOException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } catch (BTreeException e) {
+ LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ }
}
return result;
}
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 14:13:09 UTC (rev 6824)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 14:20:26 UTC (rev 6825)
@@ -97,7 +97,7 @@
index.getNodes(
context, contextId,
nodes.getDocumentSet(),
- nodes, NodeSet.ANCESTOR, null,
+ nodes, NodeSet.ANCESTOR,
hints);
}
}
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 14:13:09 UTC (rev 6824)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 14:20:26 UTC (rev 6825)
@@ -440,8 +440,9 @@
throw new XPathException(e);
}
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
- hints.put(FTIndexWorker.START_VALUE, start);
- hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, qname, hints);
+ hints.put(FTIndexWorker.START_VALUE, start);
+ hints.put(FTIndexWorker.QNAMES_KEY, qname);
+ hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, hints);
}
LOG.debug("Matches for " + token + ": " + hits[k].getLength());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-30 14:13:15
|
Revision: 6824
http://exist.svn.sourceforge.net/exist/?rev=6824&view=rev
Author: dizzzz
Date: 2007-10-30 07:13:09 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
Added fluent test srcs
Modified Paths:
--------------
trunk/eXist/eXist.iml
trunk/eXist/eXist.ipr
trunk/eXist/eXist.iws
Modified: trunk/eXist/eXist.iml
===================================================================
--- trunk/eXist/eXist.iml 2007-10-30 10:57:12 UTC (rev 6823)
+++ trunk/eXist/eXist.iml 2007-10-30 14:13:09 UTC (rev 6824)
@@ -1,230 +1,231 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module relativePaths="true" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="web" name="Web">
- <configuration>
- <descriptors>
- <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/webapp/WEB-INF/web.xml" optional="false" version="2.5" />
- </descriptors>
- <webroots>
- <root url="file://$MODULE_DIR$/webapp" relative="/" />
- </webroots>
- <building>
- <setting name="EXPLODED_URL" value="file://" />
- <setting name="EXPLODED_ENABLED" value="false" />
- <setting name="JAR_URL" value="file://" />
- <setting name="JAR_ENABLED" value="false" />
- <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
- <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
- <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
- <setting name="RUN_JASPER_VALIDATION" value="true" />
- <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
- </building>
- <packaging>
- <containerElement type="module" name="eXist">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="ant" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="cocoon" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="core" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="<N/A>" />
- </containerElement>
- <containerElement type="library" name="endorsed" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="extensions" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="optional" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="test" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="tools" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="user" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- </packaging>
- </configuration>
- </facet>
- <facet type="web" name="Web2">
- <configuration>
- <descriptors>
- <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/tools/XFormsFilter/web.xml" optional="false" version="2.5" />
- </descriptors>
- <webroots>
- <root url="file://$MODULE_DIR$/tools/XFormsFilter" relative="/WEB-INF" />
- </webroots>
- <building>
- <setting name="EXPLODED_URL" value="file://" />
- <setting name="EXPLODED_ENABLED" value="false" />
- <setting name="JAR_URL" value="file://" />
- <setting name="JAR_ENABLED" value="false" />
- <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
- <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
- <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
- <setting name="RUN_JASPER_VALIDATION" value="true" />
- <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
- </building>
- <packaging>
- <containerElement type="module" name="eXist">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="ant" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="cocoon" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="core" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="<N/A>" />
- </containerElement>
- <containerElement type="library" name="endorsed" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="extensions" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="optional" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="test" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="tools" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="user" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- </packaging>
- </configuration>
- </facet>
- <facet type="web" name="Web3">
- <configuration>
- <descriptors>
- <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/tools/ircbot/webapp/WEB-INF/web.xml" optional="false" version="2.5" />
- </descriptors>
- <webroots>
- <root url="file://$MODULE_DIR$/tools/ircbot/webapp" relative="/" />
- </webroots>
- <building>
- <setting name="EXPLODED_URL" value="file://" />
- <setting name="EXPLODED_ENABLED" value="false" />
- <setting name="JAR_URL" value="file://" />
- <setting name="JAR_ENABLED" value="false" />
- <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
- <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
- <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
- <setting name="RUN_JASPER_VALIDATION" value="true" />
- <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
- </building>
- <packaging>
- <containerElement type="module" name="eXist">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="ant" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="cocoon" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="core" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="<N/A>" />
- </containerElement>
- <containerElement type="library" name="endorsed" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="extensions" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="optional" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="test" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- <containerElement type="library" name="tools" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- <containerElement type="library" name="user" level="project">
- <attribute name="method" value="0" />
- <attribute name="URI" value="/WEB-INF/lib" />
- </containerElement>
- </packaging>
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/extensions/fluent/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/test/src" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/spatial/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/spatial/test/src" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/extensions/modules/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/samples" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/test/src" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/tools/XFormsFilter/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/tools/ircbot/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/tools/izpack/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/tools/jmx/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/tools/requestlog/src" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/tools/wrapper/src" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="optional libs" level="project" />
- <orderEntry type="library" name="core libs" level="project" />
- <orderEntry type="library" name="tools" level="project" />
- <orderEntry type="library" name="core" level="project" />
- <orderEntry type="library" name="xmlrpc-1.2-patched" level="project" />
- <orderEntry type="library" name="optional" level="project" />
- <orderEntry type="library" name="user" level="project" />
- <orderEntry type="library" name="endorsed" level="project" />
- <orderEntry type="library" name="cocoon" level="project" />
- <orderEntry type="library" name="ant" level="project" />
- <orderEntry type="library" name="test" level="project" />
- <orderEntry type="library" name="extensions" level="project" />
- <orderEntryProperties />
- </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="web" name="Web">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/webapp/WEB-INF/web.xml" optional="false" version="2.5" />
+ </descriptors>
+ <webroots>
+ <root url="file://$MODULE_DIR$/webapp" relative="/" />
+ </webroots>
+ <building>
+ <setting name="EXPLODED_URL" value="file://" />
+ <setting name="EXPLODED_ENABLED" value="false" />
+ <setting name="JAR_URL" value="file://" />
+ <setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
+ <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="true" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
+ </building>
+ <packaging>
+ <containerElement type="module" name="eXist">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="ant" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="cocoon" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="core" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="<N/A>" />
+ </containerElement>
+ <containerElement type="library" name="endorsed" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="extensions" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="optional" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="test" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="tools" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="user" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ </packaging>
+ </configuration>
+ </facet>
+ <facet type="web" name="Web2">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/tools/XFormsFilter/web.xml" optional="false" version="2.5" />
+ </descriptors>
+ <webroots>
+ <root url="file://$MODULE_DIR$/tools/XFormsFilter" relative="/WEB-INF" />
+ </webroots>
+ <building>
+ <setting name="EXPLODED_URL" value="file://" />
+ <setting name="EXPLODED_ENABLED" value="false" />
+ <setting name="JAR_URL" value="file://" />
+ <setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
+ <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="true" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
+ </building>
+ <packaging>
+ <containerElement type="module" name="eXist">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="ant" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="cocoon" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="core" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="<N/A>" />
+ </containerElement>
+ <containerElement type="library" name="endorsed" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="extensions" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="optional" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="test" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="tools" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="user" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ </packaging>
+ </configuration>
+ </facet>
+ <facet type="web" name="Web3">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/tools/ircbot/webapp/WEB-INF/web.xml" optional="false" version="2.5" />
+ </descriptors>
+ <webroots>
+ <root url="file://$MODULE_DIR$/tools/ircbot/webapp" relative="/" />
+ </webroots>
+ <building>
+ <setting name="EXPLODED_URL" value="file://" />
+ <setting name="EXPLODED_ENABLED" value="false" />
+ <setting name="JAR_URL" value="file://" />
+ <setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
+ <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="true" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
+ </building>
+ <packaging>
+ <containerElement type="module" name="eXist">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="ant" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="cocoon" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="core" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="<N/A>" />
+ </containerElement>
+ <containerElement type="library" name="endorsed" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="extensions" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="optional" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="test" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ <containerElement type="library" name="tools" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ <containerElement type="library" name="user" level="project">
+ <attribute name="method" value="0" />
+ <attribute name="URI" value="/WEB-INF/lib" />
+ </containerElement>
+ </packaging>
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/extensions/fluent/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/fluent/test/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/test/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/spatial/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/spatial/test/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/modules/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/samples" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/test/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/XFormsFilter/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/ircbot/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/izpack/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/jmx/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/requestlog/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/wrapper/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="optional libs" level="project" />
+ <orderEntry type="library" name="core libs" level="project" />
+ <orderEntry type="library" name="tools" level="project" />
+ <orderEntry type="library" name="core" level="project" />
+ <orderEntry type="library" name="xmlrpc-1.2-patched" level="project" />
+ <orderEntry type="library" name="optional" level="project" />
+ <orderEntry type="library" name="user" level="project" />
+ <orderEntry type="library" name="endorsed" level="project" />
+ <orderEntry type="library" name="cocoon" level="project" />
+ <orderEntry type="library" name="ant" level="project" />
+ <orderEntry type="library" name="test" level="project" />
+ <orderEntry type="library" name="extensions" level="project" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Modified: trunk/eXist/eXist.ipr
===================================================================
--- trunk/eXist/eXist.ipr 2007-10-30 10:57:12 UTC (rev 6823)
+++ trunk/eXist/eXist.ipr 2007-10-30 14:13:09 UTC (rev 6824)
@@ -1,397 +1,397 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project relativePaths="true" version="4">
- <component name="AntConfiguration">
- <defaultAnt bundledAnt="true" />
- <buildFile url="file://$PROJECT_DIR$/build.xml">
- <additionalClassPath />
- <antReference projectDefault="true" />
- <customJdkName value="" />
- <maximumHeapSize value="128" />
- <properties />
- </buildFile>
- <buildFile url="file://$PROJECT_DIR$/build.xml">
- <additionalClassPath />
- <antReference projectDefault="true" />
- <customJdkName value="" />
- <maximumHeapSize value="128" />
- <properties />
- </buildFile>
- </component>
- <component name="BuildJarProjectSettings">
- <option name="BUILD_JARS_ON_MAKE" value="false" />
- </component>
- <component name="CodeStyleProjectProfileManger">
- <option name="PROJECT_PROFILE" />
- <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
- </component>
- <component name="CodeStyleSettingsManager">
- <option name="PER_PROJECT_SETTINGS" />
- <option name="USE_PER_PROJECT_SETTINGS" value="false" />
- </component>
- <component name="ColorBrowser">
- <indexHtml>0</indexHtml>
- <indexColor>0</indexColor>
- <indexColorUIResource>0</indexColorUIResource>
- <hexUppercase>N</hexUppercase>
- <lastColor>-2722697</lastColor>
- </component>
- <component name="CompilerConfiguration">
- <option name="DEFAULT_COMPILER" value="Javac" />
- <option name="DEPLOY_AFTER_MAKE" value="0" />
- <resourceExtensions>
- <entry name=".+\.(properties|xml|html|dtd|tld)" />
- <entry name=".+\.(gif|png|jpeg|jpg)" />
- </resourceExtensions>
- <wildcardResourcePatterns>
- <entry name="?*.properties" />
- <entry name="?*.xml" />
- <entry name="?*.gif" />
- <entry name="?*.png" />
- <entry name="?*.jpeg" />
- <entry name="?*.jpg" />
- <entry name="?*.html" />
- <entry name="?*.dtd" />
- <entry name="?*.tld" />
- </wildcardResourcePatterns>
- </component>
- <component name="DependenciesAnalyzeManager">
- <option name="myForwardDirection" value="false" />
- </component>
- <component name="DependencyValidationManager">
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
- </component>
- <component name="EclipseCompilerSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="true" />
- <option name="DEPRECATION" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="EclipseEmbeddedCompilerSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="true" />
- <option name="DEPRECATION" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="EntryPointsManager">
- <entry_points version="2.0" />
- </component>
- <component name="ExportToHTMLSettings">
- <option name="PRINT_LINE_NUMBERS" value="false" />
- <option name="OPEN_IN_BROWSER" value="false" />
- <option name="OUTPUT_DIRECTORY" />
- </component>
- <component name="IdProvider" IDEtalkID="EDCB317F9C51C9BBC9F54E158B17D480" />
- <component name="InspectionProjectProfileManager">
- <option name="PROJECT_PROFILE" value="Project Default" />
- <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
- <scopes />
- <profiles>
- <profile version="1.0" is_locked="false">
- <option name="myName" value="Project Default" />
- <option name="myLocal" value="false" />
- </profile>
- </profiles>
- <list size="0" />
- </component>
- <component name="JavacSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="DEPRECATION" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="JavadocGenerationManager">
- <option name="OUTPUT_DIRECTORY" />
- <option name="OPTION_SCOPE" value="protected" />
- <option name="OPTION_HIERARCHY" value="true" />
- <option name="OPTION_NAVIGATOR" value="true" />
- <option name="OPTION_INDEX" value="true" />
- <option name="OPTION_SEPARATE_INDEX" value="true" />
- <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
- <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
- <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
- <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
- <option name="OPTION_DEPRECATED_LIST" value="true" />
- <option name="OTHER_OPTIONS" value="" />
- <option name="HEAP_SIZE" />
- <option name="LOCALE" />
- <option name="OPEN_IN_BROWSER" value="true" />
- </component>
- <component name="JikesSettings">
- <option name="JIKES_PATH" value="" />
- <option name="DEBUGGING_INFO" value="true" />
- <option name="DEPRECATION" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="IS_EMACS_ERRORS_MODE" value="true" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- </component>
- <component name="LogConsolePreferences">
- <option name="FILTER_ERRORS" value="false" />
- <option name="FILTER_WARNINGS" value="false" />
- <option name="FILTER_INFO" value="true" />
- <option name="CUSTOM_FILTER" />
- </component>
- <component name="Palette2">
- <group name="Swing">
- <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
- </item>
- <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
- </item>
- <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
- <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
- <initial-values>
- <property name="text" value="Button" />
- </initial-values>
- </item>
- <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="RadioButton" />
- </initial-values>
- </item>
- <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="CheckBox" />
- </initial-values>
- </item>
- <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="Label" />
- </initial-values>
- </item>
- <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
- <preferred-size width="200" height="200" />
- </default-constraints>
- </item>
- <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
- <preferred-size width="200" height="200" />
- </default-constraints>
- </item>
- <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
- </item>
- <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
- <preferred-size width="-1" height="20" />
- </default-constraints>
- </item>
- <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
- </item>
- <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
- </item>
- </group>
- </component>
- <component name="ProjectFileVersion" converted="true" />
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/eXist.iml" filepath="$PROJECT_DIR$/eXist.iml" />
- </modules>
- </component>
- <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
- <output url="file://$PROJECT_DIR$/build/classes" />
- </component>
- <component name="ResourceManagerContainer">
- <option name="myResourceBundles">
- <value>
- <list size="0" />
- </value>
- </option>
- </component>
- <component name="RmicSettings">
- <option name="IS_EANABLED" value="false" />
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="GENERATE_IIOP_STUBS" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- </component>
- <component name="SvnBranchConfigurationManager">
- <option name="myConfigurationMap">
- <map>
- <entry key="$PROJECT_DIR$">
- <value>
- <SvnBranchConfiguration>
- <option name="branchUrls">
- <list>
- <option value="https://exist.svn.sourceforge.net/svnroot/exist/branches" />
- <option value="https://exist.svn.sourceforge.net/svnroot/exist/releases" />
- <option value="https://exist.svn.sourceforge.net/svnroot/exist/tags" />
- </list>
- </option>
- <option name="trunkUrl" value="https://exist.svn.sourceforge.net/svnroot/exist/trunk" />
- </SvnBranchConfiguration>
- </value>
- </entry>
- </map>
- </option>
- </component>
- <component name="VcsDirectoryMappings">
- <mapping directory="" vcs="svn" />
- </component>
- <component name="WebServicesPlugin" addRequiredLibraries="true" />
- <component name="com.intellij.jsf.UserDefinedFacesConfigs">
- <option name="USER_DEFINED_CONFIGS">
- <value>
- <list size="0" />
- </value>
- </option>
- </component>
- <component name="libraryTable">
- <library name="tools">
- <CLASSES>
- <root url="jar://$PROJECT_DIR$/tools/jetty/lib/org.mortbay.jetty.jar!/" />
- <root url="jar://$PROJECT_DIR$/thirdparty/tomcat5/server/lib/catalina-5.0.28.jar!/" />
- <root url="jar://$PROJECT_DIR$/tools/ircbot/lib/pircbot.jar!/" />
- <root url="file://$PROJECT_DIR$/tools/ant/lib" />
- <root url="file://$PROJECT_DIR$/tools/wrapper/lib" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/tools/ant/lib" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/tools/wrapper/lib" recursive="false" />
- </library>
- <library name="core">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/core" />
- <root url="jar://$PROJECT_DIR$/exist.jar!/" />
- <root url="jar://$PROJECT_DIR$/exist-fluent.jar!/" />
- <root url="jar://$PROJECT_DIR$/start.jar!/" />
- <root url="jar://$PROJECT_DIR$/exist-optional.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/core" recursive="false" />
- </library>
- <library name="optional">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/optional" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/optional" recursive="false" />
- </library>
- <library name="user">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/user" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/user" recursive="false" />
- </library>
- <library name="endorsed">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/endorsed" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/endorsed" recursive="false" />
- </library>
- <library name="cocoon">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/cocoon" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/cocoon" recursive="false" />
- </library>
- <library name="ant">
- <CLASSES>
- <root url="jar://$PROJECT_DIR$/tools/ant/lib/ant.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="test">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/test/classes" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- <library name="extensions">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/extensions" />
- <root url="file://$PROJECT_DIR$/extensions/indexes/spatial/lib" />
- <root url="file://$PROJECT_DIR$/extensions/fluent/lib" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/extensions/fluent/lib" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/extensions/indexes/spatial/lib" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/lib/extensions" recursive="false" />
- </library>
- </component>
-</project>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project relativePaths="true" version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ <buildFile url="file://$PROJECT_DIR$/build.xml">
+ <additionalClassPath />
+ <antReference projectDefault="true" />
+ <customJdkName value="" />
+ <maximumHeapSize value="128" />
+ <properties />
+ </buildFile>
+ <buildFile url="file://$PROJECT_DIR$/build.xml">
+ <additionalClassPath />
+ <antReference projectDefault="true" />
+ <customJdkName value="" />
+ <maximumHeapSize value="128" />
+ <properties />
+ </buildFile>
+ </component>
+ <component name="BuildJarProjectSettings">
+ <option name="BUILD_JARS_ON_MAKE" value="false" />
+ </component>
+ <component name="CodeStyleProjectProfileManger">
+ <option name="PROJECT_PROFILE" />
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+ </component>
+ <component name="CodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS" />
+ <option name="USE_PER_PROJECT_SETTINGS" value="false" />
+ </component>
+ <component name="ColorBrowser">
+ <indexHtml>0</indexHtml>
+ <indexColor>0</indexColor>
+ <indexColorUIResource>0</indexColorUIResource>
+ <hexUppercase>N</hexUppercase>
+ <lastColor>-2722697</lastColor>
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <option name="DEPLOY_AFTER_MAKE" value="0" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ </wildcardResourcePatterns>
+ </component>
+ <component name="DependenciesAnalyzeManager">
+ <option name="myForwardDirection" value="false" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="EclipseCompilerSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="true" />
+ <option name="DEPRECATION" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="EclipseEmbeddedCompilerSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="true" />
+ <option name="DEPRECATION" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ <option name="OUTPUT_DIRECTORY" />
+ </component>
+ <component name="IdProvider" IDEtalkID="EDCB317F9C51C9BBC9F54E158B17D480" />
+ <component name="InspectionProjectProfileManager">
+ <option name="PROJECT_PROFILE" value="Project Default" />
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+ <scopes />
+ <profiles>
+ <profile version="1.0" is_locked="false">
+ <option name="myName" value="Project Default" />
+ <option name="myLocal" value="false" />
+ </profile>
+ </profiles>
+ <list size="0" />
+ </component>
+ <component name="JavacSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="DEPRECATION" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="JikesSettings">
+ <option name="JIKES_PATH" value="" />
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="DEPRECATION" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="IS_EMACS_ERRORS_MODE" value="true" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ </component>
+ <component name="LogConsolePreferences">
+ <option name="FILTER_ERRORS" value="false" />
+ <option name="FILTER_WARNINGS" value="false" />
+ <option name="FILTER_INFO" value="true" />
+ <option name="CUSTOM_FILTER" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectFileVersion" converted="true" />
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/eXist.iml" filepath="$PROJECT_DIR$/eXist.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+ <component name="ResourceManagerContainer">
+ <option name="myResourceBundles">
+ <value>
+ <list size="0" />
+ </value>
+ </option>
+ </component>
+ <component name="RmicSettings">
+ <option name="IS_EANABLED" value="false" />
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="GENERATE_IIOP_STUBS" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ </component>
+ <component name="SvnBranchConfigurationManager">
+ <option name="myConfigurationMap">
+ <map>
+ <entry key="$PROJECT_DIR$">
+ <value>
+ <SvnBran...
[truncated message content] |
|
From: <br...@us...> - 2007-10-30 10:57:17
|
Revision: 6823
http://exist.svn.sourceforge.net/exist/?rev=6823&view=rev
Author: brihaye
Date: 2007-10-30 03:57:12 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
introduced hints in search methods. One more step to go : unify search methods.
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 10:00:14 UTC (rev 6822)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 10:57:12 UTC (rev 6823)
@@ -504,9 +504,9 @@
Map hints) throws TerminatedException {
//TODO : use this key
List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
- //Expects a StringValue
+ //Expects a String
Object start = hints == null ? null : hints.get(START_VALUE);
- //Expects a StringValue
+ //Expects a String
//TODO : possibly use this key ?
Object end = hints == null ? null : hints.get(END_VALUE);
TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
@@ -555,9 +555,16 @@
}
//TODO : use generic index as well : or, better ?, add a method for generic index
- public NodeSet search(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, List qnames, String token)
- throws TerminatedException {
- if (qnames == null || qnames.isEmpty())
+ public NodeSet search(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, Map hints)
+ throws TerminatedException {
+ List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
+ //Expects a String
+ Object start = hints == null ? null : hints.get(START_VALUE);
+ //Expects a String
+ //TODO : possibly use this key ?
+ Object end = hints == null ? null : hints.get(END_VALUE);
+ TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
+ if (qnames == null || qnames.isEmpty())
//TODO : mmmmh : that prevents the use of the generic index. See above.
qnames = getDefinedIndexes(context.getBroker(), docs);
final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
@@ -566,19 +573,14 @@
for (int i = 0; i < qnames.size(); i++) {
QName qname = (QName) qnames.get(i);
//TODO : use generic index as well according to the collection's configuration
- FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), token);
+ FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- //TODO : not sure about the 0
- //TODO : externalize that and pass the matcher as a "hint"
- TermMatcher matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
//SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
//TODO : revisit, particularly for the right truncature ; we match have several strategies there
index.db.query(new IndexQuery(IndexQuery.TRUNC_RIGHT, key), cb);
- } catch (EXistException e) {
- LOG.warn("Failed to build a TermMatcher", e);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -595,7 +597,14 @@
//TODO : remove this method ; replace with search() when the start key and the end key would be the same ones
public NodeSet searchExact(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis,
- QName qname, String token) throws TerminatedException {
+ Map hints) throws TerminatedException {
+ List qname = hints == null ? null : (List)hints.get(QNAMES_KEY);
+ //Expects a String
+ Object start = hints == null ? null : hints.get(START_VALUE);
+ //Expects a String
+ //TODO : possibly use this key ?
+ Object end = hints == null ? null : hints.get(END_VALUE);
+ TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
final NodeSet result = new ExtArrayNodeSet(docs.getLength(), 250);
for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {
final Collection collection = (Collection) iter.next();
@@ -603,24 +612,18 @@
Value key;
if (qname == null)
//TODO : check that the collecion is generic indexed ?
- key = new FTGenericTokenKey(collectionId, token);
+ key = new FTGenericTokenKey(collectionId, (String)start);
else {
//TODO : check that the collecion is qname indexed ?
- key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), token);
+ key = new FTQNamedTokenKey(collectionId, (QName)qname.get(0), context.getBroker().getSymbols(), (String)start);
// LOG.debug("Using qname: " + qname.toString() + " " + key.dump() + " '" + key.toString() + "'");
}
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
- //TODO : not sure about the 0
- //TODO : externalize that and pass the matcher as a "hint"
- TermMatcher matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
//SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
- SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
- index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
- } catch (EXistException e) {
- LOG.warn("Failed to build a TermMatcher", e);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, (QName)qname.get(0), matcher);
+ index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java 2007-10-30 10:00:14 UTC (rev 6822)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FulltextSearch.java 2007-10-30 10:57:12 UTC (rev 6823)
@@ -1,8 +1,11 @@
package org.exist.xquery.modules.fulltext;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.exist.EXistException;
import org.exist.dom.DocumentSet;
import org.exist.dom.ExtArrayNodeSet;
import org.exist.dom.Match;
@@ -12,6 +15,9 @@
import org.exist.dom.QName;
import org.exist.indexing.fulltext.FTIndex;
import org.exist.indexing.fulltext.FTIndexWorker;
+import org.exist.indexing.fulltext.utils.RegexMatcher;
+import org.exist.indexing.fulltext.utils.TermMatcher;
+import org.exist.storage.DBBroker;
import org.exist.storage.ElementValue;
import org.exist.xquery.AnalyzeContextInfo;
import org.exist.xquery.Atomize;
@@ -155,7 +161,7 @@
qnames = new ArrayList(1);
qnames.add(contextQName);
}
- //TODO : what is qnames == null ?
+ //TODO : what if qnames == null ?
result = processMatches(index, docs, qnames, token, inNodes, NodeSet.ANCESTOR);
}
} else {
@@ -167,10 +173,22 @@
return result;
}
- private NodeSet processMatches(FTIndexWorker index, DocumentSet docs, List qnames, String token, NodeSet nodeSet, int axis) throws TerminatedException {
+ private NodeSet processMatches(FTIndexWorker index, DocumentSet docs, List qnames, String token, NodeSet nodeSet, int axis)
+ throws TerminatedException, XPathException {
NodeSet result = null;
long start = System.currentTimeMillis();
- NodeSet nodes = index.search(context, getExpressionId(), docs, nodeSet, axis, qnames, token);
+ Map hints = new HashMap();
+ TermMatcher matcher = null;
+ //TODO : not sure about the 0
+ try {
+ matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
+ } catch (EXistException e) {
+ throw new XPathException(e);
+ }
+ hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ hints.put(FTIndexWorker.START_VALUE, token);
+ hints.put(FTIndexWorker.QNAMES_KEY, qnames);
+ NodeSet nodes = index.search(context, getExpressionId(), docs, nodeSet, axis, hints);
if (LOG.isTraceEnabled())
LOG.trace("Found " + nodes.getLength() + " for " + token + " in " +
(System.currentTimeMillis() - start));
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 10:00:14 UTC (rev 6822)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 10:57:12 UTC (rev 6823)
@@ -91,6 +91,7 @@
Map hints = new HashMap();
matcher = new FuzzyMatcher(term, threshold);
hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ //TODO : check this substring
hints.put(FTIndexWorker.START_VALUE, term.substring(0, 1).toLowerCase());
hits[k] =
index.getNodes(
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 10:00:14 UTC (rev 6822)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 10:57:12 UTC (rev 6823)
@@ -374,9 +374,10 @@
protected NodeSet[] getMatches(DocumentSet docs, NodeSet contextSet, int axis, QName qname, List terms, boolean matchAll)
throws XPathException {
FTIndexWorker index = (FTIndexWorker)
- context.getBroker().getIndexController().getWorkerByIndexId(FTIndex.ID);
-
+ context.getBroker().getIndexController().getWorkerByIndexId(FTIndex.ID);
NodeSet hits[] = new NodeSet[terms.size()];
+ Map hints = new HashMap();
+ TermMatcher matcher;
for (int k = 0; k < terms.size(); k++) {
String token = (String) terms.get(k);
//Moved from FTIndexWorker. TODO : rethink
@@ -399,8 +400,17 @@
token = token.toLowerCase();
if (((FTIndex)index.getIndex()).isStemming())
token = ((FTIndex)index.getIndex()).getStemmer().stem(token);
-
- hits[k] = index.searchExact(context, contextId, docs, contextSet, axis, qname, token);
+
+ try {
+ // TODO : not sure about the 0
+ matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
+ } catch (EXistException e) {
+ throw new XPathException(e);
+ }
+ hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ hints.put(FTIndexWorker.START_VALUE, token);
+ hints.put(FTIndexWorker.QNAMES_KEY, qname);
+ hits[k] = index.searchExact(context, contextId, docs, contextSet, axis, hints);
break;
default :
//Return early
@@ -423,17 +433,15 @@
}
start = buf;
}
- try {
- Map hints = new HashMap();
- TermMatcher matcher = new RegexMatcher(token, matchType, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE,
+ try {
+ matcher = new RegexMatcher(token, matchType, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE,
matchAll);
- hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
- hints.put(FTIndexWorker.START_VALUE, start);
- hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, qname, hints);
} catch (EXistException e) {
throw new XPathException(e);
- }
-
+ }
+ hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ hints.put(FTIndexWorker.START_VALUE, start);
+ hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, qname, hints);
}
LOG.debug("Matches for " + token + ": " + hits[k].getLength());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-30 10:00:16
|
Revision: 6822
http://exist.svn.sourceforge.net/exist/?rev=6822&view=rev
Author: brihaye
Date: 2007-10-30 03:00:14 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
introduced hints in search methods
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 08:56:25 UTC (rev 6821)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 10:00:14 UTC (rev 6822)
@@ -501,7 +501,15 @@
}
public NodeSet getNodes(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet, int axis, QName qname,
- TermMatcher matcher, CharSequence startTerm) throws TerminatedException {
+ Map hints) throws TerminatedException {
+ //TODO : use this key
+ List qnames = hints == null ? null : (List)hints.get(QNAMES_KEY);
+ //Expects a StringValue
+ Object start = hints == null ? null : hints.get(START_VALUE);
+ //Expects a StringValue
+ //TODO : possibly use this key ?
+ Object end = hints == null ? null : hints.get(END_VALUE);
+ TermMatcher matcher = hints == null ? null : (TermMatcher)hints.get(TOKEN_MATCHER);
if (LOG.isTraceEnabled() && qname != null)
LOG.trace("Index lookup by QName: " + qname);
final NodeSet result = new ExtArrayNodeSet();
@@ -511,13 +519,13 @@
final int collectionId = ((Collection) iter.next()).getId();
//Compute a key for the token
Value value;
- if (startTerm != null && startTerm.length() > 0) {
+ if (start != null && ((String)start).length() > 0) {
//TODO : case conversion should be handled by the tokenizer -pb
if (qname == null) {
//See above for the problems it may raise...
- value = new FTGenericTokenKey(collectionId, startTerm.toString().toLowerCase());
+ value = new FTGenericTokenKey(collectionId, (String)start);
} else {
- value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), startTerm.toString().toLowerCase());
+ value = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), (String)start);
}
} else {
if (qname == null) {
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 08:56:25 UTC (rev 6821)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/FuzzyMatchAll.java 2007-10-30 10:00:14 UTC (rev 6822)
@@ -22,7 +22,9 @@
*/
package org.exist.xquery.modules.fulltext;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.exist.dom.NodeSet;
import org.exist.dom.QName;
@@ -86,13 +88,16 @@
if(term.length() == 0)
hits[k] = null;
else {
+ Map hints = new HashMap();
matcher = new FuzzyMatcher(term, threshold);
+ hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ hints.put(FTIndexWorker.START_VALUE, term.substring(0, 1).toLowerCase());
hits[k] =
index.getNodes(
context, contextId,
nodes.getDocumentSet(),
nodes, NodeSet.ANCESTOR, null,
- matcher, term.substring(0, 1));
+ hints);
}
}
return mergeResults(hits);
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 08:56:25 UTC (rev 6821)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/xquery/modules/fulltext/MatchRegexp.java 2007-10-30 10:00:14 UTC (rev 6822)
@@ -22,8 +22,10 @@
package org.exist.xquery.modules.fulltext;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.regex.Pattern;
import org.exist.EXistException;
@@ -421,10 +423,13 @@
}
start = buf;
}
- try {
+ try {
+ Map hints = new HashMap();
TermMatcher matcher = new RegexMatcher(token, matchType, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE,
- matchAll);
- hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, qname, matcher, start);
+ matchAll);
+ hints.put(FTIndexWorker.TOKEN_MATCHER, matcher);
+ hints.put(FTIndexWorker.START_VALUE, start);
+ hits[k] = index.getNodes(context, contextId, docs, contextSet, axis, qname, hints);
} catch (EXistException e) {
throw new XPathException(e);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-30 08:56:52
|
Revision: 6821
http://exist.svn.sourceforge.net/exist/?rev=6821&view=rev
Author: brihaye
Date: 2007-10-30 01:56:25 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
unified callbacks. Probably introduced some regressions (we still lack a lot of test cases) but, well, it's better to think (hard) on 40 lines than to add many lines for each use case.
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-29 21:01:39 UTC (rev 6820)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-30 08:56:25 UTC (rev 6821)
@@ -34,6 +34,7 @@
import javax.xml.stream.XMLStreamReader;
import org.apache.log4j.Logger;
+import org.exist.EXistException;
import org.exist.collections.Collection;
import org.exist.dom.AttrImpl;
import org.exist.dom.DocumentImpl;
@@ -59,6 +60,7 @@
import org.exist.indexing.fulltext.analysis.TextToken;
import org.exist.indexing.fulltext.utils.FTGenericTokenKey;
import org.exist.indexing.fulltext.utils.FTQNamedTokenKey;
+import org.exist.indexing.fulltext.utils.RegexMatcher;
import org.exist.indexing.fulltext.utils.TermMatcher;
import org.exist.numbering.NodeId;
import org.exist.stax.EmbeddedXMLStreamReader;
@@ -555,14 +557,20 @@
final int collectionId = ((org.exist.collections.Collection) iter.next()).getId();
for (int i = 0; i < qnames.size(); i++) {
QName qname = (QName) qnames.get(i);
- //TODO : use generic index ?
+ //TODO : use generic index as well according to the collection's configuration
FTQNamedTokenKey key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), token);
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
- //TODO : revisit
+ //TODO : not sure about the 0
+ //TODO : externalize that and pass the matcher as a "hint"
+ TermMatcher matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
+ //SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
+ //TODO : revisit, particularly for the right truncature ; we match have several strategies there
index.db.query(new IndexQuery(IndexQuery.TRUNC_RIGHT, key), cb);
+ } catch (EXistException e) {
+ LOG.warn("Failed to build a TermMatcher", e);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -586,16 +594,25 @@
final int collectionId = collection.getId();
Value key;
if (qname == null)
+ //TODO : check that the collecion is generic indexed ?
key = new FTGenericTokenKey(collectionId, token);
else {
+ //TODO : check that the collecion is qname indexed ?
key = new FTQNamedTokenKey(collectionId, qname, context.getBroker().getSymbols(), token);
// LOG.debug("Using qname: " + qname.toString() + " " + key.dump() + " '" + key.toString() + "'");
}
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ //TODO : not sure about the 0
+ //TODO : externalize that and pass the matcher as a "hint"
+ TermMatcher matcher = new RegexMatcher(token, DBBroker.MATCH_EXACT, 0, true);
+ //SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
+ SearchCallback2 cb = new SearchCallback2(context, contextId, docs, contextSet, result, axis, qname, matcher);
index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
+ } catch (EXistException e) {
+ LOG.warn("Failed to build a TermMatcher", e);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
} catch (IOException e) {
@@ -609,6 +626,7 @@
return result;
}
+ /*
private final class SearchExactCallback implements BTreeCallback {
private XQueryContext context;
@@ -752,7 +770,9 @@
}
}
}
+ */
+ /*
private final class SearchCallback implements BTreeCallback {
private XQueryContext context;
@@ -891,10 +911,9 @@
return true;
}
}
+ }
+ */
- }
-
- //TODO : merge with the previous one ?
private final class SearchCallback2 implements BTreeCallback {
XQueryContext context;
@@ -1021,6 +1040,8 @@
//Avoid generic/qnamed duplicates
if (!resultSet.contains(storedNode)) {
Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
+ //TODO : compute the offset from what is provided by the matcher
+ //that is, we probably have to introduce TermMatcher.computeOffset(String token)
for (int n = 0; n < freq; n++) {
match.addOffset(is.readInt(), length);
}
@@ -1043,6 +1064,7 @@
if (contextSet != null)
((ExtArrayNodeSet) resultSet).sort();
+ //TODO : hmmm... true ?
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-29 21:01:42
|
Revision: 6820
http://exist.svn.sourceforge.net/exist/?rev=6820&view=rev
Author: dizzzz
Date: 2007-10-29 14:01:39 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Updated fluent code a bit. Cleaned up javadoc, separated jUnit tests.
The unit tests do not run yet, I guess they did not work since ages. Well repair that later.
Modified Paths:
--------------
trunk/eXist/extensions/fluent/build.xml
trunk/eXist/extensions/fluent/src/org/exist/fluent/Database.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/ElementBuilder.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/Item.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/ItemList.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/ListenerManager.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/Node.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
trunk/eXist/extensions/fluent/src/org/exist/fluent/XMLDocument.java
Added Paths:
-----------
trunk/eXist/extensions/fluent/test/
trunk/eXist/extensions/fluent/test/src/
trunk/eXist/extensions/fluent/test/src/org/
trunk/eXist/extensions/fluent/test/src/org/exist/
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseEmptiesTest.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseMiscHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ElementBuilderHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/FolderHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ItemListHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/ListenerManagerHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/NodeHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/QueryServiceHelper.java
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/XMLDocumentHelper.java
Removed Paths:
-------------
trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTest.java
Modified: trunk/eXist/extensions/fluent/build.xml
===================================================================
--- trunk/eXist/extensions/fluent/build.xml 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/build.xml 2007-10-29 21:01:39 UTC (rev 6820)
@@ -2,11 +2,12 @@
<property name="src" value="./src"/>
<property name="classes" value="./classes"/>
+ <property name="test" value="./test"/>
<property name="javadoc" value="./javadoc"/>
<property name="top.dir" value="../.."/>
-
+
<property name="build.compiler" value="modern"/>
-
+
<condition property="java14-only">
<equals arg1="${ant.java.version}" arg2="1.4"/>
</condition>
@@ -15,41 +16,51 @@
<fileset dir="${top.dir}/${lib.core}">
<include name="*.jar"/>
</fileset>
+ <fileset dir="${top.dir}/${lib.endorsed}">
+ <include name="*.jar"/>
+ </fileset>
<fileset dir="${top.dir}/${tools.ant}/lib">
<include name="*.jar"/>
</fileset>
- <fileset dir="./lib">
- <include name="*.jar"/>
- </fileset>
+ <fileset dir="./lib">
+ <include name="*.jar"/>
+ </fileset>
<pathelement path="${top.dir}/exist.jar"/>
<pathelement path="${java.class.path}"/>
</path>
+ <path id="classpath.jar">
+ <pathelement path="${top.dir}/exist-fluent.jar"/>
+ </path>
+ <path id="classpath.test">
+ <pathelement path="${test}/classes"/>
+ </path>
- <target name="all" depends="jar,javadoc"/>
+ <target name="all" depends="jar,javadoc"/> <!-- test -->
+
<target name="prepare">
- <mkdir dir="${classes}"/>
- </target>
-
- <target name="compile" depends="prepare" unless="java14-only">
- <echo message="---------------------------"/>
+ <mkdir dir="${classes}"/>
+ </target>
+
+ <target name="compile" depends="prepare" unless="java14-only">
+ <echo message="---------------------------"/>
<echo message="Compiling fluent extension"/>
<echo message="---------------------------"/>
- <javac debug="${build.debug}" deprecation="${build.deprecation}"
- destdir="${classes}" encoding="UTF-8"
- optimize="${build.optimize}" srcdir="${src}"
- source="1.5"
- target="1.5">
+ <javac debug="${build.debug}" deprecation="${build.deprecation}"
+ destdir="${classes}" encoding="UTF-8"
+ optimize="${build.optimize}" srcdir="${src}"
+ source="1.5"
+ target="1.5">
<classpath>
- <path refid="classpath.core"/>
+ <path refid="classpath.core"/>
</classpath>
</javac>
- </target>
-
- <target name="jar" depends="compile">
- <echo message="Creating exist-fluent.jar ..."/>
+ </target>
+
+ <target name="jar" depends="compile">
+ <echo message="Creating exist-fluent.jar ..."/>
<jar basedir="${classes}" compress="true" jarfile="${top.dir}/exist-fluent.jar" update="true">
- <exclude name="org/exist/fluent/*$*Test*"/>
+ <exclude name="org/exist/fluent/*$*Test*"/>
<manifest>
<attribute name="Project-Name" value="${project.name}"/>
<attribute name="Project-Version" value="${project.version}"/>
@@ -57,14 +68,14 @@
<attribute name="SVN-Revision" value="${svn.revision}"/>
</manifest>
</jar>
- </target>
+ </target>
<target name="javadoc" unless="java14-only">
<mkdir dir="${javadoc}"/>
<javadoc bottom="Copyright (C) All rights reserved."
- destdir="${javadoc}" doctitle="eXist Fluent Javadocs"
- noindex="true" notree="true" access="public"
- maxmemory="512M" source="1.5">
+ destdir="${javadoc}" doctitle="eXist Fluent Javadocs"
+ noindex="true" notree="true" access="public"
+ maxmemory="512M" source="1.5">
<packageset dir="${src}">
<include name="org/**"/>
<exclude name="org/exist/fluent/*$*Test*"/>
@@ -74,28 +85,55 @@
</classpath>
<!--link href="" rel="nofollow">http://jakarta.apache.org/commons/collections/api/"/-->
</javadoc>
-
+
</target>
<target name="test" depends="compile">
- <echo message="Running fluent extension tests"/>
- <junit haltonfailure="false" printsummary="yes" showoutput="${junit.output}" maxmemory="${junit.forked.VM.maxmemory}">
- <sysproperty key="exist.home" value="${basedir}" />
- <classpath refid="classpath.core"/>
- <classpath refid="classpath.junit"/>
-
+ <echo message="Running fluent extension tests"/>
+
+ <mkdir dir="${test}/classes"/>
+ <mkdir dir="${test}/reports/html"/>
+ <mkdir dir="${test}/reports/data"/>
+ <javac debug="${build.debug}" deprecation="${build.deprecation}"
+ destdir="${test}/classes" encoding="UTF-8"
+ optimize="${build.optimize}" srcdir="${test}/src"
+ source="1.5" target="1.5">
+ <classpath>
+ <path refid="classpath.core"/>
+ <path refid="classpath.jar"/>
+ </classpath>
+ </javac>
+
+ <junit haltonfailure="false" printsummary="yes" showoutput="${junit.output}"
+ maxmemory="${junit.forked.VM.maxmemory}">
+ <sysproperty key="exist.home" value="${basedir}"/>
+
+ <classpath>
+ <path refid="classpath.core"/>
+ <path refid="classpath.jar"/>
+ <path refid="classpath.test"/>
+ </classpath>
+
<formatter type="plain"/>
<formatter type="xml"/>
- <batchtest fork="yes" todir="${junit.reports.dat}">
- <fileset dir="${classes}">
- <include name="*Test*.class"/>
+ <batchtest fork="yes" todir="${test}/reports/data">
+ <fileset dir="${test}/classes">
+ <include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
- </target>
- <target name="clean">
- <delete dir="${classes}"/>
- <delete file="${top.dir}/exist-fluent.jar" failonerror="false"/>
- </target>
+
+ <junitreport> <!-- todir="${test}/reports/html" -->
+ <fileset dir="${test}/reports/data">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${test}/reports/html"/>
+ </junitreport>
+ </target>
+
+ <target name="clean">
+ <delete dir="${classes}"/>
+ <delete file="${top.dir}/exist-fluent.jar" failonerror="false"/>
+ </target>
</project>
\ No newline at end of file
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Database.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Database.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Database.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -411,53 +411,4 @@
public Iterator iterator() {return EMPTY_ITERATOR;}
};
-
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class TestEmpties extends TestCase {
- public void testHasNext() {
- assertFalse(EMPTY_ITERATOR.hasNext());
- }
- @SuppressWarnings("unchecked")
- public void testNext() {
- try {
- EMPTY_ITERATOR.next();
- fail();
- } catch (NoSuchElementException e) {}
- }
- public void testRemove() {
- try {
- EMPTY_ITERATOR.remove();
- fail();
- } catch (UnsupportedOperationException e) {}
- }
- @SuppressWarnings("unchecked")
- public void testIterator() {
- assertSame(EMPTY_ITERATOR, EMPTY_ITERABLE.iterator());
- }
- }
-
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testQueryDocs1() {
- Folder c1 = db.createFolder("/c1");
- XMLDocument d1 = c1.documents().build(Name.generate()).elem("test1").end("test1").commit();
- XMLDocument d2 = c1.documents().build(Name.generate()).elem("test2").end("test2").commit();
- c1.documents().build(Name.generate()).elem("test3").end("test3").commit();
- assertTrue(db.query(d1, d2).exists("/test1"));
- assertTrue(db.query(d1, d2).exists("/test2"));
- assertFalse(db.query(d1, d2).exists("/test3"));
- }
- public void testQueryBaseUri() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- assertFalse(db.query().single("doc-available('original')").booleanValue());
- assertTrue(db.query().single("doc-available('c1/original')").booleanValue());
- }
- }
}
Deleted: trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTest.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTest.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTest.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -1,57 +0,0 @@
-package org.exist.fluent;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.*;
-
-import org.exist.security.PermissionDeniedException;
-import org.exist.security.SecurityManager;
-import org.exist.storage.DBBroker;
-import org.exist.xmldb.XmldbURI;
-import org.jmock.cglib.MockObjectTestCase;
-
-/**
- * A superclass for database unit tests. It takes care of starting up and clearing the database in
- * its <code>setUp</code> method, and supports mocking with jMock. By default, the database
- * will be configured from the file "conf.xml" in the current directory, but you can annotate your
- * test class with {@link DatabaseTest.ConfigFile} to specify a different one.
- *
- * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
- */
-@DatabaseTest.ConfigFile("conf.xml")
-public abstract class DatabaseTest extends MockObjectTestCase {
-
- /**
- * An annotation that specifies the path of the config file to use when setting up the database
- * for a test.
- *
- * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
- */
- @Inherited @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
- public @interface ConfigFile {
- String value();
- }
-
- protected Database db;
- @Override protected void setUp() {
- ConfigFile configFileAnnotation = getClass().getAnnotation(ConfigFile.class);
- assert configFileAnnotation != null;
- Database.ensureStarted(new File(configFileAnnotation.value()));
- db = new Database(SecurityManager.SYSTEM_USER);
- DBBroker broker = null;
- Transaction tx = Database.requireTransaction();
- try {
- broker = db.acquireBroker();
- broker.removeCollection(tx.tx, broker.getCollection(XmldbURI.ROOT_COLLECTION_URI));
- tx.commit();
- ListenerManager.configureTriggerDispatcher(db); // config file gets erased by command above
- } catch (PermissionDeniedException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- tx.abortIfIncomplete();
- db.releaseBroker(broker);
- }
- }
-}
\ No newline at end of file
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/ElementBuilder.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/ElementBuilder.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/ElementBuilder.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -310,287 +310,5 @@
if (!done) LOG.warn("disposed without commit");
}
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testEmpty() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- builder.commit();
- }
- public void testElemOnStack() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("blah").commit();
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testNoFragAllowed() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").elem("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testMismatchedEndSingle() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testMismatchedEndMultiple() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test2", "test3", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testElemAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.elem("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testAttrAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.attr("test2","blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testTextAfterCommit() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- try {
- builder.elem("test").end("test").commit();
- builder.text("test2");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testAttrWithoutElem1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.attr("blah", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testAttrWithoutElem2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").attr("blah", "blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testTextWithoutElemNoFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.text("blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testTextWithoutElemNoFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {fail("completed called"); return null;}
- });
- try {
- builder.elem("test").end("test").text("blah");
- fail();
- } catch (IllegalStateException e) {
- }
- }
- public void testTextWithoutElemFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- builder.text("blah").commit();
- }
- public void testTextWithoutElemFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] node) {return null;}
- });
- builder.elem("test").end("test").text("blah").commit();
- }
- public void testCommitOne() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {assertEquals(1, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); return null;}
- });
- builder.elem("test").end("test").commit();
- }
- public void testCommitFrag() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {assertEquals(2, nodes.length); assertEquals(Node.ELEMENT_NODE, nodes[0].getNodeType()); assertEquals(Node.ELEMENT_NODE, nodes[1].getNodeType()); return null;}
- });
- builder.elem("test").end("test").elem("test2").end("test2").commit();
- }
- public void testStructure1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test/>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").end("test").commit();
- }
- public void testStructure2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test><test2/></test>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").elem("test2").end("test2").end("test").commit();
- }
- public void testStructure3() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test foo='bar'/>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attr("foo", "bar").end("test").commit();
- }
- public void testStructure4() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test>blah</test>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").text("blah").end("test").commit();
- }
- public void testStructure5() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test foo='bar'/>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attrIf(true, "foo", "bar").end("test").commit();
- }
- public void testStructure6() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), false, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(1, nodes.length);
- assertEquals("<test/>", Test.toString(nodes[0]));
- return null;
- }
- });
- builder.elem("test").attrIf(false, "foo", "bar").end("test").commit();
- }
- public void testFrag1() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(2, nodes.length);
- assertEquals("<test1/><test2/>", Test.toString(nodes[0]) + Test.toString(nodes[1]));
- return null;
- }
- });
- builder.elem("test1").end("test1").elem("test2").end("test2").commit();
- }
- public void testFrag2() {
- ElementBuilder<Object> builder = new ElementBuilder<Object>(db.namespaceBindings(), true, new CompletedCallback<Object>() {
- public Object completed(Node[] nodes) {
- assertEquals(2, nodes.length);
- assertEquals("blahfoo", Test.toString(nodes[0]) + Test.toString(nodes[1]));
- return null;
- }
- });
- builder.text("blah").text("foo").commit();
- }
-
- static String toString(Node node) {
- StringBuilder buf = new StringBuilder();
- toBuf(node, buf);
- return buf.toString();
- }
-
- private static void toBuf(Node node, StringBuilder buf) {
- switch (node.getNodeType()) {
-
- case Node.DOCUMENT_FRAGMENT_NODE: {
- NodeList children = node.getChildNodes();
- for (int i=0; i<children.getLength(); i++) toBuf(children.item(i), buf);
- break;
- }
-
- case Node.DOCUMENT_NODE:
- buf.append("<?xml version=\"1.0\" ?>");
- toBuf(((org.w3c.dom.Document) node).getDocumentElement(), buf);
- break;
-
- case Node.ELEMENT_NODE: {
- buf.append("<").append(node.getNodeName());
- NamedNodeMap attrs = node.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Node attr = attrs.item(i);
- buf.append(" ").append(attr.getNodeName()).append("='").append(attr.getNodeValue()).append("'");
- }
- NodeList children = node.getChildNodes();
- if (children.getLength() == 0) {
- buf.append("/>");
- } else {
- buf.append(">");
- for (int i = 0; i < children.getLength(); i++) toBuf(children.item(i), buf);
- buf.append("</").append(node.getNodeName()).append(">");
- }
- break;
- }
-
- case Node.ENTITY_REFERENCE_NODE:
- buf.append("&").append(node.getNodeName()).append(";");
- break;
-
- case Node.TEXT_NODE:
- buf.append(node.getNodeValue());
- break;
-
- default:
- throw new RuntimeException("can't deal with node type " + node.getNodeType());
- }
-
- }
-
- }
}
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Folder.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -999,327 +999,7 @@
return getQuickHandle().getDocument(broker, uri);
}
-
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testCreateTop() {
- db.createFolder("/top");
- try {
- db.getFolder("/top");
- } catch (DatabaseException e) {
- fail(e.getMessage());
- }
- }
- public void testCreateNested() {
- db.createFolder("/top/nested");
- try {
- db.getFolder("/top/nested");
- } catch (DatabaseException e) {
- fail(e.getMessage());
- }
- }
- public void testGetRoot() {
- assertEquals("", db.getFolder("/").name());
- }
- public void testGetMissingTop1() {
- try {
- db.getFolder("/top");
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testGetMissingNested1() {
- try {
- db.getFolder("/top/nested");
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testDuplicate1() {
- Folder c1 = db.createFolder("/top");
- Folder c2 = c1.clone();
- assertEquals(c1.path(), c2.path());
- }
- public void testDuplicate2() {
- Folder c1 = db.createFolder("/top");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- Folder c2 = c1.clone();
- assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
- }
- public void testGetName1() {
- assertEquals("top", db.createFolder("/top").name());
- }
- public void testGetName2() {
- assertEquals("nested", db.createFolder("/top/nested").name());
- }
- public void testGetPath1() {
- assertEquals("/top", db.createFolder("/top").path());
- }
- public void testGetPath2() {
- assertEquals("/top/nested", db.createFolder("/top/nested").path());
- }
- public void testGetPath3() {
- assertEquals("/", db.createFolder("/").path());
- }
- public void testGetParent1() {
- assertEquals("/top", db.createFolder("/top/nested").parent().path());
- }
- public void testGetParent2() {
- try {
- db.getFolder("/").parent();
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testGetChild1() {
- db.createFolder("/top/nested");
- db.getFolder("/top").children().get("nested");
- }
- public void testGetChild2() {
- db.createFolder("/top/nested/more");
- db.getFolder("/top").children().get("nested/more");
- }
- public void testGetChild3() {
- db.createFolder("/top/nested");
- try {
- db.getFolder("/top").children().get("/nested");
- fail();
- } catch (IllegalArgumentException e) {
- }
- }
- public void testGetChild4() {
- db.createFolder("/top/nested");
- db.getFolder("/").children().get("top");
- }
- public void testGetChild5() {
- db.createFolder("/top/nested");
- Folder c1 = db.getFolder("/top");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- Folder c2 = c1.children().get("nested");
- assertEquals("http://www.ideanest.com/", c2.namespaceBindings().get("foo"));
- }
- public void testNamespace1() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get("foo"));
- }
- public void testNamespace2() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("", "http://www.ideanest.com/");
- assertEquals("http://www.ideanest.com/", c1.namespaceBindings().get(""));
- }
- public void testNamespace3() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().remove("foo");
- assertNull(c1.namespaceBindings().get("foo"));
- }
- public void testNamespace4() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().put("bar", "urn:blah");
- c1.namespaceBindings().remove("foo");
- assertNull(c1.namespaceBindings().get("foo"));
- assertEquals("urn:blah", c1.namespaceBindings().get("bar"));
- }
- public void testNamespace5() {
- Folder c1 = db.getFolder("/");
- c1.namespaceBindings().put("foo", "http://www.ideanest.com/");
- c1.namespaceBindings().put("bar", "urn:blah");
- c1.namespaceBindings().clear();
- assertNull(c1.namespaceBindings().get("foo"));
- assertNull(c1.namespaceBindings().get("bar"));
- }
- public void testBuildDocument1() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
- assertEquals(1, c1.documents().size());
- }
- public void testBuildDocument2() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
- c1.documents().build(Name.overwrite("doc1")).elem("test2").end("test2").commit();
- assertEquals(1, c1.documents().size());
- }
- public void testBuildDocument3() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.create("doc1")).elem("test1").end("test1").commit();
- try {
- c1.documents().build(Name.create("doc1")).elem("test2").end("test2").commit();
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testBuildDocument4() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(1, c1.documents().size());
- }
- public void testBuildDocument5() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(2, c1.documents().size());
- }
- public void testSize1() {
- assertEquals(0, db.getFolder("/").documents().size());
- }
- public void testSize2() {
- Folder c1 = db.createFolder("/top/nested");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.create("doc1")).elem("test").end("test").commit();
- assertEquals(3, c1.documents().size());
- assertEquals(0, db.getFolder("/top").documents().size());
- }
- public void testChildrenSize1() {
- Folder c1 = db.createFolder("/top");
- assertEquals(0, c1.children().size());
- }
- public void testChildrenSize2() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- assertEquals(2, c1.children().size());
- }
- public void testChildrenSize3() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2").documents().build(Name.generate()).elem("test").end("test").commit();
- Folder c1 = db.getFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- assertEquals(2, c1.children().size());
- }
- public void testClear1() {
- Folder c1 = db.createFolder("/top");
- c1.clear();
- assertEquals(0, c1.documents().size());
- }
- public void testClear2() {
- Folder c1 = db.createFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.clear();
- assertEquals(0, c1.documents().size());
- }
- public void testClear3() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- c1.clear();
- assertEquals(0, c1.children().size());
- }
- public void testClear4() {
- db.createFolder("/top/nested1");
- db.createFolder("/top/nested1/more");
- db.createFolder("/top/nested2");
- Folder c1 = db.getFolder("/top");
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.documents().build(Name.generate()).elem("test").end("test").commit();
- c1.clear();
- assertEquals(0, c1.documents().size());
- assertEquals(0, c1.children().size());
- }
- public void testDelete1() {
- Folder c1 = db.createFolder("/top/nested");
- db.getFolder("/top/nested");
- c1.delete();
- try {
- db.getFolder("/top/nested");
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testDelete2() {
- db.createFolder("/top/nested/more");
- Folder c1 = db.getFolder("/top/nested");
- db.getFolder("/top/nested/more");
- c1.delete();
- try {
- db.getFolder("/top/nested/more");
- fail();
- } catch (DatabaseException e) {
- }
- }
- public void testGetDocument() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- Document d = c1.documents().get("original");
- assertNotNull(d);
- }
- public void testQuery1() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- c1.query().single("/test");
- }
- public void testQuery2() {
- Folder c1 = db.createFolder("/c1");
- c1.namespaceBindings().put("", "http://example.com");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- c1.query().single("/test");
- }
- public void testQueryBaseUri() {
- Folder c1 = db.createFolder("/c1");
- c1.documents().build(Name.create("original")).elem("test").end("test").commit();
- assertTrue(c1.query().single("doc-available('original')").booleanValue());
- }
- public void testConvertToSequence() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- c1.documents().build(Name.create("one")).elem("test").end("test").commit();
- c1.children().create("sub").documents().build(Name.create("another")).elem("test").end("test").commit();
- assertEquals(0, c2.query().all("/test").size());
- assertEquals(2, c1.query().all("/test").size());
- assertEquals(2, c2.query().all("$_1/test", new Object[] {c1}).size());
- }
- public void testConvertDocumentsToSequence() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- c1.documents().build(Name.create("one")).elem("test").end("test").commit();
- c1.children().create("sub").documents().build(Name.create("another")).elem("test").end("test").commit();
- assertEquals(0, c2.query().all("/test").size());
- assertEquals(1, c2.query().all("$_1/test", new Object[] {c1.documents()}).size());
- }
- public void testMove1() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f = c1.children().create("f");
- f.move(c2, Name.keepCreate());
- assertEquals("/c2/f", f.path());
- assertEquals(c2, f.parent());
- }
- public void testMove2() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f = c1.children().create("f");
- f.move(c2, Name.create("g"));
- assertEquals("/c2/g", f.path());
- assertEquals(c2, f.parent());
- }
- public void testMove3() {
- Folder c1 = db.createFolder("/c1");
- Folder f = c1.children().create("f");
- f.move(f.parent(), Name.create("g"));
- assertEquals("/c1/g", f.path());
- assertEquals(c1, f.parent());
- }
- public void testCopy1() {
- Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2");
- Folder f1 = c1.children().create("f");
- Folder f2 = f1.copy(c2, Name.keepCreate());
- assertEquals("/c1/f", f1.path());
- assertEquals(c1, f1.parent());
- assertEquals("/c2/f", f2.path());
- assertEquals(c2, f2.parent());
- }
- public void testCopy2() {
- Folder c1 = db.createFolder("/c1");
- Folder f1 = c1.children().create("f1");
- Folder f2 = f1.copy(f1.parent(), Name.create("f2"));
- assertEquals("/c1/f1", f1.path());
- assertEquals(c1, f1.parent());
- assertEquals("/c1/f2", f2.path());
- assertEquals(c1, f2.parent());
- }
- }
+
}
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Item.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Item.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Item.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -229,31 +229,6 @@
@Override Sequence convertToSequence() {return Sequence.EMPTY_SEQUENCE;}
};
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testConvertToSequence() {
- XMLDocument doc = db.createFolder("/top").documents().build(Name.create("test"))
- .elem("a")
- .elem("b")
- .elem("c")
- .end("c")
- .end("b")
- .elem("d")
- .elem("c")
- .end("c")
- .end("d")
- .elem("c")
- .end("c")
- .end("a")
- .commit();
- assertEquals(3, doc.query().all("//c").size());
- Item res = doc.query().single("//b");
- assertEquals(1, doc.query().all("$_1//c", res).size());
- }
- }
}
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/ItemList.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/ItemList.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/ItemList.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -379,29 +379,4 @@
}
};
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testConvertToSequence() {
- XMLDocument doc = db.createFolder("/top").documents().build(Name.create("test"))
- .elem("a")
- .elem("b")
- .elem("c")
- .end("c")
- .end("b")
- .elem("d")
- .elem("c")
- .end("c")
- .end("d")
- .elem("c")
- .end("c")
- .end("a")
- .commit();
- assertEquals(3, doc.query().all("//c").size());
- ItemList res = doc.query().all("//(b|d)");
- assertEquals(2, doc.query().all("$_1//c", new Object[] {res}).size());
- }
- }
}
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/ListenerManager.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/ListenerManager.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/ListenerManager.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -353,395 +353,4 @@
}
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- private interface BothListener extends Document.Listener, Folder.Listener {/*nothing to add*/}
-
- private Mock documentListener, folderListener, bothListener;
- private Document.Listener documentListenerProxy;
- private Folder.Listener folderListenerProxy;
- private BothListener bothListenerProxy;
-
- @Override
- protected void setUp() {
- super.setUp();
-
- documentListener = mock(Document.Listener.class);
- folderListener = mock(Folder.Listener.class);
- bothListener = mock(BothListener.class);
-
- documentListenerProxy = (Document.Listener) documentListener.proxy();
- folderListenerProxy = (Folder.Listener) folderListener.proxy();
- bothListenerProxy = (BothListener) bothListener.proxy();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- INSTANCE.remove(documentListenerProxy);
- INSTANCE.remove(folderListenerProxy);
- INSTANCE.remove(bothListenerProxy);
- documentListener = null; folderListener = null; bothListener = null;
- documentListenerProxy = null; folderListenerProxy = null; bothListenerProxy = null;
- }
-
- private Constraint eqDelayedDoc(final Document.Event ev) {
- return new Constraint() {
- public StringBuffer describeTo(StringBuffer buf) {
- return buf.append("eqDelayedDoc(").append(ev).append(")");
- }
- public boolean eval(Object o) {
- return new Document.Event(ev.trigger, ev.path, db.getDocument(ev.path)).equals(o);
- }
- };
- }
-
- private Stub checkDocumentExists(final String path, final boolean shouldExist) {
- return new Stub() {
- public StringBuffer describeTo(StringBuffer buf) {
- return buf.append("check that document '" + path + "' " + (shouldExist ? "exists" : "does not exist"));
- }
- public Object invoke(Invocation inv) throws Throwable {
- try {
- db.getDocument(path);
- if (!shouldExist) fail("document '" + path + "' exists but shouldn't");
- } catch (DatabaseException e) {
- if (shouldExist) fail("document '" + path + "' doesn't exist but should");
- }
- return null;
- }
- };
- }
-
- private Stub checkFolderExists(final String path, final boolean shouldExist) {
- return new Stub() {
- public StringBuffer describeTo(StringBuffer buf) {
- return buf.append("check that folder '" + path + "' " + (shouldExist ? "exists" : "does not exist"));
- }
- public Object invoke(Invocation inv) throws Throwable {
- try {
- db.getFolder(path);
- if (!shouldExist) fail("folder '" + path + "' exists but shouldn't");
- } catch (DatabaseException e) {
- if (shouldExist) fail("folder '" + path + "' doesn't exist but should");
- }
- return null;
- }
- };
- }
-
- private Stub checkDocumentStamp(final String expectedStamp) {
- return new Stub() {
- public StringBuffer describeTo(StringBuffer buf) {
- buf.append("check that event document is stamped with '" + expectedStamp + "'");
- return buf;
- }
- public Object invoke(Invocation inv) throws Throwable {
- XMLDocument doc = ((Document.Event) inv.parameterValues.get(0)).document.xml();
- assertNotNull("event document is null", doc);
- assertEquals(expectedStamp, doc.query().single("/test/@stamp").value());
- return null;
- }
- };
- }
-
- private XMLDocument createDocument(String path) {
- return createDocument(path, null);
- }
-
- private XMLDocument createDocument(String path, String stamp) {
- int k = path.lastIndexOf('/');
- assert k > 0;
- Folder folder = db.createFolder(path.substring(0, k));
- return folder.documents().build(Name.overwrite(path.substring(k+1)))
- .elem("test").attrIf(stamp != null, "stamp", stamp).end("test").commit();
- }
-
- public void testListenDocumentsBeforeCreateDocument1() {
- final String docPath = "/top/test.xml";
- Document.Event ev = new Document.Event(Trigger.BEFORE_CREATE, docPath, null);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- top.documents().listeners().add(Trigger.BEFORE_CREATE, documentListenerProxy);
- createDocument(docPath);
- createDocument("/elsewhere/test.xml");
- createDocument("/top/deeper/test.xml");
- }
-
- public void testListenDocumentsBeforeCreateDocument2() {
- final String docPath = "/top/test.xml";
- Folder top = db.createFolder("/top");
- documentListener.expects(never()).method("handle").with(ANYTHING);
- top.documents().listeners().add(Trigger.BEFORE_CREATE, documentListenerProxy);
- top.documents().listeners().remove(documentListenerProxy);
- createDocument(docPath);
- }
-
- public void testListenDocumentsAfterCreateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.AFTER_CREATE, docPath, doc);
- doc.delete();
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eqDelayedDoc(ev)).will(checkDocumentExists(docPath, true));
- top.documents().listeners().add(Trigger.AFTER_CREATE, documentListenerProxy);
- createDocument(docPath);
- createDocument("/elsewhere/test.xml");
- createDocument("/top/deeper/test.xml");
- }
-
- public void testListenDocumentsAfterCreateDocument2() {
- final String docPath = "/top/test.xml";
- Folder top = db.createFolder("/top");
- documentListener.expects(never()).method("handle").with(ANYTHING);
- top.documents().listeners().add(Trigger.AFTER_CREATE, documentListenerProxy);
- top.documents().listeners().remove(documentListenerProxy);
- createDocument(docPath);
- }
-
- public void testListenFolderBeforeCreateDocument1() {
- final String docPath = "/top/test2.xml";
- Document.Event ev = new Document.Event(Trigger.BEFORE_CREATE, docPath, null);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- top.listeners().add(Trigger.BEFORE_CREATE, documentListenerProxy);
- createDocument(docPath);
- createDocument("/elsewhere/test.xml");
- }
-
- public void testListenFolderBeforeCreateDocument2() {
- final String docPath = "/top/test2.xml";
- Folder top = db.createFolder("/top");
- documentListener.expects(never()).method("handle").with(ANYTHING);
- top.listeners().add(Trigger.BEFORE_CREATE, documentListenerProxy);
- top.listeners().remove(documentListenerProxy);
- createDocument(docPath);
- }
-
- public void testListenFolderAfterCreateDocument1() {
- final String docPath = "/top/test2.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.AFTER_CREATE, docPath, doc);
- doc.delete();
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eqDelayedDoc(ev)).will(checkDocumentExists(docPath, true));
- top.listeners().add(Trigger.AFTER_CREATE, documentListenerProxy);
- createDocument(docPath);
- createDocument("/elsewhere/test.xml");
- }
-
- public void testListenFolderAfterCreateDocument2() {
- final String docPath = "/top/test2.xml";
- Folder top = db.createFolder("/top");
- documentListener.expects(never()).method("handle").with(ANYTHING);
- top.listeners().add(Trigger.AFTER_CREATE, documentListenerProxy);
- top.listeners().remove(documentListenerProxy);
- createDocument(docPath);
- }
-
- public void testListenDocumentsBeforeUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.BEFORE_UPDATE, docPath, doc);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("before"));
- top.documents().listeners().add(Trigger.BEFORE_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- createDocument("/top/deeper/test.xml");
- }
-
- public void testListenDocumentsAfterUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.AFTER_UPDATE, docPath, doc);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("after"));
- top.documents().listeners().add(Trigger.AFTER_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- createDocument("/top/deeper/test.xml");
- }
-
- public void testListenFolderBeforeUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.BEFORE_UPDATE, docPath, doc);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("before"));
- top.listeners().add(Trigger.BEFORE_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- }
-
- public void testListenFolderAfterUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.AFTER_UPDATE, docPath, doc);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("after"));
- top.listeners().add(Trigger.AFTER_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- }
-
- public void testListenFolderDeepBeforeCreateDocument1() {
- final String docPath = "/top/middle/test2.xml";
- Document.Event ev = new Document.Event(Trigger.BEFORE_CREATE, docPath, null);
- Folder top = db.createFolder("/top");
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- top.listeners().add(Trigger.BEFORE_CREATE, documentListenerProxy);
- createDocument(docPath);
- createDocument("/elsewhere/test.xml");
- }
-
- public void testListenDocumentBeforeUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.BEFORE_UPDATE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("before"));
- doc.listeners().add(Trigger.BEFORE_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- createDocument("/top/test2.xml");
- }
-
- public void testListenDocumentAfterUpdateDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- Document.Event ev = new Document.Event(Trigger.AFTER_UPDATE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentStamp("after"));
- doc.listeners().add(Trigger.AFTER_UPDATE, documentListenerProxy);
- createDocument(docPath, "after");
- createDocument("/elsewhere/test.xml");
- createDocument("/top/test2.xml");
- }
-
- public void testListenDocumentsBeforeDeleteDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.BEFORE_DELETE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, true));
- Folder top = db.createFolder("/top");
- top.documents().listeners().add(Trigger.BEFORE_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- createDocument("/top/deeper/test.xml").delete();
- }
-
- public void testListenDocumentsBeforeDeleteDocument2() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath, "before");
- doc.delete();
- Document.Event ev = new Document.Event(Trigger.BEFORE_DELETE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eqDelayedDoc(ev)).will(checkDocumentExists(docPath, true));
- Folder top = db.createFolder("/top");
- top.documents().listeners().add(Trigger.BEFORE_DELETE, documentListenerProxy);
- createDocument(docPath).delete();
- createDocument("/elsewhere/test.xml").delete();
- createDocument("/top/deeper/test.xml").delete();
- }
-
- public void testListenDocumentsAfterDeleteDocument1() {
- final String docPath = "/top/test.xml";
- Document.Event ev = new Document.Event(Trigger.AFTER_DELETE, docPath, null);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- Folder top = db.createFolder("/top");
- top.documents().listeners().add(Trigger.AFTER_DELETE, documentListenerProxy);
- createDocument(docPath).delete();
- createDocument("/elsewhere/test.xml").delete();
- createDocument("/top/deeper/test.xml").delete();
- }
-
- public void testListenFolderBeforeDeleteDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.BEFORE_DELETE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, true));
- Folder top = db.createFolder("/top");
- top.listeners().add(Trigger.BEFORE_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- }
-
- public void testListenFolderBeforeDeleteDocument2() {
- final String docPath = "/top/deeper/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.BEFORE_DELETE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, true));
- Folder top = db.createFolder("/top");
- top.listeners().add(Trigger.BEFORE_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- }
-
- public void testListenFolderAfterDeleteDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.AFTER_DELETE, docPath, null);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- Folder top = db.createFolder("/top");
- top.listeners().add(Trigger.AFTER_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- }
-
- public void testListenFolderAfterDeleteDocument2() {
- final String docPath = "/top/deeper/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.AFTER_DELETE, docPath, null);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- Folder top = db.createFolder("/top");
- top.listeners().add(Trigger.AFTER_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- }
-
- public void testListenDocumentBeforeDeleteDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.BEFORE_DELETE, docPath, doc);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, true));
- doc.listeners().add(Trigger.BEFORE_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- createDocument("/top/deeper/test.xml").delete();
- createDocument("/top/test2.xml").delete();
- }
-
- public void testListenDocumentAfterDeleteDocument1() {
- final String docPath = "/top/test.xml";
- XMLDocument doc = createDocument(docPath);
- Document.Event ev = new Document.Event(Trigger.AFTER_DELETE, docPath, null);
- documentListener.expects(once()).method("handle").with(eq(ev)).will(checkDocumentExists(docPath, false));
- doc.listeners().add(Trigger.AFTER_DELETE, documentListenerProxy);
- doc.delete();
- createDocument("/elsewhere/test.xml").delete();
- createDocument("/top/deeper/test.xml").delete();
- createDocument("/top/test2.xml").delete();
- }
-
- public void bugtestListenBeforeCreateFolder1() {
- final String folderPath = "/top/child";
- Folder.Event ev = new Folder.Event(Trigger.BEFORE_CREATE, folderPath, null);
- folderListener.expects(once()).method("handle").with(eq(ev)).will(checkFolderExists(folderPath, false));
- Folder top = db.createFolder("/top");
- top.listeners().add(Trigger.BEFORE_CREATE, folderListenerProxy);
- top.children().create("child");
- }
-
- public void bugtestListenBeforeCreateFolder2() {
- final String folderPath = "/top/middle/child";
- Folder.Event ev = new Folder.Event(Trigger.BEFORE_CREATE, folderPath, null);
- folderListener.expects(once()).method("handle").with(eq(ev)).will(checkFolderExists(folderPath, false));
- Folder top = db.createFolder("/top");
- Folder middle = db.createFolder("/top/middle");
- top.listeners().add(Trigger.BEFORE_CREATE, folderListenerProxy);
- middle.children().create("child");
- }
-
- }
}
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/Node.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/Node.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/Node.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -261,61 +261,4 @@
@Override public String toString() { return "NULL Node";}
};
- /**
- * @deprecated Test class that should not be javadoc'ed.
- */
- @Deprecated
- public static class Test extends DatabaseTest {
- public void testAppend1() {
- XMLDocument doc = db.createFolder("/test").documents().build(Name.create("foo")).elem("top").end("top").commit();
- Node node = doc.root().append().elem("child").end("child").commit();
- assertNotNull(node);
- assertEquals("child", node.name());
- assertEquals(1, doc.root().query().single("count(*)").intValue());
- }
- public void testAppend2() {
- XMLDocument doc = db.createFolder("/test").documents().build(Name.create("foo")).elem("top").end("top").commit();
- Node node = doc.root().append().elem("child").attr("blah","ick").elem("subchild").end("subchild").end("child").commit();
- assertNotNull(node);
- assertEquals("child", node.name());
- assertEquals(1, doc.root().query().single("count(*)").intValue());
- assertEquals("ick", node.query().single("@blah").value());
- assertEquals("subchild", node.query().single("*").node().name());
- }
- public void testAfterDelete1() {
- XMLDocument doc = db.createFolder("/test").documents().build(Name.create("foo")).elem("top").end("top").commit();
- Node node = doc.root().append().elem("child").end("child").commit();
- node.delete();
- doc.root().append().elem("newchild").end("newchild").commit();
- try {
- node.update().attr("foo", "bar").commit();
- fail("update on deleted and re-created node succeeded");
- } catch (DatabaseException e) {
- }
- }
- public void testAfterDelete2() {
- XMLDocument doc = db.createFolder("/test").documents().build(Name.create("foo")).elem("top").end("top").commit();
- Node node = doc.root();
- doc.delete();
- doc = null;
- db.createFolder("/test").documents().build(Name.create("bar")).elem("ack").end("ack").commit();
- try {
- node.update().attr("foo", "bar").commit();
- fail("update on node deleted with document succeeded");
- } catch (DatabaseException e) {
- }
- }
- public void testAfterDelete3() {
- Folder folder = db.createFolder("/test");
- XMLDocument doc = folder.documents().build(Name.create("foo")).elem("top").end("top").commit();
- Node node = doc.root();
- folder.delete();
- db.createFolder("/test").documents().build(Name.create("bar")).elem("ack").end("ack").commit();
- try {
- node.update().attr("foo", "bar").commit();
- fail("update on node deleted with folder succeeded");
- } catch (DatabaseException e) {
- }
- }
- }
}
\ No newline at end of file
Modified: trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2007-10-29 20:47:34 UTC (rev 6819)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/QueryService.java 2007-10-29 21:01:39 UTC (rev 6820)
@@ -442,33 +442,4 @@
}
}
- /**
- * @deprecated for testing only
- */
- @Deprecated public static class Test extends DatabaseTest {
- public void ...
[truncated message content] |
|
From: <wol...@us...> - 2007-10-29 20:47:35
|
Revision: 6819
http://exist.svn.sourceforge.net/exist/?rev=6819&view=rev
Author: wolfgang_m
Date: 2007-10-29 13:47:34 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Removed old workaround for FTMatchListener. Match highlighting for the full text index is now handled by the full text module.
Removed Paths:
-------------
trunk/eXist/src/org/exist/storage/serializers/FTMatchListener.java
Deleted: trunk/eXist/src/org/exist/storage/serializers/FTMatchListener.java
===================================================================
--- trunk/eXist/src/org/exist/storage/serializers/FTMatchListener.java 2007-10-29 20:46:58 UTC (rev 6818)
+++ trunk/eXist/src/org/exist/storage/serializers/FTMatchListener.java 2007-10-29 20:47:34 UTC (rev 6819)
@@ -1,221 +0,0 @@
-package org.exist.storage.serializers;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.log4j.Logger;
-import org.exist.dom.ExtArrayNodeSet;
-import org.exist.dom.Match;
-import org.exist.dom.NodeProxy;
-import org.exist.dom.NodeSet;
-import org.exist.dom.QName;
-import org.exist.indexing.AbstractMatchListener;
-import org.exist.numbering.NodeId;
-import org.exist.stax.EmbeddedXMLStreamReader;
-import org.exist.storage.NativeTextEngine;
-import org.exist.util.FastQSort;
-import org.exist.util.serializer.AttrList;
-import org.xml.sax.SAXException;
-
-/**
- * Implementation of {@link org.exist.indexing.MatchListener} for the fulltext index.
- * Right now, the serializer will directly plug this into the listener pipeline. This will
- * change once we move the fulltext index into its own module.
- */
-public class FTMatchListener extends AbstractMatchListener {
-
- private final static Logger LOG = Logger.getLogger(FTMatchListener.class);
-
- private Match match;
- private Stack offsetStack = null;
-
- public FTMatchListener() {
- }
-
- public FTMatchListener(NodeProxy proxy) {
- reset(proxy);
- }
-
- public boolean hasMatches(NodeProxy proxy) {
- Match nextMatch = proxy.getMatches();
- while (nextMatch != null) {
- if (nextMatch.getIndexId() == NativeTextEngine.FT_MATCH_ID) {
- return true;
- }
- nextMatch = nextMatch.getNextMatch();
- }
- return false;
- }
-
- protected void reset(NodeProxy proxy) {
- this.match = proxy.getMatches();
- setNextInChain(null);
-
- /* Check if an index is defined on an ancestor of the current node.
- * If yes, scan the ancestor to get the offset of the first character
- * in the current node. For example, if the indexed node is <a>abc<b>de</b></a>
- * and we query for //a[text:ngram-contains(., 'de')]/b, proxy will be a <b> node, but
- * the offsets of the matches are relative to the start of <a>.
- */
- NodeSet ancestors = null;
- Match nextMatch = this.match;
- while (nextMatch != null) {
- if (proxy.getNodeId().isDescendantOf(nextMatch.getNodeId())) {
- if (ancestors == null)
- ancestors = new ExtArrayNodeSet();
- ancestors.add(new NodeProxy(proxy.getDocument(), nextMatch.getNodeId()));
- }
- nextMatch = nextMatch.getNextMatch();
- }
- if (ancestors != null && !ancestors.isEmpty()) {
- for (Iterator i = ancestors.iterator(); i.hasNext();) {
- NodeProxy p = (NodeProxy) i.next();
- int startOffset = 0;
- try {
- XMLStreamReader reader = proxy.getDocument().getBroker().getXMLStreamReader(p, false);
- while (reader.hasNext()) {
- int ev = reader.next();
- NodeId nodeId = (NodeId) reader.getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
- if (nodeId.equals(proxy.getNodeId()))
- break;
- if (ev == XMLStreamReader.CHARACTERS)
- startOffset += reader.getText().length();
- }
- } catch (IOException e) {
- LOG.warn("Problem found while serializing XML: " + e.getMessage(), e);
- } catch (XMLStreamException e) {
- LOG.warn("Problem found while serializing XML: " + e.getMessage(), e);
- }
- if (offsetStack == null)
- offsetStack = new Stack();
- offsetStack.push(new NodeOffset(p.getNodeId(), startOffset));
- }
- }
- }
-
- public void startElement(QName qname, AttrList attribs) throws SAXException {
- Match nextMatch = match;
- // check if there are any matches in the current element
- // if yes, push a NodeOffset object to the stack to track
- // the node contents
- while (nextMatch != null) {
- if (nextMatch.getNodeId().equals(getCurrentNode().getNodeId())) {
- if (offsetStack == null)
- offsetStack = new Stack();
- offsetStack.push(new NodeOffset(nextMatch.getNodeId()));
- break;
- }
- nextMatch = nextMatch.getNextMatch();
- }
- super.startElement(qname, attribs);
- }
-
- public void endElement(QName qname) throws SAXException {
- Match nextMatch = match;
- // check if we need to pop the stack
- while (nextMatch != null) {
- if (nextMatch.getNodeId().equals(getCurrentNode().getNodeId())) {
- offsetStack.pop();
- break;
- }
- nextMatch = nextMatch.getNextMatch();
- }
- super.endElement(qname);
- }
-
- public void characters(CharSequence seq) throws SAXException {
- List offsets = null; // a list of offsets to process
- if (offsetStack != null) {
- // walk through the stack to find matches which start in
- // the current string of text
- for (int i = 0; i < offsetStack.size(); i++) {
- NodeOffset no = (NodeOffset) offsetStack.get(i);
- int end = no.offset + seq.length();
- // scan all matches
- Match next = match;
- while (next != null) {
- if (next.getIndexId() == NativeTextEngine.FT_MATCH_ID && next.getNodeId().equals(no.nodeId)) {
- int freq = next.getFrequency();
- for (int j = 0; j < freq; j++) {
- Match.Offset offset = next.getOffset(j);
- if (offset.getOffset() < end &&
- offset.getOffset() + offset.getLength() > no.offset) {
- // add it to the list to be processed
- if (offsets == null) {
- offsets = new ArrayList(4);
- }
- // adjust the offset and add it to the list
- int start = offset.getOffset() - no.offset;
- int len = offset.getLength();
- if (start < 0) {
- len = len - Math.abs(start);
- start = 0;
- }
- if (start + len > seq.length())
- len = seq.length() - start;
- offsets.add(new Match.Offset(start, len));
- }
- }
- }
- next = next.getNextMatch();
- }
- // add the length of the current text to the element content length
- no.offset = end;
- }
- }
- // walk through the matches a second time to find matches in the text node itself
- Match next = match;
- while (next != null) {
- if (next.getIndexId() == NativeTextEngine.FT_MATCH_ID &&
- next.getNodeId().equals(getCurrentNode().getNodeId())) {
- if (offsets == null)
- offsets = new ArrayList();
- int freq = next.getFrequency();
- for (int i = 0; i < freq; i++) {
- offsets.add(next.getOffset(i));
- }
- }
- next = next.getNextMatch();
- }
- // now print out the text, marking all matches with a match element
- if (offsets != null) {
- FastQSort.sort(offsets, 0, offsets.size() - 1);
- String s = seq.toString();
- int pos = 0;
- for (int i = 0; i < offsets.size(); i++) {
- Match.Offset offset = (Match.Offset) offsets.get(i);
- if (offset.getOffset() > pos) {
- super.characters(s.substring(pos, pos + (offset.getOffset() - pos)));
- }
- super.startElement(MATCH_ELEMENT, null);
- super.characters(s.substring(offset.getOffset(), offset.getOffset() + offset.getLength()));
- super.endElement(MATCH_ELEMENT);
- pos = offset.getOffset() + offset.getLength();
- }
- if (pos < s.length()) {
- super.characters(s.substring(pos));
- }
- } else
- super.characters(seq);
- }
-
- private class NodeOffset {
- NodeId nodeId;
- int offset = 0;
-
- public NodeOffset(NodeId nodeId) {
- this.nodeId = nodeId;
- }
-
- public NodeOffset(NodeId nodeId, int offset) {
- this.nodeId = nodeId;
- this.offset = offset;
- }
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-10-29 20:47:02
|
Revision: 6818
http://exist.svn.sourceforge.net/exist/?rev=6818&view=rev
Author: wolfgang_m
Date: 2007-10-29 13:46:58 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Removed old workaround for FTMatchListener. Match highlighting for the full text index is now handled by the full text module.
Modified Paths:
--------------
trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java
trunk/eXist/src/org/exist/storage/NativeTextEngine.java
trunk/eXist/src/org/exist/storage/serializers/Serializer.java
Added Paths:
-----------
trunk/eXist/src/org/exist/fulltext/FTMatch.java
trunk/eXist/src/org/exist/fulltext/FTMatchListener.java
Modified: trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java
===================================================================
--- trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java 2007-10-29 20:09:30 UTC (rev 6817)
+++ trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java 2007-10-29 20:46:58 UTC (rev 6818)
@@ -1,3 +1,24 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
package org.exist.fulltext;
import org.exist.collections.Collection;
@@ -4,6 +25,7 @@
import org.exist.dom.*;
import org.exist.indexing.*;
import org.exist.storage.*;
+import org.exist.fulltext.FTMatchListener;
import org.exist.storage.txn.Txn;
import org.exist.util.DatabaseConfigurationException;
import org.exist.util.Occurrences;
@@ -30,7 +52,8 @@
private int mode = StreamListener.UNKNOWN;
private FTStreamListener listener = new FTStreamListener();
-
+ private FTMatchListener matchListener = null;
+
public FTIndexWorker(NativeTextEngine engine) {
this.index = engine;
}
@@ -109,8 +132,22 @@
}
public MatchListener getMatchListener(NodeProxy proxy) {
- // Not implemented
- return null;
+ boolean needToFilter = false;
+ Match nextMatch = proxy.getMatches();
+ while (nextMatch != null) {
+ if (nextMatch.getIndexId() == ID) {
+ needToFilter = true;
+ break;
+ }
+ nextMatch = nextMatch.getNextMatch();
+ }
+ if (!needToFilter)
+ return null;
+ if (matchListener == null)
+ matchListener = new FTMatchListener(proxy);
+ else
+ matchListener.reset(proxy);
+ return matchListener;
}
public void flush() {
Added: trunk/eXist/src/org/exist/fulltext/FTMatch.java
===================================================================
--- trunk/eXist/src/org/exist/fulltext/FTMatch.java (rev 0)
+++ trunk/eXist/src/org/exist/fulltext/FTMatch.java 2007-10-29 20:46:58 UTC (rev 6818)
@@ -0,0 +1,52 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+package org.exist.fulltext;
+
+import org.exist.dom.Match;
+import org.exist.numbering.NodeId;
+
+public class FTMatch extends Match {
+
+ public FTMatch(int contextId, NodeId nodeId, String matchTerm) {
+ super(contextId, nodeId, matchTerm);
+ }
+
+ public FTMatch(int contextId, NodeId nodeId, String matchTerm, int frequency) {
+ super(contextId, nodeId, matchTerm, frequency);
+ }
+
+ public FTMatch(Match match) {
+ super(match);
+ }
+
+ public Match createInstance(int contextId, NodeId nodeId, String matchTerm) {
+ return new FTMatch(contextId, nodeId, matchTerm);
+ }
+
+ public Match newCopy() {
+ return new FTMatch(this);
+ }
+
+ public String getIndexId() {
+ return FTIndexWorker.ID;
+ }
+}
\ No newline at end of file
Copied: trunk/eXist/src/org/exist/fulltext/FTMatchListener.java (from rev 6817, trunk/eXist/src/org/exist/storage/serializers/FTMatchListener.java)
===================================================================
--- trunk/eXist/src/org/exist/fulltext/FTMatchListener.java (rev 0)
+++ trunk/eXist/src/org/exist/fulltext/FTMatchListener.java 2007-10-29 20:46:58 UTC (rev 6818)
@@ -0,0 +1,216 @@
+package org.exist.fulltext;
+
+import org.apache.log4j.Logger;
+import org.exist.dom.*;
+import org.exist.fulltext.FTIndexWorker;
+import org.exist.indexing.AbstractMatchListener;
+import org.exist.numbering.NodeId;
+import org.exist.stax.EmbeddedXMLStreamReader;
+import org.exist.util.FastQSort;
+import org.exist.util.serializer.AttrList;
+import org.xml.sax.SAXException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+/**
+ * Implementation of {@link org.exist.indexing.MatchListener} for the fulltext index.
+ * Right now, the serializer will directly plug this into the listener pipeline. This will
+ * change once we move the fulltext index into its own module.
+ */
+public class FTMatchListener extends AbstractMatchListener {
+
+ private final static Logger LOG = Logger.getLogger(FTMatchListener.class);
+
+ private Match match;
+ private Stack offsetStack = null;
+
+ public FTMatchListener() {
+ }
+
+ public FTMatchListener(NodeProxy proxy) {
+ reset(proxy);
+ }
+
+ public boolean hasMatches(NodeProxy proxy) {
+ Match nextMatch = proxy.getMatches();
+ while (nextMatch != null) {
+ if (nextMatch.getIndexId() == FTIndexWorker.ID) {
+ return true;
+ }
+ nextMatch = nextMatch.getNextMatch();
+ }
+ return false;
+ }
+
+ public void reset(NodeProxy proxy) {
+ this.match = proxy.getMatches();
+ setNextInChain(null);
+
+ /* Check if an index is defined on an ancestor of the current node.
+ * If yes, scan the ancestor to get the offset of the first character
+ * in the current node. For example, if the indexed node is <a>abc<b>de</b></a>
+ * and we query for //a[text:ngram-contains(., 'de')]/b, proxy will be a <b> node, but
+ * the offsets of the matches are relative to the start of <a>.
+ */
+ NodeSet ancestors = null;
+ Match nextMatch = this.match;
+ while (nextMatch != null) {
+ if (proxy.getNodeId().isDescendantOf(nextMatch.getNodeId())) {
+ if (ancestors == null)
+ ancestors = new ExtArrayNodeSet();
+ ancestors.add(new NodeProxy(proxy.getDocument(), nextMatch.getNodeId()));
+ }
+ nextMatch = nextMatch.getNextMatch();
+ }
+ if (ancestors != null && !ancestors.isEmpty()) {
+ for (Iterator i = ancestors.iterator(); i.hasNext();) {
+ NodeProxy p = (NodeProxy) i.next();
+ int startOffset = 0;
+ try {
+ XMLStreamReader reader = proxy.getDocument().getBroker().getXMLStreamReader(p, false);
+ while (reader.hasNext()) {
+ int ev = reader.next();
+ NodeId nodeId = (NodeId) reader.getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
+ if (nodeId.equals(proxy.getNodeId()))
+ break;
+ if (ev == XMLStreamReader.CHARACTERS)
+ startOffset += reader.getText().length();
+ }
+ } catch (IOException e) {
+ LOG.warn("Problem found while serializing XML: " + e.getMessage(), e);
+ } catch (XMLStreamException e) {
+ LOG.warn("Problem found while serializing XML: " + e.getMessage(), e);
+ }
+ if (offsetStack == null)
+ offsetStack = new Stack();
+ offsetStack.push(new NodeOffset(p.getNodeId(), startOffset));
+ }
+ }
+ }
+
+ public void startElement(QName qname, AttrList attribs) throws SAXException {
+ Match nextMatch = match;
+ // check if there are any matches in the current element
+ // if yes, push a NodeOffset object to the stack to track
+ // the node contents
+ while (nextMatch != null) {
+ if (nextMatch.getNodeId().equals(getCurrentNode().getNodeId())) {
+ if (offsetStack == null)
+ offsetStack = new Stack();
+ offsetStack.push(new NodeOffset(nextMatch.getNodeId()));
+ break;
+ }
+ nextMatch = nextMatch.getNextMatch();
+ }
+ super.startElement(qname, attribs);
+ }
+
+ public void endElement(QName qname) throws SAXException {
+ Match nextMatch = match;
+ // check if we need to pop the stack
+ while (nextMatch != null) {
+ if (nextMatch.getNodeId().equals(getCurrentNode().getNodeId())) {
+ offsetStack.pop();
+ break;
+ }
+ nextMatch = nextMatch.getNextMatch();
+ }
+ super.endElement(qname);
+ }
+
+ public void characters(CharSequence seq) throws SAXException {
+ List offsets = null; // a list of offsets to process
+ if (offsetStack != null) {
+ // walk through the stack to find matches which start in
+ // the current string of text
+ for (int i = 0; i < offsetStack.size(); i++) {
+ NodeOffset no = (NodeOffset) offsetStack.get(i);
+ int end = no.offset + seq.length();
+ // scan all matches
+ Match next = match;
+ while (next != null) {
+ if (next.getIndexId() == FTIndexWorker.ID && next.getNodeId().equals(no.nodeId)) {
+ int freq = next.getFrequency();
+ for (int j = 0; j < freq; j++) {
+ Match.Offset offset = next.getOffset(j);
+ if (offset.getOffset() < end &&
+ offset.getOffset() + offset.getLength() > no.offset) {
+ // add it to the list to be processed
+ if (offsets == null) {
+ offsets = new ArrayList(4);
+ }
+ // adjust the offset and add it to the list
+ int start = offset.getOffset() - no.offset;
+ int len = offset.getLength();
+ if (start < 0) {
+ len = len - Math.abs(start);
+ start = 0;
+ }
+ if (start + len > seq.length())
+ len = seq.length() - start;
+ offsets.add(new Match.Offset(start, len));
+ }
+ }
+ }
+ next = next.getNextMatch();
+ }
+ // add the length of the current text to the element content length
+ no.offset = end;
+ }
+ }
+ // walk through the matches a second time to find matches in the text node itself
+ Match next = match;
+ while (next != null) {
+ if (next.getIndexId() == FTIndexWorker.ID &&
+ next.getNodeId().equals(getCurrentNode().getNodeId())) {
+ if (offsets == null)
+ offsets = new ArrayList();
+ int freq = next.getFrequency();
+ for (int i = 0; i < freq; i++) {
+ offsets.add(next.getOffset(i));
+ }
+ }
+ next = next.getNextMatch();
+ }
+ // now print out the text, marking all matches with a match element
+ if (offsets != null) {
+ FastQSort.sort(offsets, 0, offsets.size() - 1);
+ String s = seq.toString();
+ int pos = 0;
+ for (int i = 0; i < offsets.size(); i++) {
+ Match.Offset offset = (Match.Offset) offsets.get(i);
+ if (offset.getOffset() > pos) {
+ super.characters(s.substring(pos, pos + (offset.getOffset() - pos)));
+ }
+ super.startElement(MATCH_ELEMENT, null);
+ super.characters(s.substring(offset.getOffset(), offset.getOffset() + offset.getLength()));
+ super.endElement(MATCH_ELEMENT);
+ pos = offset.getOffset() + offset.getLength();
+ }
+ if (pos < s.length()) {
+ super.characters(s.substring(pos));
+ }
+ } else
+ super.characters(seq);
+ }
+
+ private class NodeOffset {
+ NodeId nodeId;
+ int offset = 0;
+
+ public NodeOffset(NodeId nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public NodeOffset(NodeId nodeId, int offset) {
+ this.nodeId = nodeId;
+ this.offset = offset;
+ }
+ }
+}
Property changes on: trunk/eXist/src/org/exist/fulltext/FTMatchListener.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/eXist/src/org/exist/storage/NativeTextEngine.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-10-29 20:09:30 UTC (rev 6817)
+++ trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-10-29 20:46:58 UTC (rev 6818)
@@ -26,8 +26,9 @@
import org.exist.EXistException;
import org.exist.collections.Collection;
import org.exist.dom.*;
-import org.exist.fulltext.FTIndexWorker;
import org.exist.fulltext.ElementContent;
+import org.exist.fulltext.FTIndexWorker;
+import org.exist.fulltext.FTMatch;
import org.exist.numbering.NodeId;
import org.exist.security.PermissionDeniedException;
import org.exist.storage.analysis.TextToken;
@@ -64,8 +65,6 @@
*/
public class NativeTextEngine extends TextSearchEngine implements ContentLoadingObserver {
- public static final String FT_MATCH_ID = NativeTextEngine.class.getName();
-
public static final String FILE_NAME = "words.dbx";
public static final String FILE_KEY_IN_CONFIG = "db-connection.words";
@@ -497,7 +496,7 @@
throw new IllegalArgumentException("Invalid section type in '" + dbTokens.getFile().getName() + "'");
}
if (parent != null) {
- Match match = new FtMatch(-1, nodeId, token, freq);
+ Match match = new FTMatch(-1, nodeId, token, freq);
readOccurrences(freq, is, match, token.length());
if (axis == NodeSet.ANCESTOR) {
parent.addMatch(match);
@@ -513,7 +512,7 @@
}
// otherwise, we add all text nodes without check
} else {
- Match match = new FtMatch(-1, nodeId, token, freq);
+ Match match = new FTMatch(-1, nodeId, token, freq);
readOccurrences(freq, is, match, token.length());
storedNode.addMatch(match);
result.add(storedNode, Constants.NO_SIZE_HINT);
@@ -1393,7 +1392,7 @@
throw new IllegalArgumentException("Invalid section type in '" + dbTokens.getFile().getName() + "'");
}
if (parentNode != null) {
- Match match = new FtMatch(-1, nodeId, word.toString(), freq);
+ Match match = new FTMatch(-1, nodeId, word.toString(), freq);
readOccurrences(freq, is, match, word.length());
int sizeHint = contextSet.getSizeHint(storedDocument);
if (axis == NodeSet.ANCESTOR) {
@@ -1406,7 +1405,7 @@
} else
is.skip(freq);
} else {
- Match match = new FtMatch(-1, nodeId, word.toString(), freq);
+ Match match = new FTMatch(-1, nodeId, word.toString(), freq);
readOccurrences(freq, is, match, word.length());
storedNode.addMatch(match);
result.add(storedNode, Constants.NO_SIZE_HINT);
@@ -1699,31 +1698,4 @@
else return "no word";
}
}
-
- public class FtMatch extends Match {
-
- public FtMatch(int contextId, NodeId nodeId, String matchTerm) {
- super(contextId, nodeId, matchTerm);
- }
-
- public FtMatch(int contextId, NodeId nodeId, String matchTerm, int frequency) {
- super(contextId, nodeId, matchTerm, frequency);
- }
-
- public FtMatch(Match match) {
- super(match);
- }
-
- public Match createInstance(int contextId, NodeId nodeId, String matchTerm) {
- return new FtMatch(contextId, nodeId, matchTerm);
- }
-
- public Match newCopy() {
- return new FtMatch(this);
- }
-
- public String getIndexId() {
- return FT_MATCH_ID;
- }
- }
}
Modified: trunk/eXist/src/org/exist/storage/serializers/Serializer.java
===================================================================
--- trunk/eXist/src/org/exist/storage/serializers/Serializer.java 2007-10-29 20:09:30 UTC (rev 6817)
+++ trunk/eXist/src/org/exist/storage/serializers/Serializer.java 2007-10-29 20:46:58 UTC (rev 6818)
@@ -167,10 +167,6 @@
protected LexicalHandler lexicalHandler = null;
protected User user = null;
- // match listener for the fulltext index. to be removed once the index has
- // been moved to the new architecture
- private FTMatchListener ftmatch = new FTMatchListener();
-
public Serializer(DBBroker broker, Configuration config) {
this.broker = broker;
factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
@@ -552,12 +548,6 @@
if (root != null && getHighlightingMode() != TAG_NONE) {
IndexController controller = broker.getIndexController();
MatchListener listener = controller.getMatchListener(root);
- if (ftmatch.hasMatches(root)) {
- ftmatch.reset(root);
- ftmatch.setNextInChain(receiver);
- receiver = ftmatch;
- LOG.debug("Applying FTMatchListener");
- }
if (listener != null) {
MatchListener last = (MatchListener) listener.getLastInChain();
last.setNextInChain(receiver);
@@ -571,12 +561,6 @@
if (getHighlightingMode() != TAG_NONE) {
IndexController controller = broker.getIndexController();
MatchListener listener = controller.getMatchListener(p);
- if (ftmatch.hasMatches(p)) {
- ftmatch.reset(p);
- ftmatch.setNextInChain(receiver);
- receiver = ftmatch;
- LOG.debug("Applying FTMatchListener");
- }
if (listener != null) {
MatchListener last = (MatchListener) listener.getLastInChain();
last.setNextInChain(receiver);
@@ -737,11 +721,6 @@
if (root != null && getHighlightingMode() != TAG_NONE) {
IndexController controller = broker.getIndexController();
MatchListener listener = controller.getMatchListener(root);
- if (ftmatch.hasMatches(root)) {
- ftmatch.reset(root);
- ftmatch.setNextInChain(receiver);
- receiver = ftmatch;
- }
if (listener != null) {
MatchListener last = (MatchListener) listener.getLastInChain();
last.setNextInChain(receiver);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-10-29 20:09:31
|
Revision: 6817
http://exist.svn.sourceforge.net/exist/?rev=6817&view=rev
Author: wolfgang_m
Date: 2007-10-29 13:09:30 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
New test cases for the full text index.
Modified Paths:
--------------
trunk/eXist/build/scripts/junit.xml
trunk/eXist/test/src/org/exist/xquery/AllXqueryTests.java
Added Paths:
-----------
trunk/eXist/test/src/org/exist/fulltext/
trunk/eXist/test/src/org/exist/fulltext/AllFulltextTests.java
trunk/eXist/test/src/org/exist/fulltext/FTIndexTest.java
trunk/eXist/test/src/org/exist/fulltext/FTMatchListenerTest.java
trunk/eXist/test/src/org/exist/fulltext/FtQueryTest.java
Removed Paths:
-------------
trunk/eXist/test/src/org/exist/storage/serializers/FTMatchListenerTest.java
trunk/eXist/test/src/org/exist/xquery/FtQueryTest.java
Modified: trunk/eXist/build/scripts/junit.xml
===================================================================
--- trunk/eXist/build/scripts/junit.xml 2007-10-29 20:06:34 UTC (rev 6816)
+++ trunk/eXist/build/scripts/junit.xml 2007-10-29 20:09:30 UTC (rev 6817)
@@ -100,9 +100,9 @@
<test fork="yes" name="org.exist.xupdate.AllXupdateTests" todir="${junit.reports.dat}"/>
<test fork="yes" name="org.exist.xquery.AllXqueryTests" todir="${junit.reports.dat}"/>
<test fork="yes" name="org.exist.xquery.OptimizerTest" todir="${junit.reports.dat}"/>
- <test fork="yes" name="org.exist.storage.serializers.FTMatchListenerTest" todir="${junit.reports.dat}"/>
<test fork="yes" name="org.exist.collections.triggers.AllTriggerTests" todir="${junit.reports.dat}"/>
-
+ <test fork="yes" name="org.exist.fulltext.AllFulltextTests" todir="${junit.reports.dat}"/>
+
<!-- Execute all other tests except those that have to be called manually. -->
<batchtest fork="yes" todir="${junit.reports.dat}">
<fileset dir="${junit.reports}/src">
@@ -121,6 +121,7 @@
<exclude name="**/numbering/*.java"/>
<exclude name="**/collections/*.java"/>
<exclude name="org/exist/*.java"/>
+ <exclude name="**/fulltext/**/*.java"/>
</fileset>
</batchtest>
</junit>
Added: trunk/eXist/test/src/org/exist/fulltext/AllFulltextTests.java
===================================================================
--- trunk/eXist/test/src/org/exist/fulltext/AllFulltextTests.java (rev 0)
+++ trunk/eXist/test/src/org/exist/fulltext/AllFulltextTests.java 2007-10-29 20:09:30 UTC (rev 6817)
@@ -0,0 +1,15 @@
+package org.exist.fulltext;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ FTIndexTest.class,
+ FtQueryTest.class,
+ FTMatchListenerTest.class
+})
+public class AllFulltextTests {
+}
Added: trunk/eXist/test/src/org/exist/fulltext/FTIndexTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/fulltext/FTIndexTest.java (rev 0)
+++ trunk/eXist/test/src/org/exist/fulltext/FTIndexTest.java 2007-10-29 20:09:30 UTC (rev 6817)
@@ -0,0 +1,945 @@
+package org.exist.fulltext;
+
+import org.exist.TestUtils;
+import org.exist.collections.Collection;
+import org.exist.collections.CollectionConfigurationManager;
+import org.exist.collections.IndexInfo;
+import org.exist.dom.DocumentSet;
+import org.exist.dom.QName;
+import org.exist.security.PermissionDeniedException;
+import org.exist.security.SecurityManager;
+import org.exist.security.xacml.AccessContext;
+import org.exist.storage.BrokerPool;
+import org.exist.storage.DBBroker;
+import org.exist.storage.ElementValue;
+import org.exist.storage.txn.TransactionManager;
+import org.exist.storage.txn.Txn;
+import org.exist.test.TestConstants;
+import org.exist.util.Configuration;
+import org.exist.util.ConfigurationHelper;
+import org.exist.util.Occurrences;
+import org.exist.xmldb.XmldbURI;
+import org.exist.xquery.XQuery;
+import org.exist.xquery.value.Sequence;
+import org.exist.xupdate.Modification;
+import org.exist.xupdate.XUpdateProcessor;
+import org.junit.*;
+import static org.junit.Assert.*;
+import org.xml.sax.InputSource;
+
+import java.io.File;
+import java.io.StringReader;
+
+/**
+ * Low-level tests for fulltext index configuration and index updates.
+ */
+public class FTIndexTest {
+
+ public final static String XML =
+ "<content>" +
+ "<figure>" +
+ "<title>Location of equiment items on aircraft</title>" +
+ "<img src='foo.jpg'/>" +
+ "<img src='baz.jpg'/>" +
+ "</figure>" +
+ "<figure>" +
+ "<title>Hydraulic Power<b>System</b></title>" +
+ "<p>paragraphs with <span>mix</span><span>ed</span> content are <span>danger</span>ous.</p>" +
+ "</figure>" +
+ "</content>";
+
+ private static String XML1 =
+ "<test>" +
+ " <item id='1' attr='attribute'><description>Chair</description></item>" +
+ " <item id='2'><description>Table</description><price>892.25</price></item>" +
+ " <item id='3'><description>Cabinet</description><price>1525.00</price></item>" +
+ "</test>";
+
+ private static String COLLECTION_CONFIG1 =
+ "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
+ " <index>" +
+ " <fulltext default=\"none\">" +
+ " <include path=\"/content/figure/title\"/>" +
+ " <create qname=\"p\" content=\"mixed\"/>" +
+ " <create qname=\"content\"/>" +
+ " </fulltext>" +
+ " </index>" +
+ "</collection>";
+
+ private static String COLLECTION_CONFIG2 =
+ "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
+ " <index>" +
+ " <fulltext default=\"none\">" +
+ " <create qname=\"item\"/>" +
+ " <create qname=\"description\"/>" +
+ " <create qname=\"price\"/>" +
+ " <create qname=\"@attr\"/>" +
+ " </fulltext>" +
+ " </index>" +
+ "</collection>";
+
+ private static String COLLECTION_CONFIG3 =
+ "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
+ " <index>" +
+ " <fulltext default=\"none\">" +
+ " <include path=\"/content/figure/title\" content=\"mixed\"/>" +
+ " <include path=\"/content//p\" content=\"mixed\"/>" +
+ " </fulltext>" +
+ " </index>" +
+ "</collection>";
+
+ private static String XUPDATE_START =
+ "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">";
+
+ private static String XUPDATE_END =
+ "</xu:modifications>";
+
+ private static BrokerPool pool;
+ private static Collection root;
+ private static final QName[] QNDESC = new QName[]{ new QName("description", "", "") };
+ private static final QName[] QNPRICE = new QName[]{ new QName("price", "", "") };
+ private static final QName[] QNITEM = new QName[]{ new QName("item", "", "") };
+
+ @Test
+ public void defaultIndex() {
+ DocumentSet docs = configureAndStore(null, XML, "defaultIndex.xml");
+ DBBroker broker = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ Occurrences[] occur = broker.getTextEngine().scanIndexTerms(docs, docs.toNodeSet(), "a", "ax");
+ printOccurrences("Checking for 'a', 'ax'", occur);
+ assertEquals(2, occur.length);
+ assertEquals("aircraft", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, null, "power", 1);
+ assertEquals("power", occur[0].getTerm());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @Test
+ public void mixedIndexes() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG3, XML, "mixedIndexes.xml");
+ DBBroker broker = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+
+ Occurrences[] occur = checkIndex(docs, broker, null, "hydraulic", 1);
+ assertEquals("hydraulic", occur[0].getTerm());
+
+ checkIndex(docs, broker, null, "system", 0);
+ occur = checkIndex(docs, broker, null, "powersystem", 1);
+ assertEquals("powersystem", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, null, "mix", 1);
+ assertEquals("mixed", occur[0].getTerm());
+ checkIndex(docs, broker, null, "ed", 0);
+ occur = checkIndex(docs, broker, null, "mixed", 1);
+ assertEquals("mixed", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, null, "danger", 1);
+ assertEquals("dangerous", occur[0].getTerm());
+ occur = checkIndex(docs, broker, null, "dangerous", 1);
+ assertEquals("dangerous", occur[0].getTerm());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @Test
+ public void mixedQNameIndexes() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG1, XML, "mixedIndexes.xml");
+ DBBroker broker = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+
+ Occurrences[] occur = checkIndex(docs, broker, null, "aircraft", 1);
+ assertEquals("aircraft", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, null, "system", 1);
+ assertEquals("system", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, null, "power", 1);
+ assertEquals("power", occur[0].getTerm());
+
+ QName qn[] = { new QName("p", "", "") };
+ occur = checkIndex(docs, broker, qn, "mixed", 1);
+ assertEquals("mixed", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, qn, "dangerous", 1);
+ assertEquals("dangerous", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, qn, "content", 1);
+ assertEquals("content", occur[0].getTerm());
+
+ qn[0] = new QName("content", "", "");
+ occur = checkIndex(docs, broker, qn, "aircraft", 1);
+ assertEquals("aircraft", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, qn, "hydraulic", 1);
+ assertEquals("hydraulic", occur[0].getTerm());
+
+ // not a mixed-content index
+ checkIndex(docs, broker, qn, "dangerous", 0);
+ occur = checkIndex(docs, broker, qn, "danger", 1);
+ assertEquals("danger", occur[0].getTerm());
+
+ occur = checkIndex(docs, broker, qn, "power", 1);
+ assertEquals("power", occur[0].getTerm());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @Test
+ public void dropDocument() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG1, XML, "dropDocument.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+
+ System.out.println("Removing document dropDocument.xml");
+ root.removeXMLResource(transaction, broker, XmldbURI.create("dropDocument.xml"));
+ transact.commit(transaction);
+
+ checkIndex(docs, broker, null, null, 0);
+
+ QName qn[] = { new QName("p", "", "") };
+ checkIndex(docs, broker, qn, null, 0);
+
+ qn[0] = new QName("content", "", "");
+ checkIndex(docs, broker, qn, null, 0);
+
+ checkIndex(docs, broker, null, null, 0);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @Test
+ public void reindex() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG1, XML, "dropDocument.xml");
+ DBBroker broker = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+
+ broker.reindexCollection(TestConstants.TEST_COLLECTION_URI);
+
+ Occurrences[] occur = broker.getTextEngine().scanIndexTerms(docs, docs.toNodeSet(), "o", "ox");
+ printOccurrences("o, ox", occur);
+ assertEquals(2, occur.length);
+ assertEquals("of", occur[0].getTerm());
+ assertEquals("on", occur[1].getTerm());
+
+ occur = checkIndex(docs, broker, null, "power", 1);
+ assertEquals("power", occur[0].getTerm());
+
+ QName qn[] = { new QName("p", "", "") };
+ checkIndex(docs, broker, qn, "mixed", 1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ /**
+ * Remove nodes from different levels of the tree and check if the index is
+ * correctly updated.
+ */
+ @Test
+ public void xupdateRemove() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG2, XML1, "xupdate.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(SecurityManager.SYSTEM_USER);
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
+
+ Occurrences occur[] = checkIndex(docs, broker, QNDESC, "chair", 1);
+ assertEquals("chair", occur[0].getTerm());
+ checkIndex(docs, broker, QNITEM, null, 5);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//item[description &= 'chair']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+
+ XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
+ assertNotNull(proc);
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ String xupdate =
+ XUPDATE_START +
+ " <xu:remove select=\"//item[@id='2']/price\"/>" +
+ XUPDATE_END;
+ Modification[] modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 1);
+ checkIndex(docs, broker, QNITEM, null, 4);
+ checkIndex(docs, broker, QNPRICE, "892", 0);
+ checkIndex(docs, broker, QNITEM, "892", 0);
+ Occurrences o[] = checkIndex(docs, broker, QNDESC, "table", 1);
+ assertEquals("table", o[0].getTerm());
+ o = checkIndex(docs, broker, QNDESC, "cabinet", 1);
+ assertEquals("cabinet", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "table", 1);
+ assertEquals("table", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "cabinet", 1);
+ assertEquals("cabinet", o[0].getTerm());
+
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:remove select=\"//item[@id='3']/description/text()\"/>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 2);
+ checkIndex(docs, broker, QNITEM, null, 3);
+ checkIndex(docs, broker, QNDESC, "cabinet", 0);
+ checkIndex(docs, broker, QNITEM, "cabinet", 0);
+ o = checkIndex(docs, broker, QNPRICE, "1525.00", 1);
+ assertEquals("1525.00", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "1525.00", 1);
+ assertEquals("1525.00", o[0].getTerm());
+
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:remove select=\"//item[@id='1']/@attr\"/>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ QName qnattr[] = { new QName("attr", "", "") };
+ qnattr[0].setNameType(ElementValue.ATTRIBUTE);
+ checkIndex(docs, broker, qnattr, null, 0);
+
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:remove select=\"//item[@id='1']\"/>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ o = checkIndex(docs, broker, QNDESC, null, 1);
+ assertEquals("table", o[0].getTerm());
+ checkIndex(docs, broker, QNDESC, "chair", 0);
+ checkIndex(docs, broker, QNITEM, null, 2);
+ assertEquals("table", o[0].getTerm());
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) {
+ pool.release(broker);
+ }
+ }
+ }
+
+ /**
+ * Remove nodes from different levels of the tree and check if the index is
+ * correctly updated.
+ */
+ @Test
+ public void xupdateInsert() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG2, XML1, "xupdate.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(SecurityManager.SYSTEM_USER);
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
+
+ Occurrences occur[] = checkIndex(docs, broker, QNDESC, "chair", 1);
+ assertEquals("chair", occur[0].getTerm());
+ checkIndex(docs, broker, QNITEM, null, 5);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//item[description &= 'chair']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+
+ // Append to root node
+ XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
+ assertNotNull(proc);
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ String xupdate =
+ XUPDATE_START +
+ " <xu:append select=\"/test\">" +
+ " <item id='4'><description>Armchair</description><price>340</price></item>" +
+ " </xu:append>" +
+ XUPDATE_END;
+ Modification[] modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 3);
+ checkIndex(docs, broker, QNDESC, null, 4);
+ checkIndex(docs, broker, QNITEM, null, 7);
+ Occurrences o[] = checkIndex(docs, broker, QNPRICE, "340", 1);
+ assertEquals("340", o[0].getTerm());
+ o = checkIndex(docs, broker, QNDESC, "armchair", 1);
+ assertEquals("armchair", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "340", 1);
+ assertEquals("340", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "armchair", 1);
+ assertEquals("armchair", o[0].getTerm());
+
+ // Insert before top element
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:insert-before select=\"//item[@id = '1']\">" +
+ " <item id='0'><description>Wheelchair</description><price>1230</price></item>" +
+ " </xu:insert-before>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 4);
+ checkIndex(docs, broker, QNDESC, null, 5);
+ checkIndex(docs, broker, QNITEM, null, 9);
+ o = checkIndex(docs, broker, QNPRICE, "1230", 1);
+ assertEquals("1230", o[0].getTerm());
+ o = checkIndex(docs, broker, QNDESC, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "1230", 1);
+ assertEquals("1230", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+
+ // Insert after element
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:insert-after select=\"//item[@id = '1']\">" +
+ " <item id='1.1'><description>refrigerator</description><price>777</price></item>" +
+ " </xu:insert-after>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 5);
+ checkIndex(docs, broker, QNDESC, null, 6);
+ checkIndex(docs, broker, QNITEM, null, 11);
+ o = checkIndex(docs, broker, QNPRICE, "777", 1);
+ assertEquals("777", o[0].getTerm());
+ o = checkIndex(docs, broker, QNDESC, "refrigerator", 1);
+ assertEquals("refrigerator", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "777", 1);
+ assertEquals("777", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "refrigerator", 1);
+ assertEquals("refrigerator", o[0].getTerm());
+
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:insert-after select=\"//item[@id = '1']/description\">" +
+ " <price>999</price>" +
+ " </xu:insert-after>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 6);
+ checkIndex(docs, broker, QNITEM, null, 12);
+ o = checkIndex(docs, broker, QNPRICE, "999", 1);
+ assertEquals("999", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "999", 1);
+ assertEquals("999", o[0].getTerm());
+
+ // Insert before nested element
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:insert-before select=\"//item[@id = '1']/description\">" +
+ " <price>888</price>" +
+ " </xu:insert-before>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNPRICE, null, 7);
+ checkIndex(docs, broker, QNITEM, null, 13);
+ o = checkIndex(docs, broker, QNPRICE, "999", 1);
+ assertEquals("999", o[0].getTerm());
+ o = checkIndex(docs, broker, QNPRICE, "888", 1);
+ assertEquals("888", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "999", 1);
+ assertEquals("999", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "888", 1);
+ assertEquals("888", o[0].getTerm());
+
+ // Overwrite attribute
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:append select=\"//item[@id = '1']\">" +
+ " <xu:attribute name=\"attr\">abc</xu:attribute>" +
+ " </xu:append>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ QName qnattr[] = { new QName("attr", "", "") };
+ qnattr[0].setNameType(ElementValue.ATTRIBUTE);
+ o = checkIndex(docs, broker, qnattr, null, 1);
+ assertEquals("abc", o[0].getTerm());
+ checkIndex(docs, broker, qnattr, "attribute", 0);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) {
+ pool.release(broker);
+ }
+ }
+ }
+
+ @Test
+ public void xupdateUpdate() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG2, XML1, "xupdate.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
+
+ Occurrences occur[] = checkIndex(docs, broker, QNDESC, "chair", 1);
+ assertEquals("chair", occur[0].getTerm());
+ checkIndex(docs, broker, QNITEM, null, 5);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//item[description &= 'chair']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+
+ // Update element content
+ XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
+ assertNotNull(proc);
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ String xupdate =
+ XUPDATE_START +
+ " <xu:update select=\"//item[@id = '1']/description\">wardrobe</xu:update>" +
+ XUPDATE_END;
+ Modification[] modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 3);
+ checkIndex(docs, broker, QNITEM, null, 5);
+ checkIndex(docs, broker, QNDESC, "chair", 0);
+ checkIndex(docs, broker, QNITEM, "chair", 0);
+ Occurrences o[] = checkIndex(docs, broker, QNDESC, "wardrobe", 1);
+ assertEquals("wardrobe", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "wardrobe", 1);
+ assertEquals("wardrobe", o[0].getTerm());
+
+ // Update text node
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:update select=\"//item[@id = '1']/description/text()\">Wheelchair</xu:update>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 3);
+ checkIndex(docs, broker, QNITEM, null, 5);
+ checkIndex(docs, broker, QNDESC, "wardrobe", 0);
+ checkIndex(docs, broker, QNITEM, "wardrobe", 0);
+ o = checkIndex(docs, broker, QNDESC, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+
+ // Update attribute value
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:update select=\"//item[@id = '1']/@attr\">abc</xu:update>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ QName qnattr[] = { new QName("attr", "", "") };
+ qnattr[0].setNameType(ElementValue.ATTRIBUTE);
+ o = checkIndex(docs, broker, qnattr, null, 1);
+ assertEquals("abc", o[0].getTerm());
+ checkIndex(docs, broker, qnattr, "attribute", 0);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) {
+ pool.release(broker);
+ }
+ }
+ }
+
+ @Test
+ public void xupdateReplace() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG2, XML1, "xupdate.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(SecurityManager.SYSTEM_USER);
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
+
+ Occurrences occur[] = checkIndex(docs, broker, QNDESC, "chair", 1);
+ assertEquals("chair", occur[0].getTerm());
+ checkIndex(docs, broker, QNITEM, null, 5);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//item[description &= 'chair']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+
+ XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
+ assertNotNull(proc);
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ String xupdate =
+ XUPDATE_START +
+ " <xu:replace select=\"//item[@id = '1']\">" +
+ " <item id='4'><description>Wheelchair</description><price>809.50</price></item>" +
+ " </xu:replace>" +
+ XUPDATE_END;
+ Modification[] modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 3);
+ checkIndex(docs, broker, QNPRICE, null, 3);
+ checkIndex(docs, broker, QNITEM, null, 6);
+ checkIndex(docs, broker, QNDESC, "chair", 0);
+ checkIndex(docs, broker, QNITEM, "chair", 0);
+ Occurrences o[] = checkIndex(docs, broker, QNDESC, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+ o = checkIndex(docs, broker, QNPRICE, "809.50", 1);
+ assertEquals("809.50", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "wheelchair", 1);
+ assertEquals("wheelchair", o[0].getTerm());
+ o = checkIndex(docs, broker, QNITEM, "809.50", 1);
+ assertEquals("809.50", o[0].getTerm());
+
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ xupdate =
+ XUPDATE_START +
+ " <xu:replace select=\"//item[@id = '4']/description\">" +
+ " <description>Armchair</description>" +
+ " </xu:replace>" +
+ XUPDATE_END;
+ modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 3);
+ checkIndex(docs, broker, QNITEM, null, 6);
+ checkIndex(docs, broker, QNDESC, "wheelchair", 0);
+ o = checkIndex(docs, broker, QNDESC, "armchair", 1);
+ assertEquals("armchair", o[0].getTerm());
+ checkIndex(docs, broker, QNITEM, "wheelchair", 0);
+ o = checkIndex(docs, broker, QNITEM, "armchair", 1);
+ assertEquals("armchair", o[0].getTerm());
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) {
+ pool.release(broker);
+ }
+ }
+ }
+
+ @Test
+ public void xupdateRename() {
+ DocumentSet docs = configureAndStore(COLLECTION_CONFIG2, XML1, "xupdate.xml");
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(SecurityManager.SYSTEM_USER);
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
+
+ Occurrences occur[] = checkIndex(docs, broker, QNDESC, "chair", 1);
+ assertEquals("chair", occur[0].getTerm());
+ checkIndex(docs, broker, QNITEM, null, 5);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//item[description &= 'chair']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+
+ XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
+ assertNotNull(proc);
+ proc.setBroker(broker);
+ proc.setDocumentSet(docs);
+ String xupdate =
+ XUPDATE_START +
+ " <xu:rename select=\"//item[@id='2']\">renamed</xu:rename>" +
+ XUPDATE_END;
+ Modification[] modifications = proc.parse(new InputSource(new StringReader(xupdate)));
+ assertNotNull(modifications);
+ modifications[0].process(transaction);
+ proc.reset();
+
+ checkIndex(docs, broker, QNDESC, null, 3);
+ checkIndex(docs, broker, QNPRICE, null, 2);
+ checkIndex(docs, broker, QNITEM, null, 3);
+ Occurrences o[] = checkIndex(docs, broker, QNDESC, "table", 1);
+ assertEquals("table", o[0].getTerm());
+ checkIndex(docs, broker, QNITEM, "table", 0);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) {
+ pool.release(broker);
+ }
+ }
+ }
+
+ private Occurrences[] checkIndex(DocumentSet docs, DBBroker broker, QName[] qn, String term, int expected) throws PermissionDeniedException {
+ Occurrences[] occur;
+ if (qn == null)
+ occur = broker.getTextEngine().scanIndexTerms(docs, docs.toNodeSet(), term, null);
+ else
+ occur = broker.getTextEngine().scanIndexTerms(docs, docs.toNodeSet(), qn, term, null);
+ printOccurrences(term, occur);
+ assertEquals(expected, occur.length);
+ return occur;
+ }
+
+ private void printOccurrences(String msg, Occurrences[] occur) {
+ StringBuilder buf = new StringBuilder();
+ if (msg != null)
+ buf.append(msg).append(": ");
+ for (int i = 0; i < occur.length; i++) {
+ Occurrences occurrences = occur[i];
+ if (i > 0)
+ buf.append(", ");
+ buf.append(occurrences.getTerm()).append(":\t").append(occurrences.getOccurrences());
+ }
+ System.out.println(buf.toString());
+ }
+
+ private DocumentSet configureAndStore(String configuration, String data, String docName) {
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ DocumentSet docs = new DocumentSet();
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+
+ if (configuration != null) {
+ CollectionConfigurationManager mgr = pool.getConfigurationManager();
+ mgr.addConfiguration(transaction, broker, root, configuration);
+ }
+
+ IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create(docName), data);
+ assertNotNull(info);
+ root.store(transaction, broker, info, data, false);
+
+ docs.add(info.getDocument());
+ transact.commit(transaction);
+ } catch (Exception e) {
+ e.printStackTrace();
+ transact.abort(transaction);
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ return docs;
+ }
+
+ @Before
+ public void setup() {
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+ System.out.println("Transaction started ...");
+
+ root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
+ assertNotNull(root);
+ broker.saveCollection(transaction, root);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ e.printStackTrace();
+ transact.abort(transaction);
+ fail(e.getMessage());
+ } finally {
+ if (pool != null)
+ pool.release(broker);
+ }
+ }
+
+ @After
+ public void cleanup() {
+ BrokerPool pool = null;
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ pool = BrokerPool.getInstance();
+ assertNotNull(pool);
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+
+ Collection config = broker.getOrCreateCollection(transaction,
+ XmldbURI.create(CollectionConfigurationManager.CONFIG_COLLECTION + "/db"));
+ assertNotNull(config);
+ broker.removeCollection(transaction, config);
+
+ assertNotNull(root);
+ broker.removeCollection(transaction, root);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) pool.release(broker);
+ }
+ }
+
+ @BeforeClass
+ public static void startDB() {
+ try {
+ File confFile = ConfigurationHelper.lookup("conf.xml");
+ Configuration config = new Configuration(confFile.getAbsolutePath());
+ BrokerPool.configure(1, 5, config);
+ pool = BrokerPool.getInstance();
+ assertNotNull(pool);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void stopDB() {
+ TestUtils.cleanupDB();
+ BrokerPool.stopAll(false);
+ pool = null;
+ root = null;
+ }
+}
Copied: trunk/eXist/test/src/org/exist/fulltext/FTMatchListenerTest.java (from rev 6799, trunk/eXist/test/src/org/exist/storage/serializers/FTMatchListenerTest.java)
===================================================================
--- trunk/eXist/test/src/org/exist/fulltext/FTMatchListenerTest.java (rev 0)
+++ trunk/eXist/test/src/org/exist/fulltext/FTMatchListenerTest.java 2007-10-29 20:09:30 UTC (rev 6817)
@@ -0,0 +1,351 @@
+package org.exist.fulltext;
+
+import org.custommonkey.xmlunit.NamespaceContext;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.exist.TestUtils;
+import org.exist.collections.Collection;
+import org.exist.collections.CollectionConfigurationManager;
+import org.exist.collections.IndexInfo;
+import org.exist.security.xacml.AccessContext;
+import org.exist.storage.BrokerPool;
+import org.exist.storage.DBBroker;
+import org.exist.storage.serializers.EXistOutputKeys;
+import org.exist.storage.serializers.Serializer;
+import org.exist.storage.txn.TransactionManager;
+import org.exist.storage.txn.Txn;
+import org.exist.test.TestConstants;
+import org.exist.util.Configuration;
+import org.exist.util.ConfigurationHelper;
+import org.exist.xmldb.XmldbURI;
+import org.exist.xquery.XPathException;
+import org.exist.xquery.XQuery;
+import org.exist.xquery.value.NodeValue;
+import org.exist.xquery.value.Sequence;
+import org.junit.AfterClass;
+import static org.junit.Assert.*;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import javax.xml.transform.OutputKeys;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Properties;
+
+public class FTMatchListenerTest {
+
+ private static String XML =
+ "<root>" +
+ " <para>some paragraph with <hi>mixed</hi> content.</para>" +
+ " <para>another paragraph with <note><hi>nested</hi> inner</note> elements.</para>" +
+ " <para>a third paragraph with <term>term</term>.</para>" +
+ " <para>double match double match</para>" +
+ "</root>";
+
+ private static String CONF1 =
+ "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
+ " <index>" +
+ " <fulltext default=\"none\">" +
+ " <include path=\"//para\"/>" +
+ " </fulltext>" +
+ " </index>" +
+ "</collection>";
+
+ private static String CONF2 =
+ "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
+ " <index>" +
+ " <fulltext default=\"none\">" +
+ " <create qname=\"para\"/>" +
+ " <create qname=\"term\"/>" +
+ " </fulltext>" +
+ " </index>" +
+ "</collection>";
+
+ private static String MATCH_START = "<exist:match xmlns:exist=\"http://exist.sourceforge.net/NS/exist\">";
+ private static String MATCH_END = "</exist:match>";
+
+ private static BrokerPool pool;
+
+ /**
+ * Test match highlighting for index configured by path, e.g.
+ * <include path="//a/b"/>.
+ */
+ @Test
+ public void indexByPath() {
+ DBBroker broker = null;
+ try {
+ configureAndStore(CONF1);
+
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//para[. &= 'mixed']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ String result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>some paragraph with <hi>" + MATCH_START + "mixed" +
+ MATCH_END + "</hi> content.</para>", result);
+
+ seq = xquery.execute("//para[hi &= 'mixed']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>some paragraph with <hi>" + MATCH_START + "mixed" +
+ MATCH_END + "</hi> content.</para>", result);
+
+ seq = xquery.execute("//para[. &= 'another']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>" + MATCH_START + "another" + MATCH_END + " paragraph with <note><hi>nested</hi> " +
+ "inner</note> elements.</para>", result);
+
+ seq = xquery.execute("//para[. &= 'nested inner']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>another paragraph with <note><hi>" + MATCH_START + "nested" +
+ MATCH_END + "</hi> " + MATCH_START +
+ "inner" + MATCH_END + "</note> elements.</para>", result);
+
+ seq = xquery.execute("//para[. &= 'nested inner elements']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>another paragraph with <note><hi>" + MATCH_START + "nested" +
+ MATCH_END + "</hi> " + MATCH_START +
+ "inner" + MATCH_END + "</note> " + MATCH_START + "elements" + MATCH_END + ".</para>", result);
+
+ seq = xquery.execute(
+ "for $para in //para[. &= 'nested inner elements'] return\n" +
+ " <hit>{$para}</hit>", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<hit><para>another paragraph with <note><hi>" + MATCH_START + "nested" +
+ MATCH_END + "</hi> " + MATCH_START +
+ "inner" + MATCH_END + "</note> " + MATCH_START + "elements" + MATCH_END + ".</para></hit>", result);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @Test
+ public void ancestorAxis() {
+ DBBroker broker = null;
+ try {
+ configureAndStore(CONF1);
+
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//hi[. &= 'mixed']/parent::para", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ String result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertXpathEvaluatesTo("1", "count(//exist:match)", result);
+
+ seq = xquery.execute("//hi[. &= 'mixed']/..", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertXpathEvaluatesTo("1", "count(//exist:match)", result);
+
+ seq = xquery.execute("//hi[. &= 'nested']/ancestor::para", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+
+ seq = xquery.execute("//hi[. &= 'nested']/ancestor::*[2]", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertXpathEvaluatesTo("1", "count(//exist:match)", result);
+
+ String query =
+ "let $results := for $m in //para[. &= 'mixed']/hi order by $m return $m/parent::para " +
+ "return $results";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertXpathEvaluatesTo("1", "count(//exist:match)", result);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ /**
+ * Test match highlighting for index configured by QName, e.g.
+ * <create qname="a"/>.
+ */
+ @Test
+ public void indexByQName() {
+ DBBroker broker = null;
+ try {
+ configureAndStore(CONF2);
+
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ Sequence seq = xquery.execute("//para[. &= 'mixed']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ String result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>some paragraph with <hi>" + MATCH_START + "mixed" +
+ MATCH_END + "</hi> content.</para>", result);
+
+ seq = xquery.execute("//para[. &= 'nested inner elements']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>another paragraph with <note><hi>" + MATCH_START + "nested" +
+ MATCH_END + "</hi> " + MATCH_START +
+ "inner" + MATCH_END + "</note> " + MATCH_START + "elements" + MATCH_END + ".</para>", result);
+
+ seq = xquery.execute("//para[term &= 'term']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>a third paragraph with <term>" + MATCH_START + "term" + MATCH_END +
+ "</term>.</para>", result);
+
+ seq = xquery.execute("//para[. &= 'double match']", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<para>" + MATCH_START + "double" + MATCH_END + " " +
+ MATCH_START + "match" + MATCH_END + " " + MATCH_START + "double" + MATCH_END + " " +
+ MATCH_START + "match" + MATCH_END + "</para>", result);
+
+ seq = xquery.execute(
+ "for $para in //para[. &= 'double match'] return\n" +
+ " <hit>{$para}</hit>", null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertEquals(1, seq.getItemCount());
+ result = queryResult2String(broker, seq);
+ System.out.println("RESULT: " + result);
+ XMLAssert.assertEquals("<hit><para>" + MATCH_START + "double" + MATCH_END + " " +
+ MATCH_START + "match" + MATCH_END + " " + MATCH_START + "double" + MATCH_END + " " +
+ MATCH_START + "match" + MATCH_END + "</para></hit>", result);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ @BeforeClass
+ public static void startDB() {
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ File confFile = ConfigurationHelper.lookup("conf.xml");
+ Configuration config = new Configuration(confFile.getAbsolutePath());
+ BrokerPool.configure(1, 5, config);
+ pool = BrokerPool.getInstance();
+ assertNotNull(pool);
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+ System.out.println("Transaction started ...");
+
+ Collection root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
+ assertNotNull(root);
+ broker.saveCollection(transaction, root);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ if (transact != null)
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null)
+ pool.release(broker);
+ }
+ HashMap m = new HashMap();
+ m.put("exist", "http://exist.sourceforge.net/NS/exist");
+ NamespaceContext ctx = new SimpleNamespaceContext(m);
+ XMLUnit.setXpathNamespaceContext(ctx);
+ }
+
+ @AfterClass
+ public static void closeDB() {
+ TestUtils.cleanupDB();
+ BrokerPool.stopAll(false);
+ pool = null;
+ }
+
+ private void configureAndStore(String config) {
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+
+ Collection root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
+ assertNotNull(root);
+ CollectionConfigurationManager mgr = pool.getConfigurationManager();
+ mgr.addConfiguration(transaction, broker, root, config);
+
+ IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("test_matches.xml"), XML);
+ assertNotNull(info);
+ root.store(transaction, broker, info, XML, false);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
+ private String queryResult2String(DBBroker broker, Sequence seq) throws SAXException, XPathException {
+ Properties props = new Properties();
+ props.setProperty(OutputKeys.INDENT, "no");
+ props.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, "elements");
+ Serializer serializer = broker.getSerializer();
+ serializer.reset();
+ serializer.setProperties(props);
+ return serializer.serialize((NodeValue) seq.itemAt(0));
+ }
+}
\ No newline at end of file
Copied: trunk/eXist/test/src/org/exist/fulltext/FtQueryTest.java (from rev 6799, trunk/eXist/test/src/org/exist/xquery/FtQueryTest.java)
===================================================================
--- trunk/eXist/test/src/org/exist/fulltext/FtQueryTest.java (rev 0)
+++ trunk/eXist/test/src/org/exist/fulltext/FtQueryTest.java 2007-10-29 20:09:30 UTC (rev 6817)
@@ -0,0 +1,662 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-2007 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+package org.exist.fulltext;
+
+import junit.textui.TestRunner;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.exist.TestUtils;
+import org.exist.storage.DBBroker;
+import org.exist.xmldb.DatabaseInstanceManager;
+import org.exist.xmldb.IndexQueryService;
+import org.exist.xmldb.XQueryService;
+import org.xmldb.api.DatabaseManager;
+import org.xmldb.api.base.*;
+import org.xmldb.api.modules.CollectionManagementService;
+import org.xmldb.api.modules.XMLResource;
+
+import java.io.File;
+
+public class FtQueryTest extends XMLTestCase {
+
+ private final static String TEST_XML =
+ "<test-d...
[truncated message content] |
|
From: <wol...@us...> - 2007-10-29 20:06:37
|
Revision: 6816
http://exist.svn.sourceforge.net/exist/?rev=6816&view=rev
Author: wolfgang_m
Date: 2007-10-29 13:06:34 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Partially adapted the full text index to the new modularized indexing architecture. This was necessary to fix a number of configuration issues we had with full text indexes configured by QName and indexes on mixed-content nodes.
This code will be merged with/into the new ft index branch.
Modified Paths:
--------------
trunk/eXist/src/org/exist/Indexer.java
trunk/eXist/src/org/exist/indexing/IndexController.java
trunk/eXist/src/org/exist/storage/FulltextIndexSpec.java
trunk/eXist/src/org/exist/storage/NativeBroker.java
trunk/eXist/src/org/exist/storage/NativeTextEngine.java
trunk/eXist/src/org/exist/storage/TextSearchEngine.java
trunk/eXist/src/org/exist/storage/analysis/SimpleTokenizer.java
trunk/eXist/src/org/exist/storage/analysis/Tokenizer.java
trunk/eXist/src/org/exist/util/XMLString.java
Added Paths:
-----------
trunk/eXist/src/org/exist/fulltext/
trunk/eXist/src/org/exist/fulltext/ElementContent.java
trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java
Modified: trunk/eXist/src/org/exist/Indexer.java
===================================================================
--- trunk/eXist/src/org/exist/Indexer.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/Indexer.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -97,7 +97,6 @@
protected StreamListener indexListener;
- protected FulltextIndexSpec ftIdx = null;
protected XMLString charBuf = new XMLString();
protected boolean inCDATASection = false;
protected int currentLine = 0;
@@ -210,7 +209,6 @@
indexListener = null;
rootNode = null;
setPrevious(null);
- ftIdx = doc.getCollection().getFulltextIndexConfiguration(broker);
}
/**
@@ -330,10 +328,9 @@
stack.pop();
XMLString elemContent = null;
- if (!validate && (GeneralRangeIndexSpec.hasQNameOrValueIndex(last.getIndexType()) ||
- (ftIdx != null && ftIdx.hasQNameIndex(last.getQName())))) {
- elemContent = (XMLString) nodeContentStack.pop();
- }
+ if (!validate && GeneralRangeIndexSpec.hasQNameOrValueIndex(last.getIndexType())) {
+ elemContent = (XMLString) nodeContentStack.pop();
+ }
if (!validate) {
final String content = elemContent == null ? null : elemContent.toString();
@@ -679,8 +676,7 @@
if (indexListener != null)
indexListener.startElement(transaction, node, currentPath);
node.setChildCount(0);
- if (GeneralRangeIndexSpec.hasQNameOrValueIndex(node.getIndexType()) ||
- (ftIdx != null && ftIdx.hasQNameIndex(node.getQName()))) {
+ if (GeneralRangeIndexSpec.hasQNameOrValueIndex(node.getIndexType())) {
XMLString contentBuf = new XMLString();
nodeContentStack.push(contentBuf);
}
@@ -708,20 +704,20 @@
private void setPrevious(StoredNode previous) {
if (prevNode != null) {
switch (prevNode.getNodeType()) {
- case Node.ATTRIBUTE_NODE :
- prevNode.release();
- break;
- case Node.ELEMENT_NODE :
- if (prevNode != rootNode) {
- prevNode.clear();
- usedElements.push(prevNode);
- }
- break;
- case Node.TEXT_NODE :
- prevNode.clear();
- break;
- }
- }
+ case Node.ATTRIBUTE_NODE :
+ prevNode.release();
+ break;
+ case Node.ELEMENT_NODE :
+ if (prevNode != rootNode) {
+ prevNode.clear();
+ usedElements.push(prevNode);
+ }
+ break;
+ case Node.TEXT_NODE :
+ prevNode.clear();
+ break;
+ }
+ }
prevNode = previous;
}
}
Added: trunk/eXist/src/org/exist/fulltext/ElementContent.java
===================================================================
--- trunk/eXist/src/org/exist/fulltext/ElementContent.java (rev 0)
+++ trunk/eXist/src/org/exist/fulltext/ElementContent.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -0,0 +1,89 @@
+package org.exist.fulltext;
+
+import org.apache.log4j.Logger;
+import org.exist.dom.QName;
+import org.exist.util.XMLString;
+
+/**
+ *
+ */
+public class ElementContent {
+
+ private static final Logger LOG = Logger.getLogger(ElementContent.class);
+
+ public static class TextSpan {
+ XMLString content;
+ TextSpan next = null;
+
+ TextSpan(XMLString content) {
+ this.content = new XMLString(content);
+ }
+
+ public XMLString getContent() {
+ return content;
+ }
+
+ public TextSpan getNext() {
+ return next;
+ }
+ }
+
+ private QName nodeName;
+ private boolean mixedContent;
+ private TextSpan first = null;
+ private TextSpan last = null;
+
+ public ElementContent(QName nodeName, boolean mixedContent) {
+ this.nodeName = nodeName;
+ this.mixedContent = mixedContent;
+ }
+
+ public void append(XMLString string) {
+ if (mixedContent)
+ appendString(string);
+ else
+ appendSpan(string);
+ }
+
+ public void appendSpan(XMLString string) {
+ if (first == null) {
+ first = new TextSpan(string);
+ last = first;
+ } else {
+ TextSpan span = new TextSpan(string);
+ last.next = span;
+ last = span;
+ }
+ }
+
+ public void appendString(XMLString string) {
+ if (first == null) {
+ first = new TextSpan(string);
+ last = first;
+ } else {
+ last.content.append(string);
+ }
+ }
+
+ public QName getNodeName() {
+ return nodeName;
+ }
+
+ public void setMixedContent(boolean mixedContent) {
+ this.mixedContent = mixedContent;
+ }
+
+ public TextSpan getFirst() {
+ return first;
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ TextSpan span = getFirst();
+ while (span != null) {
+ buf.append(span.getContent()).append('|');
+ span = span.getNext();
+ }
+ return buf.toString();
+ }
+}
Added: trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java
===================================================================
--- trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java (rev 0)
+++ trunk/eXist/src/org/exist/fulltext/FTIndexWorker.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -0,0 +1,215 @@
+package org.exist.fulltext;
+
+import org.exist.collections.Collection;
+import org.exist.dom.*;
+import org.exist.indexing.*;
+import org.exist.storage.*;
+import org.exist.storage.txn.Txn;
+import org.exist.util.DatabaseConfigurationException;
+import org.exist.util.Occurrences;
+import org.exist.xquery.XQueryContext;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.Map;
+import java.util.Stack;
+
+/**
+ * A legacy IndexWorker which wraps around {@link org.exist.storage.NativeTextEngine}. Right
+ * now, the fulltext index has only partly been moved into the new modularized indexing architecture
+ * and we thus need some glue classes to keep the old and new parts together. This class will become
+ * part of the new fulltext indexing module.
+ */
+public class FTIndexWorker implements OrderedValuesIndex, QNamedKeysIndex {
+
+ public final static String ID = FTIndexWorker.class.getName();
+
+ private NativeTextEngine index;
+ private DocumentImpl document;
+ private FulltextIndexSpec config;
+ private int mode = StreamListener.UNKNOWN;
+
+ private FTStreamListener listener = new FTStreamListener();
+
+ public FTIndexWorker(NativeTextEngine engine) {
+ this.index = engine;
+ }
+
+ public String getIndexId() {
+ return ID;
+ }
+
+ public String getIndexName() {
+ return "ft-index-old";
+ }
+
+ public Object configure(IndexController controller, NodeList configNodes, Map namespaces) throws DatabaseConfigurationException {
+ // Not implemented
+ return null;
+ }
+
+ public void setDocument(DocumentImpl doc) {
+ setDocument(doc, StreamListener.UNKNOWN);
+ }
+
+ public void setDocument(DocumentImpl doc, int newMode) {
+ document = doc;
+ mode = newMode;
+ IndexSpec indexConf = document.getCollection().getIndexConfiguration(document.getBroker());
+ if (indexConf != null)
+ config = indexConf.getFulltextIndexSpec();
+ index.setDocument(document);
+ }
+
+ public void setMode(int newMode) {
+ setDocument(document, newMode);
+ }
+
+ public DocumentImpl getDocument() {
+ return document;
+ }
+
+ public int getMode() {
+ return mode;
+ }
+
+ public StoredNode getReindexRoot(StoredNode node, NodePath path, boolean includeSelf) {
+ if (node.getNodeType() == Node.ATTRIBUTE_NODE)
+ return null;
+ IndexSpec indexConf = node.getDocument().getCollection().getIndexConfiguration(node.getDocument().getBroker());
+ if (indexConf != null) {
+ FulltextIndexSpec config = indexConf.getFulltextIndexSpec();
+ if (config == null)
+ return null;
+ boolean reindexRequired = false;
+ int len = node.getNodeType() == Node.ELEMENT_NODE && !includeSelf ? path.length() - 1 : path.length();
+ for (int i = 0; i < len; i++) {
+ QName qn = path.getComponent(i);
+ if (config.hasQNameIndex(qn)) {
+ reindexRequired = true;
+ break;
+ }
+ }
+ if (reindexRequired) {
+ StoredNode topMost = null;
+ StoredNode currentNode = node;
+ while (currentNode != null) {
+ if (config.hasQNameIndex(currentNode.getQName()))
+ topMost = currentNode;
+ currentNode = (StoredNode) currentNode.getParentNode();
+ }
+ return topMost;
+ }
+ }
+ return null;
+ }
+
+ public StreamListener getListener() {
+ return listener;
+ }
+
+ public MatchListener getMatchListener(NodeProxy proxy) {
+ // Not implemented
+ return null;
+ }
+
+ public void flush() {
+ switch (mode) {
+ case StreamListener.STORE :
+ index.flush();
+ break;
+ case StreamListener.REMOVE_ALL_NODES :
+ index.dropIndex(document);
+ break;
+ case StreamListener.REMOVE_SOME_NODES :
+ index.remove();
+ break;
+ }
+ }
+
+ public void removeCollection(Collection collection, DBBroker broker) {
+ index.dropIndex(collection);
+ }
+
+ public boolean checkIndex(DBBroker broker) {
+ // Not implemented
+ return false;
+ }
+
+ public Occurrences[] scanIndex(XQueryContext context, DocumentSet docs, NodeSet contextSet, Map hints) {
+ // Not implemented
+ return new Occurrences[0];
+ }
+
+ private class FTStreamListener extends AbstractStreamListener {
+
+ private Stack contentStack = new Stack();
+
+ public FTStreamListener() {
+ }
+
+ public void startElement(Txn transaction, ElementImpl element, NodePath path) {
+ if (config != null) {
+ boolean mixedContent = config.matchMixedElement(path);
+ if (mixedContent || config.hasQNameIndex(element.getQName())) {
+ ElementContent contentBuf =
+ new ElementContent(element.getQName(), mixedContent || config.preserveMixedContent(element.getQName()));
+ contentStack.push(contentBuf);
+ }
+ }
+ super.startElement(transaction, element, path);
+ }
+
+ public void endElement(Txn transaction, ElementImpl element, NodePath path) {
+ if (config != null) {
+ boolean mixedContent = config.matchMixedElement(path);
+ if (mixedContent || config.hasQNameIndex(element.getQName())) {
+ ElementContent contentBuf = (ElementContent) contentStack.pop();
+ element.getQName().setNameType(ElementValue.ELEMENT);
+ index.storeText(element, contentBuf,
+ mixedContent ? NativeTextEngine.FOURTH_OPTION : NativeTextEngine.TEXT_BY_QNAME,
+ null, mode == REMOVE_ALL_NODES);
+ }
+ }
+ super.endElement(transaction, element, path);
+ }
+
+ /**
+ *
+ * @param transaction
+ * @param text
+ * @param path
+ */
+ public void characters(Txn transaction, TextImpl text, NodePath path) {
+ if (config == null) {
+ index.storeText(text, NativeTextEngine.TOKENIZE, config, mode == REMOVE_ALL_NODES);
+ } else if (config.match(path)) {
+ int tokenize = config.preserveContent(path) ? NativeTextEngine.DO_NOT_TOKENIZE : NativeTextEngine.TOKENIZE;
+ index.storeText(text, tokenize, config, mode == REMOVE_ALL_NODES);
+ }
+ if (!contentStack.isEmpty()) {
+ for (int i = 0; i < contentStack.size(); i++) {
+ ElementContent next = (ElementContent) contentStack.get(i);
+ next.append(text.getXMLString());
+ }
+ }
+ super.characters(transaction, text, path);
+ }
+
+ public void attribute(Txn transaction, AttrImpl attrib, NodePath path) {
+ path.addComponent(attrib.getQName());
+ if (config == null || config.matchAttribute(path)) {
+ index.storeAttribute(attrib, null, NativeTextEngine.ATTRIBUTE_NOT_BY_QNAME, config, mode == REMOVE_ALL_NODES);
+ }
+ if (config != null && config.hasQNameIndex(attrib.getQName())){
+ index.storeAttribute(attrib, null, NativeTextEngine.ATTRIBUTE_BY_QNAME, config, mode == REMOVE_ALL_NODES);
+ }
+ path.removeLastComponent();
+ super.attribute(transaction, attrib, path);
+ }
+
+ public IndexWorker getWorker() {
+ return FTIndexWorker.this;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/eXist/src/org/exist/indexing/IndexController.java
===================================================================
--- trunk/eXist/src/org/exist/indexing/IndexController.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/indexing/IndexController.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -61,8 +61,18 @@
indexWorkers.put(workers[i].getIndexId(), workers[i]);
}
}
-
+
/**
+ * TODO: temporary method to plug in fulltext index.
+ * Remove once new fulltext index module is ready.
+ *
+ * @param worker
+ */
+ public void addIndexWorker(IndexWorker worker) {
+ indexWorkers.put(worker.getIndexId(), worker);
+ }
+
+ /**
* Configures all index workers registered with the db instance.
*
* @param configNodes lists the top-level child nodes below the <index> element in collection.xconf
Modified: trunk/eXist/src/org/exist/storage/FulltextIndexSpec.java
===================================================================
--- trunk/eXist/src/org/exist/storage/FulltextIndexSpec.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/FulltextIndexSpec.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -20,12 +20,6 @@
*/
package org.exist.storage;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
import org.apache.log4j.Logger;
import org.exist.dom.QName;
import org.exist.util.DatabaseConfigurationException;
@@ -33,7 +27,9 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import java.util.*;
+
/**
* Contains information about which parts of a document should be
* fulltext-indexed for a specified doctype. It basically keeps a list of paths
@@ -72,7 +68,7 @@
protected NodePath[] excludePath;
protected NodePath[] mixedPath;
protected NodePath[] preserveContent;
- protected Set qnameSpecs = new TreeSet();
+ protected Map qnameSpecs = new TreeMap();
protected boolean includeByDefault = true;
protected boolean includeAttributes = true;
@@ -160,7 +156,7 @@
QName qname = new QName(localName, namespaceURI, null);
if (isAttribute)
qname.setNameType(ElementValue.ATTRIBUTE);
- qnameSpecs.add(qname);
+ qnameSpecs.put(qname, new QNameSpec(qname, elem));
}
}
includePath = (NodePath[]) includeList.toArray(ARRAY_TYPE);
@@ -264,9 +260,17 @@
}
public boolean hasQNameIndex(QName qname) {
- return qnameSpecs.contains(qname);
+ return qnameSpecs.containsKey(qname);
}
+ public boolean preserveMixedContent(QName qname) {
+ QNameSpec spec = (QNameSpec) qnameSpecs.get(qname);
+ if (spec != null) {
+ return spec.hasMixedContent();
+ }
+ return false;
+ }
+
/**
* Check if a given path should be preserveContent.
*
@@ -309,12 +313,53 @@
result.append("\tpreserve content : ").append(path.toString()).append('\n');
}
}
- for (Iterator i = qnameSpecs.iterator(); i.hasNext(); ) {
+ for (Iterator i = qnameSpecs.values().iterator(); i.hasNext(); ) {
result.append("\tQName : ").append(i.next()).append('\n');
}
return result.toString();
}
+ private static class QNameSpec implements Comparable {
+ private QName qname;
+ private boolean mixedContent = false;
+ private Set preserve = new HashSet();
+ QNameSpec(QName qname, Element node) {
+ this.qname = qname;
+ String attr = node.getAttribute(CONTENT_ATTRIB);
+ if (attr != null && attr.length() > 0) {
+ this.mixedContent = CONTENT_MIXED.equalsIgnoreCase(attr);
+ if (!mixedContent) {
+ attr = node.getAttribute("preserve");
+ if (attr != null && attr.length() > 0) {
+ StringTokenizer tok = new StringTokenizer(attr, ",;: \n\t");
+ while (tok.hasMoreTokens()) {
+ preserve.add(tok.nextToken());
+ }
+ }
+ }
+ }
+ }
+
+ public boolean hasMixedContent() {
+ return mixedContent;
+ }
+
+ public Set getPreserve() {
+ return preserve;
+ }
+
+ public boolean equals(Object obj) {
+ return ((QNameSpec) obj).qname.equals(qname);
+ }
+
+ public int compareTo(Object other) {
+ return ((QNameSpec) other).qname.compareTo(qname);
+ }
+
+ public String toString() {
+ return qname.toString() + " [" + mixedContent + ']';
+ }
+ }
}
Modified: trunk/eXist/src/org/exist/storage/NativeBroker.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeBroker.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/NativeBroker.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -236,7 +236,7 @@
//Initialize collections storage
collectionsDb = (CollectionStore) config.getProperty(CollectionStore.getConfigKeyForFile());
- if (collectionsDb == null)
+ if (collectionsDb == null)
collectionsDb = new CollectionStore(pool, COLLECTIONS_DBX_ID, dataDir, config);
readOnly = readOnly || collectionsDb.isReadOnly();
@@ -249,8 +249,9 @@
elementIndex = new NativeElementIndex(this, ELEMENTS_DBX_ID, dataDir, config);
valueIndex = new NativeValueIndex(this, VALUES_DBX_ID, dataDir, config);
- textEngine = new NativeTextEngine(this, WORDS_DBX_ID, dataDir, config);
-
+ textEngine = new NativeTextEngine(this, WORDS_DBX_ID, dataDir, config);
+ // TODO: temporary hack to plug in fulltext index
+ indexController.addIndexWorker(textEngine.getWorker());
if (readOnly)
LOG.info("Database runs in read-only mode");
@@ -411,37 +412,6 @@
// qnameValueIndex.setDocument((DocumentImpl) node.getOwnerDocument());
// qnameValueIndex.endElement((ElementImpl) node, currentPath, content);
}
-
- // TODO : move to NativeTextEngine
- if (RangeIndexSpec.hasMixedTextIndex(indexType)) {
- node.getQName().setNameType(ElementValue.ELEMENT);
- if (content == null) {
- //NodeProxy p = new NodeProxy(node);
- //if (node.getOldInternalAddress() != StoredNode.UNKNOWN_NODE_IMPL_ADDRESS)
- // p.setInternalAddress(node.getOldInternalAddress());
- content = getNodeValue(node, false);
- //Curious... I assume getNodeValue() needs the old address
- //p.setInternalAddress(node.getInternalAddress());
- }
- textEngine.setDocument((DocumentImpl) node.getOwnerDocument());
- textEngine.storeText(node, content, NativeTextEngine.FOURTH_OPTION, null, remove);
- }
-
- FulltextIndexSpec ftIdx = ((DocumentImpl)node.getOwnerDocument()).getCollection().getFulltextIndexConfiguration(this);
- if (ftIdx != null && ftIdx.hasQNameIndex(node.getQName())) {
- node.getQName().setNameType(ElementValue.ELEMENT);
- if (content == null) {
- //NodeProxy p = new NodeProxy(node);
- //if (node.getOldInternalAddress() != StoredNode.UNKNOWN_NODE_IMPL_ADDRESS)
- // p.setInternalAddress(node.getOldInternalAddress());
- content = getNodeValue(node, false);
- //Curious... I assume getNodeValue() needs the old address
- //p.setInternalAddress(node.getInternalAddress());
- }
- //Grrr : unify with above !
- textEngine.setDocument((DocumentImpl) node.getOwnerDocument());
- textEngine.storeText(node, content, NativeTextEngine.TEXT_BY_QNAME, ftIdx, remove);
- }
}
/*
@@ -2448,7 +2418,6 @@
*/
public void removeNode(final Txn transaction, final StoredNode node, NodePath currentPath, String content) {
final DocumentImpl doc = (DocumentImpl)node.getOwnerDocument();
- final FulltextIndexSpec ftIdx = doc.getCollection().getFulltextIndexConfiguration(this);
new DOMTransaction(this, domDb, Lock.WRITE_LOCK, doc) {
public Object start() {
@@ -2528,25 +2497,9 @@
valueIndex.storeAttribute((AttrImpl) node, null, NativeValueIndex.WITHOUT_PATH, qnSpec, false);
}
- // check if attribute value should be fulltext-indexed
- // by calling IndexPaths.match(path)
- if(ftIdx != null && ftIdx.matchAttribute(currentPath)) {
- textEngine.setDocument(doc);
- textEngine.storeAttribute((AttrImpl) node, null, NativeTextEngine.ATTRIBUTE_NOT_BY_QNAME, ftIdx, false);
- }
-
currentPath.removeLastComponent();
break;
case Node.TEXT_NODE :
- // check if this textual content should be fulltext-indexed
- // by calling IndexPaths.match(path)
- if (ftIdx == null) {
- textEngine.setDocument(doc);
- textEngine.storeText((TextImpl) node, NativeTextEngine.TOKENIZE, ftIdx, false);
- } else if (ftIdx.match(currentPath)) {
- textEngine.setDocument(doc);
- textEngine.storeText((TextImpl) node, NativeTextEngine.DO_NOT_TOKENIZE, ftIdx, false);
- }
break;
}
}
@@ -2764,7 +2717,8 @@
try {
elementIndex = new NativeElementIndex(this, ELEMENTS_DBX_ID, dataDir, config);
valueIndex = new NativeValueIndex(this, VALUES_DBX_ID, dataDir, config);
- textEngine = new NativeTextEngine(this, WORDS_DBX_ID, dataDir, config);
+ textEngine = new NativeTextEngine(this, WORDS_DBX_ID, dataDir, config);
+ indexController.addIndexWorker(textEngine.getWorker());
} catch (DBException e) {
LOG.warn("Exception during repair: " + e.getMessage(), e);
}
@@ -2816,7 +2770,8 @@
lock.release(Lock.WRITE_LOCK);
}
notifySync();
- // System.gc();
+ textEngine.sync();
+ // System.gc();
NumberFormat nf = NumberFormat.getNumberInstance();
LOG.info("Memory: " + nf.format(run.totalMemory() / 1024) + "K total; " +
nf.format(run.maxMemory() / 1024) + "K max; " +
@@ -2838,6 +2793,7 @@
sync(Sync.MAJOR_SYNC);
domDb.close();
collectionsDb.close();
+ textEngine.close();
notifyClose();
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
@@ -3037,18 +2993,6 @@
qnIdx, mode == MODE_REMOVE);
}
}
- //Special handling for fulltext index
- //TODO : harmonize
- if (fullTextIndexing && !isTemp ) {
- textEngine.setDocument((DocumentImpl)node.getOwnerDocument());
- textEngine.storeAttribute((AttrImpl) node, null, NativeTextEngine.ATTRIBUTE_NOT_BY_QNAME, ftIdx,
- mode == MODE_REMOVE);
- }
- if (ftIdx != null && ftIdx.hasQNameIndex(node.getQName())) {
- textEngine.setDocument((DocumentImpl)node.getOwnerDocument());
- textEngine.storeAttribute((AttrImpl) node, null, NativeTextEngine.ATTRIBUTE_BY_QNAME, ftIdx,
- mode == MODE_REMOVE);
- }
//notifyStoreAttribute((AttrImpl)node, currentPath, NativeValueIndex.WITH_PATH, null);
@@ -3089,21 +3033,6 @@
}
case Node.TEXT_NODE:
- // --move to-- NativeTextEngine
- // TODO textEngine.storeText( (TextImpl) node, currentPath, index);
- // check if this textual content should be fulltext-indexed
- // by calling IndexPaths.match(path)
- if (fullTextIndex && !isTemp) {
- if (ftIdx == null || currentPath == null) {
- textEngine.setDocument(doc);
- textEngine.storeText((TextImpl) node, NativeTextEngine.TOKENIZE, ftIdx, mode == MODE_REMOVE);
- } else if (ftIdx.match(currentPath)) {
- int tokenize = ftIdx.preserveContent(currentPath) ?
- NativeTextEngine.DO_NOT_TOKENIZE : NativeTextEngine.TOKENIZE;
- textEngine.setDocument(doc);
- textEngine.storeText((TextImpl) node, tokenize, ftIdx, mode == MODE_REMOVE);
- }
- }
notifyStoreText( (TextImpl)node, currentPath,
fullTextIndex ? NativeTextEngine.DO_NOT_TOKENIZE : NativeTextEngine.TOKENIZE);
Modified: trunk/eXist/src/org/exist/storage/NativeTextEngine.java
===================================================================
--- trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -23,60 +23,32 @@
//import java.io.EOFException;
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
-
import org.exist.EXistException;
import org.exist.collections.Collection;
-import org.exist.dom.AttrImpl;
-import org.exist.dom.DocumentImpl;
-import org.exist.dom.DocumentSet;
-import org.exist.dom.ElementImpl;
-import org.exist.dom.ExtArrayNodeSet;
-import org.exist.dom.Match;
-import org.exist.dom.NodeProxy;
-import org.exist.dom.NodeSet;
-import org.exist.dom.QName;
-import org.exist.dom.StoredNode;
-import org.exist.dom.SymbolTable;
-import org.exist.dom.TextImpl;
-import org.exist.dom.VirtualNodeSet;
+import org.exist.dom.*;
+import org.exist.fulltext.FTIndexWorker;
+import org.exist.fulltext.ElementContent;
import org.exist.numbering.NodeId;
import org.exist.security.PermissionDeniedException;
import org.exist.storage.analysis.TextToken;
-import org.exist.storage.btree.BTreeCallback;
-import org.exist.storage.btree.BTreeException;
-import org.exist.storage.btree.DBException;
-import org.exist.storage.btree.IndexQuery;
-import org.exist.storage.btree.Value;
+import org.exist.storage.btree.*;
import org.exist.storage.index.BFile;
import org.exist.storage.io.VariableByteArrayInput;
import org.exist.storage.io.VariableByteInput;
import org.exist.storage.io.VariableByteOutputStream;
import org.exist.storage.lock.Lock;
-import org.exist.util.ByteArray;
-import org.exist.util.ByteConversion;
-import org.exist.util.Configuration;
-import org.exist.util.LockException;
-import org.exist.util.Occurrences;
-import org.exist.util.ProgressIndicator;
-import org.exist.util.ReadOnlyException;
-import org.exist.util.UTF8;
-import org.exist.util.XMLString;
+import org.exist.util.*;
import org.exist.xquery.Constants;
import org.exist.xquery.TerminatedException;
import org.exist.xquery.XQueryContext;
import org.w3c.dom.Node;
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+import java.util.regex.Pattern;
+
/**
* This class is responsible for fulltext-indexing. Text-nodes are handed over
* to this class to be fulltext-indexed. Method storeText() is called by
@@ -131,8 +103,10 @@
/** The datastore for this token index */
protected BFile dbTokens;
protected InvertedIndex invertedIndex;
-
- /** The current document */
+
+ FTIndexWorker worker;
+
+ /** The current document */
private DocumentImpl doc;
/** Work output Stream that should be cleared before every use */
@@ -150,13 +124,18 @@
LOG.debug("Creating '" + file.getName() + "'...");
nativeFile = new BFile(broker.getBrokerPool(), id, false,
file, broker.getBrokerPool().getCacheManager(),
- cacheGrowth, cacheKeyThresdhold, cacheValueThresHold);
+ cacheGrowth, cacheKeyThresdhold, cacheValueThresHold);
config.setProperty(getConfigKeyForFile(), nativeFile);
}
dbTokens = nativeFile;
this.invertedIndex = new InvertedIndex();
- broker.addContentLoadingObserver(getInstance());
+// broker.addContentLoadingObserver(getInstance());
+ worker = new FTIndexWorker(this);
}
+
+ public FTIndexWorker getWorker() {
+ return worker;
+ }
public String getFileName() {
return FILE_NAME;
@@ -300,30 +279,42 @@
}
}
- public void storeText(StoredNode parent, String text, int indexingHint, FulltextIndexSpec indexSpec, boolean remove) {
+ public void storeText(StoredNode parent, ElementContent text, int indexingHint, FulltextIndexSpec indexSpec, boolean remove) {
//final DocumentImpl doc = (DocumentImpl)parent.getOwnerDocument();
//TODO : case conversion should be handled by the tokenizer -pb
TextToken token;
- tokenizer.setText(text.toLowerCase());
- while (null != (token = tokenizer.nextToken())) {
- if (token.length() > MAX_TOKEN_LENGTH) {
- LOG.warn("Token length exceeded " + MAX_TOKEN_LENGTH + ": " + token.getText().substring(0,20) + "...");
- continue;
+ ElementContent.TextSpan span = text.getFirst();
+ XMLString data = null;
+ int currentOffset = 0;
+ while (span != null) {
+ if (data == null)
+ data = span.getContent().transformToLower();
+ else {
+ currentOffset = data.length();
+ data.append(span.getContent().transformToLower());
}
- if (stoplist.contains(token)) {
- continue;
- }
- if (indexSpec != null) {
- //TODO : the tokenizer should strip unwanted token types itself -pb
- if (!indexSpec.getIncludeAlphaNum() && !token.isAlpha()) {
+ tokenizer.setText(data, currentOffset);
+ while (null != (token = tokenizer.nextToken())) {
+ if (token.length() > MAX_TOKEN_LENGTH) {
+ LOG.warn("Token length exceeded " + MAX_TOKEN_LENGTH + ": " + token.getText().substring(0,20) + "...");
continue;
}
+ if (stoplist.contains(token)) {
+ continue;
+ }
+ if (indexSpec != null) {
+ //TODO : the tokenizer should strip unwanted token types itself -pb
+ if (!indexSpec.getIncludeAlphaNum() && !token.isAlpha()) {
+ continue;
+ }
+ }
+ //invertedIndex.setDocument(doc);
+ if (indexingHint == TEXT_BY_QNAME)
+ invertedIndex.addText(token, (ElementImpl) parent, remove);
+ else
+ invertedIndex.addText(token, parent.getNodeId(), remove);
}
- //invertedIndex.setDocument(doc);
- if (indexingHint == TEXT_BY_QNAME)
- invertedIndex.addText(token, (ElementImpl) parent, remove);
- else
- invertedIndex.addText(token, parent.getNodeId(), remove);
+ span = span.getNext();
}
}
@@ -695,7 +686,7 @@
final int collectionId = ((Collection) i.next()).getId();
final IndexQuery query;
if (start == null) {
- Value startRef = new QNameWordRef(collectionId);
+ Value startRef = new QNameWordRef(collectionId, qnames[q], broker.getSymbols());
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else if (end == null) {
Value startRef = new QNameWordRef(collectionId, qnames[q],
@@ -1157,7 +1148,7 @@
*/
//TODO: use VariableInputStream
public void remove() {
- //Return early
+ //Return early
if (doc == null)
return;
final int collectionId = this.doc.getCollection().getId();
Modified: trunk/eXist/src/org/exist/storage/TextSearchEngine.java
===================================================================
--- trunk/eXist/src/org/exist/storage/TextSearchEngine.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/TextSearchEngine.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -20,21 +20,11 @@
*/
package org.exist.storage;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StreamTokenizer;
-import java.util.Observable;
-import java.util.TreeSet;
-
import org.apache.log4j.Logger;
import org.exist.collections.Collection;
-import org.exist.dom.DocumentImpl;
-import org.exist.dom.DocumentSet;
-import org.exist.dom.NodeSet;
-import org.exist.dom.QName;
-import org.exist.dom.StoredNode;
-import org.exist.dom.TextImpl;
+import org.exist.dom.*;
+import org.exist.fulltext.FTIndexWorker;
+import org.exist.fulltext.ElementContent;
import org.exist.security.PermissionDeniedException;
import org.exist.storage.analysis.SimpleTokenizer;
import org.exist.storage.analysis.Tokenizer;
@@ -46,6 +36,13 @@
import org.exist.xquery.TerminatedException;
import org.exist.xquery.XQueryContext;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StreamTokenizer;
+import java.util.Observable;
+import java.util.TreeSet;
+
/**
* This is the base class for all classes providing access to the fulltext index.
*
@@ -148,7 +145,7 @@
}
}
- /**
+ /**
* Returns the Tokenizer used for tokenizing strings into
* words.
*
@@ -158,14 +155,16 @@
return tokenizer;
}
- /**
+ public abstract FTIndexWorker getWorker();
+
+ /**
* Tokenize and index the given text node.
*
* @param indexSpec
* @param node
*/
public abstract void storeText(TextImpl node, int indexingHint, FulltextIndexSpec indexSpec, boolean remove);
- public abstract void storeText(StoredNode parent, String text, int indexingHint, FulltextIndexSpec indexSpec, boolean remove);
+ public abstract void storeText(StoredNode parent, ElementContent text, int indexingHint, FulltextIndexSpec indexSpec, boolean remove);
public abstract void flush();
public abstract boolean close() throws DBException;
Modified: trunk/eXist/src/org/exist/storage/analysis/SimpleTokenizer.java
===================================================================
--- trunk/eXist/src/org/exist/storage/analysis/SimpleTokenizer.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/analysis/SimpleTokenizer.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -275,7 +275,13 @@
this.text = text;
}
- protected TextToken whitespace() {
+ public void setText(CharSequence text, int offset) {
+ pos = offset;
+ len = text.length();
+ this.text = text;
+ }
+
+ protected TextToken whitespace() {
consume();
return TextToken.WS_TOKEN;
}
Modified: trunk/eXist/src/org/exist/storage/analysis/Tokenizer.java
===================================================================
--- trunk/eXist/src/org/exist/storage/analysis/Tokenizer.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/storage/analysis/Tokenizer.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -4,7 +4,8 @@
public interface Tokenizer {
public void setText(CharSequence text);
- public TextToken nextToken();
+ public void setText(CharSequence text, int offset);
+ public TextToken nextToken();
public TextToken nextToken(boolean allowWildcards);
public void setStemming(boolean stem);
}
Modified: trunk/eXist/src/org/exist/util/XMLString.java
===================================================================
--- trunk/eXist/src/org/exist/util/XMLString.java 2007-10-29 19:57:26 UTC (rev 6815)
+++ trunk/eXist/src/org/exist/util/XMLString.java 2007-10-29 20:06:34 UTC (rev 6816)
@@ -60,7 +60,13 @@
length_ = length;
}
- public final XMLString append(String str) {
+ public XMLString(XMLString other) {
+ value_ = CharArrayPool.getCharArray(other.length_);
+ System.arraycopy(other.value_, other.start_, value_, 0, other.length_);
+ length_ = other.length_;
+ }
+
+ public final XMLString append(String str) {
append(str.toCharArray());
return this;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-10-29 19:57:31
|
Revision: 6815
http://exist.svn.sourceforge.net/exist/?rev=6815&view=rev
Author: wolfgang_m
Date: 2007-10-29 12:57:26 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Cleaning test suite. Added static method TestUtils.cleanupDB() to make sure all resources and created collections are removed after a test.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/ngram/test/src/org/exist/indexing/ngram/CustomIndexTest.java
trunk/eXist/test/src/org/exist/collections/triggers/TriggerConfigTest.java
trunk/eXist/test/src/org/exist/collections/triggers/XQueryTriggerTest.java
trunk/eXist/test/src/org/exist/xmldb/CollectionConfigurationTest.java
trunk/eXist/test/src/org/exist/xmldb/CollectionTest.java
trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java
trunk/eXist/test/src/org/exist/xquery/OptimizerTest.java
Added Paths:
-----------
trunk/eXist/test/src/org/exist/TestUtils.java
Modified: trunk/eXist/extensions/indexes/ngram/test/src/org/exist/indexing/ngram/CustomIndexTest.java
===================================================================
--- trunk/eXist/extensions/indexes/ngram/test/src/org/exist/indexing/ngram/CustomIndexTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/extensions/indexes/ngram/test/src/org/exist/indexing/ngram/CustomIndexTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -78,10 +78,12 @@
*/
public void testXUpdateRemove() {
DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
try {
broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
- TransactionManager transact = pool.getTransactionManager();
- Txn transaction = transact.beginTransaction();
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
checkIndex(broker, docs, "cha", 1);
checkIndex(broker, docs, "le8", 1);
@@ -155,6 +157,7 @@
transact.commit(transaction);
} catch (Exception e) {
+ transact.abort(transaction);
e.printStackTrace();
fail(e.getMessage());
} finally {
@@ -166,10 +169,12 @@
public void testXUpdateInsert() {
DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
try {
broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
- TransactionManager transact = pool.getTransactionManager();
- Txn transaction = transact.beginTransaction();
+ transact = pool.getTransactionManager();
+ transaction = transact.beginTransaction();
checkIndex(broker, docs, "cha", 1);
checkIndex(broker, docs, "le8", 1);
@@ -279,6 +284,7 @@
transact.commit(transaction);
} catch (Exception e) {
+ transact.abort(transaction);
e.printStackTrace();
fail(e.getMessage());
} finally {
Added: trunk/eXist/test/src/org/exist/TestUtils.java
===================================================================
--- trunk/eXist/test/src/org/exist/TestUtils.java (rev 0)
+++ trunk/eXist/test/src/org/exist/TestUtils.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -0,0 +1,72 @@
+package org.exist;
+
+import org.exist.collections.Collection;
+import org.exist.collections.CollectionConfigurationManager;
+import org.exist.dom.DocumentImpl;
+import org.exist.storage.BrokerPool;
+import org.exist.storage.DBBroker;
+import org.exist.storage.txn.TransactionManager;
+import org.exist.storage.txn.Txn;
+import org.exist.xmldb.XmldbURI;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.Iterator;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: wolf
+ * Date: Oct 29, 2007
+ * Time: 4:28:26 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestUtils {
+
+ public static void cleanupDB() {
+ BrokerPool pool = null;
+ DBBroker broker = null;
+ TransactionManager transact = null;
+ Txn transaction = null;
+ try {
+ pool = BrokerPool.getInstance();
+ assertNotNull(pool);
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ assertNotNull(broker);
+ transact = pool.getTransactionManager();
+ assertNotNull(transact);
+ transaction = transact.beginTransaction();
+ assertNotNull(transaction);
+
+ // Remove all collections below the /db root, except /db/system
+ Collection root = broker.getOrCreateCollection(transaction, XmldbURI.ROOT_COLLECTION_URI);
+ assertNotNull(root);
+ for (Iterator i = root.iterator(broker); i.hasNext(); ) {
+ DocumentImpl doc = (DocumentImpl) i.next();
+ root.removeXMLResource(transaction, broker, doc.getURI().lastSegment());
+ }
+ broker.saveCollection(transaction, root);
+ for (Iterator i = root.collectionIterator(); i.hasNext(); ) {
+ XmldbURI childName = (XmldbURI) i.next();
+ if (childName.equals("system"))
+ continue;
+ Collection childColl = broker.getOrCreateCollection(transaction, XmldbURI.ROOT_COLLECTION_URI.append(childName));
+ assertNotNull(childColl);
+ broker.removeCollection(transaction, childColl);
+ }
+
+ // Remove /db/system/config/db and all collection configurations with it
+ Collection config = broker.getOrCreateCollection(transaction,
+ XmldbURI.create(CollectionConfigurationManager.CONFIG_COLLECTION + "/db"));
+ assertNotNull(config);
+ broker.removeCollection(transaction, config);
+
+ transact.commit(transaction);
+ } catch (Exception e) {
+ transact.abort(transaction);
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (pool != null) pool.release(broker);
+ }
+ }
+}
Modified: trunk/eXist/test/src/org/exist/collections/triggers/TriggerConfigTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/collections/triggers/TriggerConfigTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/collections/triggers/TriggerConfigTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -1,22 +1,19 @@
package org.exist.collections.triggers;
+import org.exist.TestUtils;
+import org.exist.collections.CollectionConfigurationManager;
import org.exist.storage.DBBroker;
import org.exist.xmldb.DatabaseInstanceManager;
import org.exist.xmldb.IndexQueryService;
-import org.exist.collections.CollectionConfigurationManager;
import org.junit.AfterClass;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runners.Parameterized;
import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
import org.xmldb.api.DatabaseManager;
-import org.xmldb.api.base.Collection;
-import org.xmldb.api.base.Database;
-import org.xmldb.api.base.Resource;
-import org.xmldb.api.base.ResourceSet;
-import org.xmldb.api.base.XMLDBException;
+import org.xmldb.api.base.*;
import org.xmldb.api.modules.CollectionManagementService;
import org.xmldb.api.modules.XQueryService;
@@ -182,15 +179,9 @@
@AfterClass
public static void closeDB() {
+ TestUtils.cleanupDB();
try {
Collection root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
- CollectionManagementService cmgr = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
- cmgr.removeCollection("triggers");
-
- Collection configRoot = DatabaseManager.getCollection("xmldb:exist://" + CollectionConfigurationManager.CONFIG_COLLECTION,
- "admin", null);
- cmgr = (CollectionManagementService) configRoot.getService("CollectionManagementService", "1.0");
- cmgr.removeCollection("db");
DatabaseInstanceManager mgr = (DatabaseInstanceManager) root.getService("DatabaseInstanceManager", "1.0");
mgr.shutdown();
} catch (XMLDBException e) {
Modified: trunk/eXist/test/src/org/exist/collections/triggers/XQueryTriggerTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/collections/triggers/XQueryTriggerTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/collections/triggers/XQueryTriggerTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -21,13 +21,16 @@
package org.exist.collections.triggers;
import static org.custommonkey.xmlunit.XMLAssert.*;
+import org.exist.TestUtils;
import org.exist.storage.DBBroker;
import org.exist.xmldb.EXistResource;
import org.exist.xmldb.IndexQueryService;
+import org.exist.xmldb.DatabaseInstanceManager;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.junit.Assert.fail;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.Database;
@@ -176,16 +179,16 @@
@AfterClass
public static void shutdownDB() {
+ TestUtils.cleanupDB();
try {
- Collection root = DatabaseManager.getCollection(URI, "admin", null);
- CollectionManagementService service = (CollectionManagementService)
- root.getService("CollectionManagementService", "1.0");
- service.removeCollection(TEST_COLLECTION);
- testCollection = null;
+ Collection root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
+ DatabaseInstanceManager mgr = (DatabaseInstanceManager) root.getService("DatabaseInstanceManager", "1.0");
+ mgr.shutdown();
} catch (XMLDBException e) {
e.printStackTrace();
fail(e.getMessage());
}
+ testCollection = null;
}
/** create "log" document that will be updated by the trigger,
Modified: trunk/eXist/test/src/org/exist/xmldb/CollectionConfigurationTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xmldb/CollectionConfigurationTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/xmldb/CollectionConfigurationTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -113,6 +113,7 @@
fail("Could not create config collection: "+CONF_COLL_URI);
}
} catch (Exception e) {
+ e.printStackTrace();
fail(e.getMessage());
}
}
Modified: trunk/eXist/test/src/org/exist/xmldb/CollectionTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xmldb/CollectionTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/xmldb/CollectionTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -57,8 +57,19 @@
fail(e.getMessage());
}
}
-
- /**
+
+ protected void tearDown() {
+ try {
+ Collection root = DatabaseManager.getCollection(URI + DBBroker.ROOT_COLLECTION, "admin", null);
+ DatabaseInstanceManager mgr = (DatabaseInstanceManager) root.getService("DatabaseInstanceManager", "1.0");
+ mgr.shutdown();
+ } catch (XMLDBException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ /**
* @param args
*/
public static void main(String[] args) {
Modified: trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/xmldb/ResourceTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -314,7 +314,8 @@
testCollection.storeResource(res);
}
} catch (Exception e) {
- fail(e.getMessage());
+ e.printStackTrace();
+ fail(e.getMessage());
}
}
Modified: trunk/eXist/test/src/org/exist/xquery/OptimizerTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xquery/OptimizerTest.java 2007-10-29 15:57:28 UTC (rev 6814)
+++ trunk/eXist/test/src/org/exist/xquery/OptimizerTest.java 2007-10-29 19:57:26 UTC (rev 6815)
@@ -21,19 +21,23 @@
*/
package org.exist.xquery;
+import org.exist.TestUtils;
import org.exist.storage.DBBroker;
+import org.exist.util.XMLFilenameFilter;
import org.exist.xmldb.DatabaseInstanceManager;
import org.exist.xmldb.IndexQueryService;
-import org.exist.util.XMLFilenameFilter;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.Database;
-import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.base.ResourceSet;
+import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.modules.CollectionManagementService;
import org.xmldb.api.modules.XMLResource;
import org.xmldb.api.modules.XQueryService;
-import org.junit.*;
import java.io.File;
import java.io.IOException;
@@ -352,14 +356,7 @@
@AfterClass
public static void shutdownDB() {
try {
- CollectionManagementService service =
- (CollectionManagementService) testCollection.getService("CollectionManagementService", "1.0");
- service.removeCollection(".");
-
- Collection system = DatabaseManager.getCollection("xmldb:exist:///db/system/config/db", "admin", null);
- service = (CollectionManagementService) system.getService("CollectionManagementService", "1.0");
- service.removeCollection(".");
-
+ TestUtils.cleanupDB();
DatabaseInstanceManager dim =
(DatabaseInstanceManager) testCollection.getService(
"DatabaseInstanceManager", "1.0");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-29 15:57:30
|
Revision: 6814
http://exist.svn.sourceforge.net/exist/?rev=6814&view=rev
Author: brihaye
Date: 2007-10-29 08:57:28 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
More steps toward unification.
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-29 08:58:52 UTC (rev 6813)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-29 15:57:28 UTC (rev 6814)
@@ -560,7 +560,7 @@
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, qname, token, axis == NodeSet.ANCESTOR);
+ SearchCallback cb = new SearchCallback(context, contextId, docs, contextSet, result, axis, qname, token);
//TODO : revisit
index.db.query(new IndexQuery(IndexQuery.TRUNC_RIGHT, key), cb);
} catch (LockException e) {
@@ -594,7 +594,7 @@
final Lock lock = index.db.getLock();
try {
lock.acquire(Lock.READ_LOCK);
- SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, qname, token, axis == NodeSet.ANCESTOR);
+ SearchExactCallback cb = new SearchExactCallback(context, contextId, docs, contextSet, result, axis, qname, token);
index.db.query(new IndexQuery(IndexQuery.EQ, key), cb);
} catch (LockException e) {
LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
@@ -618,20 +618,19 @@
private NodeSet resultSet;
int axis;
QName qname;
- private XMLString token;
- private boolean returnAncestor;
+ private XMLString token;
public SearchExactCallback(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet,
- NodeSet result, QName qname, String token, boolean returnAncestor) {
+ NodeSet result, int axis, QName qname, String token) {
this.context = context;
this.contextId = contextId;
this.docs = docs;
this.contextSet = contextSet;
this.resultSet = result;
+ this.axis = axis;
this.qname = qname;
//Token should remain immutable
- this.token = new XMLString().append(token);
- this.returnAncestor = returnAncestor;
+ this.token = new XMLString().append(token);
}
public boolean indexInfo(Value key, long pointer) throws TerminatedException {
@@ -644,13 +643,12 @@
LOG.error(e.getMessage(), e);
return true;
}
- /* this is the *incoming* token, not the searched one. Well, currently, it's an *exact* search ;-)
+ //this is the *incoming* token, not the searched one. Well, an eaxt search will work with both
token.reuse();
if (qname == null)
FTGenericTokenKey.decode(key, token);
else
- FTQNamedTokenKey.decode(key, token);
- */
+ FTQNamedTokenKey.decode(key, token);
try {
//Does the token already has data in the index ?
while (is.available() > 0) {
@@ -691,24 +689,24 @@
// in the context set.
if (contextSet != null) {
int sizeHint = contextSet.getSizeHint(storedDocument);
- NodeProxy parent;
+ NodeProxy parentNode;
switch(nameType) {
case FTGenericTokenKey.ATTRIBUTE :
if (contextSet instanceof VirtualNodeSet) {
- parent = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
- if (parent != null && !parent.getNodeId().equals(storedNode.getNodeId()))
- parent = null;
+ parentNode = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
+ if (parentNode != null && !parentNode.getNodeId().equals(storedNode.getNodeId()))
+ parentNode = null;
} else
- parent = contextSet.get(storedNode);
+ parentNode = contextSet.get(storedNode);
break;
case FTQNamedTokenKey.QNAMED_KEY:
case FTGenericTokenKey.TEXT :
- parent = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
+ parentNode = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
break;
default :
throw new IllegalArgumentException("Invalid section type in '" + index.db.getFile().getName() + "'");
}
- if (parent != null) {
+ if (parentNode != null) {
Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
//TODO : currently stupid ; I guess this is for matching the current token
//inside a wider text part
@@ -720,8 +718,8 @@
match.addOffset(offset, token.length());
}
if (axis == NodeSet.ANCESTOR) {
- parent.addMatch(match);
- resultSet.add(parent, sizeHint);
+ parentNode.addMatch(match);
+ resultSet.add(parentNode, sizeHint);
} else {
storedNode.addMatch(match);
resultSet.add(storedNode, sizeHint);
@@ -764,19 +762,18 @@
private NodeSet resultSet;
int axis;
QName qname;
- private XMLString token;
- private boolean returnAncestor;
+ private XMLString token;
public SearchCallback(XQueryContext context, int contextId, DocumentSet docs, NodeSet contextSet,
- NodeSet result, QName qname, String token, boolean returnAncestor) {
+ NodeSet result, int axis, QName qname, String token) {
this.context = context;
this.contextId = contextId;
this.docs = docs;
this.contextSet = contextSet;
this.resultSet = result;
+ this.axis = axis;
this.qname = qname;
- this.token = new XMLString().append(token);
- this.returnAncestor = returnAncestor;
+ this.token = new XMLString().append(token);
}
public boolean indexInfo(Value key, long pointer) throws TerminatedException {
@@ -834,24 +831,24 @@
// in the context set.
if (contextSet != null) {
int sizeHint = contextSet.getSizeHint(storedDocument);
- if (returnAncestor) {
- NodeProxy parentNode = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
- if (parentNode != null) {
- Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
- //TODO : currently stupid ; I guess this is for matching the current token
- //inside a wider text part
- final int diff = token.length() - token.length();
- for (int n = 0; n < freq; n++) {
- int offset = is.readInt();
- if (diff > 0)
- offset += diff;
- match.addOffset(offset, token.length());
- }
- parentNode.addMatch(match);
- resultSet.add(parentNode, sizeHint);
- } else
- is.skip(freq);
- } else {
+ NodeProxy parentNode;
+ switch(nameType) {
+ case FTGenericTokenKey.ATTRIBUTE :
+ if (contextSet instanceof VirtualNodeSet) {
+ parentNode = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
+ if (parentNode != null && !parentNode.getNodeId().equals(storedNode.getNodeId()))
+ parentNode = null;
+ } else
+ parentNode = contextSet.get(storedNode);
+ break;
+ case FTQNamedTokenKey.QNAMED_KEY:
+ case FTGenericTokenKey.TEXT :
+ parentNode = contextSet.parentWithChild(storedNode, false, true, NodeProxy.UNKNOWN_NODE_LEVEL);
+ break;
+ default :
+ throw new IllegalArgumentException("Invalid section type in '" + index.db.getFile().getName() + "'");
+ }
+ if (parentNode != null) {
Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
//TODO : currently stupid ; I guess this is for matching the current token
//inside a wider text part
@@ -862,9 +859,15 @@
offset += diff;
match.addOffset(offset, token.length());
}
- storedNode.addMatch(match);
- resultSet.add(storedNode, sizeHint);
- }
+ if (axis == NodeSet.ANCESTOR) {
+ parentNode.addMatch(match);
+ resultSet.add(parentNode, sizeHint);
+ } else {
+ storedNode.addMatch(match);
+ resultSet.add(storedNode, sizeHint);
+ }
+ } else
+ is.skip(freq);
// otherwise, we add all text nodes without check
} else {
Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
@@ -916,15 +919,17 @@
this.matcher = comparator;
}
- public boolean indexInfo(Value key, long pointer) throws TerminatedException {
- VariableByteInput is;
+ public boolean indexInfo(Value key, long pointer) throws TerminatedException {
+ VariableByteInput is = null;
try {
is = index.db.getAsStream(pointer);
+ if (is == null)
+ return true;
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return true;
- }
- token.reuse();
+ }
+ token.reuse();
if (qname == null)
FTGenericTokenKey.decode(key, token);
else
@@ -989,8 +994,7 @@
break;
default :
throw new IllegalArgumentException("Invalid section type in '" + index.db.getFile().getName() + "'");
- }
-
+ }
if (parentNode != null) {
Match match = new FTMatch(contextId, nodeId, token.toString(), freq);
for (int n = 0; n < freq; n++) {
@@ -1012,6 +1016,7 @@
}
} else
is.skip(freq);
+ // otherwise, we add all text nodes without check
} else {
//Avoid generic/qnamed duplicates
if (!resultSet.contains(storedNode)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-10-29 08:58:54
|
Revision: 6813
http://exist.svn.sourceforge.net/exist/?rev=6813&view=rev
Author: brihaye
Date: 2007-10-29 01:58:52 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
commiting unification stuff from last friday
Modified Paths:
--------------
branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
Modified: branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java
===================================================================
--- branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-28 21:32:10 UTC (rev 6812)
+++ branches/meshram/eXist/extensions/indexes/fulltext/src/org/exist/indexing/fulltext/FTIndexWorker.java 2007-10-29 08:58:52 UTC (rev 6813)
@@ -629,6 +629,7 @@
this.contextSet = contextSet;
this.resultSet = result;
this.qname = qname;
+ //Token should remain immutable
this.token = new XMLString().append(token);
this.returnAncestor = returnAncestor;
}
@@ -643,7 +644,13 @@
LOG.error(e.getMessage(), e);
return true;
}
+ /* this is the *incoming* token, not the searched one. Well, currently, it's an *exact* search ;-)
token.reuse();
+ if (qname == null)
+ FTGenericTokenKey.decode(key, token);
+ else
+ FTQNamedTokenKey.decode(key, token);
+ */
try {
//Does the token already has data in the index ?
while (is.available() > 0) {
@@ -789,8 +796,6 @@
FTQNamedTokenKey.decode(key, token);
try {
//Does the token already has data in the index ?
- if (is == null)
- return true;
while (is.available() > 0) {
int storedDocId = is.readInt();
byte nameType = is.readByte();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-28 21:32:11
|
Revision: 6812
http://exist.svn.sourceforge.net/exist/?rev=6812&view=rev
Author: dizzzz
Date: 2007-10-28 14:32:10 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Added javadoc generation for fluent extension. Found that jUnit tests and code are integrated, resulting in... javadocs with Test class info. Need to create separate test-tree
Modified Paths:
--------------
trunk/eXist/extensions/fluent/build.xml
Modified: trunk/eXist/extensions/fluent/build.xml
===================================================================
--- trunk/eXist/extensions/fluent/build.xml 2007-10-28 20:54:11 UTC (rev 6811)
+++ trunk/eXist/extensions/fluent/build.xml 2007-10-28 21:32:10 UTC (rev 6812)
@@ -1,8 +1,9 @@
-<project basedir="." default="jar" name="fluent">
+<project basedir="." default="all" name="fluent">
<property name="src" value="./src"/>
<property name="classes" value="./classes"/>
- <property name="top.dir" value="../.."/>
+ <property name="javadoc" value="./javadoc"/>
+ <property name="top.dir" value="../.."/>
<property name="build.compiler" value="modern"/>
@@ -24,7 +25,9 @@
<pathelement path="${java.class.path}"/>
</path>
- <target name="prepare">
+ <target name="all" depends="jar,javadoc"/>
+
+ <target name="prepare">
<mkdir dir="${classes}"/>
</target>
@@ -55,8 +58,26 @@
</manifest>
</jar>
</target>
-
- <target name="test" depends="compile">
+
+ <target name="javadoc" unless="java14-only">
+ <mkdir dir="${javadoc}"/>
+ <javadoc bottom="Copyright (C) All rights reserved."
+ destdir="${javadoc}" doctitle="eXist Fluent Javadocs"
+ noindex="true" notree="true" access="public"
+ maxmemory="512M" source="1.5">
+ <packageset dir="${src}">
+ <include name="org/**"/>
+ <exclude name="org/exist/fluent/*$*Test*"/>
+ </packageset>
+ <classpath>
+ <path refid="classpath.core"/>
+ </classpath>
+ <!--link href="" rel="nofollow">http://jakarta.apache.org/commons/collections/api/"/-->
+ </javadoc>
+
+ </target>
+
+ <target name="test" depends="compile">
<echo message="Running fluent extension tests"/>
<junit haltonfailure="false" printsummary="yes" showoutput="${junit.output}" maxmemory="${junit.forked.VM.maxmemory}">
<sysproperty key="exist.home" value="${basedir}" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-28 20:54:13
|
Revision: 6811
http://exist.svn.sourceforge.net/exist/?rev=6811&view=rev
Author: dizzzz
Date: 2007-10-28 13:54:11 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Additional updates for Intellij.
Modified Paths:
--------------
trunk/eXist/eXist.ipr
trunk/eXist/eXist.iws
Modified: trunk/eXist/eXist.ipr
===================================================================
--- trunk/eXist/eXist.ipr 2007-10-28 20:26:05 UTC (rev 6810)
+++ trunk/eXist/eXist.ipr 2007-10-28 20:54:11 UTC (rev 6811)
@@ -315,10 +315,12 @@
<root url="jar://$PROJECT_DIR$/thirdparty/tomcat5/server/lib/catalina-5.0.28.jar!/" />
<root url="jar://$PROJECT_DIR$/tools/ircbot/lib/pircbot.jar!/" />
<root url="file://$PROJECT_DIR$/tools/ant/lib" />
+ <root url="file://$PROJECT_DIR$/tools/wrapper/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$PROJECT_DIR$/tools/ant/lib" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/tools/wrapper/lib" recursive="false" />
</library>
<library name="core">
<CLASSES>
@@ -382,9 +384,11 @@
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/extensions" />
<root url="file://$PROJECT_DIR$/extensions/indexes/spatial/lib" />
+ <root url="file://$PROJECT_DIR$/extensions/fluent/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
+ <jarDirectory url="file://$PROJECT_DIR$/extensions/fluent/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/extensions/indexes/spatial/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/extensions" recursive="false" />
</library>
Modified: trunk/eXist/eXist.iws
===================================================================
--- trunk/eXist/eXist.iws 2007-10-28 20:26:05 UTC (rev 6810)
+++ trunk/eXist/eXist.iws 2007-10-28 20:54:11 UTC (rev 6811)
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project relativePaths="true" version="4">
+ <component name="AnalysisUIOptions">
+ <option name="ANALYZE_TEST_SOURCES" value="false" />
+ <option name="SCOPE_TYPE" value="3" />
+ <option name="CUSTOM_SCOPE_NAME" value="Project Files" />
+ </component>
<component name="CCaseConfig">
<option name="checkoutReserved" value="false" />
<option name="markExternalChangeAsUpToDate" value="true" />
@@ -30,11 +35,7 @@
</component>
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java" afterPath="$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java" afterPath="$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.iws" afterPath="$PROJECT_DIR$/eXist.iws" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.ipr" afterPath="$PROJECT_DIR$/eXist.ipr" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.iml" afterPath="$PROJECT_DIR$/eXist.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/VERSION.txt" afterPath="$PROJECT_DIR$/VERSION.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/org/exist/collections/Collection.java" afterPath="$PROJECT_DIR$/src/org/exist/collections/Collection.java" />
</list>
@@ -128,26 +129,7 @@
</subPane>
</component>
<component name="FileEditorManager">
- <leaf>
- <file leaf-file-name="AnyUriResolver.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="102" column="65" selection-start="3457" selection-end="3457" vertical-scroll-proportion="0.16155419">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="SearchResourceResolver.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="117" column="87" selection-start="4431" selection-end="4431" vertical-scroll-proportion="0.28834355">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- </leaf>
+ <leaf />
</component>
<component name="FindManager">
<FindUsagesManager>
@@ -278,7 +260,29 @@
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/tools" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/tools/XFormsFilter" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="eXist" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="eXist" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/tools" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -304,7 +308,7 @@
<showLibraryContents />
<hideEmptyPackages ProjectPane="false" />
<abbreviatePackageNames />
- <showStructure PackagesPane="false" Scope="false" Favorites="false" ProjectPane="false" />
+ <showStructure ProjectPane="false" Scope="false" PackagesPane="false" Favorites="false" />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
@@ -315,8 +319,8 @@
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="cvs_file_history_treeWidth0" value="292" />
<property name="cvs_file_history_flatWidth2" value="292" />
- <property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web2" value="/private/tmp/webExplodedDir42908tmp" />
<property name="cvs_file_history_treeOrder1" value="1" />
+ <property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web2" value="/private/tmp/webExplodedDir42908tmp" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="cvs_file_history_flatOrder1" value="1" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
@@ -335,10 +339,10 @@
<property name="cvs_file_history_flatOrder0" value="0" />
<property name="cvs_file_history_treeOrder3" value="3" />
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
- <property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web3" value="/private/tmp/webExplodedDir6251tmp" />
- <property name="cvs_file_history_treeOrder2" value="2" />
+ <property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="cvs_file_history_treeWidth3" value="292" />
+ <property name="cvs_file_history_treeOrder2" value="2" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
<property name="cvs_file_history_flatWidth0" value="292" />
<property name="cvs_file_history_flatWidth3" value="292" />
@@ -349,161 +353,19 @@
<recent name="org.exist.xquery.functions.text" />
</key>
</component>
- <component name="RestoreUpdateTree">
- <UpdateInfo date="10/28/07 6:35 PM" ActionInfo="_Update">
- <UpdatedFiles>
- <FILE-GROUP>
- <option name="myUpdateName" value="Updated from server" />
- <option name="myStatusName" value="Changed on server" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="CHANGED_ON_SERVER" />
- <FILE-GROUP>
- <option name="myUpdateName" value="Updated" />
- <option name="myStatusName" value="Changed" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="UPDATED" />
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/config.xml.tmpl</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/xqts.xql</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/report.css</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tableft1.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tree.css</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/container.css</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tabright1.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/SyntaxHighlighter.css</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/xml2html.css</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lp.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tph.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/loading.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/vline.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lmh.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tm.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tn.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lph.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tp.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lm.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tmh.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/ln.gif</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/skip.xml</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/progress.xql</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/treeview.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/report.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shBrushXQuery.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/connection.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/dom.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shBrushXml.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/yahoo.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/event.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/container.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shCore.js</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/collectresults.xql</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/xqts.xconf</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/stylesheets/xml-highlight.xsl</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/build.xml</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/hacked-tests.xml</PATH>
- <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/report.xql</PATH>
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Created" />
- <option name="myStatusName" value="Created" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="CREATED" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Deleted" />
- <option name="myStatusName" value="Deleted" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="true" />
- <option name="myId" value="REMOVED_FROM_REPOSITORY" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Restored" />
- <option name="myStatusName" value="Will be restored" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="RESTORED" />
- </FILE-GROUP>
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Modified" />
- <option name="myStatusName" value="Modified" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="MODIFIED" />
- <PATH>$PROJECT_DIR$/eXist.ipr</PATH>
- <PATH>$PROJECT_DIR$/eXist.iws</PATH>
- <PATH>$PROJECT_DIR$/src/org/exist/collections/Collection.java</PATH>
- <PATH>$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java</PATH>
- <PATH>$PROJECT_DIR$/VERSION.txt</PATH>
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Skipped" />
- <option name="myStatusName" value="Skipped" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="SKIPPED" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Merged with conflicts" />
- <option name="myStatusName" value="Will be merged with conflicts" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="MERGED_WITH_CONFLICTS" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Merged" />
- <option name="myStatusName" value="Will be merged" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="MERGED" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Not in repository" />
- <option name="myStatusName" value="Not in repository" />
- <option name="mySupportsDeletion" value="true" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="UNKNOWN" />
- <PATH>$PROJECT_DIR$/collection.xconf</PATH>
- <PATH>$PROJECT_DIR$/hamlet.xml</PATH>
- <PATH>$PROJECT_DIR$/macbeth.xml</PATH>
- <PATH>$PROJECT_DIR$/nbproject/existdb.properties</PATH>
- <PATH>$PROJECT_DIR$/webapp/documentation.xml.bak</PATH>
- <PATH>$PROJECT_DIR$/webapp/validation.xml.bak</PATH>
- <PATH>$PROJECT_DIR$/webapp/WEB-INF/test.xsd</PATH>
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Locally added" />
- <option name="myStatusName" value="Locally added" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="LOCALLY_ADDED" />
- </FILE-GROUP>
- <FILE-GROUP>
- <option name="myUpdateName" value="Locally removed" />
- <option name="myStatusName" value="Locally removed" />
- <option name="mySupportsDeletion" value="false" />
- <option name="myCanBeAbsent" value="false" />
- <option name="myId" value="LOCALLY_REMOVED" />
- </FILE-GROUP>
- </UpdatedFiles>
- </UpdateInfo>
- </component>
- <component name="RunManager" selected="JUnit.XQueryTest">
- <tempConfiguration default="false" name="XQueryTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
- <pattern value="org.exist.xquery.*" />
+ <component name="RunManager" selected="JUnit.CollectionConfigurationValidationModeTest">
+ <tempConfiguration default="false" name="CollectionConfigurationValidationModeTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+ <pattern value="org.exist.validation.*" />
<module name="eXist" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" value="" />
- <option name="PACKAGE_NAME" value="org.exist.xquery" />
- <option name="MAIN_CLASS_NAME" value="org.exist.xquery.XQueryTest" />
- <option name="METHOD_NAME" value="" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="org.exist.validation" />
+ <option name="MAIN_CLASS_NAME" value="org.exist.validation.CollectionConfigurationValidationModeTest" />
+ <option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="" />
- <option name="PARAMETERS" value="" />
- <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
+ <option name="VM_PARAMETERS" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="ADDITIONAL_CLASS_PATH" />
@@ -524,17 +386,20 @@
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
- <configuration default="true" type="Applet" factoryName="Applet">
- <module name="" />
+ <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
- <option name="HTML_FILE_NAME" />
- <option name="HTML_USED" value="false" />
- <option name="WIDTH" value="400" />
- <option name="HEIGHT" value="300" />
- <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <method>
+ <option name="Make" value="true" />
+ </method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
<module name="" />
@@ -586,20 +451,17 @@
<option name="Run ant target" value="true" />
</method>
</configuration>
- <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+ <configuration default="true" type="Applet" factoryName="Applet">
+ <module name="" />
<option name="MAIN_CLASS_NAME" />
+ <option name="HTML_FILE_NAME" />
+ <option name="HTML_USED" value="false" />
+ <option name="WIDTH" value="400" />
+ <option name="HEIGHT" value="300" />
+ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
- <option name="PROGRAM_PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
- <option name="ENABLE_SWING_INSPECTOR" value="false" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <module name="" />
- <method>
- <option name="Make" value="true" />
- </method>
</configuration>
<configuration default="false" name="eXist Client" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" value="org.exist.start.Main" />
@@ -648,7 +510,7 @@
</method>
</configuration>
<list size="3">
- <item index="0" class="java.lang.String" itemvalue="JUnit.XQueryTest" />
+ <item index="0" class="java.lang.String" itemvalue="JUnit.CollectionConfigurationValidationModeTest" />
<item index="1" class="java.lang.String" itemvalue="Application.eXist Client" />
<item index="2" class="java.lang.String" itemvalue="JUnit.XIncludeSerializerTest" />
</list>
@@ -741,7 +603,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
- <frame x="10" y="22" width="1420" height="828" extended-state="0" />
+ <frame x="60" y="22" width="1420" height="828" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@@ -790,7 +652,7 @@
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
- <option name="LAST_COMMIT_MESSAGE" value="minor changes for Intellij ; added spatial jars" />
+ <option name="LAST_COMMIT_MESSAGE" value="Added logging to resolvers. Additional refactoring needed" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
@@ -813,6 +675,8 @@
<MESSAGE value="Added XIncludeSerializerTest." />
<MESSAGE value="A" />
<MESSAGE value="minor changes for Intellij ; added spatial jars" />
+ <MESSAGE value="minor changes for Intellij ; added sources" />
+ <MESSAGE value="Added logging to resolvers. Additional refactoring needed" />
</component>
<component name="VssConfiguration">
<option name="CLIENT_PATH" value="" />
@@ -999,134 +863,132 @@
<option name="myLastEditedConfigurable" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/tools/ircbot/src/org/exist/irc/IRCProxy.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/collections/Collection.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="13" column="26" selection-start="362" selection-end="362" vertical-scroll-proportion="0.01832061">
+ <state line="994" column="67" selection-start="36455" selection-end="36455" vertical-scroll-proportion="0.27363184">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/tools/izpack/src/org/exist/izpack/PasswordValidator.java">
+ <entry file="file://$PROJECT_DIR$/webapp/WEB-INF/web.xml">
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
+ <state />
+ </provider>
<provider selected="true" editor-type-id="text-editor">
- <state line="23" column="33" selection-start="943" selection-end="943" vertical-scroll-proportion="0.42137405">
+ <state line="444" column="8" selection-start="16141" selection-end="16141" vertical-scroll-proportion="0.33252427">
<folding />
</state>
</provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
+ <state />
+ </provider>
</entry>
- <entry file="file://$PROJECT_DIR$/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java">
+ <entry file="file://$PROJECT_DIR$/tools/XFormsFilter/web.xml">
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
+ <state />
+ </provider>
<provider selected="true" editor-type-id="text-editor">
- <state line="53" column="123" selection-start="1934" selection-end="1934" vertical-scroll-proportion="0.2094763">
+ <state line="79" column="6" selection-start="2569" selection-end="2569" vertical-scroll-proportion="0.33252427">
<folding />
</state>
</provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
+ <state />
+ </provider>
</entry>
- <entry file="file://$PROJECT_DIR$/eXist.iml">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/CollectionConfigurationValidationModeTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <state line="23" column="77" selection-start="990" selection-end="990" vertical-scroll-proportion="0.08977556">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/eXist.iws">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/ValidationFunctions_XSD_Test.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <state line="175" column="16" selection-start="6351" selection-end="6351" vertical-scroll-proportion="0.024539877">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/ValidationServiceTest.java">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/ValidationFunctions_DTD_Test.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="129" column="16" selection-start="4214" selection-end="4214" vertical-scroll-proportion="0.33173078">
+ <state line="60" column="101" selection-start="2143" selection-end="2143" vertical-scroll-proportion="0.024539877">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/CollectionConfigurationTest.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="56" column="13" selection-start="1847" selection-end="1847" vertical-scroll-proportion="0.01832061">
+ <state line="123" column="11" selection-start="4574" selection-end="4574" vertical-scroll-proportion="0.30879346">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/CollectionConfigurationValidationModeTest.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="138" column="137" selection-start="8283" selection-end="8283" vertical-scroll-proportion="0.01875">
+ <state line="101" column="25" selection-start="3405" selection-end="3405" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/test/src/org/exist/xquery/XQueryTest.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/service/LocalValidationService.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="72" column="124" selection-start="3148" selection-end="3148" vertical-scroll-proportion="0.13125">
+ <state line="48" column="23" selection-start="1718" selection-end="1718" vertical-scroll-proportion="0.27868852">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/eXist.ipr">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/internal/node/NodeInputStream.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="279" column="0" selection-start="15078" selection-end="15078" vertical-scroll-proportion="0.33333334">
+ <state line="41" column="33" selection-start="1525" selection-end="1525" vertical-scroll-proportion="-0.04918033">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/collections/Collection.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/Validator.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="994" column="67" selection-start="36455" selection-end="36455" vertical-scroll-proportion="0.27363184">
+ <state line="131" column="28" selection-start="4365" selection-end="4365" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/webapp/WEB-INF/web.xml">
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
- <state />
- </provider>
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
- <state />
- </provider>
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
- <state />
- </provider>
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/XmlLibraryChecker.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="444" column="8" selection-start="16141" selection-end="16141" vertical-scroll-proportion="0.33252427">
+ <state line="235" column="12" selection-start="7109" selection-end="7109" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/tools/XFormsFilter/web.xml">
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
- <state />
- </provider>
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
- <state />
- </provider>
- <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
- <state />
- </provider>
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/internal/DatabaseResources.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="79" column="6" selection-start="2569" selection-end="2569" vertical-scroll-proportion="0.33252427">
+ <state line="132" column="106" selection-start="4325" selection-end="4325" vertical-scroll-proportion="0.49726775">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extensions/fluent/src/org/exist/fluent/ListenerManager.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="66" selection-start="579" selection-end="579" vertical-scroll-proportion="0.48523206">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="14" column="17" selection-start="416" selection-end="416" vertical-scroll-proportion="0.35443038">
+ <folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java">
+ <entry file="file://$PROJECT_DIR$/extensions/fluent/build.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="117" column="87" selection-start="4431" selection-end="4431" vertical-scroll-proportion="0.28834355">
+ <state line="0" column="41" selection-start="41" selection-end="41" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java">
+ <entry file="file://$PROJECT_DIR$/tools/XFormsFilter/src/uk/gov/devonline/www/xforms/XFormsFilter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="102" column="65" selection-start="3457" selection-end="3457" vertical-scroll-proportion="0.16155419">
+ <state line="52" column="25" selection-start="1788" selection-end="1788" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-28 20:26:25
|
Revision: 6810
http://exist.svn.sourceforge.net/exist/?rev=6810&view=rev
Author: dizzzz
Date: 2007-10-28 13:26:05 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Added logging to resolvers. Additional refactoring needed
Modified Paths:
--------------
trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java
Modified: trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java
===================================================================
--- trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java 2007-10-28 19:57:18 UTC (rev 6809)
+++ trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java 2007-10-28 20:26:05 UTC (rev 6810)
@@ -51,6 +51,7 @@
/** Creates a new instance of StoredResourceResolver */
public SearchResourceResolver(String collectionPath, BrokerPool pool) {
+ LOG.debug("Specified collectionPath="+collectionPath);
collection=collectionPath;
brokerPool=pool;
}
@@ -67,9 +68,8 @@
return null;
}
LOG.debug("Resolving XMLResourceIdentifier: "+getXriDetails(xri));
-
-
- String documentName = null;
+
+
String resourcePath = null;
DatabaseResources databaseResources = new DatabaseResources(brokerPool);
@@ -121,7 +121,7 @@
return null;
}
- if(resourcePath!=null && resourcePath.startsWith("/")){
+ if(resourcePath.startsWith("/")){
resourcePath="xmldb:exist://"+resourcePath;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-10-28 19:57:19
|
Revision: 6809
http://exist.svn.sourceforge.net/exist/?rev=6809&view=rev
Author: wolfgang_m
Date: 2007-10-28 12:57:18 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Fixed XUpdate replace bug: indexes were not properly updated; old index entries not removed.
Modified Paths:
--------------
trunk/eXist/src/org/exist/dom/ElementImpl.java
Modified: trunk/eXist/src/org/exist/dom/ElementImpl.java
===================================================================
--- trunk/eXist/src/org/exist/dom/ElementImpl.java 2007-10-28 18:35:41 UTC (rev 6808)
+++ trunk/eXist/src/org/exist/dom/ElementImpl.java 2007-10-28 19:57:18 UTC (rev 6809)
@@ -1359,6 +1359,7 @@
getBroker().removeAllNodes(transaction, oldNode, oldPath, listener);
getBroker().endRemove(transaction);
+ getBroker().flush();
getBroker().getIndexController().setMode(StreamListener.STORE);
listener = getBroker().getIndexController().getStreamListener();
Node newNode = appendChild(transaction, oldNode.nodeId, new NodeImplRef(previous), getPath(), newChild, listener);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-28 18:35:43
|
Revision: 6808
http://exist.svn.sourceforge.net/exist/?rev=6808&view=rev
Author: dizzzz
Date: 2007-10-28 11:35:41 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Added logging to resolvers. Additional refactoring needed
Modified Paths:
--------------
trunk/eXist/src/org/exist/validation/resolver/AnyUriResolver.java
trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java
Modified: trunk/eXist/src/org/exist/validation/resolver/AnyUriResolver.java
===================================================================
--- trunk/eXist/src/org/exist/validation/resolver/AnyUriResolver.java 2007-10-28 18:25:20 UTC (rev 6807)
+++ trunk/eXist/src/org/exist/validation/resolver/AnyUriResolver.java 2007-10-28 18:35:41 UTC (rev 6808)
@@ -113,11 +113,13 @@
is = new URL(resourcePath).openStream();
}
- XMLInputSource retVal = new XMLInputSource(xri.getPublicId(), resourcePath,
+ XMLInputSource xis = new XMLInputSource(xri.getPublicId(), resourcePath,
baseSystemId, is, "UTF-8");
- return retVal;
+ LOG.debug( "XMLInputSource: "+getXisDetails(xis) );
+ return xis;
+
}
private String getXriDetails(XMLResourceIdentifier xrid){
@@ -129,5 +131,14 @@
sb.append("Namespace='").append(xrid.getNamespace()).append("' ");
return sb.toString();
}
+
+ private String getXisDetails(XMLInputSource xis){
+ StringBuffer sb = new StringBuffer();
+ sb.append("PublicId='").append(xis.getPublicId()).append("' ");
+ sb.append("SystemId='").append(xis.getSystemId()).append("' ");
+ sb.append("BaseSystemId='").append(xis.getBaseSystemId()).append("' ");
+ sb.append("Encoding='").append(xis.getEncoding()).append("' ");
+ return sb.toString();
+ }
}
Modified: trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java
===================================================================
--- trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java 2007-10-28 18:25:20 UTC (rev 6807)
+++ trunk/eXist/src/org/exist/validation/resolver/SearchResourceResolver.java 2007-10-28 18:35:41 UTC (rev 6808)
@@ -129,9 +129,12 @@
InputStream is = new URL(resourcePath).openStream();
- XMLInputSource retVal = new XMLInputSource(xri.getPublicId(),
+ XMLInputSource xis = new XMLInputSource(xri.getPublicId(),
xri.getExpandedSystemId(), xri.getBaseSystemId(), is, "UTF-8");
- return retVal;
+
+ LOG.debug( "XMLInputSource: "+getXisDetails(xis) );
+
+ return xis;
}
private String getXriDetails(XMLResourceIdentifier xrid){
@@ -143,5 +146,14 @@
sb.append("Namespace='").append(xrid.getNamespace()).append("' ");
return sb.toString();
}
+
+ private String getXisDetails(XMLInputSource xis){
+ StringBuffer sb = new StringBuffer();
+ sb.append("PublicId='").append(xis.getPublicId()).append("' ");
+ sb.append("SystemId='").append(xis.getSystemId()).append("' ");
+ sb.append("BaseSystemId='").append(xis.getBaseSystemId()).append("' ");
+ sb.append("Encoding='").append(xis.getEncoding()).append("' ");
+ return sb.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-10-28 18:25:23
|
Revision: 6807
http://exist.svn.sourceforge.net/exist/?rev=6807&view=rev
Author: dizzzz
Date: 2007-10-28 11:25:20 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
minor changes for Intellij ; added sources
Modified Paths:
--------------
trunk/eXist/eXist.iml
trunk/eXist/eXist.ipr
trunk/eXist/eXist.iws
Modified: trunk/eXist/eXist.iml
===================================================================
--- trunk/eXist/eXist.iml 2007-10-28 16:47:31 UTC (rev 6806)
+++ trunk/eXist/eXist.iml 2007-10-28 18:25:20 UTC (rev 6807)
@@ -194,6 +194,7 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/extensions/fluent/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/extensions/indexes/ngram/test/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/extensions/indexes/spatial/src" isTestSource="false" />
@@ -202,7 +203,12 @@
<sourceFolder url="file://$MODULE_DIR$/samples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/XFormsFilter/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/ircbot/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/izpack/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/jmx/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools/requestlog/src" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/tools/wrapper/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Modified: trunk/eXist/eXist.ipr
===================================================================
--- trunk/eXist/eXist.ipr 2007-10-28 16:47:31 UTC (rev 6806)
+++ trunk/eXist/eXist.ipr 2007-10-28 18:25:20 UTC (rev 6807)
@@ -277,6 +277,26 @@
<option name="GENERATE_IIOP_STUBS" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
+ <component name="SvnBranchConfigurationManager">
+ <option name="myConfigurationMap">
+ <map>
+ <entry key="$PROJECT_DIR$">
+ <value>
+ <SvnBranchConfiguration>
+ <option name="branchUrls">
+ <list>
+ <option value="https://exist.svn.sourceforge.net/svnroot/exist/branches" />
+ <option value="https://exist.svn.sourceforge.net/svnroot/exist/releases" />
+ <option value="https://exist.svn.sourceforge.net/svnroot/exist/tags" />
+ </list>
+ </option>
+ <option name="trunkUrl" value="https://exist.svn.sourceforge.net/svnroot/exist/trunk" />
+ </SvnBranchConfiguration>
+ </value>
+ </entry>
+ </map>
+ </option>
+ </component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="svn" />
</component>
Modified: trunk/eXist/eXist.iws
===================================================================
--- trunk/eXist/eXist.iws 2007-10-28 16:47:31 UTC (rev 6806)
+++ trunk/eXist/eXist.iws 2007-10-28 18:25:20 UTC (rev 6807)
@@ -31,6 +31,7 @@
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java" afterPath="$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java" afterPath="$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.iws" afterPath="$PROJECT_DIR$/eXist.iws" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.ipr" afterPath="$PROJECT_DIR$/eXist.ipr" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/eXist.iml" afterPath="$PROJECT_DIR$/eXist.iml" />
@@ -44,14 +45,6 @@
<rightPanel url="file://$PROJECT_DIR$" />
<splitter proportion="0.5" />
</component>
- <component name="CompilerWorkspaceConfiguration">
- <option name="COMPILE_IN_BACKGROUND" value="false" />
- <option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
- <option name="CLOSE_MESSAGE_VIEW_IF_SUCCESS" value="true" />
- <option name="COMPILE_DEPENDENT_FILES" value="false" />
- <option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
- <option name="ASSERT_NOT_NULL" value="true" />
- </component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
<option name="REVERSE_PATCH" value="false" />
@@ -136,17 +129,24 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="GMLIndexTest.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java">
+ <file leaf-file-name="AnyUriResolver.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="93" column="54" selection-start="3451" selection-end="3455" vertical-scroll-proportion="0.88125">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="102" column="65" selection-start="3457" selection-end="3457" vertical-scroll-proportion="0.16155419">
+ <folding />
</state>
</provider>
</entry>
</file>
+ <file leaf-file-name="SearchResourceResolver.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="117" column="87" selection-start="4431" selection-end="4431" vertical-scroll-proportion="0.28834355">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
</leaf>
</component>
<component name="FindManager">
@@ -275,58 +275,10 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/tools" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="eXist" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="eXist" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions/indexes" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="eXist" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="eXist" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions/indexes" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/extensions/indexes/spatial" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -363,12 +315,13 @@
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="cvs_file_history_treeWidth0" value="292" />
<property name="cvs_file_history_flatWidth2" value="292" />
+ <property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web2" value="/private/tmp/webExplodedDir42908tmp" />
<property name="cvs_file_history_treeOrder1" value="1" />
- <property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web2" value="/private/tmp/webExplodedDir42908tmp" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="cvs_file_history_flatOrder1" value="1" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="cvs_file_history_flatWidth1" value="291" />
+ <property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web" value="/private/tmp/webExplodedDir6263tmp" />
<property name="cvs_file_history_treeWidth1" value="291" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.showClasses" value="true" />
@@ -382,10 +335,10 @@
<property name="cvs_file_history_flatOrder0" value="0" />
<property name="cvs_file_history_treeOrder3" value="3" />
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
+ <property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="TEMP_MODULE_EXPLODED_DIR_FOR_eXist/web/Web3" value="/private/tmp/webExplodedDir6251tmp" />
- <property name="GenerateAntBuildDialog.backupFiles" value="true" />
+ <property name="cvs_file_history_treeOrder2" value="2" />
<property name="cvs_file_history_treeWidth3" value="292" />
- <property name="cvs_file_history_treeOrder2" value="2" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
<property name="cvs_file_history_flatWidth0" value="292" />
<property name="cvs_file_history_flatWidth3" value="292" />
@@ -396,19 +349,161 @@
<recent name="org.exist.xquery.functions.text" />
</key>
</component>
- <component name="RunManager" selected="JUnit.AllTests">
- <tempConfiguration default="false" name="AllTests" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
- <pattern value="org.exist.storage.test.*" />
+ <component name="RestoreUpdateTree">
+ <UpdateInfo date="10/28/07 6:35 PM" ActionInfo="_Update">
+ <UpdatedFiles>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Updated from server" />
+ <option name="myStatusName" value="Changed on server" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="CHANGED_ON_SERVER" />
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Updated" />
+ <option name="myStatusName" value="Changed" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="UPDATED" />
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/extensions/modules/src/org/exist/xquery/modules/scheduler/GetScheduledJobs.java</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/config.xml.tmpl</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/xqts.xql</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/report.css</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tableft1.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tree.css</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/container.css</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/tabright1.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/SyntaxHighlighter.css</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/styles/xml2html.css</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lp.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tph.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/loading.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/vline.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lmh.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tm.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tn.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lph.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tp.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/lm.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/tmh.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/images/ln.gif</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/skip.xml</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/progress.xql</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/treeview.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/report.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shBrushXQuery.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/connection.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/dom.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shBrushXml.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/yahoo.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/event.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/container.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/scripts/shCore.js</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/collectresults.xql</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/xqts.xconf</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/stylesheets/xml-highlight.xsl</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/build.xml</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/hacked-tests.xml</PATH>
+ <PATH vcs="svn" revision="6806">$PROJECT_DIR$/webapp/xqts/report.xql</PATH>
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Created" />
+ <option name="myStatusName" value="Created" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="CREATED" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Deleted" />
+ <option name="myStatusName" value="Deleted" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="true" />
+ <option name="myId" value="REMOVED_FROM_REPOSITORY" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Restored" />
+ <option name="myStatusName" value="Will be restored" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="RESTORED" />
+ </FILE-GROUP>
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Modified" />
+ <option name="myStatusName" value="Modified" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="MODIFIED" />
+ <PATH>$PROJECT_DIR$/eXist.ipr</PATH>
+ <PATH>$PROJECT_DIR$/eXist.iws</PATH>
+ <PATH>$PROJECT_DIR$/src/org/exist/collections/Collection.java</PATH>
+ <PATH>$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java</PATH>
+ <PATH>$PROJECT_DIR$/VERSION.txt</PATH>
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Skipped" />
+ <option name="myStatusName" value="Skipped" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="SKIPPED" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Merged with conflicts" />
+ <option name="myStatusName" value="Will be merged with conflicts" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="MERGED_WITH_CONFLICTS" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Merged" />
+ <option name="myStatusName" value="Will be merged" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="MERGED" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Not in repository" />
+ <option name="myStatusName" value="Not in repository" />
+ <option name="mySupportsDeletion" value="true" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="UNKNOWN" />
+ <PATH>$PROJECT_DIR$/collection.xconf</PATH>
+ <PATH>$PROJECT_DIR$/hamlet.xml</PATH>
+ <PATH>$PROJECT_DIR$/macbeth.xml</PATH>
+ <PATH>$PROJECT_DIR$/nbproject/existdb.properties</PATH>
+ <PATH>$PROJECT_DIR$/webapp/documentation.xml.bak</PATH>
+ <PATH>$PROJECT_DIR$/webapp/validation.xml.bak</PATH>
+ <PATH>$PROJECT_DIR$/webapp/WEB-INF/test.xsd</PATH>
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Locally added" />
+ <option name="myStatusName" value="Locally added" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="LOCALLY_ADDED" />
+ </FILE-GROUP>
+ <FILE-GROUP>
+ <option name="myUpdateName" value="Locally removed" />
+ <option name="myStatusName" value="Locally removed" />
+ <option name="mySupportsDeletion" value="false" />
+ <option name="myCanBeAbsent" value="false" />
+ <option name="myId" value="LOCALLY_REMOVED" />
+ </FILE-GROUP>
+ </UpdatedFiles>
+ </UpdateInfo>
+ </component>
+ <component name="RunManager" selected="JUnit.XQueryTest">
+ <tempConfiguration default="false" name="XQueryTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+ <pattern value="org.exist.xquery.*" />
<module name="eXist" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.exist.storage.test" />
- <option name="MAIN_CLASS_NAME" value="org.exist.storage.test.AllTests" />
- <option name="METHOD_NAME" />
+ <option name="ALTERNATIVE_JRE_PATH" value="" />
+ <option name="PACKAGE_NAME" value="org.exist.xquery" />
+ <option name="MAIN_CLASS_NAME" value="org.exist.xquery.XQueryTest" />
+ <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="VM_PARAMETERS" value="" />
+ <option name="PARAMETERS" value="" />
+ <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="ADDITIONAL_CLASS_PATH" />
@@ -429,21 +524,6 @@
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
- <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
- <option name="MAIN_CLASS_NAME" />
- <option name="VM_PARAMETERS" />
- <option name="PROGRAM_PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="ENABLE_SWING_INSPECTOR" value="false" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <module name="" />
- <method>
- <option name="Make" value="true" />
- </method>
- </configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
@@ -456,6 +536,34 @@
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
+ <configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="SUITE_NAME" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="GROUP_NAME" />
+ <option name="TEST_OBJECT" value="CLASS" />
+ <option name="VM_PARAMETERS" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" />
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="ANNOTATION_TYPE" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="ADDITIONAL_CLASS_PATH" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="wholeProject" />
+ </option>
+ <option name="PROPERTIES_FILE" />
+ <properties />
+ <listeners />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
<configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -478,6 +586,21 @@
<option name="Run ant target" value="true" />
</method>
</configuration>
+ <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
<configuration default="false" name="eXist Client" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" value="org.exist.start.Main" />
<option name="VM_PARAMETERS" value="-Dexist.home=D:\Source\Idea\eXist-1.0 -Xmx128m" />
@@ -525,7 +648,7 @@
</method>
</configuration>
<list size="3">
- <item index="0" class="java.lang.String" itemvalue="JUnit.AllTests" />
+ <item index="0" class="java.lang.String" itemvalue="JUnit.XQueryTest" />
<item index="1" class="java.lang.String" itemvalue="Application.eXist Client" />
<item index="2" class="java.lang.String" itemvalue="JUnit.XIncludeSerializerTest" />
</list>
@@ -619,28 +742,28 @@
</component>
<component name="ToolWindowManager">
<frame x="10" y="22" width="1420" height="828" extended-state="0" />
- <editor active="true" />
+ <editor active="false" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32927817" order="3" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.22566372" order="7" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21079504" order="0" x="72" y="49" width="451" height="485" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.21836506" order="1" />
+ <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21079504" order="0" x="72" y="49" width="451" height="485" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.21702127" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24939074" order="1" />
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.22553192" order="8" />
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.22553192" order="8" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24856909" order="1" />
<window_info id="Maven projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
- <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32970026" order="8" />
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32922733" order="2" />
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32907802" order="8" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32907802" order="2" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24979724" order="2" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3990188" order="0" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29977876" order="4" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" weight="0.32963374" order="8" x="4" y="2" width="968" height="391" />
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3281075" order="8" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32765958" order="8" />
<window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
<window_info id="Color Browser" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@@ -667,7 +790,7 @@
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
- <option name="LAST_COMMIT_MESSAGE" value="Added XIncludeSerializerTest." />
+ <option name="LAST_COMMIT_MESSAGE" value="minor changes for Intellij ; added spatial jars" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
@@ -688,6 +811,8 @@
<MESSAGE value="Fixed: wrong line numbers in XQuery error messages: line breaks inside comments were not counted." />
<MESSAGE value="Fixed: util:catch needs to push/pop local variables on the stack before executing the main expression. Fixes a problem with running the XQTS." />
<MESSAGE value="Added XIncludeSerializerTest." />
+ <MESSAGE value="A" />
+ <MESSAGE value="minor changes for Intellij ; added spatial jars" />
</component>
<component name="VssConfiguration">
<option name="CLIENT_PATH" value="" />
@@ -874,110 +999,135 @@
<option name="myLastEditedConfigurable" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/org/exist/dom/DocumentSet.java">
+ <entry file="file://$PROJECT_DIR$/tools/ircbot/src/org/exist/irc/IRCProxy.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="261" column="30" selection-start="6864" selection-end="6864" vertical-scroll-proportion="0.6275116">
+ <state line="13" column="26" selection-start="362" selection-end="362" vertical-scroll-proportion="0.01832061">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/dom/DocumentImpl.java">
+ <entry file="file://$PROJECT_DIR$/tools/izpack/src/org/exist/izpack/PasswordValidator.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="242" column="17" selection-start="6817" selection-end="6817" vertical-scroll-proportion="0.47310126">
+ <state line="23" column="33" selection-start="943" selection-end="943" vertical-scroll-proportion="0.42137405">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/xquery/functions/xmldb/XMLDBHasLock.java">
+ <entry file="file://$PROJECT_DIR$/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="43" column="61" selection-start="1702" selection-end="1702" vertical-scroll-proportion="0.2420886">
+ <state line="53" column="123" selection-start="1934" selection-end="1934" vertical-scroll-proportion="0.2094763">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/xquery/update/Modification.java">
+ <entry file="file://$PROJECT_DIR$/eXist.iml">
<provider selected="true" editor-type-id="text-editor">
- <state line="134" column="47" selection-start="4286" selection-end="4286" vertical-scroll-proportion="0.96677214">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/webapp/ant-tasks.xml">
+ <entry file="file://$PROJECT_DIR$/eXist.iws">
<provider selected="true" editor-type-id="text-editor">
- <state line="436" column="42" selection-start="17075" selection-end="17075" vertical-scroll-proportion="0.37294334">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/build/scripts/junit.xml">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/ValidationServiceTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="164" column="80" selection-start="7581" selection-end="7581" vertical-scroll-proportion="1.1661538">
+ <state line="129" column="16" selection-start="4214" selection-end="4214" vertical-scroll-proportion="0.33173078">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/storage/journal/Journal.java">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/CollectionConfigurationTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="330" column="14" selection-start="12971" selection-end="12971" vertical-scroll-proportion="0.023483366">
+ <state line="56" column="13" selection-start="1847" selection-end="1847" vertical-scroll-proportion="0.01832061">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/dom/StoredNode.java">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/validation/CollectionConfigurationValidationModeTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="36" column="24" selection-start="1336" selection-end="1336" vertical-scroll-proportion="0.023483366">
+ <state line="138" column="137" selection-start="8283" selection-end="8283" vertical-scroll-proportion="0.01875">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/cluster/cocoon/ClusterGenerator.java">
+ <entry file="file://$PROJECT_DIR$/test/src/org/exist/xquery/XQueryTest.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="27" column="168" selection-start="855" selection-end="855" vertical-scroll-proportion="0.01832061">
+ <state line="72" column="124" selection-start="3148" selection-end="3148" vertical-scroll-proportion="0.13125">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/extensions/fluent/src/org/exist/fluent/Folder.java">
+ <entry file="file://$PROJECT_DIR$/eXist.ipr">
<provider selected="true" editor-type-id="text-editor">
- <state line="78" column="9" selection-start="2524" selection-end="2524" vertical-scroll-proportion="0.01832061">
+ <state line="279" column="0" selection-start="15078" selection-end="15078" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/collections/Collection.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="70" column="33" selection-start="2580" selection-end="2580" vertical-scroll-proportion="0.01832061">
+ <state line="994" column="67" selection-start="36455" selection-end="36455" vertical-scroll-proportion="0.27363184">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/exist/http/realm/XmldbRealm.java">
+ <entry file="file://$PROJECT_DIR$/webapp/WEB-INF/web.xml">
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
+ <state />
+ </provider>
<provider selected="true" editor-type-id="text-editor">
- <state line="9" column="27" selection-start="220" selection-end="220" vertical-scroll-proportion="0.01832061">
+ <state line="444" column="8" selection-start="16141" selection-end="16141" vertical-scroll-proportion="0.33252427">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/tools/ircbot/src/org/exist/irc/IRCProxy.java">
+ <entry file="file://$PROJECT_DIR$/tools/XFormsFilter/web.xml">
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleGeneralEditorProvider">
+ <state />
+ </provider>
+ <provider editor-type-id="com.intellij.javaee.module.view.web.viewlets.WebModuleAssemblyDescriptorReferencesProvider">
+ <state />
+ </provider>
<provider selected="true" editor-type-id="text-editor">
- <state line="13" column="26" selection-start="362" selection-end="362" vertical-scroll-proportion="0.01832061">
+ <state line="79" column="6" selection-start="2569" selection-end="2569" vertical-scroll-proportion="0.33252427">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/tools/izpack/src/org/exist/izpack/PasswordValidator.java">
+ <entry file="file://$PROJECT_DIR$/extensions/fluent/src/org/exist/fluent/ListenerManager.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="23" column="33" selection-start="943" selection-end="943" vertical-scroll-proportion="0.42137405">
+ <state line="20" column="66" selection-start="579" selection-end="579" vertical-scroll-proportion="0.48523206">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/SearchResourceResolver.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="117" column="87" selection-start="4431" selection-end="4431" vertical-scroll-proportion="0.28834355">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java">
+ <entry file="file://$PROJECT_DIR$/src/org/exist/validation/resolver/AnyUriResolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="93" column="54" selection-start="3451" selection-end="3455" vertical-scroll-proportion="0.88125">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="102" column="65" selection-start="3457" selection-end="3457" vertical-scroll-proportion="0.16155419">
+ <folding />
</state>
</provider>
</entry>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|