diff --git a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/AllowedArgumentsForCreateServer.java b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/AllowedArgumentsForCreateServer.java index 068bb6bba7..8769902833 100644 --- a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/AllowedArgumentsForCreateServer.java +++ b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/AllowedArgumentsForCreateServer.java @@ -20,15 +20,15 @@ package org.jclouds.glesys.domain; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.Arrays; -import java.util.List; +import java.util.Set; import com.google.common.base.Joiner; import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; import com.google.gson.annotations.SerializedName; /** - * Lists the allowed arguments for some of the functions in this module such as disksize, cpucores etc. + * Sets the allowed arguments for some of the functions in this module such as disksize, cpucores etc. * * @author Adam Lowe * @see @@ -39,64 +39,64 @@ public class AllowedArgumentsForCreateServer { } public static class Builder { - private List diskSizes; - private List memorySizes; - private List cpuCores; - private List templates; - private List transfers; - private List dataCenters; + private Set diskSizes; + private Set memorySizes; + private Set cpuCores; + private Set templates; + private Set transfers; + private Set dataCenters; public Builder diskSizes(Integer... sizes) { - return diskSizes(Arrays.asList(sizes)); + return diskSizes(ImmutableSet.copyOf(sizes)); } - public Builder diskSizes(List sizes) { + public Builder diskSizes(Set sizes) { this.diskSizes = sizes; return this; } public Builder memorySizes(Integer... sizes) { - return memorySizes(Arrays.asList(sizes)); + return memorySizes(ImmutableSet.copyOf(sizes)); } - public Builder memorySizes(List sizes) { + public Builder memorySizes(Set sizes) { this.memorySizes = sizes; return this; } public Builder cpuCores(Integer... cpuCores) { - this.cpuCores = Arrays.asList(cpuCores); + this.cpuCores = ImmutableSet.copyOf(cpuCores); return this; } - public Builder cpuCores(List cpuCores) { + public Builder cpuCores(Set cpuCores) { this.cpuCores = cpuCores; return this; } public Builder templates(String... templates) { - return templates(Arrays.asList(templates)); + return templates(ImmutableSet.copyOf(templates)); } - public Builder templates(List templates) { + public Builder templates(Set templates) { this.templates = templates; return this; } public Builder transfers(Integer... transfers) { - return transfers(Arrays.asList(transfers)); + return transfers(ImmutableSet.copyOf(transfers)); } - public Builder transfers(List transfers) { + public Builder transfers(Set transfers) { this.transfers = transfers; return this; } public Builder dataCenters(String... dataCenters) { - return dataCenters(Arrays.asList(dataCenters)); + return dataCenters(ImmutableSet.copyOf(dataCenters)); } - public Builder dataCenters(List dataCenters) { + public Builder dataCenters(Set dataCenters) { this.dataCenters = dataCenters; return this; } @@ -106,30 +106,30 @@ public class AllowedArgumentsForCreateServer { } public Builder fromAllowedArguments(AllowedArgumentsForCreateServer in) { - return diskSizes(in.getDiskSizes()) - .memorySizes(in.getMemorySizes()) - .cpuCores(in.getCpuCores()) - .templates(in.getTemplates()) - .transfers(in.getTransfers()) + return diskSizes(in.getDiskSizesInGB()) + .memorySizes(in.getMemorySizesInMB()) + .cpuCores(in.getCpuCoreOptions()) + .templates(in.getTemplateNames()) + .transfers(in.getTransfersInGB()) .dataCenters(in.getDataCenters()); } } @SerializedName("disksize") - private final List diskSizes; + private final Set diskSizes; @SerializedName("memorysize") - private final List memorySizes; + private final Set memorySizes; @SerializedName("cpucores") - private final List cpuCores; + private final Set cpuCores; @SerializedName("template") - private final List templates; + private final Set templates; @SerializedName("transfer") - private final List transfers; + private final Set transfers; @SerializedName("datacenter") - private final List dataCenters; + private final Set dataCenters; - public AllowedArgumentsForCreateServer(List diskSizes, List memorySizes, List cpuCores, - List templates, List transfers, List dataCenters) { + public AllowedArgumentsForCreateServer(Set diskSizes, Set memorySizes, Set cpuCores, + Set templates, Set transfers, Set dataCenters) { checkNotNull(diskSizes, "diskSizes"); checkNotNull(memorySizes, "memorySizes"); checkNotNull(cpuCores, "cpuCores"); @@ -147,46 +147,46 @@ public class AllowedArgumentsForCreateServer { /** * @return a list of disk sizes, in GB, that can be used for creating servers on this platform - * @see org.jclouds.glesys.domain.Template#getMinDiskSize() + * @see org.jclouds.glesys.domain.OSTemplate#getMinDiskSize() */ - public List getDiskSizes() { + public Set getDiskSizesInGB() { return diskSizes; } /** * @return a list of memory sizes, in MB, that can be used for creating servers on this platform - * @see org.jclouds.glesys.domain.Template#getMinMemSize() + * @see org.jclouds.glesys.domain.OSTemplate#getMinMemSize() */ - public List getMemorySizes() { + public Set getMemorySizesInMB() { return memorySizes; } /** * @return a list of which core counts can be used for creating servers on this platform */ - public List getCpuCores() { + public Set getCpuCoreOptions() { return cpuCores; } /** * @return a list of template names available for creating servers on this platform - * @see org.jclouds.glesys.domain.Template#getName() + * @see org.jclouds.glesys.domain.OSTemplate#getName() */ - public List getTemplates() { + public Set getTemplateNames() { return templates; } /** * @return the list of transfer settings available for creating servers on this platform */ - public List getTransfers() { + public Set getTransfersInGB() { return transfers; } /** * @return the list of datacenters available that support creating servers on this platform */ - public List getDataCenters() { + public Set getDataCenters() { return dataCenters; } diff --git a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Template.java b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/OSTemplate.java similarity index 88% rename from sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Template.java rename to sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/OSTemplate.java index e068f7ceae..e516280554 100644 --- a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/Template.java +++ b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/domain/OSTemplate.java @@ -28,7 +28,7 @@ import com.google.gson.annotations.SerializedName; * @author Adam Lowe * @see */ -public class Template implements Comparable