You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by fr...@apache.org on 2016/05/19 14:15:23 UTC
svn commit: r1744588 - in
/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console:
Console.java NodeStoreFixture.java SegmentTarFixture.java
Author: frm
Date: Thu May 19 14:15:23 2016
New Revision: 1744588
URL: http://svn.apache.org/viewvc?rev=1744588&view=rev
Log:
OAK-4329 - Add a flag to choose between segment store implementations in the "console" command
Added:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java (with props)
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java (with props)
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java?rev=1744588&r1=1744587&r2=1744588&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java Thu May 19 14:15:23 2016
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.oak.console;
-import java.io.Closeable;
+import static java.util.Arrays.asList;
+
import java.io.File;
import java.io.IOException;
import java.util.Collections;
@@ -26,11 +27,9 @@ import javax.sql.DataSource;
import com.mongodb.MongoClientURI;
import com.mongodb.MongoURI;
-
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
-
import org.apache.jackrabbit.core.data.FileDataStore;
import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
@@ -44,8 +43,6 @@ import org.apache.jackrabbit.oak.spi.blo
import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.codehaus.groovy.tools.shell.IO;
-import static java.util.Arrays.asList;
-
/**
* A command line console.
*/
@@ -59,6 +56,7 @@ public class Console {
OptionSpec shell = parser.accepts("shell", "run the shell after executing files");
OptionSpec readWrite = parser.accepts("read-write", "connect to repository in read-write mode");
OptionSpec<String> fdsPathSpec = parser.accepts("fds-path", "Path to FDS store").withOptionalArg().defaultsTo("");
+ OptionSpec segmentTar = parser.accepts("segment-tar", "Use the new segment store implementation");
OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp();
// RDB specific options
@@ -125,6 +123,8 @@ public class Console {
}
DocumentNodeStore store = builder.getNodeStore();
fixture = new MongoFixture(store);
+ } else if (options.has(segmentTar)) {
+ fixture = SegmentTarFixture.create(new File(nonOptions.get(0)), readOnly, blobStore);
} else {
FileStore.Builder fsBuilder = FileStore.builder(new File(nonOptions.get(0))).withMaxFileSize(256);
if (blobStore != null) {
@@ -166,10 +166,6 @@ public class Console {
System.exit(code);
}
- private static interface NodeStoreFixture extends Closeable{
- NodeStore getStore();
- }
-
private static class MongoFixture implements NodeStoreFixture {
private final DocumentNodeStore nodeStore;
Added: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java?rev=1744588&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java (added)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java Thu May 19 14:15:23 2016
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.console;
+
+import java.io.Closeable;
+
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
+interface NodeStoreFixture extends Closeable {
+
+ NodeStore getStore();
+
+}
Propchange: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/NodeStoreFixture.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java?rev=1744588&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java (added)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java Thu May 19 14:15:23 2016
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.console;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jackrabbit.oak.segment.SegmentNodeStore;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+
+class SegmentTarFixture implements NodeStoreFixture {
+
+ static NodeStoreFixture create(File path, boolean readOnly, BlobStore blobStore) throws IOException {
+ FileStore.Builder builder = FileStore.builder(path).withMaxFileSize(256);
+
+ if (blobStore != null) {
+ builder.withBlobStore(blobStore);
+ }
+
+ FileStore store;
+
+ if (readOnly) {
+ store = builder.buildReadOnly();
+ } else {
+ store = builder.build();
+ }
+
+ return new SegmentTarFixture(store);
+ }
+
+ private final FileStore fileStore;
+
+ private final SegmentNodeStore segmentNodeStore;
+
+ private SegmentTarFixture(FileStore fileStore) {
+ this.fileStore = fileStore;
+ this.segmentNodeStore = SegmentNodeStore.builder(fileStore).build();
+ }
+
+ @Override
+ public NodeStore getStore() {
+ return segmentNodeStore;
+ }
+
+ @Override
+ public void close() throws IOException {
+ fileStore.close();
+ }
+
+}
Propchange: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/console/SegmentTarFixture.java
------------------------------------------------------------------------------
svn:eol-style = native