You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrew Gaul <no...@github.com> on 2015/03/24 08:01:24 UTC

[jclouds] Forwarding and read-only BlobStores (#713)

You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/713

-- Commit Summary --

  * Add ForwardingBlobStore
  * Add ReadOnlyBlobStore

-- File Changes --

    A blobstore/src/main/java/org/jclouds/blobstore/util/ForwardingBlobStore.java (210)
    A blobstore/src/main/java/org/jclouds/blobstore/util/ReadOnlyBlobStore.java (124)
    M blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java (28)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/713.patch
https://github.com/jclouds/jclouds/pull/713.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/713

Re: [jclouds] Forwarding and read-only BlobStores (#713)

Posted by Andrew Gaul <no...@github.com>.
> +
> +public abstract class ForwardingBlobStore extends ForwardingObject
> +      implements BlobStore {
> +   private final BlobStore blobStore;
> +
> +   public ForwardingBlobStore(BlobStore blobStore) {
> +      this.blobStore = checkNotNull(blobStore);
> +   }
> +
> +   protected BlobStore delegate() {
> +      return blobStore;
> +   }
> +
> +   @Override
> +   public BlobStoreContext getContext() {
> +      return delegate().getContext();

Note that there is an unintentional escape hatch from the `ForwardingObject`:

```java
BlobStore rwBlobStore = ...;
BlobStore roBlobStore = ReadOnlyBlobStore.newReadOnlyBlobStore(rwBlobStore);
roBlobStore.getContext().getBlobStore().putBlob(...);
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/713/files#r27006641