Search in sources :

Example 1 with FileBlobStore

use of org.apache.jackrabbit.oak.spi.blob.FileBlobStore in project jackrabbit-oak by apache.

the class BlobStoreFixture method getFileBlobStore.

public static BlobStoreFixture getFileBlobStore(final File basedir) {
    return new BlobStoreFixture("FBS") {

        private File storeDir;

        private FileBlobStore fbs;

        @Override
        public BlobStore setUp() {
            storeDir = new File(basedir, unique);
            fbs = new FileBlobStore(storeDir.getAbsolutePath());
            configure(fbs);
            return fbs;
        }

        @Override
        public void tearDown() {
            FileUtils.deleteQuietly(storeDir);
        }

        @Override
        public long size() {
            return FileUtils.sizeOfDirectory(storeDir);
        }
    };
}
Also used : FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) File(java.io.File)

Example 2 with FileBlobStore

use of org.apache.jackrabbit.oak.spi.blob.FileBlobStore in project jackrabbit-oak by apache.

the class ReferenceBinaryIT method fixtures.

@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> fixtures() throws Exception {
    File file = getTestDir("tar");
    FileStore fileStore = FileStoreBuilder.fileStoreBuilder(file).withBlobStore(createBlobStore()).withMaxFileSize(256).withMemoryMapping(true).build();
    SegmentNodeStore sns = SegmentNodeStoreBuilders.builder(fileStore).build();
    List<Object[]> fixtures = Lists.newArrayList();
    SegmentTarFixture segmentTarFixture = new SegmentTarFixture(sns);
    if (segmentTarFixture.isAvailable()) {
        fixtures.add(new Object[] { segmentTarFixture });
    }
    FileBlobStore fbs = new FileBlobStore(getTestDir("fbs1").getAbsolutePath());
    fbs.setReferenceKeyPlainText("foobar");
    FileStore fileStoreWithFBS = FileStoreBuilder.fileStoreBuilder(getTestDir("tar2")).withBlobStore(fbs).withMaxFileSize(256).withMemoryMapping(true).build();
    SegmentNodeStore snsWithFBS = SegmentNodeStoreBuilders.builder(fileStoreWithFBS).build();
    SegmentTarFixture segmentTarFixtureFBS = new SegmentTarFixture(snsWithFBS);
    if (segmentTarFixtureFBS.isAvailable()) {
        fixtures.add(new Object[] { segmentTarFixtureFBS });
    }
    DocumentMongoFixture documentFixture = new DocumentMongoFixture(MongoUtils.URL, createBlobStore());
    if (documentFixture.isAvailable()) {
        fixtures.add(new Object[] { documentFixture });
    }
    return fixtures;
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) DocumentMongoFixture(org.apache.jackrabbit.oak.fixture.DocumentMongoFixture) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) SegmentTarFixture(org.apache.jackrabbit.oak.segment.fixture.SegmentTarFixture) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) File(java.io.File)

Example 3 with FileBlobStore

use of org.apache.jackrabbit.oak.spi.blob.FileBlobStore in project jackrabbit-oak by apache.

the class SplitBlobStoreTest method setup.

@Before
public void setup() throws IOException {
    repository = Files.createTempDir();
    oldBlobStore = new FileBlobStore(repository.getPath() + "/old");
    newBlobStore = new FileBlobStore(repository.getPath() + "/new");
    splitBlobStore = new DefaultSplitBlobStore(repository.getPath(), oldBlobStore, newBlobStore);
    oldBlobIds = addBlobs(oldBlobStore);
    newBlobIds = addBlobs(splitBlobStore);
}
Also used : DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) Before(org.junit.Before)

Example 4 with FileBlobStore

use of org.apache.jackrabbit.oak.spi.blob.FileBlobStore in project jackrabbit-oak by apache.

the class FileBlobStoreService method activate.

@Activate
protected void activate(ComponentContext context, Map<String, Object> config) {
    String homeDir = lookup(context, PROP_HOME);
    if (homeDir != null) {
        log.info("Initializing the FileBlobStore with homeDir [{}]", homeDir);
    }
    BlobStore blobStore = new FileBlobStore(FilenameUtils.concat(homeDir, "datastore"));
    PropertiesUtil.populate(blobStore, config, false);
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
        props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
    }
    reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, blobStore, props);
}
Also used : Hashtable(java.util.Hashtable) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) GarbageCollectableBlobStore(org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

FileBlobStore (org.apache.jackrabbit.oak.spi.blob.FileBlobStore)4 File (java.io.File)2 Hashtable (java.util.Hashtable)1 Activate (org.apache.felix.scr.annotations.Activate)1 DocumentMongoFixture (org.apache.jackrabbit.oak.fixture.DocumentMongoFixture)1 SegmentNodeStore (org.apache.jackrabbit.oak.segment.SegmentNodeStore)1 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)1 SegmentTarFixture (org.apache.jackrabbit.oak.segment.fixture.SegmentTarFixture)1 BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)1 GarbageCollectableBlobStore (org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore)1 DefaultSplitBlobStore (org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore)1 Before (org.junit.Before)1