From 20f1a75606ab84af63ba63f9302e589650f4dd01 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 29 Jun 2010 15:52:41 -0700 Subject: [PATCH] Issue 297: made ssh optional in case we are in gae and we cannot invoke network sockets --- compute/src/main/java/org/jclouds/compute/Utils.java | 4 ++++ .../java/org/jclouds/compute/internal/UtilsImpl.java | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/compute/src/main/java/org/jclouds/compute/Utils.java b/compute/src/main/java/org/jclouds/compute/Utils.java index 7477e4f167..e1f27d3de2 100644 --- a/compute/src/main/java/org/jclouds/compute/Utils.java +++ b/compute/src/main/java/org/jclouds/compute/Utils.java @@ -18,6 +18,8 @@ */ package org.jclouds.compute; +import javax.annotation.Nullable; + import org.jclouds.compute.internal.UtilsImpl; import org.jclouds.ssh.SshClient; @@ -29,7 +31,9 @@ import com.google.inject.ImplementedBy; */ @ImplementedBy(UtilsImpl.class) public interface Utils extends org.jclouds.rest.Utils { + @Nullable SshClient.Factory getSshClientFactory(); + @Nullable SshClient.Factory sshFactory(); } diff --git a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java index 1621ace75d..3739d6b737 100644 --- a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java +++ b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java @@ -20,7 +20,6 @@ package org.jclouds.compute.internal; import java.util.concurrent.ExecutorService; -import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; @@ -31,27 +30,27 @@ import org.jclouds.encryption.EncryptionService; import org.jclouds.logging.Logger.LoggerFactory; import org.jclouds.rest.HttpAsyncClient; import org.jclouds.rest.HttpClient; -import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient.Factory; +import com.google.inject.Inject; + /** * * @author Adrian Cole */ @Singleton public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Utils { - - private final Factory sshFactory; + @Inject(optional = true) + private Factory sshFactory; @Inject UtilsImpl(HttpClient simpleClient, HttpAsyncClient simpleAsyncClient, EncryptionService encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, @Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, - LoggerFactory loggerFactory, SshClient.Factory sshFactory) { + LoggerFactory loggerFactory) { super(simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, loggerFactory); - this.sshFactory = sshFactory; } @Override