jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r815805 [1/2] - in /jackrabbit/sandbox/JCR-2170: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 16 Sep 2009 14:33:25 GMT
Author: mreutegg
Date: Wed Sep 16 14:33:23 2009
New Revision: 815805

URL: http://svn.apache.org/viewvc?rev=815805&view=rev
Log:
JCR-2170: Remove PropDefId and NodeDefId
- merge with recent changes from trunk

Added:
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepositoryFactory.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepositoryFactory.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/
      - copied from r815796, jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/DataStoreGarbageCollector.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/DataStoreGarbageCollector.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/MarkEventListener.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/MarkEventListener.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/RepositoryManager.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/RepositoryManager.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitParser.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/query/lucene/tika-config.xml
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/query/lucene/tika-config.xml
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/query/test.rtf
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/query/test.rtf
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/query/test.txt
      - copied unchanged from r815796, jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/query/test.txt
Removed:
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitTextExtractor.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PooledTextExtractor.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/TextExtractorJob.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/TextExtractorReader.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-text-extractors/
Modified:
    jackrabbit/sandbox/JCR-2170/   (props changed)
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/pom.xml
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/ScanEventListener.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCConcurrentTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextQueryTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/pom.xml
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-parent/pom.xml
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/NameParserTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java
    jackrabbit/sandbox/JCR-2170/pom.xml

Propchange: jackrabbit/sandbox/JCR-2170/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 16 14:33:23 2009
@@ -1,3 +1,3 @@
 /jackrabbit/branches/1.5:794012,794100,794102
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:812417-814663
+/jackrabbit/trunk:812417-815796

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java Wed Sep 16 14:33:23 2009
@@ -54,4 +54,5 @@
      * @see UserManager
      */
     UserManager getUserManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java Wed Sep 16 14:33:23 2009
@@ -48,9 +48,9 @@
      * The identifier is opaque, meaning it can have any format and size, however
      * it is at normally about 50 characters and at most 255 characters long.
      * The string only contains Unicode code points from 32 to 127 (including).
-     * 
+     *
      * @return the unique identifier or null
      */
-    public String getContentIdentity();
+    String getContentIdentity();
 
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/pom.xml?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/pom.xml (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/pom.xml Wed Sep 16 14:33:23 2009
@@ -193,9 +193,9 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-text-extractors</artifactId>
-      <version>2.0-SNAPSHOT</version>
+      <groupId>org.apache.tika</groupId>
+      <artifactId>tika-parsers</artifactId>
+      <version>0.4</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java Wed Sep 16 14:33:23 2009
@@ -16,20 +16,23 @@
  */
 package org.apache.jackrabbit.core;
 
+import java.util.HashSet;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
-import javax.jcr.RepositoryFactory;
 import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.apache.jackrabbit.api.JackrabbitRepositoryFactory;
+import org.apache.jackrabbit.api.management.RepositoryManager;
 
 /**
  * <code>RepositoryFactoryImpl</code> implements a repository factory that
  * creates a {@link TransientRepository} on {@link #getRepository(Map)}.
  */
-public class RepositoryFactoryImpl implements RepositoryFactory {
+public class RepositoryFactoryImpl implements JackrabbitRepositoryFactory {
 
     /**
      * Name of the repository home parameter.
@@ -49,6 +52,11 @@
      */
     private static final Map<String, JackrabbitRepository> REPOSITORY_INSTANCES = new HashMap<String, JackrabbitRepository>();
 
+    /**
+     * The repository instances that were created by this factory.
+     */
+    private final Set<TransientRepository> ownRepositories = new HashSet<TransientRepository>();
+
     public Repository getRepository(Map parameters) throws RepositoryException {
         JackrabbitRepository repo;
         synchronized (REPOSITORY_INSTANCES) {
@@ -91,8 +99,19 @@
                 tr = new TransientRepository(conf, home);
             }
             REPOSITORY_INSTANCES.put(tr.getHomeDir(), tr);
+            ownRepositories.add(tr);
             repo = tr;
         }
         return repo;
     }
+
+    public RepositoryManager getRepositoryManager(JackrabbitRepository repo) throws RepositoryException {
+        if (repo instanceof TransientRepository) {
+            throw new RepositoryException("The repository was not created in this factory");
+        }
+        if (!ownRepositories.contains(repo)) {
+            throw new RepositoryException("The repository was not created in this factory");
+        }
+        return new RepositoryManagerImpl((TransientRepository) repo);
+    }
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Wed Sep 16 14:33:23 2009
@@ -34,8 +34,6 @@
 import java.util.Properties;
 import java.util.Set;
 import java.util.Iterator;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -668,9 +666,11 @@
             throws RepositoryException {
         if (systemSearchMgr == null) {
             if (repConfig.getSearchConfig() != null) {
-                systemSearchMgr = new SearchManager(repConfig.getSearchConfig(),
-                        nsReg, ntReg, getWorkspaceInfo(wspName).itemStateMgr,
-                        vMgr.getPersistenceManager(), SYSTEM_ROOT_NODE_ID, null, null);
+                systemSearchMgr = new SearchManager(
+                        repConfig.getSearchConfig(), nsReg, ntReg,
+                        getWorkspaceInfo(wspName).itemStateMgr,
+                        vMgr.getPersistenceManager(), SYSTEM_ROOT_NODE_ID,
+                        null, null, executor);
 
                 SystemSession defSysSession = getSystemSession(wspName);
                 ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
@@ -1181,7 +1181,7 @@
         // wake up threads waiting on this instance's monitor (e.g. workspace janitor)
         notifyAll();
 
-        // Shut down the executor service 
+        // Shut down the executor service
         executor.shutdown();
         try {
             // Wait for all remaining background threads to terminate
@@ -1840,13 +1840,9 @@
                     // search manager is lazily instantiated in order to avoid
                     // 'chicken & egg' bootstrap problems
                     searchMgr = new SearchManager(config.getSearchConfig(),
-                            nsReg,
-                            ntReg,
-                            itemStateMgr,
-                            persistMgr,
-                            rootNodeId,
+                            nsReg, ntReg, itemStateMgr, persistMgr, rootNodeId,
                             getSystemSearchManager(getName()),
-                            SYSTEM_ROOT_NODE_ID);
+                            SYSTEM_ROOT_NODE_ID, executor);
                 }
                 return searchMgr;
             }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java Wed Sep 16 14:33:23 2009
@@ -24,6 +24,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Executor;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.Node;
@@ -141,6 +142,11 @@
     private Path excludePath;
 
     /**
+     * Background task executor.
+     */
+    private final Executor executor;
+
+    /**
      * Creates a new <code>SearchManager</code>.
      *
      * @param config         the search configuration.
@@ -163,7 +169,8 @@
                          PersistenceManager pm,
                          NodeId rootNodeId,
                          SearchManager parentMgr,
-                         NodeId excludedNodeId) throws RepositoryException {
+                         NodeId excludedNodeId,
+                         Executor executor) throws RepositoryException {
         this.fs = config.getFileSystem();
         this.config = config;
         this.ntReg = ntReg;
@@ -173,6 +180,7 @@
         this.rootNodeId = rootNodeId;
         this.parentHandler = (parentMgr != null) ? parentMgr.handler : null;
         this.excludedNodeId = excludedNodeId;
+        this.executor = executor;
 
         // register namespaces
         safeRegisterNamespace(NS_XS_PREFIX, NS_XS_URI);
@@ -505,9 +513,9 @@
         // initialize query handler
         try {
             handler = (QueryHandler) config.newInstance();
-            QueryHandlerContext context
-                    = new QueryHandlerContext(fs, itemMgr, pm, rootNodeId,
-                            ntReg, nsReg, parentHandler, excludedNodeId);
+            QueryHandlerContext context = new QueryHandlerContext(
+                    fs, itemMgr, pm, rootNodeId, ntReg, nsReg,
+                    parentHandler, excludedNodeId, executor);
             handler.init(context);
         } catch (Exception e) {
             throw new RepositoryException(e.getMessage(), e);

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java Wed Sep 16 14:33:23 2009
@@ -418,4 +418,13 @@
     public void loggingOut(SessionImpl session) {
     }
 
+    /**
+     * Get the current repository.
+     *
+     * @return the repository
+     */
+    RepositoryImpl getRepository() {
+        return repository;
+    }
+
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.data;
 
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.RepositoryImpl;
@@ -32,7 +34,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -64,20 +65,25 @@
  * <p>
  * Example code to run the data store garbage collection:
  * <pre>
- * GarbageCollector gc = ((SessionImpl)session).createDataStoreGarbageCollector();
- * gc.scan();
- * gc.stopScan();
- * gc.deleteUnused();
+ * JackrabbitRepositoryFactory jf = (JackrabbitRepositoryFactory) factory;
+ * RepositoryManager m = factory.getRepositoryManager((JackrabbitRepository) rep);
+ * GarbageCollector gc = m.createDataStoreGarbageCollector();
+ * try {
+ *     gc.mark();
+ *     gc.sweep();
+ * } finally {
+ *     gc.close();
+ * }
  * </pre>
  */
-public class GarbageCollector {
+public class GarbageCollector implements DataStoreGarbageCollector {
 
     /** logger instance */
     private static final Logger LOG = LoggerFactory.getLogger(GarbageCollector.class);
 
-    private ScanEventListener callback;
+    private MarkEventListener callback;
 
-    private int sleepBetweenNodes;
+    private long sleepBetweenNodes;
 
     private int testDelay;
 
@@ -90,14 +96,12 @@
     private final IterablePersistenceManager[] pmList;
 
     private final Session[] sessionList;
-    private final SessionListener sessionListener;
+    private SessionListener sessionListener;
 
     private final AtomicBoolean closed = new AtomicBoolean();
 
     private boolean persistenceManagerScan;
 
-    // TODO It should be possible to stop and restart a garbage collection scan.
-
     /**
      * Create a new garbage collector.
      * This method is usually not called by the application, it is called
@@ -114,28 +118,27 @@
         this.persistenceManagerScan = list != null;
         this.sessionList = sessionList;
 
-        // Auto-close if the main session logs out
-        this.sessionListener = new SessionListener() {
-            public void loggedOut(SessionImpl session) {
-            }
-            public void loggingOut(SessionImpl session) {
-                close();
-            }
-        };
-        session.addListener(sessionListener);
+        if (session != null) {
+            // Auto-close if the main session logs out
+            this.sessionListener = new SessionListener() {
+                public void loggedOut(SessionImpl session) {
+                }
+                public void loggingOut(SessionImpl session) {
+                    close();
+                }
+            };
+            session.addListener(sessionListener);
+        }
     }
 
-    /**
-     * Set the delay between scanning items.
-     * The main scan loop sleeps this many milliseconds after
-     * scanning a node. The default is 0, meaning the scan should run at full speed.
-     *
-     * @param millis the number of milliseconds to sleep
-     */
-    public void setSleepBetweenNodes(int millis) {
+    public void setSleepBetweenNodes(long millis) {
         this.sleepBetweenNodes = millis;
     }
 
+    public long getSleepBetweenNodes() {
+        return sleepBetweenNodes;
+    }
+
     /**
      * When testing the garbage collection, a delay is used instead of simulating concurrent access.
      *
@@ -146,29 +149,24 @@
     }
 
     /**
-     * Set the event listener. If set, the event listener will be called
-     * for each item that is scanned. This mechanism can be used
-     * to display the progress.
-     *
-     * @param callback if set, this is called while scanning
+     * @deprecated use setMarkEventListener().
      */
     public void setScanEventListener(ScanEventListener callback) {
+        setMarkEventListener(callback);
+    }
+
+    public void setMarkEventListener(MarkEventListener callback) {
         this.callback = callback;
     }
 
     /**
-     * Scan the repository. The garbage collector will iterate over all nodes in the repository
-     * and update the last modified date. If all persistence managers implement the
-     * IterablePersistenceManager interface, this mechanism will be used; if not, the garbage
-     * collector will scan the repository using the JCR API starting from the root node.
-     *
-     * @throws RepositoryException
-     * @throws IllegalStateException
-     * @throws IOException
-     * @throws ItemStateException
+     * @deprecated use mark().
      */
-    public void scan() throws RepositoryException,
-            IllegalStateException, IOException, ItemStateException {
+    public void scan() throws RepositoryException {
+        mark();
+    }
+
+    public void mark() throws RepositoryException {
         if (store == null) {
             throw new RepositoryException("No DataStore configured.");
         }
@@ -183,12 +181,15 @@
                 scanNodes(s);
             }
         } else {
-            scanPersistenceManagers();
+            try {
+                scanPersistenceManagers();
+            } catch (ItemStateException e) {
+                throw new RepositoryException(e);
+            }
         }
     }
 
-    private void scanNodes(Session session)
-        throws RepositoryException, IllegalStateException, IOException {
+    private void scanNodes(Session session) throws RepositoryException {
 
         // add a listener to get 'new' nodes
         // actually, new nodes are not the problem, but moved nodes
@@ -199,28 +200,22 @@
         recurse(session.getRootNode(), sleepBetweenNodes);
     }
 
-    /**
-     * Enable or disable using the IterablePersistenceManager interface
-     * to scan the items. This is important for clients that need
-     * the complete Node implementation in the ScanEventListener
-     * callback.
-     *
-     * @param allow true if using the IterablePersistenceManager interface is allowed
-     */
     public void setPersistenceManagerScan(boolean allow) {
         persistenceManagerScan = allow;
     }
 
+    public boolean isPersistenceManagerScan() {
+        return persistenceManagerScan;
+    }
+
     /**
-     * Check if using the IterablePersistenceManager interface is allowed.
-     *
-     * @return true if using IterablePersistenceManager is possible.
+     * @deprecated use isPersistenceManagerScan().
      */
     public boolean getPersistenceManagerScan() {
-        return persistenceManagerScan;
+        return isPersistenceManagerScan();
     }
 
-    private void scanPersistenceManagers() throws ItemStateException, RepositoryException {
+    private void scanPersistenceManagers() throws RepositoryException, ItemStateException {
         for (IterablePersistenceManager pm : pmList) {
             for (NodeId id : pm.getAllNodeIds(null, 0)) {
                 if (callback != null) {
@@ -244,50 +239,39 @@
                     // the node may have been deleted or moved in the meantime
                     // ignore it
                 }
-                if (callback != null) {
-                    callback.afterScanning(null);
-                }
             }
         }
     }
 
     /**
-     * The repository was scanned. This method will stop the observation
-     * listener.
+     * Stop the observation listener if any are installed.
      */
     public void stopScan() throws RepositoryException {
-        checkScanStarted();
-        for (Listener listener : listeners) {
-            try {
-                listener.stop();
-            } catch (Exception e) {
-                throw new RepositoryException(e);
+        if (listeners.size() > 0) {
+            for (Listener listener : listeners) {
+                try {
+                    listener.stop();
+                } catch (Exception e) {
+                    throw new RepositoryException(e);
+                }
             }
+            listeners.clear();
         }
-        listeners.clear();
     }
 
     /**
-     * Delete all unused items in the data store.
-     *
-     * @return the number of deleted items
+     * @deprecated use sweep().
      */
     public int deleteUnused() throws RepositoryException {
-        checkScanStarted();
-        checkScanStopped();
-        return store.deleteAllOlderThan(startScanTimestamp);
+        return sweep();
     }
 
-    private void checkScanStarted() throws RepositoryException {
+    public int sweep() throws RepositoryException {
         if (startScanTimestamp == 0) {
             throw new RepositoryException("scan must be called first");
         }
-    }
-
-    private void checkScanStopped() throws RepositoryException {
-        if (listeners.size() > 0) {
-            throw new RepositoryException("stopScan must be called first");
-        }
+        stopScan();
+        return store.deleteAllOlderThan(startScanTimestamp);
     }
 
     /**
@@ -299,8 +283,7 @@
         return store;
     }
 
-    private void recurse(final Node n, int sleep) throws RepositoryException,
-            IllegalStateException, IOException {
+    private void recurse(final Node n, long sleep) throws RepositoryException {
         if (sleep > 0) {
             try {
                 Thread.sleep(sleep);
@@ -334,9 +317,6 @@
         } catch (InvalidItemStateException e) {
             LOG.debug("Node removed concurrently - ignoring", e);
         }
-        if (callback != null) {
-            callback.afterScanning(n);
-        }
         try {
             for (NodeIterator it = n.getNodes(); it.hasNext();) {
                 recurse(it.nextNode(), sleep);
@@ -382,11 +362,13 @@
          */
     }
 
-    /**
-     * Cleanup resources used internally by this instance.
-     */
     public void close() {
         if (!closed.getAndSet(true)) {
+            try {
+                stopScan();
+            } catch (RepositoryException e) {
+                LOG.warn("An error occured when stopping the event listener", e);
+            }
             for (Session s : sessionList) {
                 s.logout();
             }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/ScanEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/ScanEventListener.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/ScanEventListener.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/ScanEventListener.java Wed Sep 16 14:33:23 2009
@@ -16,28 +16,11 @@
  */
 package org.apache.jackrabbit.core.data;
 
-import java.util.EventListener;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 
 /**
  * The listener interface for receiving garbage collection scan events.
  */
-public interface ScanEventListener extends EventListener {
-
-    /**
-     * This method is called before a node is scanned.
-     */
-    void beforeScanning(Node n) throws RepositoryException;
-
-    /**
-     * This method is called after a node is scanned.
-     */
-    void afterScanning(Node n) throws RepositoryException;
+public interface ScanEventListener extends MarkEventListener {
 
-    /**
-     * This method is called when the garbage collection scan is finished.
-     */
-    void done();
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java Wed Sep 16 14:33:23 2009
@@ -636,7 +636,7 @@
         } catch (IOException e) {
             String msg = "Configuration error: Could not read properties '" + databaseType + ".properties'";
             log.debug(msg);
-            throw new DataStoreException(msg);
+            throw new DataStoreException(msg, e);
         }
         if (driver == null) {
             driver = getProperty(prop, "driver", driver);

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.query;
 
+import java.util.concurrent.Executor;
+
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.state.ItemStateManager;
@@ -84,6 +86,11 @@
     private final NodeId excludedNodeId;
 
     /**
+     * Background task executor.
+     */
+    private final Executor executor;
+
+    /**
      * Creates a new context instance.
      *
      * @param fs               a {@link FileSystem} this <code>QueryHandler</code>
@@ -100,6 +107,7 @@
      * @param excludedNodeId   id of the node that should be excluded from
      *                         indexing. Any descendant of that node is also
      *                         excluded from indexing.
+     * @param executor         background task executor
      */
     public QueryHandlerContext(FileSystem fs,
                                SharedItemStateManager stateMgr,
@@ -108,7 +116,8 @@
                                NodeTypeRegistry ntRegistry,
                                NamespaceRegistryImpl nsRegistry,
                                QueryHandler parentHandler,
-                               NodeId excludedNodeId) {
+                               NodeId excludedNodeId,
+                               Executor executor) {
         this.fs = fs;
         this.stateMgr = stateMgr;
         this.hmgr = new CachingHierarchyManager(rootId, stateMgr);
@@ -120,6 +129,7 @@
         propRegistry = new PropertyTypeRegistry(ntRegistry);
         this.parentHandler = parentHandler;
         this.excludedNodeId = excludedNodeId;
+        this.executor =  executor;
         ntRegistry.addListener(propRegistry);
     }
 
@@ -219,4 +229,14 @@
     public void destroy() {
         ntRegistry.removeListener(propRegistry);
     }
+
+    /**
+     * Returns the background task executor.
+     *
+     * @return background task executor
+     */
+    public Executor getExecutor() {
+        return executor;
+    }
+
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java Wed Sep 16 14:33:23 2009
@@ -16,15 +16,22 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.concurrent.Executor;
+
+import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.document.AbstractField;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.LoggerFactory;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.Field.TermVector;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
 import org.slf4j.Logger;
-
-import java.io.Reader;
-import java.io.IOException;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.ContentHandler;
 
 /**
  * <code>LazyTextExtractorField</code> implements a Lucene field with a String
@@ -37,24 +44,16 @@
 public class LazyTextExtractorField extends AbstractField {
 
     /**
-     * The serial version UID.
-     */
-    private static final long serialVersionUID = -2707986404659820071L;
-
-    /**
      * The logger instance for this class.
      */
-    private static final Logger log = LoggerFactory.getLogger(LazyTextExtractorField.class);
+    private static final Logger log =
+        LoggerFactory.getLogger(LazyTextExtractorField.class);
 
     /**
-     * The reader from where to read the text extract.
+     * The extracted text content of the given binary value.
+     * Set to non-null when the text extraction task finishes.
      */
-    private final Reader reader;
-
-    /**
-     * The extract as obtained lazily from {@link #reader}.
-     */
-    private String extract;
+    private volatile String extract = null;
 
     /**
      * Creates a new <code>LazyTextExtractorField</code> with the given
@@ -62,84 +61,114 @@
      *
      * @param name the name of the field.
      * @param reader the reader where to obtain the string from.
-     * @param store when set <code>true</code> the string value is stored in the
-     *          index.
-     * @param withOffsets when set <code>true</code> a term vector with offsets
-     *          is written into the index.
-     */
-    public LazyTextExtractorField(String name,
-                                  Reader reader,
-                                  boolean store,
-                                  boolean withOffsets) {
-        super(name,
-                store ? Field.Store.YES : Field.Store.NO,
+     * @param highlighting set to <code>true</code> to
+     *                     enable result highlighting support
+     */
+    public LazyTextExtractorField(
+            Parser parser, InternalValue value, Metadata metadata,
+            Executor executor, boolean highlighting) {
+        super(FieldNames.FULLTEXT,
+                highlighting ? Store.YES : Store.NO,
                 Field.Index.ANALYZED,
-                withOffsets ? Field.TermVector.WITH_OFFSETS : Field.TermVector.NO);
-        this.reader = reader;
+                highlighting ? TermVector.WITH_OFFSETS : TermVector.NO);
+        executor.execute(new ParsingTask(parser, value, metadata));
     }
 
     /**
-     * @return the string value of this field.
+     * Returns the extracted text. This method blocks until the text
+     * extraction task has been completed.
+     *
+     * @return the string value of this field
      */
-    public String stringValue() {
-        if (extract == null) {
-            StringBuffer textExtract = new StringBuffer();
-            char[] buffer = new char[1024];
-            int len;
-            try {
-                while ((len = reader.read(buffer)) > -1) {
-                    textExtract.append(buffer, 0, len);
-                }
-            } catch (IOException e) {
-                log.warn("Exception reading value for field: "
-                        + e.getMessage());
-                log.debug("Dump:", e);
-            } finally {
-                IOUtils.closeQuietly(reader);
+    public synchronized String stringValue() {
+        try {
+            while (!isExtractorFinished()) {
+                wait();
             }
-            extract = textExtract.toString();
+            return extract;
+        } catch (InterruptedException e) {
+            log.error("Text extraction thread was interrupted", e);
+            return "";
         }
-        return extract;
     }
 
     /**
-     * @return always <code>null</code>.
+     * @return always <code>null</code>
      */
     public Reader readerValue() {
         return null;
     }
 
     /**
-     * @return always <code>null</code>.
+     * @return always <code>null</code>
      */
     public byte[] binaryValue() {
         return null;
     }
 
     /**
-     * @return always <code>null</code>.
+     * @return always <code>null</code>
      */
     public TokenStream tokenStreamValue() {
         return null;
     }
 
     /**
-     * @return <code>true</code> if the underlying reader is ready to provide
-     *          extracted text.
+     * Checks whether the text extraction task has finished.
+     *
+     * @return <code>true</code> if the extracted text is available
      */
     public boolean isExtractorFinished() {
-        if (reader instanceof TextExtractorReader) {
-            return ((TextExtractorReader) reader).isExtractorFinished();
-        }
-        return true;
+        return extract != null;
+    }
+
+    private synchronized void setExtractedText(String value) {
+        extract = value;
+        notify();
     }
 
     /**
-     * Disposes this field and closes the underlying reader.
-     *
-     * @throws IOException if an error occurs while closing the reader.
+     * Releases all resources associated with this field.
+     */
+    public void dispose() {
+        // TODO: Cause the ContentHandler below to throw an exception
+    }
+
+    /**
+     * The background task for extracting text from a binary value.
      */
-    public void dispose() throws IOException {
-        reader.close();
+    private class ParsingTask implements Runnable {
+
+        private final Parser parser;
+
+        private final InternalValue value;
+
+        private final Metadata metadata;
+
+        public ParsingTask(
+                Parser parser, InternalValue value, Metadata metadata) {
+            this.parser = parser;
+            this.value = value;
+            this.metadata = metadata;
+        }
+
+        public void run() {
+            ContentHandler handler = new BodyContentHandler();
+            try {
+                InputStream stream = value.getStream();
+                try {
+                    parser.parse(stream, handler, metadata);
+                } finally {
+                    stream.close();
+                }
+            } catch (Throwable t) {
+                log.warn("Failed to extract text from a binary property", t);
+            } finally {
+                value.discard();
+            }
+            setExtractedText(handler.toString());
+        }
+
     }
+
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Wed Sep 16 14:33:23 2009
@@ -16,39 +16,39 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.core.id.PropertyId;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Executor;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.extractor.TextExtractor;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.Calendar;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Date;
-import java.net.URI;
-import java.math.BigDecimal;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.Parser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Creates a lucene <code>Document</code> object from a {@link javax.jcr.Node}.
@@ -87,9 +87,15 @@
     protected final NamePathResolver resolver;
 
     /**
-     * Content extractor.
+     * Background task executor used for full text extraction.
      */
-    protected final TextExtractor extractor;
+    private final Executor executor;
+
+    /**
+     * Parser used for extracting text content from binary properties
+     * for full text indexing.
+     */
+    private final Parser parser;
 
     /**
      * The indexing configuration or <code>null</code> if none is available.
@@ -119,17 +125,18 @@
      * @param node          the node state to index.
      * @param stateProvider the persistent item state manager to retrieve properties.
      * @param mappings      internal namespace mappings.
-     * @param extractor     content extractor
+     * @param executor      background task executor for text extraction
+     * @param parser        parser for binary properties
      */
-    public NodeIndexer(NodeState node,
-                       ItemStateManager stateProvider,
-                       NamespaceMappings mappings,
-                       TextExtractor extractor) {
+    public NodeIndexer(
+            NodeState node, ItemStateManager stateProvider,
+            NamespaceMappings mappings, Executor executor, Parser parser) {
         this.node = node;
         this.stateProvider = stateProvider;
         this.mappings = mappings;
         this.resolver = NamePathResolverImpl.create(mappings);
-        this.extractor = extractor;
+        this.executor = executor;
+        this.parser = parser;
     }
 
     /**
@@ -413,20 +420,19 @@
                 return;
             }
 
-            InternalValue typeValue = getValue(NameConstants.JCR_MIMETYPE);
-            if (typeValue != null) {
-                String type = typeValue.getString();
+            InternalValue type = getValue(NameConstants.JCR_MIMETYPE);
+            if (type != null) {
+                Metadata metadata = new Metadata();
+                metadata.set(Metadata.CONTENT_TYPE, type.getString());
 
                 // jcr:encoding is not mandatory
-                String encoding = null;
-                InternalValue encodingValue = getValue(NameConstants.JCR_ENCODING);
-                if (encodingValue != null) {
-                    encoding = encodingValue.getString();
+                InternalValue encoding = getValue(NameConstants.JCR_ENCODING);
+                if (encoding != null) {
+                    metadata.set(
+                            Metadata.CONTENT_ENCODING, encoding.getString());
                 }
 
-                InputStream stream = internalValue.getStream();
-                Reader reader = extractor.extractText(stream, type, encoding);
-                doc.add(createFulltextField(reader));
+                doc.add(createFulltextField(internalValue, metadata));
             }
         } catch (Throwable t) {
             // TODO: How to recover from a transient indexing failure?
@@ -805,15 +811,14 @@
     /**
      * Creates a fulltext field for the reader <code>value</code>.
      *
-     * @param value the reader value.
+     * @param value the binary value
+     * @param metadata document metatadata
      * @return a lucene field.
      */
-    protected Fieldable createFulltextField(Reader value) {
-        if (supportHighlighting) {
-            return new LazyTextExtractorField(FieldNames.FULLTEXT, value, true, true);
-        } else {
-            return new LazyTextExtractorField(FieldNames.FULLTEXT, value, false, false);
-        }
+    protected Fieldable createFulltextField(
+            InternalValue value, Metadata metadata) {
+        return new LazyTextExtractorField(
+                parser, value, metadata, executor, supportHighlighting);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java Wed Sep 16 14:33:23 2009
@@ -16,73 +16,73 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.fs.local.LocalFileSystem;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.query.AbstractQueryHandler;
 import org.apache.jackrabbit.core.query.ExecutableQuery;
 import org.apache.jackrabbit.core.query.QueryHandler;
 import org.apache.jackrabbit.core.query.QueryHandlerContext;
 import org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager;
 import org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager;
-import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
+import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.extractor.DefaultTextExtractor;
-import org.apache.jackrabbit.extractor.TextExtractor;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi.commons.query.DefaultQueryNodeFactory;
-import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 import org.apache.jackrabbit.spi.commons.query.qom.OrderingImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.Token;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.MultiReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.search.HitCollector;
+import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Sort;
-import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortComparatorSource;
-import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.HitCollector;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Fieldable;
-import org.xml.sax.SAXException;
+import org.apache.tika.parser.Parser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.query.InvalidQueryException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.File;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collection;
+import org.xml.sax.SAXException;
 
 /**
  * Implements a {@link org.apache.jackrabbit.core.query.QueryHandler} using
@@ -207,20 +207,12 @@
     /**
      * The analyzer we use for indexing.
      */
-    private JackrabbitAnalyzer analyzer;
+    private final JackrabbitAnalyzer analyzer = new JackrabbitAnalyzer();
 
     /**
-     * List of text extractor and text filter class names. The configured
-     * classes will be instantiated and used to extract text content from
-     * binary properties.
+     * The parser for extracting text content from binary properties.
      */
-    private String textFilterClasses =
-        DefaultTextExtractor.class.getName();
-
-    /**
-     * Text extractor for extracting text content of binary properties.
-     */
-    private TextExtractor extractor;
+    private final JackrabbitParser parser = new JackrabbitParser();
 
     /**
      * The namespace mappings used internally.
@@ -476,13 +468,6 @@
     private boolean closed = false;
 
     /**
-     * Default constructor.
-     */
-    public SearchIndex() {
-        this.analyzer = new JackrabbitAnalyzer();
-    }
-
-    /**
      * Initializes this <code>QueryHandler</code>. This implementation requires
      * that a path parameter is set in the configuration. If this condition
      * is not met, a <code>IOException</code> is thrown.
@@ -500,7 +485,6 @@
             excludedIDs.add(context.getExcludedNodeId());
         }
 
-        extractor = createTextExtractor();
         synProvider = createSynonymProvider();
         directoryManager = createDirectoryManager();
         redoLogFactory = createRedoLogFactory();
@@ -792,10 +776,6 @@
                 log.warn("Exception while closing FileSystem", e);
             }
         }
-        // shutdown extractor
-        if (extractor instanceof PooledTextExtractor) {
-            ((PooledTextExtractor) extractor).shutdown();
-        }
         if (spellChecker != null) {
             spellChecker.close();
         }
@@ -910,12 +890,13 @@
     }
 
     /**
-     * Returns the text extractor in use for indexing.
+     * Returns the parser used for extracting text content
+     * from binary properties for full text indexing.
      *
-     * @return the text extractor in use for indexing.
+     * @return the configured parser
      */
-    public TextExtractor getTextExtractor() {
-        return extractor;
+    public Parser getParser() {
+        return parser;
     }
 
     /**
@@ -1114,8 +1095,9 @@
                                       NamespaceMappings nsMappings,
                                       IndexFormatVersion indexFormatVersion)
             throws RepositoryException {
-        NodeIndexer indexer = new NodeIndexer(node,
-                getContext().getItemStateManager(), nsMappings, extractor);
+        NodeIndexer indexer = new NodeIndexer(
+                node, getContext().getItemStateManager(), nsMappings,
+                getContext().getExecutor(), parser);
         indexer.setSupportHighlighting(supportHighlighting);
         indexer.setIndexingConfiguration(indexingConfig);
         indexer.setIndexFormatVersion(indexFormatVersion);
@@ -1141,21 +1123,6 @@
     }
 
     /**
-     * Factory method to create the <code>TextExtractor</code> instance.
-     *
-     * @return the <code>TextExtractor</code> instance this index should use.
-     */
-    protected TextExtractor createTextExtractor() {
-        TextExtractor txtExtr = new JackrabbitTextExtractor(textFilterClasses);
-        if (extractorPoolSize > 0) {
-            // wrap with pool
-            txtExtr = new PooledTextExtractor(txtExtr, extractorPoolSize,
-                    extractorBackLog, extractorTimeout);
-        }
-        return txtExtr;
-    }
-
-    /**
      * @param namespaceMappings The namespace mappings
      * @return the fulltext indexing configuration or <code>null</code> if there
      *         is no configuration.
@@ -1881,9 +1848,10 @@
      * constructor.
      *
      * @param filterClasses comma separated list of class names
+     * @deprecated 
      */
     public void setTextFilterClasses(String filterClasses) {
-        this.textFilterClasses = filterClasses;
+        parser.setTextFilterClasses(filterClasses);
     }
 
     /**
@@ -1891,9 +1859,10 @@
      * currently in use. The names are comma separated.
      *
      * @return class names of the text filters in use.
+     * @deprecated 
      */
     public String getTextFilterClasses() {
-        return textFilterClasses;
+        return "deprectated";
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCConcurrentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCConcurrentTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCConcurrentTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCConcurrentTest.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.data;
 
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
@@ -52,22 +54,19 @@
         final String testNodeName = "testConcurrentDelete";
         node(root, testNodeName);
         session.save();
-        GarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
+        DataStoreGarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
         gc.setPersistenceManagerScan(false);
-        gc.setScanEventListener(new ScanEventListener() {
+        gc.setMarkEventListener(new MarkEventListener() {
             public void beforeScanning(Node n) throws RepositoryException {
                 if (n.getName().equals(testNodeName)) {
                     n.remove();
                     n.getSession().save();
                 }
             }
-            public void afterScanning(Node n) throws RepositoryException {
-            }
-            public void done() {
-            }
+
         });
-        gc.scan();
-        gc.stopScan();
+        gc.mark();
+        gc.close();
     }
 
     public void testGC() throws Exception {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCEventListenerTest.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.data;
 
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.slf4j.Logger;
@@ -35,17 +37,17 @@
  *
  * @author Thomas Mueller
  */
-public class GCEventListenerTest extends AbstractJCRTest implements ScanEventListener {
+public class GCEventListenerTest extends AbstractJCRTest implements MarkEventListener {
 
     /** logger instance */
     private static final Logger LOG = LoggerFactory.getLogger(GCEventListenerTest.class);
 
+    private static final String TEST_NODE_NAME = "testGCEventListener";
+
     private boolean gotNullNode;
     private boolean gotNode;
     private int count;
 
-    private static final String TEST_NODE_NAME = "testGCEventListener";
-
     public void testEventListener() throws Exception {
         doTestEventListener(true);
         doTestEventListener(false);
@@ -74,16 +76,16 @@
         }
         session.save();
         SessionImpl si = (SessionImpl) session;
-        GarbageCollector gc = si.createDataStoreGarbageCollector();
-        if (gc.getDataStore() != null) {
-            gc.getDataStore().clearInUse();
-            boolean pmScan = gc.getPersistenceManagerScan();
+        DataStoreGarbageCollector gc = si.createDataStoreGarbageCollector();
+        DataStore ds = ((GarbageCollector) gc).getDataStore();
+        if (ds != null) {
+            ds.clearInUse();
+            boolean pmScan = gc.isPersistenceManagerScan();
             gc.setPersistenceManagerScan(allowPmScan);
             gotNullNode = false;
             gotNode = false;
-            gc.setScanEventListener(this);
-            gc.scan();
-            gc.stopScan();
+            gc.setMarkEventListener(this);
+            gc.mark();
             if (pmScan && allowPmScan) {
                 assertTrue("PM scan without null Node", gotNullNode);
                 assertFalse("PM scan, but got a real node", gotNode);
@@ -91,7 +93,7 @@
                 assertFalse("Not a PM scan - but got a null Node", gotNullNode);
                 assertTrue("Not a PM scan - without a real node", gotNode);
             }
-            int deleted = gc.deleteUnused();
+            int deleted = gc.sweep();
             LOG.debug("Deleted " + deleted);
             assertTrue("Should delete at least one item", deleted >= 0);
             gc.close();

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.data;
 
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,7 +31,7 @@
 /**
  * Helper class that runs data store garbage collection as a background thread.
  */
-public class GCThread implements Runnable, ScanEventListener {
+public class GCThread implements Runnable, MarkEventListener {
 
     /** logger instance */
     private static final Logger LOG = LoggerFactory.getLogger(GCThread.class);
@@ -45,15 +47,16 @@
     public void run() {
 
         try {
-            GarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
-            gc.setScanEventListener(this);
+            GarbageCollector gc = ((SessionImpl) session)
+                    .createDataStoreGarbageCollector();
+            gc.setMarkEventListener(this);
             while (!stop) {
                 LOG.debug("Scanning...");
-                gc.scan();
+                gc.mark();
                 int count = listIdentifiers(gc);
                 LOG.debug("Stop; currently " + count + " identifiers");
                 gc.stopScan();
-                int numDeleted = gc.deleteUnused();
+                int numDeleted = gc.sweep();
                 if (numDeleted > 0) {
                     LOG.debug("Deleted " + numDeleted + " identifiers");
                 }
@@ -75,8 +78,9 @@
         return exception;
     }
 
-    private int listIdentifiers(GarbageCollector gc) throws DataStoreException {
-        Iterator<DataIdentifier> it = gc.getDataStore().getAllIdentifiers();
+    private int listIdentifiers(DataStoreGarbageCollector gc) throws DataStoreException {
+        DataStore ds = ((GarbageCollector) gc).getDataStore();
+        Iterator<DataIdentifier> it = ds.getAllIdentifiers();
         int count = 0;
         while (it.hasNext()) {
             DataIdentifier id = it.next();

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java Wed Sep 16 14:33:23 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.data;
 
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
@@ -48,22 +50,15 @@
             LOG.info("testConcurrentClose skipped. Data store is not used.");
             return;
         }
-        final GarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
+        final DataStoreGarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
         final Exception[] ex = new Exception[1];
-        gc.setScanEventListener(new ScanEventListener() {
+        gc.setMarkEventListener(new MarkEventListener() {
             boolean closed;
 
-            public void afterScanning(Node n) throws RepositoryException {
-                closeTest();
-            }
-
             public void beforeScanning(Node n) throws RepositoryException {
                 closeTest();
             }
 
-            public void done() {
-            }
-
             private void closeTest() throws RepositoryException {
                 if (closed) {
                     ex[0] = new Exception("Scanning after the session is closed");
@@ -74,7 +69,7 @@
 
         });
         try {
-            gc.scan();
+            gc.mark();
             fail("Exception 'session has been closed' expected");
         } catch (RepositoryException e) {
             LOG.debug("Expected exception caught: " + e.getMessage());
@@ -127,10 +122,9 @@
             }
         }.start();
         assertEquals("x", sync.take());
-        GarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
-        gc.scan();
-        gc.stopScan();
-        gc.deleteUnused();
+        DataStoreGarbageCollector gc = ((SessionImpl) session).createDataStoreGarbageCollector();
+        gc.mark();
+        gc.sweep();
         sync.put("deleted");
         assertEquals("saved", sync.take());
         InputStream in = node.getProperty("slowBlob").getBinary().getStream();
@@ -176,13 +170,13 @@
         }
 
         LOG.debug("scanning...");
-        gc.scan();
+        gc.mark();
         int count = listIdentifiers(gc);
         LOG.debug("stop scanning; currently " + count + " identifiers");
         gc.stopScan();
         LOG.debug("deleting...");
         gc.getDataStore().clearInUse();
-        assertTrue(gc.deleteUnused() > 0);
+        assertTrue(gc.sweep() > 0);
         int count2 = listIdentifiers(gc);
         assertEquals(count - 1, count2);
 
@@ -193,17 +187,17 @@
 
     private void runGC(Session session, boolean all) throws Exception {
         GarbageCollector gc = ((SessionImpl)session).createDataStoreGarbageCollector();
-        gc.setScanEventListener(this);
+        gc.setMarkEventListener(this);
         if (gc.getDataStore() instanceof FileDataStore) {
             // make sure the file is old (access time resolution is 2 seconds)
             Thread.sleep(2000);
         }
-        gc.scan();
+        gc.mark();
         gc.stopScan();
         if (all) {
             gc.getDataStore().clearInUse();
         }
-        gc.deleteUnused();
+        gc.sweep();
         gc.close();
     }
 

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextQueryTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextQueryTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextQueryTest.java Wed Sep 16 14:33:23 2009
@@ -16,11 +16,18 @@
  */
 package org.apache.jackrabbit.core.query;
 
+import java.io.IOException;
+import java.io.InputStream;
+
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
 import javax.jcr.query.QueryResult;
 
+import org.apache.commons.io.IOUtils;
+
 /**
  * Performs tests with the <code>CONTAINS</code> function.
  */
@@ -276,6 +283,39 @@
         testRootNode.addNode(nodeName1).setProperty("text", content);
         testRootNode.save();
 
+        assertContainsQuery(statement, match);
+    }
+
+    public void testFileContains() throws Exception {
+        assertFileContains(
+                "test.txt", "text/plain", "AE502DBEA2C411DEBD340AD156D89593");
+        assertFileContains(
+                "test.rtf", "text/rtf", "quick brown fox");
+    }
+
+    private void assertFileContains(
+            String name, String type, String... statements) throws Exception {
+        while (testRootNode.hasNode(nodeName1)) {
+            testRootNode.getNode(nodeName1).remove();
+        }
+        Node resource = testRootNode.addNode(nodeName1, NodeType.NT_RESOURCE);
+        resource.setProperty("jcr:mimeType", type);
+        InputStream stream = FulltextQueryTest.class.getResourceAsStream(name);
+        try {
+            resource.setProperty("jcr:data", stream);
+        } finally {
+            stream.close();
+        }
+        testRootNode.save();
+        getSearchIndex().flush();
+
+        for (String statement : statements) {
+            assertContainsQuery(statement, true);
+        }
+    }
+
+    private void assertContainsQuery(String statement, boolean match)
+            throws InvalidQueryException, RepositoryException {
         StringBuffer stmt = new StringBuffer();
         stmt.append("/jcr:root").append(testRoot).append("/*");
         stmt.append("[jcr:contains(., '").append(statement);
@@ -292,4 +332,5 @@
         q = superuser.getWorkspace().getQueryManager().createQuery(stmt.toString(), Query.SQL);
         checkResult(q.execute(), match ? 1 : 0);
     }
+
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java Wed Sep 16 14:33:23 2009
@@ -16,24 +16,22 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.extractor.TextExtractor;
-import org.apache.jackrabbit.core.query.AbstractIndexingTest;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.TestHelper;
-import org.apache.jackrabbit.core.fs.local.FileUtil;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Calendar;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.query.Query;
-import java.io.Reader;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.Calendar;
+
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.TestHelper;
+import org.apache.jackrabbit.core.fs.local.FileUtil;
+import org.apache.jackrabbit.core.query.AbstractIndexingTest;
 
 /**
  * <code>IndexingQueueTest</code> checks if the indexing queue properly indexes
@@ -44,15 +42,15 @@
 
     private static final File TEMP_DIR = new File(System.getProperty("java.io.tmpdir")); 
 
-    private static final String CONTENT_TYPE = "application/indexing-queue-test";
+    private static final String CONTENT_TYPE = "text/plain";
 
     private static final String ENCODING = "UTF-8";
 
     public void testQueue() throws Exception {
-        Extractor.sleepTime = 200;
         SearchIndex index = getSearchIndex();
         IndexingQueue queue = index.getIndex().getIndexingQueue();
 
+        JackrabbitParser.block();
         assertEquals(0, queue.getNumPendingDocuments());
 
         String text = "the quick brown fox jumps over the lazy dog.";
@@ -70,6 +68,7 @@
         NodeIterator nodes = q.execute().getNodes();
         assertFalse(nodes.hasNext());
 
+        JackrabbitParser.unblock();
         index.flush();
         assertEquals(0, queue.getNumPendingDocuments());
 
@@ -79,7 +78,7 @@
     }
 
     public void testInitialIndex() throws Exception {
-        Extractor.sleepTime = 200;
+        JackrabbitParser.block();
         File indexDir = new File(getSearchIndex().getPath());
 
         // fill workspace
@@ -105,7 +104,7 @@
 
         int initialNumExtractorFiles = getNumExtractorFiles();
 
-        Extractor.sleepTime = 20;
+        JackrabbitParser.unblock();
         Thread t = new Thread(new Runnable() {
             public void run() {
                 try {
@@ -140,7 +139,7 @@
      * Test case for JCR-2082
      */
     public void testReaderUpToDate() throws Exception {
-        Extractor.sleepTime = 10;
+        JackrabbitParser.block();
         SearchIndex index = getSearchIndex();
         File indexDir = new File(index.getPath());
 
@@ -159,6 +158,7 @@
             fail("Unable to delete index directory");
         }
 
+        JackrabbitParser.unblock();
         // start workspace again by getting a session
         session = getHelper().getSuperuserSession(WORKSPACE_NAME);
 
@@ -202,22 +202,4 @@
         }).length;
     }
 
-    public static final class Extractor implements TextExtractor {
-
-        protected static volatile int sleepTime = 200;
-
-        public String[] getContentTypes() {
-            return new String[]{CONTENT_TYPE};
-        }
-
-        public Reader extractText(InputStream stream, String type, String encoding)
-        throws IOException {
-            try {
-                Thread.sleep(sleepTime);
-            } catch (InterruptedException e) {
-                throw new IOException();
-            }
-            return new InputStreamReader(stream, encoding);
-        }
-    }
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/pom.xml?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/pom.xml (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/pom.xml Wed Sep 16 14:33:23 2009
@@ -51,7 +51,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <skip>true</skip>
+                    <skip>false</skip>
                     <includes>
                         <include>**/*Test.java</include>
                     </includes>
@@ -103,5 +103,10 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java Wed Sep 16 14:33:23 2009
@@ -16,15 +16,16 @@
  */
 package org.apache.jackrabbit.client;
 
-import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
-import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.Map;
 
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.RepositoryFactory;
-import java.util.Map;
+
+import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
+import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>RepositoryFactoryImpl</code>...
@@ -66,7 +67,7 @@
     public Repository getRepository(Map parameters) throws RepositoryException {
         RepositoryConfig config = null;
         if (parameters == null) {
-            config = org.apache.jackrabbit.client.spi2dav.RepositoryConfigImpl.create((Map) null);
+            config = org.apache.jackrabbit.client.spi2davex.RepositoryConfigImpl.create((Map) null);
         } else {
             Object param = parameters.get(REPOSITORY_CONFIG);
             if (param != null && param instanceof RepositoryConfig) {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java Wed Sep 16 14:33:23 2009
@@ -16,64 +16,66 @@
  */
 package org.apache.jackrabbit.client;
 
-import junit.framework.TestCase;
-import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
-import org.apache.jackrabbit.spi.RepositoryService;
-import org.apache.jackrabbit.spi.IdFactory;
-import org.apache.jackrabbit.spi.NameFactory;
-import org.apache.jackrabbit.spi.PathFactory;
-import org.apache.jackrabbit.spi.QValueFactory;
-import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.spi.ItemId;
-import org.apache.jackrabbit.spi.QNodeDefinition;
-import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.spi.QPropertyDefinition;
-import org.apache.jackrabbit.spi.PropertyId;
-import org.apache.jackrabbit.spi.NodeInfo;
-import org.apache.jackrabbit.spi.PropertyInfo;
-import org.apache.jackrabbit.spi.Batch;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.LockInfo;
-import org.apache.jackrabbit.spi.QueryInfo;
-import org.apache.jackrabbit.spi.EventFilter;
-import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.spi.Subscription;
-import org.apache.jackrabbit.spi.EventBundle;
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.QNodeTypeDefinition;
-import org.apache.jackrabbit.spi.commons.logging.Slf4jLogWriterProvider;
-import org.apache.jackrabbit.client.spilogger.RepositoryConfigImpl;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Repository;
+import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.LoginException;
+import javax.jcr.MergeException;
+import javax.jcr.NamespaceException;
 import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.ItemNotFoundException;
 import javax.jcr.PathNotFoundException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.AccessDeniedException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.InvalidItemStateException;
 import javax.jcr.ReferentialIntegrityException;
-import javax.jcr.MergeException;
-import javax.jcr.NamespaceException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.jcr.RepositoryFactory;
-import javax.jcr.query.InvalidQueryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.ValueFormatException;
 import javax.jcr.lock.LockException;
-import javax.jcr.version.VersionException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.InvalidNodeTypeDefinitionException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeTypeExistsException;
-import java.util.Map;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.InputStream;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.version.VersionException;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.client.spilogger.RepositoryConfigImpl;
+import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
+import org.apache.jackrabbit.spi.Batch;
+import org.apache.jackrabbit.spi.EventBundle;
+import org.apache.jackrabbit.spi.EventFilter;
+import org.apache.jackrabbit.spi.IdFactory;
+import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.LockInfo;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.NodeInfo;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.PathFactory;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.PropertyInfo;
+import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QValueFactory;
+import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.Subscription;
+import org.apache.jackrabbit.spi.commons.logging.Slf4jLogWriterProvider;
 
 /**
  * <code>RepositoryFactoryImplTest</code>...
@@ -132,7 +134,7 @@
             params.put(RepositoryConfigImpl.PARAM_LOG_WRITER_PROVIDER, lwprovider.get(i));
             Repository repo = factory.getRepository(params);
             assertNotNull(repo);
-        }        
+        }
     }
 
     public void testGetRepositoryUnknownParams() throws RepositoryException {
@@ -163,7 +165,7 @@
         }
 
         public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
-            return null;
+            return Collections.emptyMap();
         }
 
         public SessionInfo obtain(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-parent/pom.xml?rev=815805&r1=815804&r2=815805&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-parent/pom.xml (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-parent/pom.xml Wed Sep 16 14:33:23 2009
@@ -30,7 +30,7 @@
   <parent>
     <groupId>org.apache.jackrabbit</groupId>
     <artifactId>parent</artifactId>
-    <version>3</version>
+    <version>4</version>
   </parent>
 
   <artifactId>jackrabbit-parent</artifactId>
@@ -73,7 +73,6 @@
       <plugin>
         <!-- http://maven.apache.org/plugins/maven-idea-plugin/ -->
         <artifactId>maven-idea-plugin</artifactId>
-        <version>2.2</version>
         <configuration>
           <downloadSources>true</downloadSources>
           <jdkLevel>1.5</jdkLevel>



Mime
View raw message