Author: chetanm
Date: Mon Jun 19 08:48:18 2017
New Revision: 1799155

URL: http://svn.apache.org/viewvc?rev=1799155&view=rev
Log:
OAK-6361 - Oak run tika command should connect to NodeStore in read only mode

Modified:
    
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/SegmentTarUtils.java
    
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/TextExtractorMain.java

Modified: 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/SegmentTarUtils.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/SegmentTarUtils.java?rev=1799155&r1=1799154&r2=1799155&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/SegmentTarUtils.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/SegmentTarUtils.java
 Mon Jun 19 08:48:18 2017
@@ -24,8 +24,8 @@ import java.io.IOException;
 
 import com.google.common.io.Closer;
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
-import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
+import org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
@@ -43,12 +43,12 @@ class SegmentTarUtils {
         }
     }
 
-    private static FileStore fileStore(String path, BlobStore store, Closer 
closer) throws IOException, InvalidFileStoreVersionException {
+    private static ReadOnlyFileStore fileStore(String path, BlobStore store, 
Closer closer) throws IOException, InvalidFileStoreVersionException {
         return closer.register(fileStore(path, store));
     }
 
-    private static FileStore fileStore(String path, BlobStore store) throws 
IOException, InvalidFileStoreVersionException {
-        return fileStoreBuilder(new File(path)).withBlobStore(store).build();
+    private static ReadOnlyFileStore fileStore(String path, BlobStore store) 
throws IOException, InvalidFileStoreVersionException {
+        return fileStoreBuilder(new 
File(path)).withBlobStore(store).buildReadOnly();
     }
 
 }

Modified: 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/TextExtractorMain.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/TextExtractorMain.java?rev=1799155&r1=1799154&r2=1799155&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/TextExtractorMain.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/tika/TextExtractorMain.java
 Mon Jun 19 08:48:18 2017
@@ -299,7 +299,9 @@ public class TextExtractorMain {
             closer.register(asCloseable(mongo));
             DocumentNodeStore store = new DocumentMK.Builder()
                     .setBlobStore(blobStore)
-                    .setMongoDB(mongo.getDB()).getNodeStore();
+                    .setMongoDB(mongo.getDB())
+                    .setReadOnlyMode()
+                    .getNodeStore();
             closer.register(asCloseable(store));
             return store;
         }


Reply via email to