Search in sources :

Example 6 with NodeStoreFixture

use of org.apache.jackrabbit.oak.run.cli.NodeStoreFixture in project jackrabbit-oak by apache.

the class IndexCommand method performReindexInReadOnlyMode.

private File performReindexInReadOnlyMode(IndexOptions indexOpts, String checkpoint) throws Exception {
    try (Closer closer = Closer.create()) {
        configureCustomizer(opts, closer, true);
        NodeStoreFixture fixture = NodeStoreFixtureProvider.create(opts, true);
        closer.register(fixture);
        IndexHelper indexHelper = createIndexHelper(fixture, indexOpts, closer);
        reindex(indexOpts, indexHelper, checkpoint);
        return new File(indexOpts.getOutDir(), OutOfBandIndexer.LOCAL_INDEX_ROOT_DIR);
    }
}
Also used : Closer(com.google.common.io.Closer) NodeStoreFixture(org.apache.jackrabbit.oak.run.cli.NodeStoreFixture) File(java.io.File)

Example 7 with NodeStoreFixture

use of org.apache.jackrabbit.oak.run.cli.NodeStoreFixture in project jackrabbit-oak by apache.

the class NodeStateExportCommand method execute.

@Override
public void execute(String... args) throws Exception {
    Stopwatch w = Stopwatch.createStarted();
    OptionParser parser = new OptionParser();
    Options opts = new Options();
    opts.setCommandName(NAME);
    opts.setSummary(summary);
    opts.registerOptionsFactory(ExportOptions.FACTORY);
    opts.setConnectionString(CommonOptions.DEFAULT_CONNECTION_STRING);
    opts.parseAndConfigure(parser, args);
    ExportOptions eo = opts.getOptionBean(ExportOptions.class);
    try (NodeStoreFixture fixture = NodeStoreFixtureProvider.create(opts)) {
        NodeStateSerializer serializer = new NodeStateSerializer(fixture.getStore().getRoot());
        serializer.setDepth(eo.getDepth());
        serializer.setPath(eo.getPath());
        serializer.setFilter(eo.getFilter());
        serializer.setFilterFile(eo.getFilterFile());
        serializer.setFormat(eo.getFormat());
        serializer.setMaxChildNodes(eo.getMaxChildNodes());
        serializer.setPrettyPrint(eo.isPrettyPrint());
        serializer.setSerializeBlobContent(eo.includeBlobs());
        File dir = eo.getOutDir();
        serializer.serialize(dir);
        System.out.printf("Export the nodes under path [%s] to file [%s] in %s%n", eo.getPath(), dir.getAbsolutePath(), w);
    }
}
Also used : Options(org.apache.jackrabbit.oak.run.cli.Options) CommonOptions(org.apache.jackrabbit.oak.run.cli.CommonOptions) NodeStoreFixture(org.apache.jackrabbit.oak.run.cli.NodeStoreFixture) Stopwatch(com.google.common.base.Stopwatch) OptionParser(joptsimple.OptionParser) File(java.io.File)

Aggregations

NodeStoreFixture (org.apache.jackrabbit.oak.run.cli.NodeStoreFixture)7 Closer (com.google.common.io.Closer)4 OptionParser (joptsimple.OptionParser)4 Options (org.apache.jackrabbit.oak.run.cli.Options)4 File (java.io.File)3 CommonOptions (org.apache.jackrabbit.oak.run.cli.CommonOptions)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)2 Stopwatch (com.google.common.base.Stopwatch)1 OptionSet (joptsimple.OptionSet)1 OptionSpec (joptsimple.OptionSpec)1 DataStoreTextWriter (org.apache.jackrabbit.oak.plugins.index.datastore.DataStoreTextWriter)1 BlobStoreFixture (org.apache.jackrabbit.oak.run.cli.BlobStoreFixture)1 BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)1 IO (org.codehaus.groovy.tools.shell.IO)1 Test (org.junit.Test)1