jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1368222 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Wed, 01 Aug 2012 19:52:24 GMT
Author: jukka
Date: Wed Aug  1 19:52:23 2012
New Revision: 1368222

URL: http://svn.apache.org/viewvc?rev=1368222&view=rev
Log:
OAK-154: Full text search index

Add temporary workarounds to fix build problems introduced by the Lucene index

Modified:
    jackrabbit/oak/trunk/oak-core/pom.xml
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/pom.xml?rev=1368222&r1=1368221&r2=1368222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-core/pom.xml Wed Aug  1 19:52:23 2012
@@ -51,11 +51,18 @@
               org.apache.jackrabbit.oak.spi.security.principal,
               org.apache.jackrabbit.oak.spi.security.privilege,
               org.apache.jackrabbit.oak.spi.security.user,
+              org.apache.jackrabbit.oak.security.principal,
               org.apache.jackrabbit.oak.security.privilege
             </Export-Package>
             <Bundle-Activator>
               org.apache.jackrabbit.oak.osgi.Activator
             </Bundle-Activator>
+            <!-- FIXME: Shouldn't need to inline Lucene (OAK-154) -->
+            <Embed-Dependency>
+              lucene-core;inline=true,
+              lucene-analyzers-common;inline=true,
+              tika-core;inline=true
+            </Embed-Dependency>
           </instructions>
         </configuration>
       </plugin>
@@ -160,23 +167,24 @@
     </dependency>
 
     <!-- Optional Lucene dependency -->
+    <!-- FIXME: make these optional again (OAK-154) -->
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-core</artifactId>
       <version>4.0.0-ALPHA</version>
-      <optional>true</optional>
+      <scope>provided</scope>
     </dependency>
     <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-analyzers-common</artifactId>
-        <version>4.0.0-ALPHA</version>
-        <optional>true</optional>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-analyzers-common</artifactId>
+      <version>4.0.0-ALPHA</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.tika</groupId>
-      <artifactId>tika-parsers</artifactId>
-      <version>1.1</version>
-      <optional>true</optional>
+      <artifactId>tika-core</artifactId>
+      <version>1.2</version>
+      <scope>provided</scope>
     </dependency>
 
     <!-- Logging -->

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java?rev=1368222&r1=1368221&r2=1368222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
Wed Aug  1 19:52:23 2012
@@ -53,8 +53,19 @@ public class LuceneEditor implements Com
 
     private static final Analyzer ANALYZER = new StandardAnalyzer(VERSION);
 
-    private static final IndexWriterConfig config = new IndexWriterConfig(VERSION,
-            ANALYZER);
+    private static final IndexWriterConfig config = getIndexWriterConfig();
+
+    private static IndexWriterConfig getIndexWriterConfig() {
+        // FIXME: Hack needed to make Lucene work in an OSGi environment
+        Thread thread = Thread.currentThread();
+        ClassLoader loader = thread.getContextClassLoader();
+        thread.setContextClassLoader(IndexWriterConfig.class.getClassLoader());
+        try {
+            return new IndexWriterConfig(VERSION, ANALYZER);
+        } finally {
+            thread.setContextClassLoader(loader);
+        }
+    }
 
     private final String[] path;
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1368222&r1=1368221&r2=1368222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Wed Aug  1 19:52:23 2012
@@ -218,13 +218,14 @@ public class RepositoryTest extends Abst
         root.getNode("bar").remove();  // transiently removed and...
         root.addNode("bar");           // ... added again
         NodeIterator nodes = root.getNodes();
-        int expected = 3 + (root.hasNode("jcr:system") ? 1 : 0);
+        // TODO: use a test subtree to avoid excluding default content
+        int expected = 3 + (root.hasNode("jcr:system") ? 1 : 0)  + (root.hasNode("oak-index")
? 1 : 0);
         assertEquals(expected, nodes.getSize());
         while (nodes.hasNext()) {
-        		String name = nodes.nextNode().getName();
-        		if (!name.equals("jcr:system")) {
-        			assertTrue(nodeNames.remove(name));
-        		}
+            String name = nodes.nextNode().getName();
+            if (!name.equals("jcr:system") && !name.equals("oak-index")) {
+                assertTrue(nodeNames.remove(name));
+            }
         }
 
         assertTrue(nodeNames.isEmpty());



Mime
View raw message