Search in sources :

Example 1 with BlobStoreProvider

use of com.enonic.xp.blob.BlobStoreProvider in project xp by enonic.

the class BlobStoreFactory method populateWithReadThroughIfApplicable.

private BlobStore populateWithReadThroughIfApplicable(final ProviderConfig config, final BlobStore providerStore) {
    if (config.readThroughEnabled()) {
        LOG.info("Setting up readthrough provider");
        final String readThroughProviderName = config.readThroughProvider();
        final BlobStoreProvider readThroughProvider = this.providers.get(readThroughProviderName);
        if (readThroughProvider == null) {
            LOG.warn("Readthrough provider [" + readThroughProviderName + "] not found, skipping");
        } else {
            LOG.info("Readthrough provider [" + readThroughProviderName + "] registered successfully");
            return ReadThroughBlobStore.create().store(providerStore).readThroughStore(readThroughProvider.get()).sizeThreshold(config.readThroughSizeThreshold()).build();
        }
    }
    return providerStore;
}
Also used : BlobStoreProvider(com.enonic.xp.blob.BlobStoreProvider)

Example 2 with BlobStoreProvider

use of com.enonic.xp.blob.BlobStoreProvider in project xp by enonic.

the class BlobStoreActivator method doRegister.

private void doRegister() {
    final String name = config.providerName();
    LOG.info("Waiting for blobstore-provider [" + name + "]");
    final BlobStoreProvider blobStoreProvider = this.providers.get(name);
    if (blobStoreProvider == null) {
        return;
    }
    LOG.info("Found blobstore-provider [" + name + "]");
    if (blobStoreProvider.config().readThroughEnabled()) {
        final String readThroughProviderName = blobStoreProvider.config().readThroughProvider();
        if (this.providers.get(readThroughProviderName) == null) {
            LOG.info("Waiting for readThrough-provider [" + readThroughProviderName + "]");
            return;
        }
    }
    if (blobStoreProvider.get() != null) {
        final BlobStore blobStore = BlobStoreFactory.create().config(this.config).provider(blobStoreProvider).providers(this.providers).build().execute();
        this.blobStoreReg = this.context.registerService(BlobStore.class, blobStore, null);
        LOG.info("Registered blobstore [" + this.config.providerName() + "] successfully");
    }
}
Also used : BlobStoreProvider(com.enonic.xp.blob.BlobStoreProvider) BlobStore(com.enonic.xp.blob.BlobStore)

Aggregations

BlobStoreProvider (com.enonic.xp.blob.BlobStoreProvider)2 BlobStore (com.enonic.xp.blob.BlobStore)1