Amdatu BlobStores

Project Info

Introduction

BlobStores are used to store (large) files in the cloud. Amdatu BlobStores is based on the jclouds library that supports BlobStores from several cloud providers such as Amazon S3 and Microsoft Azure. Amdatu BlobStores re-packages jclouds and all of it's dependencies to provide a single comprehensive component that is available as an OSGi service which is configurable using a Managed Service Factory. This way ConfigurationAdmin can be used to configure BlobStores while using the jclouds API to use the BlobStores from code.

Usage

Deploy the BlobStore bundle; `org.amdatu.blobstores` with your application and inject the BlobStoreService into components as desired. After providing a configuration, the BlobStoreService then allows you to interact with the configured BlobStore.

Dependencies

The Amdatu MongoDB bundle depends on the following bundles:

  1. Apache Felix DependencyManager v3.1.0;
  2. An OSGi ConfigurationAdmin service implementation, for example Apache Felix ConfigAdmin v1.8.0;
  3. (Optionally) an OSGi LogService implementation, for example Apache Felix LogService v1.0.1.

Configuration

The `BlobStoreService` must be configured before it can be used. Once the `BlobStoreService` is configured, you can use it to interact with the configured BlobStore through the jclouds BlobStore API. The BlobStoreService is configured by providing a factory configuration using the PID `org.amdatu.storage.servicefactory`.
Note that this configuration is mandatory in order to make use of the BlobStore service!

Configuration is done by setting the required `ID_KEY`, `PROVIDER_KEY` and optional `IDENTITY_KEY`, `SECRET_KEY` and `BASEDIR_KEY` properties.

Example

The following example shows how to retrieve a BlobStoreContext and BlobStore, create a container and store a Blob inside the container using the configured BlobStore:

Amdatu BlobStores code example
BlobStoreContext bsContext = m_blobStoreService.getContext();
BlobStore blobStore = bsContext.getBlobStore();
	
blobStore.createContainerInLocation(null, containerName);
blobStore.putBlob(containerName,
	blobStore.blobBuilder(blobName).payload(ByteSource.wrap("somecontent".getBytes())).build());

License

The Amdatu MongoDB project is licensed under Apache License 2.0.