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.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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue