Search in sources :

Example 1 with WrappingSplitBlobStore

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

the class SplitBlobStoreService method registerSplitBlobStore.

private void registerSplitBlobStore() {
    if (oldBlobStore == null && oldBlobStoreType == BlobStoreType.EXTERNAL) {
        log.info("No BlobStore with ({}=old)", PROP_SPLIT_BLOBSTORE);
        return;
    }
    if (newBlobStore == null) {
        log.info("No BlobStore with ({}=new)", PROP_SPLIT_BLOBSTORE);
        return;
    }
    if (reg != null) {
        log.info("SplitBlobStore already registered");
        return;
    }
    if (ctx == null) {
        log.info("Component not activated yet");
        return;
    }
    log.info("Registering SplitBlobStore with old={} ({}) and new={}", oldBlobStore, oldBlobStoreType, newBlobStore);
    BlobStore blobStore;
    if (oldBlobStoreType == EXTERNAL || oldBlobStoreType == SEGMENT) {
        blobStore = new DefaultSplitBlobStore(homeDir, oldBlobStore, newBlobStore);
    } else if (oldBlobStoreType == DOCUMENT) {
        blobStore = new WrappingSplitBlobStore(homeDir, newBlobStore);
    } else {
        throw new IllegalStateException("Illegal blob store type value: " + oldBlobStoreType);
    }
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    props.put("service.pid", "org.apache.jackrabbit.oak.spi.blob.split.SplitBlobStore");
    reg = ctx.registerService(new String[] { BlobStore.class.getName() }, blobStore, props);
}
Also used : DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) Hashtable(java.util.Hashtable) WrappingSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.WrappingSplitBlobStore) DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) WrappingSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.WrappingSplitBlobStore)

Aggregations

Hashtable (java.util.Hashtable)1 BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)1 DefaultSplitBlobStore (org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore)1 WrappingSplitBlobStore (org.apache.jackrabbit.oak.spi.blob.split.WrappingSplitBlobStore)1