Author: frm Date: Fri Feb 2 10:28:35 2018 New Revision: 1822935 URL: http://svn.apache.org/viewvc?rev=1822935&view=rev Log: OAK-7235 - Remove SegmentTarUtils
SegmentTarUtils was used to maintain compatibility in tooling with the functionalities provided by oak-segment. Since oak-segment is not in the source tree anymore, it is now safe to delete this class and inline its few remaining usages. Removed: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/BackupCommand.java jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/FileStoreDiffCommand.java jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/ResetClusterIdCommand.java jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RestoreCommand.java jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Utils.java Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/BackupCommand.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/BackupCommand.java?rev=1822935&r1=1822934&r2=1822935&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/BackupCommand.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/BackupCommand.java Fri Feb 2 10:28:35 2018 @@ -22,6 +22,7 @@ import java.io.File; import joptsimple.OptionParser; import joptsimple.OptionSet; import org.apache.jackrabbit.oak.run.commons.Command; +import org.apache.jackrabbit.oak.segment.tool.Backup; class BackupCommand implements Command { @@ -38,7 +39,11 @@ class BackupCommand implements Command { File source = new File(options.nonOptionArguments().get(0).toString()); File target = new File(options.nonOptionArguments().get(1).toString()); - SegmentTarUtils.backup(source, target); + Backup.builder() + .withSource(source) + .withTarget(target) + .build() + .run(); } } \ No newline at end of file Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/FileStoreDiffCommand.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/FileStoreDiffCommand.java?rev=1822935&r1=1822934&r2=1822935&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/FileStoreDiffCommand.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/FileStoreDiffCommand.java Fri Feb 2 10:28:35 2018 @@ -25,6 +25,8 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.OptionSpec; import org.apache.jackrabbit.oak.run.commons.Command; +import org.apache.jackrabbit.oak.segment.tool.Diff; +import org.apache.jackrabbit.oak.segment.tool.Revisions; class FileStoreDiffCommand implements Command { @@ -61,7 +63,23 @@ class FileStoreDiffCommand implements Co String path = pathO.value(options); boolean ignoreSNFEs = options.has(ignoreSNFEsO); - SegmentTarUtils.diff(store, out, listOnly, interval, incremental, path, ignoreSNFEs); + if (listOnly) { + Revisions.builder() + .withPath(store) + .withOutput(out) + .build() + .run(); + } else { + Diff.builder() + .withPath(store) + .withOutput(out) + .withInterval(interval) + .withIncremental(incremental) + .withFilter(path) + .withIgnoreMissingSegments(ignoreSNFEs) + .build() + .run(); + } } private File defaultOutFile() { Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/ResetClusterIdCommand.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/ResetClusterIdCommand.java?rev=1822935&r1=1822934&r2=1822935&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/ResetClusterIdCommand.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/ResetClusterIdCommand.java Fri Feb 2 10:28:35 2018 @@ -20,6 +20,8 @@ import org.apache.jackrabbit.oak.api.Com import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.run.commons.Command; import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore; +import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders; +import org.apache.jackrabbit.oak.segment.file.FileStore; import org.apache.jackrabbit.oak.spi.cluster.ClusterRepositoryInfo; import org.apache.jackrabbit.oak.spi.commit.CommitInfo; import org.apache.jackrabbit.oak.spi.commit.EmptyHook; @@ -35,6 +37,9 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; import static org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentNodeStoreBuilder.newMongoDocumentNodeStoreBuilder; +import static org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder; + +import java.io.File; /** * OFFLINE utility to delete the clusterId stored as hidden @@ -104,7 +109,11 @@ class ResetClusterIdCommand implements C closer.register(Utils.asCloseable(dns)); store = dns; } else { - store = SegmentTarUtils.bootstrapNodeStore(source, closer); + FileStore fileStore = fileStoreBuilder(new File(source)) + .withStrictVersionCheck(true) + .build(); + closer.register(fileStore); + store = SegmentNodeStoreBuilders.builder(fileStore).build(); } deleteClusterId(store); Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RestoreCommand.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RestoreCommand.java?rev=1822935&r1=1822934&r2=1822935&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RestoreCommand.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RestoreCommand.java Fri Feb 2 10:28:35 2018 @@ -22,6 +22,7 @@ import java.io.File; import joptsimple.OptionParser; import joptsimple.OptionSet; import org.apache.jackrabbit.oak.run.commons.Command; +import org.apache.jackrabbit.oak.segment.tool.Restore; class RestoreCommand implements Command { @@ -38,7 +39,11 @@ class RestoreCommand implements Command File target = new File(options.nonOptionArguments().get(0).toString()); File source = new File(options.nonOptionArguments().get(1).toString()); - SegmentTarUtils.restore(source, target); + Restore.builder() + .withSource(source) + .withTarget(target) + .build() + .run(); } } \ No newline at end of file Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Utils.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Utils.java?rev=1822935&r1=1822934&r2=1822935&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Utils.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Utils.java Fri Feb 2 10:28:35 2018 @@ -21,6 +21,7 @@ import static java.util.Arrays.asList; import static org.apache.jackrabbit.oak.commons.PropertiesUtil.populate; import static org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentNodeStoreBuilder.newMongoDocumentNodeStoreBuilder; import static org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentNodeStoreBuilder.newRDBDocumentNodeStoreBuilder; +import static org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder; import java.io.Closeable; import java.io.File; @@ -53,6 +54,9 @@ import org.apache.jackrabbit.oak.plugins import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory; import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection; import org.apache.jackrabbit.oak.run.cli.DummyDataStore; +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.spi.blob.GarbageCollectableBlobStore; import org.apache.jackrabbit.oak.spi.state.NodeStore; @@ -149,11 +153,11 @@ class Utils { } } - public static NodeStore bootstrapNodeStore(String[] args, Closer closer, String h) throws IOException { + public static NodeStore bootstrapNodeStore(String[] args, Closer closer, String h) throws IOException, InvalidFileStoreVersionException { return bootstrapNodeStore(new NodeStoreOptions(h).parse(args), closer); } - public static NodeStore bootstrapNodeStore(NodeStoreOptions options, Closer closer) throws IOException { + public static NodeStore bootstrapNodeStore(NodeStoreOptions options, Closer closer) throws IOException, InvalidFileStoreVersionException { String src = options.getStoreArg(); if (src == null || src.length() == 0) { options.printHelpOn(System.err); @@ -169,7 +173,11 @@ class Utils { } } - return SegmentTarUtils.bootstrapNodeStore(src, closer); + FileStore fileStore = fileStoreBuilder(new File(src)) + .withStrictVersionCheck(true) + .build(); + closer.register(fileStore); + return SegmentNodeStoreBuilders.builder(fileStore).build(); } @CheckForNull