You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Stian Brattland | Upright Music Scandinavia <sb...@upright-music.com> on 2013/11/08 09:17:03 UTC
Trying to get jclouds to work with Rackspace Cloud Files ServiceNet
(snet)
Hi,
I'm trying to get jclouds to replace public url's for Rackspace Cloud Files with an internal snet URL. My application sits on a
Rackspace Cloud Server and processes files on Rackspace Cloud Files. Right now, I'm paying for traffic between the server
and Cloud Files, but if I can get jclouds to use the internal service net (snet) to connect to Cloud Files then this traffic will be
both free and faster.
I've tried to use the example provided on this page<https://groups.google.com/forum/#%21msg/jclouds/AdhB4aZTggY/UYJunQFs5WIJ>. However, jclouds does not seem to pick up the module I'm passing to
the ContextBuilder. You'll find an example of how I do things below.
Does anyone have any experience with this? I'd be really happy if someone could point me in the right direction.
Thanks!
public class Test {
public static void main(String[] args) {
// We need to make sure that jclouds not spawns any threads on its
// own. We'll do this using the ExecutorServiceModule.
Iterable<Module> modules = ImmutableSet.<Module> of (
new RackspaceServicenetModule(),
new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor())
);
// Create a new connection and authenticate.
BlobStoreContext ctx = ContextBuilder.newBuilder("cloudfiles-uk")
.credentials([USERNAME], [KEY])
.modules(modules)
.buildView(BlobStoreContext.class);
// All interaction with the BlobStoreContext appears to go over the public network
// from here. However, I'd like it to go over the Service Net.
}
}
public class RackspaceServicenetModule extends AbstractModule {
@Override
protected void configure() {
bind(EndpointToSupplierURI.class).to(InternalURLSupplier.class);
}
@Singleton
public static class InternalURLSupplier implements EndpointToSupplierURI {
@Override
public Supplier<URI> apply(Endpoint input) {
return Suppliers.ofInstance(input.getInternalURL() != null ? input.getInternalURL() : input.getPublicURL());
}
@Override
public String toString() {
return "supplyInternalURL()";
}
}
}
Re: Trying to get jclouds to work with Rackspace Cloud Files
ServiceNet (snet)
Posted by Burton Rhodes <bu...@gmail.com>.
I am very curious about this as well. I did read an email a few weeks back
about someone submitting a JIRA request, but I don't see it anywhere.
On Fri, Nov 8, 2013 at 2:17 AM, Stian Brattland | Upright Music Scandinavia
<sb...@upright-music.com> wrote:
> Hi,
>
> I'm trying to get jclouds to replace public url's for Rackspace Cloud
> Files with an internal snet URL. My application sits on a
> Rackspace Cloud Server and processes files on Rackspace Cloud Files. Right
> now, I'm paying for traffic between the server
> and Cloud Files, but if I can get jclouds to use the internal service net
> (snet) to connect to Cloud Files then this traffic will be
> both free and faster.
>
> I've tried to use the example provided on this page<https://groups.google.com/forum/#%21msg/jclouds/AdhB4aZTggY/UYJunQFs5WIJ>.
> However, jclouds does not seem to pick up the module I'm passing to
> the ContextBuilder. You'll find an example of how I do things below.
>
> Does anyone have any experience with this? I'd be really happy if someone
> could point me in the right direction.
>
> Thanks!
>
> *public class Test {*
>
> * public static void main(String[] args) {*
>
> * // We need to make sure that jclouds not spawns any threads on its*
> * // own. We'll do this using the ExecutorServiceModule.*
> * Iterable<Module> modules = ImmutableSet.<Module> of (*
> * new RackspaceServicenetModule(),*
> * new ExecutorServiceModule(sameThreadExecutor(),
> sameThreadExecutor())*
> * );*
>
> * // Create a new connection and authenticate.*
> * BlobStoreContext ctx = ContextBuilder.newBuilder("cloudfiles-uk")*
> * .credentials([USERNAME], [KEY])*
> * .modules(modules)*
> * .buildView(BlobStoreContext.class);*
>
> * // All interaction with the BlobStoreContext appears to go over the
> public network*
> * // from here.** However, I'd like it to go over the Service Net.*
>
> * }*
>
> *}*
>
> *public class RackspaceServicenetModule extends AbstractModule {*
>
> * @Override*
> * protected void configure() {*
> * bind(EndpointToSupplierURI.class).to(InternalURLSupplier.class);*
> * }*
>
> * @Singleton*
> * public static class InternalURLSupplier implements
> EndpointToSupplierURI {*
>
> * @Override*
> * public Supplier<URI> apply(Endpoint input) {*
> * return Suppliers.ofInstance(input.getInternalURL() != null ?
> input.getInternalURL() : input.getPublicURL());*
> * }*
>
> * @Override*
> * public String toString() {*
> * return "supplyInternalURL()";*
> * }*
> * }*
> *}*
>
>
>