mirror of https://github.com/apache/jclouds.git
slicehost related changes for Issue 826
This commit is contained in:
parent
e45aaa8a3c
commit
44329eceaf
|
@ -35,7 +35,6 @@ import org.jclouds.compute.domain.TemplateBuilder;
|
|||
import org.jclouds.compute.internal.BaseComputeService;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
|
||||
import org.jclouds.slicehost.SlicehostAsyncClient;
|
||||
import org.jclouds.slicehost.SlicehostClient;
|
||||
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.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -88,10 +86,6 @@ public class SlicehostComputeServiceContextModule
|
|||
bind(new TypeLiteral<Function<Location, Location>>() {
|
||||
}).to((Class) IdentityFunction.class);
|
||||
|
||||
// there are no locations except the provider
|
||||
bind(new TypeLiteral<Supplier<Location>>() {
|
||||
}).to(OnlyLocationOrFirstZone.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,12 +28,13 @@ import org.jclouds.compute.ComputeServiceAdapter;
|
|||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.location.suppliers.JustProvider;
|
||||
import org.jclouds.slicehost.SlicehostClient;
|
||||
import org.jclouds.slicehost.domain.Flavor;
|
||||
import org.jclouds.slicehost.domain.Image;
|
||||
import org.jclouds.slicehost.domain.Slice;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* defines the connection between the {@link SlicehostClient} implementation and the jclouds
|
||||
* {@link ComputeService}
|
||||
|
@ -43,13 +44,10 @@ import org.jclouds.slicehost.domain.Slice;
|
|||
public class SlicehostComputeServiceAdapter implements ComputeServiceAdapter<Slice, Flavor, Image, Location> {
|
||||
|
||||
protected final SlicehostClient client;
|
||||
protected final JustProvider locationSupplier;
|
||||
|
||||
@Inject
|
||||
protected SlicehostComputeServiceAdapter(SlicehostClient client, JustProvider locationSupplier) {
|
||||
protected SlicehostComputeServiceAdapter(SlicehostClient client) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
this.locationSupplier = checkNotNull(locationSupplier, "locationSupplier");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,10 +77,10 @@ public class SlicehostComputeServiceAdapter implements ComputeServiceAdapter<Sli
|
|||
return client.listSlices();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Iterable<Location> listLocations() {
|
||||
return (Iterable<Location>) locationSupplier.get();
|
||||
// Not using the adapter to determine locations
|
||||
return ImmutableSet.<Location>of();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue