slicehost related changes for Issue 826

This commit is contained in:
Adrian Cole 2012-02-02 07:38:06 -08:00
parent e45aaa8a3c
commit 44329eceaf
2 changed files with 6 additions and 14 deletions

View File

@ -35,7 +35,6 @@ import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService; import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
import org.jclouds.slicehost.SlicehostAsyncClient; import org.jclouds.slicehost.SlicehostAsyncClient;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import org.jclouds.slicehost.compute.functions.FlavorToHardware; import org.jclouds.slicehost.compute.functions.FlavorToHardware;
@ -48,7 +47,6 @@ import org.jclouds.slicehost.domain.Slice;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -88,10 +86,6 @@ public class SlicehostComputeServiceContextModule
bind(new TypeLiteral<Function<Location, Location>>() { bind(new TypeLiteral<Function<Location, Location>>() {
}).to((Class) IdentityFunction.class); }).to((Class) IdentityFunction.class);
// there are no locations except the provider
bind(new TypeLiteral<Supplier<Location>>() {
}).to(OnlyLocationOrFirstZone.class);
} }
@Override @Override

View File

@ -28,12 +28,13 @@ import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.location.suppliers.JustProvider;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import org.jclouds.slicehost.domain.Flavor; import org.jclouds.slicehost.domain.Flavor;
import org.jclouds.slicehost.domain.Image; import org.jclouds.slicehost.domain.Image;
import org.jclouds.slicehost.domain.Slice; import org.jclouds.slicehost.domain.Slice;
import com.google.common.collect.ImmutableSet;
/** /**
* defines the connection between the {@link SlicehostClient} implementation and the jclouds * defines the connection between the {@link SlicehostClient} implementation and the jclouds
* {@link ComputeService} * {@link ComputeService}
@ -43,13 +44,10 @@ import org.jclouds.slicehost.domain.Slice;
public class SlicehostComputeServiceAdapter implements ComputeServiceAdapter<Slice, Flavor, Image, Location> { public class SlicehostComputeServiceAdapter implements ComputeServiceAdapter<Slice, Flavor, Image, Location> {
protected final SlicehostClient client; protected final SlicehostClient client;
protected final JustProvider locationSupplier;
@Inject @Inject
protected SlicehostComputeServiceAdapter(SlicehostClient client, JustProvider locationSupplier) { protected SlicehostComputeServiceAdapter(SlicehostClient client) {
this.client = checkNotNull(client, "client"); this.client = checkNotNull(client, "client");
this.locationSupplier = checkNotNull(locationSupplier, "locationSupplier");
} }
@Override @Override
@ -79,10 +77,10 @@ public class SlicehostComputeServiceAdapter implements ComputeServiceAdapter<Sli
return client.listSlices(); return client.listSlices();
} }
@SuppressWarnings("unchecked")
@Override @Override
public Iterable<Location> listLocations() { public Iterable<Location> listLocations() {
return (Iterable<Location>) locationSupplier.get(); // Not using the adapter to determine locations
return ImmutableSet.<Location>of();
} }
@Override @Override