mirror of https://github.com/apache/jclouds.git
VCloud Director 1.5: making sure collections in domain objects are immutable
This commit is contained in:
parent
969c5132eb
commit
d1b0da081d
|
@ -23,11 +23,13 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
|
@ -98,7 +100,7 @@ public class AvailableNetworks {
|
|||
protected Set<Reference> networks = Sets.newLinkedHashSet();
|
||||
|
||||
private AvailableNetworks(Set<Reference> networks) {
|
||||
this.networks = networks;
|
||||
this.networks = ImmutableSet.copyOf(networks);
|
||||
}
|
||||
|
||||
private AvailableNetworks() {
|
||||
|
@ -109,7 +111,7 @@ public class AvailableNetworks {
|
|||
* Gets the value of the network property.
|
||||
*/
|
||||
public Set<Reference> getNetworks() {
|
||||
return this.networks;
|
||||
return Collections.unmodifiableSet(this.networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -101,12 +102,10 @@ public class CaptureVAppParams
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CaptureVAppParams build() {
|
||||
return new CaptureVAppParams(description, name, source, sections);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromParamsType(ParamsType<CaptureVAppParams> in) {
|
||||
return Builder.class.cast(super.fromParamsType(in));
|
||||
|
@ -133,7 +132,6 @@ public class CaptureVAppParams
|
|||
this.sections = ImmutableSet.copyOf(sections);
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name = "Source", required = true)
|
||||
protected Reference source;
|
||||
@XmlElementRef
|
||||
|
@ -151,22 +149,9 @@ public class CaptureVAppParams
|
|||
|
||||
/**
|
||||
* An ovf:Section to configure the captured vAppTemplate.
|
||||
* Gets the value of the section property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the section property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getSection().add(newItem);
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* Gets the value of the section property.
|
||||
*
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link JAXBElement }{@code <}{@link Section> }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >}
|
||||
|
@ -188,7 +173,7 @@ public class CaptureVAppParams
|
|||
* {@link JAXBElement }{@code <}{@link InstallSection> }{@code >}
|
||||
*/
|
||||
public Set<? extends Section<?>> getSections() {
|
||||
return this.sections;
|
||||
return Collections.unmodifiableSet(this.sections);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -173,7 +174,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
private CatalogItem(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Reference entity, Set<Property> properties) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
this.entity = entity;
|
||||
this.properties = properties;
|
||||
this.properties = ImmutableSet.copyOf(properties);
|
||||
}
|
||||
|
||||
private CatalogItem() {
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -86,11 +87,11 @@ public class CatalogItems {
|
|||
}
|
||||
|
||||
private CatalogItems() {
|
||||
// For JAXB and builder use
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
private CatalogItems(Set<Reference> catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
this.catalogItems = ImmutableSet.copyOf(catalogItems);
|
||||
}
|
||||
|
||||
@XmlElement(name = "CatalogItem")
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -62,16 +63,8 @@ public class CatalogsList {
|
|||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogs(Collection<Reference> catalogReferences) {
|
||||
this.catalogReferences = Sets.newLinkedHashSet(checkNotNull(catalogReferences, "catalogReferences"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalog(Reference catalog) {
|
||||
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
|
||||
public Builder catalogs(Set<Reference> catalogReferences) {
|
||||
this.catalogReferences = checkNotNull(catalogReferences, "catalogReferences");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -99,7 +92,7 @@ public class CatalogsList {
|
|||
* Gets the value of the catalogReferences property.
|
||||
*/
|
||||
public Set<Reference> getCatalogItems() {
|
||||
return this.catalogReferences;
|
||||
return Collections.unmodifiableSet(this.catalogReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -57,7 +58,7 @@ import com.google.common.collect.Sets;
|
|||
* </pre>
|
||||
*/
|
||||
@XmlType(name = "ComposeVAppParams", propOrder = {
|
||||
"sourcedItem",
|
||||
"sourcedItems",
|
||||
"allEULAsAccepted"
|
||||
})
|
||||
@XmlSeeAlso({
|
||||
|
@ -78,15 +79,15 @@ public class ComposeVAppParams
|
|||
|
||||
public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> {
|
||||
|
||||
private Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
|
||||
private Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
|
||||
private Boolean allEULAsAccepted;
|
||||
private Boolean linkedClone;
|
||||
|
||||
/**
|
||||
* @see ComposeVAppParams#getSourcedItem()
|
||||
* @see ComposeVAppParams#getSourcedItems()
|
||||
*/
|
||||
public Builder sourcedItem(Set<SourcedCompositionItemParam> sourcedItem) {
|
||||
this.sourcedItem = checkNotNull(sourcedItem, "sourcedItem");
|
||||
public Builder sourcedItems(Set<SourcedCompositionItemParam> sourcedItems) {
|
||||
this.sourcedItems = checkNotNull(sourcedItems, "sourcedItems");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -109,7 +110,7 @@ public class ComposeVAppParams
|
|||
|
||||
public ComposeVAppParams build() {
|
||||
return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn,
|
||||
sourcedItem, allEULAsAccepted, linkedClone);
|
||||
sourcedItems, allEULAsAccepted, linkedClone);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,16 +121,16 @@ public class ComposeVAppParams
|
|||
|
||||
public Builder fromComposeVAppParams(ComposeVAppParams in) {
|
||||
return fromVAppCreationParamsType(in)
|
||||
.sourcedItem(in.getSourcedItem())
|
||||
.sourcedItems(in.getSourcedItems())
|
||||
.allEULAsAccepted(in.isAllEULAsAccepted())
|
||||
.linkedClone(in.isLinkedClone());
|
||||
}
|
||||
}
|
||||
|
||||
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
|
||||
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItem, Boolean allEULAsAccepted, Boolean linkedClone) {
|
||||
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItems, Boolean allEULAsAccepted, Boolean linkedClone) {
|
||||
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
|
||||
this.sourcedItem = ImmutableSet.copyOf(sourcedItem);
|
||||
this.sourcedItems = ImmutableSet.copyOf(sourcedItems);
|
||||
this.allEULAsAccepted = allEULAsAccepted;
|
||||
this.linkedClone = linkedClone;
|
||||
}
|
||||
|
@ -140,7 +141,7 @@ public class ComposeVAppParams
|
|||
|
||||
|
||||
@XmlElement(name = "SourcedItem")
|
||||
protected Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
|
||||
protected Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
|
||||
@XmlElement(name = "AllEULAsAccepted")
|
||||
protected Boolean allEULAsAccepted;
|
||||
@XmlAttribute
|
||||
|
@ -148,26 +149,9 @@ public class ComposeVAppParams
|
|||
|
||||
/**
|
||||
* Gets the value of the sourcedItem property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the sourcedItem property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getSourcedItem().add(newItem);
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link SourcedCompositionItemParam }
|
||||
*/
|
||||
public Set<SourcedCompositionItemParam> getSourcedItem() {
|
||||
return this.sourcedItem;
|
||||
public Set<SourcedCompositionItemParam> getSourcedItems() {
|
||||
return Collections.unmodifiableSet(this.sourcedItems);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,14 +185,14 @@ public class ComposeVAppParams
|
|||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ComposeVAppParams that = ComposeVAppParams.class.cast(o);
|
||||
return equal(sourcedItem, that.sourcedItem) &&
|
||||
return equal(sourcedItems, that.sourcedItems) &&
|
||||
equal(allEULAsAccepted, that.allEULAsAccepted) &&
|
||||
equal(linkedClone, that.linkedClone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(sourcedItem,
|
||||
return Objects.hashCode(sourcedItems,
|
||||
allEULAsAccepted,
|
||||
linkedClone);
|
||||
}
|
||||
|
@ -216,7 +200,7 @@ public class ComposeVAppParams
|
|||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("sourcedItem", sourcedItem)
|
||||
.add("sourcedItem", sourcedItems)
|
||||
.add("allEULAsAccepted", allEULAsAccepted)
|
||||
.add("linkedClone", linkedClone).toString();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -187,7 +188,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
|
|||
* Gets the value of the links property.
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return this.links;
|
||||
return Collections.unmodifiableSet(this.links);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -112,7 +113,7 @@ public class FilesList {
|
|||
* Gets the value of the file property.
|
||||
*/
|
||||
public List<File> getFiles() {
|
||||
return this.files;
|
||||
return Collections.unmodifiableList(this.files);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -237,7 +237,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink()
|
||||
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLinks()
|
||||
*/
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = checkNotNull(links, "links");
|
||||
|
@ -285,7 +285,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
|
|||
.resetPasswordRequired(in.isResetPasswordRequired())
|
||||
.customizationScript(in.getCustomizationScript())
|
||||
.computerName(in.getComputerName())
|
||||
.links(in.getLink())
|
||||
.links(in.getLinks())
|
||||
.href(in.getHref())
|
||||
.type(in.getType());
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
|
|||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Link }
|
||||
*/
|
||||
public Set<Link> getLink() {
|
||||
public Set<Link> getLinks() {
|
||||
return Collections.unmodifiableSet(this.links);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
|
@ -105,7 +106,7 @@ public class InstantiationParams {
|
|||
}
|
||||
|
||||
|
||||
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
|
||||
@XmlElementRef
|
||||
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
|
@ -113,20 +114,6 @@ public class InstantiationParams {
|
|||
* <p/>
|
||||
* Gets the value of the section property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the section property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getSection().add(newItem);
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
|
||||
|
@ -148,7 +135,7 @@ public class InstantiationParams {
|
|||
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
|
||||
*/
|
||||
public Set<? extends SectionType<?>> getSections() {
|
||||
return this.sections;
|
||||
return Collections.unmodifiableSet(this.sections);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -52,7 +53,7 @@ public class IpAddresses {
|
|||
* @see IpAddresses#getIpAddresses()
|
||||
*/
|
||||
public Builder ipAddresses(Set<String> ipAddresses) {
|
||||
this.ipAddresses = Sets.newLinkedHashSet(checkNotNull(ipAddresses, "ipAddresses"));
|
||||
this.ipAddresses.addAll(checkNotNull(ipAddresses, "ipAddresses"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class IpAddresses {
|
|||
private Set<String> ipAddresses = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<String> getIpAddresses() {
|
||||
return ImmutableSet.copyOf(ipAddresses);
|
||||
return Collections.unmodifiableSet(ipAddresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -85,7 +87,7 @@ public class IpRanges {
|
|||
private Set<IpRange> ipRanges = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<IpRange> getIpRanges() {
|
||||
return ImmutableSet.copyOf(ipRanges);
|
||||
return Collections.unmodifiableSet(ipRanges);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,18 +24,20 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
|
@ -88,8 +90,8 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
private Integer deploymentLeaseInSeconds;
|
||||
private Integer storageLeaseInSeconds;
|
||||
private XMLGregorianCalendar deploymentLeaseExpiration;
|
||||
private XMLGregorianCalendar storageLeaseExpiration;
|
||||
private Date deploymentLeaseExpiration;
|
||||
private Date storageLeaseExpiration;
|
||||
private URI href;
|
||||
private String type;
|
||||
|
||||
|
@ -120,7 +122,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
/**
|
||||
* @see LeaseSettingsSection#getDeploymentLeaseExpiration()
|
||||
*/
|
||||
public Builder deploymentLeaseExpiration(XMLGregorianCalendar deploymentLeaseExpiration) {
|
||||
public Builder deploymentLeaseExpiration(Date deploymentLeaseExpiration) {
|
||||
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
|
||||
return this;
|
||||
}
|
||||
|
@ -128,7 +130,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
/**
|
||||
* @see LeaseSettingsSection#getStorageLeaseExpiration()
|
||||
*/
|
||||
public Builder storageLeaseExpiration(XMLGregorianCalendar storageLeaseExpiration) {
|
||||
public Builder storageLeaseExpiration(Date storageLeaseExpiration) {
|
||||
this.storageLeaseExpiration = storageLeaseExpiration;
|
||||
return this;
|
||||
}
|
||||
|
@ -200,10 +202,10 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
protected Integer storageLeaseInSeconds;
|
||||
@XmlElement(name = "DeploymentLeaseExpiration")
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar deploymentLeaseExpiration;
|
||||
protected Date deploymentLeaseExpiration;
|
||||
@XmlElement(name = "StorageLeaseExpiration")
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar storageLeaseExpiration;
|
||||
protected Date storageLeaseExpiration;
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
protected URI href;
|
||||
|
@ -211,10 +213,10 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
protected String type;
|
||||
|
||||
private LeaseSettingsSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Integer deploymentLeaseInSeconds,
|
||||
Integer storageLeaseInSeconds, XMLGregorianCalendar deploymentLeaseExpiration,
|
||||
XMLGregorianCalendar storageLeaseExpiration, URI href, String type) {
|
||||
Integer storageLeaseInSeconds, Date deploymentLeaseExpiration,
|
||||
Date storageLeaseExpiration, URI href, String type) {
|
||||
super(info, required);
|
||||
this.links = links;
|
||||
this.links = ImmutableSet.copyOf(links);
|
||||
this.deploymentLeaseInSeconds = deploymentLeaseInSeconds;
|
||||
this.storageLeaseInSeconds = storageLeaseInSeconds;
|
||||
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
|
||||
|
@ -229,23 +231,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
|
||||
/**
|
||||
* Gets the value of the link property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the link property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getLink().add(newItem);
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Link }
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return Collections.unmodifiableSet(this.links);
|
||||
|
@ -273,21 +258,15 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
|
|||
|
||||
/**
|
||||
* Gets the value of the deploymentLeaseExpiration property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*/
|
||||
public XMLGregorianCalendar getDeploymentLeaseExpiration() {
|
||||
public Date getDeploymentLeaseExpiration() {
|
||||
return deploymentLeaseExpiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the storageLeaseExpiration property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*/
|
||||
public XMLGregorianCalendar getStorageLeaseExpiration() {
|
||||
public Date getStorageLeaseExpiration() {
|
||||
return storageLeaseExpiration;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -105,8 +106,7 @@ public class Metadata extends ResourceType<Metadata> {
|
|||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,7 +145,7 @@ public class Metadata extends ResourceType<Metadata> {
|
|||
private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<MetadataEntry> getMetadataEntries() {
|
||||
return ImmutableSet.copyOf(metadataEntries);
|
||||
return Collections.unmodifiableSet(metadataEntries);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,7 +81,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
|
|||
public static class Builder extends SectionType.Builder<NetworkConfigSection> {
|
||||
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
private Set<VAppNetworkConfiguration<?>> networkConfigs = Sets.newLinkedHashSet();
|
||||
private Set<VAppNetworkConfiguration> networkConfigs = Sets.newLinkedHashSet();
|
||||
private URI href;
|
||||
private String type;
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
|
|||
/**
|
||||
* @see NetworkConfigSection#getNetworkConfigs()
|
||||
*/
|
||||
public Builder networkConfig(Set<VAppNetworkConfiguration<?>> networkConfigs) {
|
||||
public Builder networkConfigs(Set<VAppNetworkConfiguration> networkConfigs) {
|
||||
this.networkConfigs = checkNotNull(networkConfigs, "networkConfigs");
|
||||
return this;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
|
|||
public Builder fromNetworkConfigSection(NetworkConfigSection in) {
|
||||
return fromSection(in)
|
||||
.links(in.getLinks())
|
||||
.networkConfig(in.getNetworkConfigs())
|
||||
.networkConfigs(in.getNetworkConfigs())
|
||||
.href(in.getHref())
|
||||
.type(in.getType());
|
||||
}
|
||||
|
@ -157,16 +157,16 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
|
|||
}
|
||||
|
||||
@XmlElement(name = "Link")
|
||||
protected Set<Link> links;
|
||||
protected Set<Link> links = Sets.newLinkedHashSet();
|
||||
@XmlElement(name = "NetworkConfig")
|
||||
protected Set<VAppNetworkConfiguration<?>> networkConfigs;
|
||||
protected Set<VAppNetworkConfiguration> networkConfigs = Sets.newLinkedHashSet();
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
protected URI href;
|
||||
@XmlAttribute
|
||||
protected String type;
|
||||
|
||||
public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Set<VAppNetworkConfiguration<?>> networkConfigs,
|
||||
public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Set<VAppNetworkConfiguration> networkConfigs,
|
||||
URI href, String type) {
|
||||
super(info, required);
|
||||
this.links = ImmutableSet.copyOf(links);
|
||||
|
@ -189,7 +189,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
|
|||
/**
|
||||
* Gets the value of the networkConfig property.
|
||||
*/
|
||||
public Set<VAppNetworkConfiguration<?>> getNetworkConfigs() {
|
||||
public Set<VAppNetworkConfiguration> getNetworkConfigs() {
|
||||
return Collections.unmodifiableSet(this.networkConfigs);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ public class NetworkConfiguration {
|
|||
|
||||
public static class Builder {
|
||||
private IpScope ipScope;
|
||||
private ReferenceType<?> parentNetwork;
|
||||
private Reference parentNetwork;
|
||||
private String fenceMode;
|
||||
private boolean retainNetInfoAcrossDeployments;
|
||||
private Boolean retainNetInfoAcrossDeployments;
|
||||
private NetworkFeatures features;
|
||||
private SyslogServerSettings syslogServerSettings;
|
||||
private RouterInfo routerInfo;
|
||||
|
@ -62,7 +62,7 @@ public class NetworkConfiguration {
|
|||
/**
|
||||
* @see NetworkConfiguration#getParentNetwork()
|
||||
*/
|
||||
public Builder parentNetwork(ReferenceType<?> parentNetwork) {
|
||||
public Builder parentNetwork(Reference parentNetwork) {
|
||||
this.parentNetwork = parentNetwork;
|
||||
return this;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class NetworkConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public NetworkConfiguration(IpScope ipScope, ReferenceType<?> parentNetwork, String fenceMode, boolean retainNetInfoAcrossDeployments,
|
||||
public NetworkConfiguration(IpScope ipScope, Reference parentNetwork, String fenceMode, Boolean retainNetInfoAcrossDeployments,
|
||||
NetworkFeatures features, SyslogServerSettings syslogServerSettings, RouterInfo routerInfo) {
|
||||
this.ipScope = ipScope;
|
||||
this.parentNetwork = parentNetwork;
|
||||
|
@ -138,11 +138,11 @@ public class NetworkConfiguration {
|
|||
@XmlElement(name = "IpScope")
|
||||
private IpScope ipScope;
|
||||
@XmlElement(name = "ParentNetwork")
|
||||
private ReferenceType<?> parentNetwork;
|
||||
private Reference parentNetwork;
|
||||
@XmlElement(name = "FenceMode")
|
||||
private String fenceMode;
|
||||
@XmlElement(name = "RetainNetInfoAcrossDeployments")
|
||||
private boolean retainNetInfoAcrossDeployments = false;
|
||||
private Boolean retainNetInfoAcrossDeployments;
|
||||
@XmlElement(name = "Features")
|
||||
private NetworkFeatures features;
|
||||
@XmlElement(name = "SyslogServerSettings")
|
||||
|
@ -162,7 +162,7 @@ public class NetworkConfiguration {
|
|||
/**
|
||||
* @return reference to parent network.
|
||||
*/
|
||||
public ReferenceType<?> getParentNetwork() {
|
||||
public Reference getParentNetwork() {
|
||||
return parentNetwork;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,8 @@ public class NetworkConfiguration {
|
|||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
NetworkConfiguration that = NetworkConfiguration.class.cast(o);
|
||||
return equal(ipScope, that.ipScope) && equal(parentNetwork, that.parentNetwork) &&
|
||||
return equal(ipScope, that.ipScope) &&
|
||||
equal(parentNetwork, that.parentNetwork) &&
|
||||
equal(fenceMode, that.fenceMode) &&
|
||||
equal(retainNetInfoAcrossDeployments, that.retainNetInfoAcrossDeployments) &&
|
||||
equal(features, that.features) &&
|
||||
|
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -83,7 +84,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
|
|||
public static class Builder extends SectionType.Builder<NetworkConnectionSection> {
|
||||
|
||||
private Integer primaryNetworkConnectionIndex;
|
||||
private Set<NetworkConnection> networkConnection = Sets.newLinkedHashSet();
|
||||
private Set<NetworkConnection> networkConnections = Sets.newLinkedHashSet();
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
private URI href;
|
||||
private String type;
|
||||
|
@ -99,8 +100,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
|
|||
/**
|
||||
* @see NetworkConnectionSection#getNetworkConnections()
|
||||
*/
|
||||
public Builder networkConnection(Set<NetworkConnection> networkConnection) {
|
||||
this.networkConnection = checkNotNull(networkConnection, "networkConnection");
|
||||
public Builder networkConnections(Set<NetworkConnection> networkConnections) {
|
||||
this.networkConnections = checkNotNull(networkConnections, "networkConnection");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -130,14 +131,14 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
|
|||
|
||||
|
||||
public NetworkConnectionSection build() {
|
||||
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnection, links, href, type);
|
||||
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnections, links, href, type);
|
||||
|
||||
}
|
||||
|
||||
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
|
||||
return fromSection(in)
|
||||
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
|
||||
.networkConnection(in.getNetworkConnections())
|
||||
.networkConnections(in.getNetworkConnections())
|
||||
.links(in.getLinks())
|
||||
.href(in.getHref())
|
||||
.type(in.getType());
|
||||
|
@ -212,7 +213,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
|
|||
* {@link NetworkConnection }
|
||||
*/
|
||||
public Set<NetworkConnection> getNetworkConnections() {
|
||||
return this.networkConnections;
|
||||
return Collections.unmodifiableSet(this.networkConnections);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,7 +223,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
|
|||
* {@link Link }
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return this.links;
|
||||
return Collections.unmodifiableSet(this.links);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,8 +21,10 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
@ -47,12 +49,12 @@ public class NetworkFeatures {
|
|||
|
||||
public static class Builder {
|
||||
|
||||
private Set<NetworkService> services = Sets.newLinkedHashSet();
|
||||
private Set<NetworkServiceType> services = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see NetworkFeatures#getNetworkServices()
|
||||
*/
|
||||
public Builder services(Set<NetworkService> services) {
|
||||
public Builder services(Set<NetworkServiceType> services) {
|
||||
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
|
||||
return this;
|
||||
}
|
||||
|
@ -60,7 +62,7 @@ public class NetworkFeatures {
|
|||
/**
|
||||
* @see NetworkFeatures#getNetworkServices()
|
||||
*/
|
||||
public Builder service(NetworkService service) {
|
||||
public Builder service(NetworkServiceType service) {
|
||||
services.add(checkNotNull(service, "service"));
|
||||
return this;
|
||||
}
|
||||
|
@ -78,19 +80,19 @@ public class NetworkFeatures {
|
|||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
public NetworkFeatures(Set<NetworkService> services) {
|
||||
this.services = services;
|
||||
public NetworkFeatures(Set<NetworkServiceType> services) {
|
||||
this.services = ImmutableSet.copyOf(services);
|
||||
}
|
||||
|
||||
@XmlElement(name = "NetworkService")
|
||||
private Set<NetworkService> services = Sets.newLinkedHashSet();
|
||||
@XmlElementRef
|
||||
private Set<NetworkServiceType> services = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @return a Network service. May be any of DhcpService, NatService, IpsecVpnService,
|
||||
* DhcpService, or StaticRoutingService.
|
||||
*/
|
||||
public Set<NetworkService> getNetworkServices() {
|
||||
return ImmutableSet.copyOf(services);
|
||||
public Set<NetworkServiceType> getNetworkServices() {
|
||||
return Collections.unmodifiableSet(services);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -90,7 +91,7 @@ public class OrgList {
|
|||
private Set<Reference> orgs = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<Reference> getOrgs() {
|
||||
return ImmutableSet.copyOf(orgs);
|
||||
return Collections.unmodifiableSet(orgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
@ -55,7 +56,7 @@ import com.google.common.collect.Sets;
|
|||
* </pre>
|
||||
*/
|
||||
@XmlType(name = "ProductSectionList", propOrder = {
|
||||
"productSection"
|
||||
"productSections"
|
||||
})
|
||||
public class ProductSectionList
|
||||
extends ResourceType<ProductSectionList>
|
||||
|
@ -76,9 +77,9 @@ public class ProductSectionList
|
|||
private Set<ProductSection> productSections = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see ProductSectionList#getProductSection()
|
||||
* @see ProductSectionList#getProductSections()
|
||||
*/
|
||||
public Builder productSection(Set<ProductSection> productSections) {
|
||||
public Builder productSections(Set<ProductSection> productSections) {
|
||||
this.productSections = checkNotNull(productSections, "productSection");
|
||||
return this;
|
||||
}
|
||||
|
@ -89,7 +90,6 @@ public class ProductSectionList
|
|||
return productSectionList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
|
@ -134,7 +134,7 @@ public class ProductSectionList
|
|||
|
||||
public Builder fromProductSectionList(ProductSectionList in) {
|
||||
return fromResourceType(in)
|
||||
.productSection(in.getProductSection());
|
||||
.productSections(in.getProductSections());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,19 +142,19 @@ public class ProductSectionList
|
|||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private ProductSectionList(Set<ProductSection> productSection) {
|
||||
this.productSection = ImmutableSet.copyOf(productSection);
|
||||
private ProductSectionList(Set<ProductSection> productSections) {
|
||||
this.productSections = ImmutableSet.copyOf(productSections);
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
|
||||
protected Set<ProductSection> productSection = Sets.newLinkedHashSet();
|
||||
protected Set<ProductSection> productSections = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* Gets the value of the productSection property.
|
||||
*/
|
||||
public Set<ProductSection> getProductSection() {
|
||||
return this.productSection;
|
||||
public Set<ProductSection> getProductSections() {
|
||||
return Collections.unmodifiableSet(this.productSections);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,18 +164,18 @@ public class ProductSectionList
|
|||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ProductSectionList that = ProductSectionList.class.cast(o);
|
||||
return equal(productSection, that.productSection);
|
||||
return equal(productSections, that.productSections);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(productSection);
|
||||
return Objects.hashCode(productSections);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("productSection", productSection).toString();
|
||||
.add("productSections", productSections).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,15 @@
|
|||
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* Parameters to be used for vm relocation.
|
||||
|
@ -43,13 +49,38 @@ import javax.xml.bind.annotation.XmlType;
|
|||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlType(name = "RelocateParams", propOrder = {
|
||||
@XmlRootElement(name = "RelocateParams")
|
||||
@XmlType(propOrder = {
|
||||
"datastore"
|
||||
})
|
||||
public class RelocateParams {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Reference datastore;
|
||||
|
||||
public Builder datastore(Reference dataStore) {
|
||||
this.datastore = dataStore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RelocateParams build() {
|
||||
return new RelocateParams(datastore);
|
||||
}
|
||||
}
|
||||
|
||||
@XmlElement(name = "Datastore", required = true)
|
||||
protected ReferenceType<?> datastore;
|
||||
private Reference datastore;
|
||||
|
||||
private RelocateParams(Reference datastore) {
|
||||
this.datastore = checkNotNull(datastore);
|
||||
}
|
||||
|
||||
private RelocateParams() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the datastore property.
|
||||
|
@ -60,4 +91,25 @@ public class RelocateParams {
|
|||
public ReferenceType<?> getDatastore() {
|
||||
return datastore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
RelocateParams that = RelocateParams.class.cast(o);
|
||||
return equal(datastore, that.datastore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(datastore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("datastore", datastore).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
@ -72,7 +73,7 @@ public class ResourceEntities {
|
|||
* @see ResourceEntities#getResourceEntities()
|
||||
*/
|
||||
public Builder resourceEntities(Set<Reference> resourceEntities) {
|
||||
this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
|
||||
this.resourceEntities = Sets.newLinkedHashSet(checkNotNull(resourceEntities, "resourceEntities"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -110,7 +111,7 @@ public class ResourceEntities {
|
|||
* Gets the value of the resourceEntity property.
|
||||
*/
|
||||
public Set<Reference> getResourceEntities() {
|
||||
return this.resourceEntities;
|
||||
return Collections.unmodifiableSet(this.resourceEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,12 +22,14 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -100,7 +102,7 @@ public abstract class ResourceType<T extends ResourceType<T>> implements URISupp
|
|||
protected ResourceType(URI href, String type, Set<Link> links) {
|
||||
this.href = href;
|
||||
this.type = type;
|
||||
this.links = links;
|
||||
this.links = ImmutableSet.copyOf(links);
|
||||
}
|
||||
|
||||
protected ResourceType() {
|
||||
|
@ -148,7 +150,7 @@ public abstract class ResourceType<T extends ResourceType<T>> implements URISupp
|
|||
* Set of optional links to an entity or operation associated with this object.
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return links;
|
||||
return Collections.unmodifiableSet(links);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -129,7 +130,7 @@ public class Session {
|
|||
private URI href;
|
||||
|
||||
public Set<Link> getLinks() {
|
||||
return ImmutableSet.copyOf(links);
|
||||
return Collections.unmodifiableSet(links);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
@ -107,7 +109,7 @@ public class SourcedCompositionItemParam {
|
|||
* @see SourcedCompositionItemParam#getNetworkAssignments()
|
||||
*/
|
||||
public Builder networkAssignments(Set<NetworkAssignment> networkAssignments) {
|
||||
this.networkAssignments = networkAssignments;
|
||||
this.networkAssignments = checkNotNull(networkAssignments, "networkAssignments");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -189,26 +191,9 @@ public class SourcedCompositionItemParam {
|
|||
|
||||
/**
|
||||
* Gets the value of the networkAssignment property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the networkAssignment property.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getNetworkAssignment().add(newItem);
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link NetworkAssignment }
|
||||
*/
|
||||
public Set<NetworkAssignment> getNetworkAssignments() {
|
||||
return this.networkAssignments;
|
||||
return Collections.unmodifiableSet(this.networkAssignments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
|
@ -100,7 +101,7 @@ public class SupportedHardwareVersions {
|
|||
}
|
||||
|
||||
private SupportedHardwareVersions(Set<String> supportedHardwareVersions) {
|
||||
this.supportedHardwareVersions = supportedHardwareVersions;
|
||||
this.supportedHardwareVersions = ImmutableSet.copyOf(supportedHardwareVersions);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -52,7 +53,7 @@ public class TasksInProgress {
|
|||
* @see TasksInProgress#getTasks()
|
||||
*/
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
this.tasks = Sets.newLinkedHashSet(checkNotNull(tasks, "tasks"));
|
||||
this.tasks = checkNotNull(tasks, "tasks");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -73,11 +74,11 @@ public class TasksInProgress {
|
|||
}
|
||||
}
|
||||
|
||||
protected TasksInProgress() {
|
||||
private TasksInProgress() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected TasksInProgress(Collection<Task> tasks) {
|
||||
private TasksInProgress(Collection<Task> tasks) {
|
||||
this.tasks = ImmutableSet.copyOf(tasks);
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class TasksInProgress {
|
|||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<Task> getTasks() {
|
||||
return ImmutableSet.copyOf(tasks);
|
||||
return Collections.unmodifiableSet(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -172,7 +173,7 @@ public class TasksList extends EntityType<TasksList> {
|
|||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<Task> getTasks() {
|
||||
return ImmutableSet.copyOf(tasks);
|
||||
return Collections.unmodifiableSet(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,17 +61,17 @@ import com.google.common.collect.Sets;
|
|||
"configuration",
|
||||
"isDeployed"
|
||||
})
|
||||
public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> extends ResourceType<T> {
|
||||
public static <T extends VAppNetworkConfiguration<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfiguration> {
|
||||
public static <T extends VAppNetworkConfiguration> Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromVAppNetworkConfiguration(this);
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromVAppNetworkConfiguration(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends VAppNetworkConfiguration<T>> extends ResourceType.Builder<T> {
|
||||
public static class Builder extends ResourceType.Builder<VAppNetworkConfiguration> {
|
||||
|
||||
private String description;
|
||||
private NetworkConfiguration configuration;
|
||||
|
@ -81,7 +81,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
/**
|
||||
* @see VAppNetworkConfiguration#getDescription()
|
||||
*/
|
||||
public Builder<T> description(String description) {
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
/**
|
||||
* @see VAppNetworkConfiguration#getConfiguration()
|
||||
*/
|
||||
public Builder<T> configuration(NetworkConfiguration configuration) {
|
||||
public Builder configuration(NetworkConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
return this;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
/**
|
||||
* @see VAppNetworkConfiguration#isDeployed()
|
||||
*/
|
||||
public Builder<T> isDeployed(Boolean isDeployed) {
|
||||
public Builder isDeployed(Boolean isDeployed) {
|
||||
this.isDeployed = isDeployed;
|
||||
return this;
|
||||
}
|
||||
|
@ -105,14 +105,14 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
/**
|
||||
* @see VAppNetworkConfiguration#getNetworkName()
|
||||
*/
|
||||
public Builder<T> networkName(String networkName) {
|
||||
public Builder networkName(String networkName) {
|
||||
this.networkName = networkName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public VAppNetworkConfiguration<T> build() {
|
||||
return new VAppNetworkConfiguration<T>(href, type, links,
|
||||
public VAppNetworkConfiguration build() {
|
||||
return new VAppNetworkConfiguration(href, type, links,
|
||||
description, configuration, isDeployed, networkName);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
public Builder href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
public Builder type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
public Builder links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
public Builder link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
@ -157,11 +157,11 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Builder<T> fromResourceType(ResourceType<T> in) {
|
||||
public Builder fromResourceType(ResourceType<VAppNetworkConfiguration> in) {
|
||||
return Builder.class.cast(super.fromResourceType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) {
|
||||
public Builder fromVAppNetworkConfiguration(VAppNetworkConfiguration in) {
|
||||
return fromResourceType(in)
|
||||
.description(in.getDescription())
|
||||
.configuration(in.getConfiguration())
|
||||
|
@ -238,7 +238,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
|
|||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
VAppNetworkConfiguration<?> that = VAppNetworkConfiguration.class.cast(o);
|
||||
VAppNetworkConfiguration that = VAppNetworkConfiguration.class.cast(o);
|
||||
return equal(description, that.description) &&
|
||||
equal(configuration, that.configuration) &&
|
||||
equal(isDeployed, that.isDeployed) &&
|
||||
|
|
|
@ -20,14 +20,12 @@ package org.jclouds.vcloud.director.v1_5.domain.cim;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -238,7 +236,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
|
|||
* @see ResourceAllocationSettingData#getConnections
|
||||
*/
|
||||
public Builder connections(List<String> connections) {
|
||||
this.connections.addAll(checkNotNull(connections, "connections"));
|
||||
this.connections = Lists.newArrayList(checkNotNull(connections, "connections"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -246,7 +244,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
|
|||
* @see ResourceAllocationSettingData#getHostResources
|
||||
*/
|
||||
public Builder hostResources(List<String> hostResources) {
|
||||
this.hostResources.addAll(checkNotNull(hostResources, "hostResources"));
|
||||
this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -665,7 +663,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
|
|||
* network or switch port.
|
||||
*/
|
||||
public List<String> getConnections() {
|
||||
return connections;
|
||||
return Collections.unmodifiableList(connections);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -687,7 +685,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
|
|||
* based on host resources that are identified by element values.
|
||||
*/
|
||||
public List<String> getHostResources() {
|
||||
return hostResources;
|
||||
return Collections.unmodifiableList(hostResources);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue