You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Jeremy Glesner <je...@bericotechnologies.com> on 2015/09/24 00:28:13 UTC

Retrieving an S3 Object using Provider Specific APIs

Hello,

We're using jclouds 1.9.1 for working with S3.  I am new to jclouds, and
trying to get up to speed on the API. Apologize in advance for the newbie
questions.  Based on our use cases, which include assigning ACLs to
objects, it appears that I need to use the Provider specific APIs. However,
I'm struggling to make use of those.  The example on the jclouds site (
https://jclouds.apache.org/guides/aws/) refers to
context.getProviderSpecificContext().getApi(), while other examples on the
web point to RestContext, both of which appear to be deprecated. I've seen
some conversations about unwrap() replacing getProviderSpecificContext(),
but also seen references in the javadocs to using contextBuilder to
assemble APIs.  Would greatly appreciate being pointed in the right
direction.

Could you please provide, or point me to a current example that:
1. Demonstrates how to set up a S3Client and S3Object that leverages the
AWS S3 provider specific API,
2. Connects to an object via a "bucket" and "key",
3. Retrieves that Object ... recognizing that the Object was stored as a
byte[] payload,
4. Reconstitutes the byte[] from the payload object

I would *greatly* appreciate any help.

Thanks much,
Jeremy

Jeremy M Glesner
Chief Technology Officer
Berico Technologies, LLC.

11130 Sunrise Valley Drive, Suite 300
Reston, VA 20191

703.731.6984 (m)
703.390.9926 x2014 (o)
www.bericotechnologies.com

Re: Retrieving an S3 Object using Provider Specific APIs

Posted by Ignasi Barrera <na...@apache.org>.
Hi Jeremy,

Apologies for the late reply. I'm not very familiar with the BlobStore
APIs, but I'll try to help with how you can instantiate them. I'll also fix
the docs in the site as soon as I can.

You can use the ContextBuilder to create a view [1] such as the BlobStore
one, that provides portable interfaces across multiple cloud providers, or
to directly create the provider APIs, by calling, say,
"buildApi(AWSS3Api.class)".

I'd suggest you create the BlobStore view to keep your code as portable as
possible and get the provider specific API just when you need. Views are
just... views :) and delegate operations to the underlying provider api,
but hiding the complexity to you. When you need to access the api, you can
use the "unwrapApi" method from the context like:
"context.unwrapApi(AWSS3Api.class)" to get it.

HTH!

I.

[1] https://jclouds.apache.org/start/concepts/
El 24/9/2015 0:28, "Jeremy Glesner" <je...@bericotechnologies.com>
escribió:

> Hello,
>
> We're using jclouds 1.9.1 for working with S3.  I am new to jclouds, and
> trying to get up to speed on the API. Apologize in advance for the newbie
> questions.  Based on our use cases, which include assigning ACLs to
> objects, it appears that I need to use the Provider specific APIs. However,
> I'm struggling to make use of those.  The example on the jclouds site (
> https://jclouds.apache.org/guides/aws/) refers to
> context.getProviderSpecificContext().getApi(), while other examples on the
> web point to RestContext, both of which appear to be deprecated. I've seen
> some conversations about unwrap() replacing getProviderSpecificContext(),
> but also seen references in the javadocs to using contextBuilder to
> assemble APIs.  Would greatly appreciate being pointed in the right
> direction.
>
> Could you please provide, or point me to a current example that:
> 1. Demonstrates how to set up a S3Client and S3Object that leverages the
> AWS S3 provider specific API,
> 2. Connects to an object via a "bucket" and "key",
> 3. Retrieves that Object ... recognizing that the Object was stored as a
> byte[] payload,
> 4. Reconstitutes the byte[] from the payload object
>
> I would *greatly* appreciate any help.
>
> Thanks much,
> Jeremy
>
> Jeremy M Glesner
> Chief Technology Officer
> Berico Technologies, LLC.
>
> 11130 Sunrise Valley Drive, Suite 300
> Reston, VA 20191
>
> 703.731.6984 (m)
> 703.390.9926 x2014 (o)
> www.bericotechnologies.com
>
>
>