mirror of https://github.com/apache/jclouds.git
switch to old google collections syntax to avoid conflict between guava and google collections
This commit is contained in:
parent
1af5fccb0c
commit
e3a816e6cd
|
@ -116,7 +116,8 @@ public class EC2RestClientModule extends AbstractModule {
|
|||
@Singleton
|
||||
@EC2
|
||||
Region provideCurrentRegion(@EC2 Map<Region, URI> regionMap, @EC2 URI currentUri) {
|
||||
ImmutableBiMap<URI, Region> map = ImmutableBiMap.copyOf(regionMap).inverse();
|
||||
ImmutableBiMap<URI, Region> map = ImmutableBiMap.<Region, URI> builder().putAll(regionMap)
|
||||
.build().inverse();
|
||||
Region region = map.get(currentUri);
|
||||
assert region != null : currentUri + " not in " + map;
|
||||
return region;
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.aws.ec2.domain;
|
||||
|
||||
import com.google.common.collect.*;
|
||||
import com.google.inject.internal.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.inject.internal.Nullable;
|
||||
|
||||
/**
|
||||
* Defines the mapping of volumes for
|
||||
* {@link org.jclouds.aws.ec2.services.InstanceClient#setBlockDeviceMappingForInstanceInRegion}.
|
||||
|
@ -31,8 +33,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
*/
|
||||
public class BlockDeviceMapping {
|
||||
|
||||
private final Multimap<String, RunningInstance.EbsBlockDevice> ebsBlockDevices =
|
||||
LinkedHashMultimap.create();
|
||||
private final Multimap<String, RunningInstance.EbsBlockDevice> ebsBlockDevices = LinkedHashMultimap
|
||||
.create();
|
||||
|
||||
public BlockDeviceMapping() {
|
||||
}
|
||||
|
@ -41,6 +43,7 @@ public class BlockDeviceMapping {
|
|||
* Creates block device mapping from the list of {@link RunningInstance.EbsBlockDevice devices}.
|
||||
*
|
||||
* This method copies the values of the list.
|
||||
*
|
||||
* @param ebsBlockDevices
|
||||
* devices to be changed for the volume. This cannot be null.
|
||||
*/
|
||||
|
@ -51,18 +54,22 @@ public class BlockDeviceMapping {
|
|||
|
||||
/**
|
||||
* Adds a {@link RunningInstance.EbsBlockDevice} to the mapping.
|
||||
* @param deviceName name of the device to apply the mapping. Can be null.
|
||||
*
|
||||
* @param deviceName
|
||||
* name of the device to apply the mapping. Can be null.
|
||||
* @param ebsBlockDevice
|
||||
* ebsBlockDevice to be added. This cannot be null.
|
||||
* @return the same instance for method chaining purposes
|
||||
*/
|
||||
public BlockDeviceMapping addEbsBlockDevice(@Nullable String deviceName, RunningInstance.EbsBlockDevice ebsBlockDevice) {
|
||||
public BlockDeviceMapping addEbsBlockDevice(@Nullable String deviceName,
|
||||
RunningInstance.EbsBlockDevice ebsBlockDevice) {
|
||||
this.ebsBlockDevices.put(deviceName, checkNotNull(ebsBlockDevice,
|
||||
/* or throw */"EbsBlockDevice can't be null"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Multimap<String, RunningInstance.EbsBlockDevice> getEbsBlockDevices() {
|
||||
return ImmutableMultimap.copyOf(ebsBlockDevices);
|
||||
return ImmutableMultimap.<String, RunningInstance.EbsBlockDevice> builder().putAll(
|
||||
ebsBlockDevices).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class S3RestClientModule extends AbstractModule {
|
|||
@Singleton
|
||||
@S3
|
||||
Region getDefaultRegion(@S3 URI uri, @S3 Map<Region, URI> map) {
|
||||
return ImmutableBiMap.copyOf(map).inverse().get(uri);
|
||||
return ImmutableBiMap.<Region, URI> builder().putAll(map).build().inverse().get(uri);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -110,7 +110,7 @@ public class SQSRestClientModule extends AbstractModule {
|
|||
@Singleton
|
||||
@SQS
|
||||
Region getDefaultRegion(@SQS URI uri, @SQS Map<Region, URI> map) {
|
||||
return ImmutableBiMap.copyOf(map).inverse().get(uri);
|
||||
return ImmutableBiMap.<Region, URI> builder().putAll(map).build().inverse().get(uri);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -49,7 +49,7 @@ public class QueueHandler extends ParseSax.HandlerWithResult<Queue> {
|
|||
@Inject
|
||||
QueueHandler(Provider<UriBuilder> uriBuilderProvider, @SQS Map<Region, URI> regionMap) {
|
||||
this.uriBuilderProvider = uriBuilderProvider;
|
||||
this.regionBiMap = ImmutableBiMap.copyOf(regionMap);
|
||||
this.regionBiMap = ImmutableBiMap.<Region, URI> builder().putAll(regionMap).build();
|
||||
}
|
||||
|
||||
public Queue getResult() {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BaseRegexQueueHandler {
|
|||
|
||||
@Inject
|
||||
protected BaseRegexQueueHandler(Map<Region, URI> regionMap) {
|
||||
this.uriToRegion = ImmutableBiMap.copyOf(regionMap).inverse();
|
||||
this.uriToRegion = ImmutableBiMap.<Region, URI> builder().putAll(regionMap).build().inverse();
|
||||
}
|
||||
|
||||
public Set<Queue> parse(String in) {
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Singleton
|
||||
public class SyncProxy implements InvocationHandler {
|
||||
|
||||
|
@ -60,7 +61,7 @@ public class SyncProxy implements InvocationHandler {
|
|||
private final Map<Method, Method> methodMap;
|
||||
private final Map<Method, Method> syncMethodMap;
|
||||
private final Map<Method, Long> timeoutMap;
|
||||
private static final Set<Method> objectMethods = ImmutableSet.copyOf(Object.class.getMethods());
|
||||
private static final Set<Method> objectMethods = ImmutableSet.of(Object.class.getMethods());
|
||||
|
||||
@Inject
|
||||
public SyncProxy(Class<?> declaring, Object delegate) throws SecurityException,
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.domain;
|
||||
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Represents any job in GoGrid system
|
||||
* (jobs include server creation, stopping, etc)
|
||||
|
@ -47,7 +47,7 @@ public class Job implements Comparable<Job> {
|
|||
private JobState currentState;
|
||||
private int attempts;
|
||||
private String owner;
|
||||
private SortedSet<JobProperties> history;
|
||||
private Set<JobProperties> history;
|
||||
@SerializedName("detail") /*NOTE: as of Feb 28, 10,
|
||||
there is a contradiction b/w the name in
|
||||
documentation (details) and actual param
|
||||
|
@ -108,8 +108,8 @@ public class Job implements Comparable<Job> {
|
|||
return owner;
|
||||
}
|
||||
|
||||
public SortedSet<JobProperties> getHistory() {
|
||||
return ImmutableSortedSet.copyOf(history);
|
||||
public Set<JobProperties> getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.domain;
|
||||
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
|
@ -35,7 +34,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
@SerializedName("virtualip")
|
||||
private IpPortPair virtualIp;
|
||||
@SerializedName("realiplist")
|
||||
private SortedSet<IpPortPair> realIpList;
|
||||
private Set<IpPortPair> realIpList;
|
||||
private LoadBalancerType type;
|
||||
private LoadBalancerPersistenceType persistence;
|
||||
private LoadBalancerOs os;
|
||||
|
@ -48,7 +47,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
}
|
||||
|
||||
public LoadBalancer(long id, String name, String description,
|
||||
IpPortPair virtualIp, SortedSet<IpPortPair> realIpList, LoadBalancerType type,
|
||||
IpPortPair virtualIp, Set<IpPortPair> realIpList, LoadBalancerType type,
|
||||
LoadBalancerPersistenceType persistence, LoadBalancerOs os,
|
||||
LoadBalancerState state) {
|
||||
this.id = id;
|
||||
|
@ -78,8 +77,8 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
return virtualIp;
|
||||
}
|
||||
|
||||
public SortedSet<IpPortPair> getRealIpList() {
|
||||
return ImmutableSortedSet.copyOf(realIpList);
|
||||
public Set<IpPortPair> getRealIpList() {
|
||||
return realIpList;
|
||||
}
|
||||
|
||||
public LoadBalancerType getType() {
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
*/
|
||||
package org.jclouds.gogrid.domain;
|
||||
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
|
@ -50,7 +49,7 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
private Date createdTime;
|
||||
private Date updatedTime;
|
||||
@SerializedName("billingtokens")
|
||||
private SortedSet<BillingToken> billingTokens;
|
||||
private Set<BillingToken> billingTokens;
|
||||
private Customer owner;
|
||||
|
||||
/**
|
||||
|
@ -59,11 +58,10 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
public ServerImage() {
|
||||
}
|
||||
|
||||
public ServerImage(long id, String name, String friendlyName,
|
||||
String description, Option os, Option architecture,
|
||||
ServerImageType type, ServerImageState state, double price, String location,
|
||||
boolean active, boolean aPublic, Date createdTime,
|
||||
Date updatedTime, SortedSet<BillingToken> billingTokens, Customer owner) {
|
||||
public ServerImage(long id, String name, String friendlyName, String description, Option os,
|
||||
Option architecture, ServerImageType type, ServerImageState state, double price,
|
||||
String location, boolean active, boolean aPublic, Date createdTime, Date updatedTime,
|
||||
Set<BillingToken> billingTokens, Customer owner) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.friendlyName = friendlyName;
|
||||
|
@ -138,8 +136,8 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
return updatedTime;
|
||||
}
|
||||
|
||||
public SortedSet<BillingToken> getBillingTokens() {
|
||||
return ImmutableSortedSet.copyOf(billingTokens);
|
||||
public Set<BillingToken> getBillingTokens() {
|
||||
return billingTokens;
|
||||
}
|
||||
|
||||
public Customer getOwner() {
|
||||
|
@ -148,28 +146,48 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
ServerImage that = (ServerImage) o;
|
||||
|
||||
if (id != that.id) return false;
|
||||
if (isActive != that.isActive) return false;
|
||||
if (isPublic != that.isPublic) return false;
|
||||
if (Double.compare(that.price, price) != 0) return false;
|
||||
if (architecture != null ? !architecture.equals(that.architecture) : that.architecture != null) return false;
|
||||
if (billingTokens != null ? !billingTokens.equals(that.billingTokens) : that.billingTokens != null)
|
||||
if (id != that.id)
|
||||
return false;
|
||||
if (isActive != that.isActive)
|
||||
return false;
|
||||
if (isPublic != that.isPublic)
|
||||
return false;
|
||||
if (Double.compare(that.price, price) != 0)
|
||||
return false;
|
||||
if (architecture != null ? !architecture.equals(that.architecture)
|
||||
: that.architecture != null)
|
||||
return false;
|
||||
if (billingTokens != null ? !billingTokens.equals(that.billingTokens)
|
||||
: that.billingTokens != null)
|
||||
return false;
|
||||
if (!createdTime.equals(that.createdTime))
|
||||
return false;
|
||||
if (description != null ? !description.equals(that.description) : that.description != null)
|
||||
return false;
|
||||
if (friendlyName != null ? !friendlyName.equals(that.friendlyName)
|
||||
: that.friendlyName != null)
|
||||
return false;
|
||||
if (location != null ? !location.equals(that.location) : that.location != null)
|
||||
return false;
|
||||
if (!name.equals(that.name))
|
||||
return false;
|
||||
if (!os.equals(that.os))
|
||||
return false;
|
||||
if (owner != null ? !owner.equals(that.owner) : that.owner != null)
|
||||
return false;
|
||||
if (!state.equals(that.state))
|
||||
return false;
|
||||
if (!type.equals(that.type))
|
||||
return false;
|
||||
if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null)
|
||||
return false;
|
||||
if (!createdTime.equals(that.createdTime)) return false;
|
||||
if (description != null ? !description.equals(that.description) : that.description != null) return false;
|
||||
if (friendlyName != null ? !friendlyName.equals(that.friendlyName) : that.friendlyName != null) return false;
|
||||
if (location != null ? !location.equals(that.location) : that.location != null) return false;
|
||||
if (!name.equals(that.name)) return false;
|
||||
if (!os.equals(that.os)) return false;
|
||||
if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
|
||||
if (!state.equals(that.state)) return false;
|
||||
if (!type.equals(that.type)) return false;
|
||||
if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -204,23 +222,11 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerImage{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", friendlyName='" + friendlyName + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", os=" + os +
|
||||
", architecture=" + architecture +
|
||||
", type=" + type +
|
||||
", state=" + state +
|
||||
", price=" + price +
|
||||
", location='" + location + '\'' +
|
||||
", isActive=" + isActive +
|
||||
", isPublic=" + isPublic +
|
||||
", createdTime=" + createdTime +
|
||||
", updatedTime=" + updatedTime +
|
||||
", billingTokens=" + billingTokens +
|
||||
", owner=" + owner +
|
||||
'}';
|
||||
return "ServerImage{" + "id=" + id + ", name='" + name + '\'' + ", friendlyName='"
|
||||
+ friendlyName + '\'' + ", description='" + description + '\'' + ", os=" + os
|
||||
+ ", architecture=" + architecture + ", type=" + type + ", state=" + state
|
||||
+ ", price=" + price + ", location='" + location + '\'' + ", isActive=" + isActive
|
||||
+ ", isPublic=" + isPublic + ", createdTime=" + createdTime + ", updatedTime="
|
||||
+ updatedTime + ", billingTokens=" + billingTokens + ", owner=" + owner + '}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue