mirror of https://github.com/apache/jclouds.git
Drive domain object (and subclasses) refer to tags, and not explicitly to affinity
This commit is contained in:
parent
e4eedf9b99
commit
ede85e28f5
|
@ -89,7 +89,7 @@ public class CreateDriveRequest extends Drive {
|
|||
}
|
||||
|
||||
public CreateDriveRequest build() {
|
||||
return new CreateDriveRequest(name, size, claimType, affinity, readers, use, encryptionCipher, avoid);
|
||||
return new CreateDriveRequest(name, size, claimType, tags, readers, use, encryptionCipher, avoid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,9 +97,9 @@ public class CreateDriveRequest extends Drive {
|
|||
@Nullable
|
||||
private final String encryptionCipher;
|
||||
|
||||
public CreateDriveRequest(String name, long size, @Nullable ClaimType claimType, AffinityType affinity,
|
||||
public CreateDriveRequest(String name, long size, @Nullable ClaimType claimType, Iterable<String> tags,
|
||||
Iterable<String> readers, Iterable<String> use, @Nullable String encryptionCipher, Iterable<String> avoid) {
|
||||
super(null, name, size, claimType, affinity, readers, use);
|
||||
super(null, name, size, claimType, tags, readers, use);
|
||||
this.encryptionCipher = encryptionCipher;
|
||||
this.avoid = ImmutableSet.copyOf(checkNotNull(avoid, "avoid"));
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +35,7 @@ public class Drive extends Item {
|
|||
public static class Builder extends Item.Builder {
|
||||
protected long size;
|
||||
protected ClaimType claimType = ClaimType.EXCLUSIVE;
|
||||
protected AffinityType affinity = AffinityType.HDD;
|
||||
protected Set<String> tags = ImmutableSet.of();
|
||||
protected Set<String> readers = ImmutableSet.of();
|
||||
|
||||
public Builder claimType(ClaimType claimType) {
|
||||
|
@ -42,8 +43,8 @@ public class Drive extends Item {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder affinity(AffinityType affinity) {
|
||||
this.affinity = affinity;
|
||||
public Builder tags(Iterable<String> tags) {
|
||||
this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class Drive extends Item {
|
|||
}
|
||||
|
||||
public Drive build() {
|
||||
return new Drive(uuid, name, size, claimType, affinity, readers, use);
|
||||
return new Drive(uuid, name, size, claimType, tags, readers, use);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,7 +91,7 @@ public class Drive extends Item {
|
|||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((claimType == null) ? 0 : claimType.hashCode());
|
||||
result = prime * result + ((affinity == null) ? 0 : affinity.hashCode());
|
||||
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
|
||||
result = prime * result + ((readers == null) ? 0 : readers.hashCode());
|
||||
result = prime * result + (int) (size ^ (size >>> 32));
|
||||
return result;
|
||||
|
@ -107,13 +108,10 @@ public class Drive extends Item {
|
|||
Builder other = (Builder) obj;
|
||||
if (claimType != other.claimType)
|
||||
return false;
|
||||
if (affinity != other.affinity)
|
||||
if (!Objects.equal(tags, other.tags))
|
||||
return false;
|
||||
if (!Objects.equal(readers, other.readers))
|
||||
return false;
|
||||
if (readers == null) {
|
||||
if (other.readers != null)
|
||||
return false;
|
||||
} else if (!readers.equals(other.readers))
|
||||
return false;
|
||||
if (size != other.size)
|
||||
return false;
|
||||
return true;
|
||||
|
@ -122,15 +120,15 @@ public class Drive extends Item {
|
|||
|
||||
protected final long size;
|
||||
protected final ClaimType claimType;
|
||||
protected final AffinityType affinity;
|
||||
protected final Set<String> tags;
|
||||
protected final Set<String> readers;
|
||||
|
||||
public Drive(@Nullable String uuid, String name, long size, @Nullable ClaimType claimType,
|
||||
AffinityType affinity, Iterable<String> readers, Iterable<String> use) {
|
||||
Iterable<String> tags, Iterable<String> readers, Iterable<String> use) {
|
||||
super(uuid, name, use);
|
||||
this.size = size;
|
||||
this.claimType = checkNotNull(claimType, "set claimType to exclusive, not null");
|
||||
this.affinity = checkNotNull(affinity, "affinity");
|
||||
this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags"));
|
||||
this.readers = ImmutableSet.copyOf(checkNotNull(readers, "readers"));
|
||||
}
|
||||
|
||||
|
@ -145,10 +143,10 @@ public class Drive extends Item {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return either 'HDD' (the default) or 'SSD' (for solid-state drives)
|
||||
* @return all tags associated with this drive, both user-specified and "system" tags (e.g. "affinity:ssd")
|
||||
*/
|
||||
public AffinityType getAffinity() {
|
||||
return affinity;
|
||||
public Set<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,7 +171,7 @@ public class Drive extends Item {
|
|||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((claimType == null) ? 0 : claimType.hashCode());
|
||||
result = prime * result + ((affinity == null) ? 0 : affinity.hashCode());
|
||||
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((readers == null) ? 0 : readers.hashCode());
|
||||
result = prime * result + (int) (size ^ (size >>> 32));
|
||||
|
@ -192,18 +190,12 @@ public class Drive extends Item {
|
|||
Drive other = (Drive) obj;
|
||||
if (claimType != other.claimType)
|
||||
return false;
|
||||
if (affinity != other.affinity)
|
||||
if (!Objects.equal(tags, other.tags))
|
||||
return false;
|
||||
if (!Objects.equal(name, other.name))
|
||||
return false;
|
||||
if (!Objects.equal(readers, other.readers))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (readers == null) {
|
||||
if (other.readers != null)
|
||||
return false;
|
||||
} else if (!readers.equals(other.readers))
|
||||
return false;
|
||||
if (size != other.size)
|
||||
return false;
|
||||
if (use == null) {
|
||||
|
|
|
@ -68,12 +68,12 @@ public class DriveData extends Drive {
|
|||
}
|
||||
|
||||
public DriveData build() {
|
||||
return new DriveData(uuid, name, size, claimType, affinity, readers, use);
|
||||
return new DriveData(uuid, name, size, claimType, tags, readers, use);
|
||||
}
|
||||
}
|
||||
|
||||
public DriveData(@Nullable String uuid, String name, long size, @Nullable ClaimType claimType,
|
||||
AffinityType affinity, Iterable<String> readers, Iterable<String> use) {
|
||||
super(uuid, name, size, claimType, affinity, readers, use);
|
||||
Iterable<String> tags, Iterable<String> readers, Iterable<String> use) {
|
||||
super(uuid, name, size, claimType, tags, readers, use);
|
||||
}
|
||||
}
|
|
@ -195,7 +195,7 @@ public class DriveInfo extends Drive {
|
|||
*/
|
||||
@Override
|
||||
public DriveInfo build() {
|
||||
return new DriveInfo(uuid, name, size, claimType, affinity, readers, use, status, user, claimed, encryptionCipher,
|
||||
return new DriveInfo(uuid, name, size, claimType, tags, readers, use, status, user, claimed, encryptionCipher,
|
||||
imaging, metrics, autoexpanding, bits, description, driveType, encryptionKey, free, installNotes, os,
|
||||
type, url);
|
||||
}
|
||||
|
@ -221,12 +221,12 @@ public class DriveInfo extends Drive {
|
|||
private final DriveType type;
|
||||
private final URI url;
|
||||
|
||||
public DriveInfo(String uuid, String name, long size, ClaimType claimType, AffinityType affinity, Iterable<String> readers,
|
||||
public DriveInfo(String uuid, String name, long size, ClaimType claimType, Iterable<String> tags, Iterable<String> readers,
|
||||
Iterable<String> use, DriveStatus status, String user, Set<String> claimed, String encryptionCipher,
|
||||
String imaging, DriveMetrics metrics, Boolean autoexpanding, Integer bits, String description,
|
||||
Iterable<String> driveType, String encryptionKey, Boolean free, String installNotes, String os,
|
||||
DriveType type, URI url) {
|
||||
super(uuid, name, size, claimType, affinity, readers, use);
|
||||
super(uuid, name, size, claimType, tags, readers, use);
|
||||
this.status = status;
|
||||
this.user = user;
|
||||
this.claimed = ImmutableSet.copyOf(checkNotNull(claimed, "claimed"));
|
||||
|
|
Loading…
Reference in New Issue