mirror of https://github.com/apache/jclouds.git
allowed provider to be the default location
This commit is contained in:
parent
5f0a0e628a
commit
337ea7d4aa
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
package org.jclouds.compute.suppliers;
|
package org.jclouds.compute.suppliers;
|
||||||
|
|
||||||
|
import static com.google.common.collect.Iterables.find;
|
||||||
|
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -30,7 +33,6 @@ import org.jclouds.domain.LocationScope;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -48,7 +50,9 @@ public class DefaultLocationSupplier implements Supplier<Location> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location get() {
|
public Location get() {
|
||||||
return Iterables.find(locations.get(), new Predicate<Location>() {
|
if (locations.get().size() == 1)
|
||||||
|
return getOnlyElement(locations.get());
|
||||||
|
return find(locations.get(), new Predicate<Location>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Location input) {
|
public boolean apply(Location input) {
|
||||||
|
|
Loading…
Reference in New Issue