Package org.apache.jackrabbit.oak.spi.blob

Examples of org.apache.jackrabbit.oak.spi.blob.BlobStore


        }
    }

    private RecordId internalWriteStream(InputStream stream)
            throws IOException {
        BlobStore blobStore = store.getBlobStore();
        byte[] data = new byte[MAX_SEGMENT_SIZE];
        int n = ByteStreams.read(stream, data, 0, data.length);

        // Special case for short binaries (up to about 16kB):
        // store them directly as small- or medium-sized value records
        if (n < Segment.MEDIUM_LIMIT) {
            return writeValueRecord(n, data);
        } else if (blobStore != null) {
            String blobId = blobStore.writeBlob(new SequenceInputStream(
                    new ByteArrayInputStream(data, 0, n), stream));
            return writeValueRecord(blobId);
        }

        long length = n;
View Full Code Here


    @Override
    @CheckForNull
    public String getReference() {
        String blobId = getBlobId();
        if (blobId != null) {
            BlobStore blobStore = getSegment().getSegmentId().getTracker().
                    getStore().getBlobStore();
            if (blobStore != null) {
                return blobStore.getReference(blobId);
            } else {
                throw new IllegalStateException("Attempt to read external blob with blobId [" + blobId + "] " +
                        "without specifying BlobStore");
            }
        }
View Full Code Here

    public Blob getBlob(@Nonnull String reference) {
        //Use of 'reference' here is bit overloaded. In terms of NodeStore API
        //a blob reference refers to the secure reference obtained from Blob#getReference()
        //However in SegmentStore terminology a blob is referred via 'external reference'
        //That 'external reference' would map to blobId obtained from BlobStore#getBlobId
        BlobStore blobStore = store.getBlobStore();
        if (blobStore != null) {
            String blobId = blobStore.getBlobId(reference);
            if (blobId != null) {
                return store.readBlob(blobId);
            }
            return null;
        }
View Full Code Here

    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);
        reg = context.getBundleContext().registerService(new String[]{
                BlobStore.class.getName(),
                GarbageCollectableBlobStore.class.getName()
        }, blobStore, null);
View Full Code Here

        }
    }

    private RecordId internalWriteStream(InputStream stream)
            throws IOException {
        BlobStore blobStore = store.getBlobStore();
        byte[] data = new byte[MAX_SEGMENT_SIZE];
        int n = ByteStreams.read(stream, data, 0, data.length);

        // Special case for short binaries (up to about 16kB):
        // store them directly as small- or medium-sized value records
        if (n < Segment.MEDIUM_LIMIT) {
            return writeValueRecord(n, data);
        } else if (blobStore != null) {
            String blobId = blobStore.writeBlob(new SequenceInputStream(
                    new ByteArrayInputStream(data, 0, n), stream));
            return writeValueRecord(blobId);
        }

        long length = n;
View Full Code Here

        MongoClient client = new MongoClient(mongoURI);
        DB mongoDB = client.getDB(db);

        // Check if any valid external BlobStore is defined.
        // If not then use the default which is MongoBlobStore
        BlobStore blobStore = createBlobStore(config);

        DocumentMK.Builder mkBuilder =
                new DocumentMK.Builder().
                memoryCacheSize(cacheSize * MB).
                offHeapCacheSize(offHeapCache * MB);
 
View Full Code Here

    private BlobStore createBlobStore(Map<String, ?> config) throws Exception {
        String blobStoreType = PropertiesUtil.toString(
                prop(config, BlobStoreConfiguration.PROP_BLOB_STORE_PROVIDER),
                BlobStoreConfiguration.DEFAULT_BLOB_STORE_PROVIDER);

        BlobStore blobStore = null;
        if (!Strings.isNullOrEmpty(blobStoreType)) {
            blobStore = BlobStoreHelper.create(
                    BlobStoreConfiguration.newInstance().
                            loadFromContextOrMap(config, bundleContext))
                    .orNull();
View Full Code Here

                Repository[] cluster = new Repository[n];
                kernels = new DocumentMK[cluster.length];
                for (int i = 0; i < cluster.length; i++) {
                    MongoConnection mongo =
                            new MongoConnection(host, port, dbName);
                    BlobStore blobStore = getBlobStore();
                    DocumentMK.Builder mkBuilder = new DocumentMK.Builder().
                            setMongoDB(mongo.getDB()).
                            memoryCacheSize(cacheSize).
                            setClusterId(i).setLogging(false);
                    if (blobStore != null) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.blob.BlobStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.