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()"; } } }
