diff --git a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java index d6802c8945..66d59703be 100755 --- a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java +++ b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java @@ -32,6 +32,7 @@ import java.util.concurrent.ExecutorService; import org.jclouds.cloud.CloudContextBuilder; import org.jclouds.nirvanix.sdn.config.RestSDNAuthenticationModule; +import org.jclouds.nirvanix.sdn.config.RestSDNConnectionModule; import org.jclouds.nirvanix.sdn.config.SDNContextModule; import org.jclouds.nirvanix.sdn.reference.SDNConstants; @@ -85,6 +86,7 @@ public class SDNContextBuilder extends CloudContextBuilder { public static void addAuthenticationModule(SDNContextBuilder builder) { builder.withModule(new RestSDNAuthenticationModule()); + builder.withModule(new RestSDNConnectionModule()); } public static SDNContextBuilder withEndpoint(SDNContextBuilder builder, URI endpoint) { diff --git a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNAuthenticationModule.java b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNAuthenticationModule.java index f6ce53a2f7..3ca18ac6eb 100755 --- a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNAuthenticationModule.java +++ b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNAuthenticationModule.java @@ -31,7 +31,6 @@ import javax.inject.Singleton; import org.jclouds.http.RequiresHttp; import org.jclouds.nirvanix.sdn.SDN; import org.jclouds.nirvanix.sdn.SDNAuthentication; -import org.jclouds.nirvanix.sdn.SDNConnection; import org.jclouds.nirvanix.sdn.SessionToken; import org.jclouds.nirvanix.sdn.reference.SDNConstants; import org.jclouds.rest.RestClientFactory; @@ -49,8 +48,6 @@ public class RestSDNAuthenticationModule extends AbstractModule { @Override protected void configure() { - bindErrorHandlers(); - bindRetryHandlers(); } @Provides @@ -69,17 +66,4 @@ public class RestSDNAuthenticationModule extends AbstractModule { return factory.create(SDNAuthentication.class).authenticate(appKey, username, password); } - @Provides - protected SDNConnection provideConnection(RestClientFactory factory) { - return factory.create(SDNConnection.class); - } - - protected void bindErrorHandlers() { - // TODO - } - - protected void bindRetryHandlers() { - // TODO retry on 401 by AuthenticateRequest.update() - } - } \ No newline at end of file diff --git a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNConnectionModule.java b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNConnectionModule.java new file mode 100644 index 0000000000..4eca9f2e1e --- /dev/null +++ b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/config/RestSDNConnectionModule.java @@ -0,0 +1,60 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + */ +package org.jclouds.nirvanix.sdn.config; + +import org.jclouds.http.RequiresHttp; +import org.jclouds.nirvanix.sdn.SDNConnection; +import org.jclouds.rest.RestClientFactory; + +import com.google.inject.AbstractModule; +import com.google.inject.Provides; + +/** + * Configures the SDN authentication service connection, including logging and http transport. + * + * @author Adrian Cole + */ +@RequiresHttp +public class RestSDNConnectionModule extends AbstractModule { + + @Override + protected void configure() { + bindErrorHandlers(); + bindRetryHandlers(); + } + + @Provides + protected SDNConnection provideConnection(RestClientFactory factory) { + return factory.create(SDNConnection.class); + } + + protected void bindErrorHandlers() { + // TODO + } + + protected void bindRetryHandlers() { + // TODO retry on 401 by AuthenticateRequest.update() + } + +} \ No newline at end of file