VCloud Director 1.5: making domain objects immutable and fixing a number of de/serialization problems

This commit is contained in:
Adam Lowe 2012-03-01 23:08:06 +00:00
parent 8cd642af6b
commit cc4a27072b
99 changed files with 3089 additions and 5737 deletions

View File

@ -22,26 +22,23 @@ 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.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Collection;
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.Lists;
import com.google.common.collect.Sets;
/**
*
* Represents a list of references to available networks.
*
*
* <p/>
* <p/>
* <p>Java class for AvailableNetworks complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="AvailableNetworks">
* &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AvailableNetworks", propOrder = {
"networks"
})
@ -71,14 +65,13 @@ public class AvailableNetworks {
}
public static class Builder {
private List<Reference> networks = Lists.newArrayList();
private Set<Reference> networks = Sets.newLinkedHashSet();
/**
* @see AvailableNetworks#getNetworks()
*/
public Builder networks(List<Reference> networks) {
this.networks = Lists.newArrayList(checkNotNull(networks, "networks"));
public Builder networks(Collection<Reference> networks) {
this.networks = Sets.newLinkedHashSet(checkNotNull(networks, "networks"));
return this;
}
@ -101,44 +94,21 @@ public class AvailableNetworks {
}
}
private AvailableNetworks() {
// For JAXB and builder use
}
@XmlElement(name = "Network")
protected Set<Reference> networks = Sets.newLinkedHashSet();
private AvailableNetworks(List<Reference> networks) {
private AvailableNetworks(Set<Reference> networks) {
this.networks = networks;
}
@XmlElement(name = "Network")
protected List<Reference> networks;
private AvailableNetworks() {
// For JAXB
}
/**
* Gets the value of the network property.
*
* <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 network property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNetwork().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<Reference> getNetworks() {
if (networks == null) {
networks = Lists.newArrayList();
}
public Set<Reference> getNetworks() {
return this.networks;
}

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Collection of supported hardware capabilities.
*
*
* <p/>
* <p/>
* <p>Java class for Capabilities complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="Capabilities">
* &lt;complexContent>
@ -50,10 +47,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capabilities", propOrder = {
"supportedHardwareVersions"
})
@ -80,9 +74,7 @@ public class Capabilities {
public Capabilities build() {
Capabilities capabilities = new Capabilities();
capabilities.setSupportedHardwareVersions(supportedHardwareVersions);
return capabilities;
return new Capabilities(supportedHardwareVersions);
}
@ -91,10 +83,13 @@ public class Capabilities {
}
}
private Capabilities() {
// For JAXB and builder use
private Capabilities(SupportedHardwareVersions supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions;
}
private Capabilities() {
// For JAXB
}
@XmlElement(name = "SupportedHardwareVersions")
@ -103,27 +98,13 @@ public class Capabilities {
/**
* Gets the value of the supportedHardwareVersions property.
*
* @return
* possible object is
* @return possible object is
* {@link SupportedHardwareVersions }
*
*/
public SupportedHardwareVersions getSupportedHardwareVersions() {
return supportedHardwareVersions;
}
/**
* Sets the value of the supportedHardwareVersions property.
*
* @param value
* allowed object is
* {@link SupportedHardwareVersions }
*
*/
public void setSupportedHardwareVersions(SupportedHardwareVersions value) {
this.supportedHardwareVersions = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
@ -31,14 +29,13 @@ import com.google.common.base.Objects;
/**
*
* Represents a capacity of a given resource.
*
*
* <p/>
* <p/>
* <p>Java class for Capacity complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="Capacity">
* &lt;complexContent>
@ -53,17 +50,14 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capacity", propOrder = {
"units",
"allocated",
"limit"
})
@XmlSeeAlso({
// CapacityWithUsageType.class
CapacityWithUsage.class
})
public class CapacityType<T extends CapacityType<T>> {
@ -107,11 +101,7 @@ public class CapacityType<T extends CapacityType<T>> {
public CapacityType<T> build() {
CapacityType<T> capacity = new CapacityType<T>();
capacity.setUnits(units);
capacity.setAllocated(allocated);
capacity.setLimit(limit);
return capacity;
return new CapacityType<T>(units, allocated, limit);
}
@ -122,16 +112,16 @@ public class CapacityType<T extends CapacityType<T>> {
}
}
protected CapacityType(String units, Long allocated, Long limit) {
this.units = units;
this.allocated = allocated;
this.limit = limit;
}
protected CapacityType() {
// For JAXB and builder use
}
protected CapacityType(String units) {
this.units = units;
}
@XmlElement(name = "Units", required = true)
protected String units;
@XmlElement(name = "Allocated")
@ -142,67 +132,30 @@ public class CapacityType<T extends CapacityType<T>> {
/**
* Gets the value of the units property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getUnits() {
return units;
}
/**
* Sets the value of the units property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnits(String value) {
this.units = value;
}
/**
* Gets the value of the allocated property.
*
* @return
* possible object is
* @return possible object is
* {@link Long }
*
*/
public Long getAllocated() {
return allocated;
}
/**
* Sets the value of the allocated property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setAllocated(Long value) {
this.allocated = value;
}
/**
* Gets the value of the limit property.
*
*/
public Long getLimit() {
return limit;
}
/**
* Sets the value of the limit property.
*
*/
public void setLimit(Long value) {
this.limit = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents a capacity and usage of a given resource.
*
*
* <p/>
* <p/>
* <p>Java class for CapacityWithUsage complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="CapacityWithUsage">
* &lt;complexContent>
@ -51,10 +48,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CapacityWithUsage", propOrder = {
"used",
"overhead"
@ -94,12 +88,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
public CapacityWithUsage build() {
CapacityWithUsage capacityWithUsage = new CapacityWithUsage(units);
capacityWithUsage.setUsed(used);
capacityWithUsage.setOverhead(overhead);
capacityWithUsage.setAllocated(allocated);
capacityWithUsage.setLimit(limit);
return capacityWithUsage;
return new CapacityWithUsage(units, allocated, limit, used, overhead);
}
/**
@ -131,6 +120,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
public Builder fromCapacityType(CapacityType<CapacityWithUsage> in) {
return Builder.class.cast(super.fromCapacityType(in));
}
public Builder fromCapacityWithUsage(CapacityWithUsage in) {
return fromCapacityType(in)
.used(in.getUsed())
@ -138,15 +128,16 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
}
}
protected CapacityWithUsage() {
private CapacityWithUsage(String units, Long allocated, Long limit, Long used, Long overhead) {
super(units, allocated, limit);
this.used = used;
this.overhead = overhead;
}
private CapacityWithUsage() {
// For JAXB and builder use
}
public CapacityWithUsage(String units) {
super(units);
}
@XmlElement(name = "Used")
protected Long used;
@XmlElement(name = "Overhead")
@ -155,51 +146,23 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/**
* Gets the value of the used property.
*
* @return
* possible object is
* @return possible object is
* {@link Long }
*
*/
public Long getUsed() {
return used;
}
/**
* Sets the value of the used property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setUsed(Long value) {
this.used = value;
}
/**
* Gets the value of the overhead property.
*
* @return
* possible object is
* @return possible object is
* {@link Long }
*
*/
public Long getOverhead() {
return overhead;
}
/**
* Sets the value of the overhead property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setOverhead(Long value) {
this.overhead = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,13 +20,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.ArrayList;
import java.util.List;
import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
@ -40,17 +37,18 @@ import org.jclouds.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
*
* Represents the parameters for capturing a vApp to a vApp template.
*
*
* <p/>
* <p/>
* <p>Java class for CaptureVAppParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="CaptureVAppParams">
* &lt;complexContent>
@ -64,10 +62,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CaptureVAppParams", propOrder = {
"source",
"section"
@ -88,7 +83,7 @@ public class CaptureVAppParams
public static class Builder extends ParamsType.Builder<CaptureVAppParams> {
private Reference source;
private List<JAXBElement<? extends Section<?>>> sections;
private Set<? extends Section<?>> sections = ImmutableSet.of();
/**
* @see CaptureVAppParams#getSource()
@ -101,16 +96,14 @@ public class CaptureVAppParams
/**
* @see CaptureVAppParams#getSections()
*/
public Builder sections(List<JAXBElement<? extends Section<?>>> sections) {
this.sections = sections;
public Builder sections(Set<? extends Section<?>> sections) {
this.sections = checkNotNull(sections, "sections");
return this;
}
public CaptureVAppParams build() {
CaptureVAppParams captureVAppParams = new CaptureVAppParams(sections);
captureVAppParams.setSource(source);
return captureVAppParams;
return new CaptureVAppParams(description, name, source, sections);
}
@ -118,6 +111,7 @@ public class CaptureVAppParams
public Builder fromParamsType(ParamsType<CaptureVAppParams> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCaptureVAppParams(CaptureVAppParams in) {
return fromParamsType(in)
.source(in.getSource())
@ -125,63 +119,54 @@ public class CaptureVAppParams
}
}
private CaptureVAppParams(String description, String name, Reference source, Set<? extends Section<?>> sections) {
super(description, name);
this.source = source;
this.sections = sections;
}
private CaptureVAppParams() {
// For JAXB and builder use
}
private CaptureVAppParams(List<JAXBElement<? extends Section<?>>> sections) {
this.sections = sections;
private CaptureVAppParams(Set<? extends Section<?>> sections) {
this.sections = ImmutableSet.copyOf(sections);
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected List<JAXBElement<? extends Section<?>>> sections;
@XmlElementRef
protected Set<? extends Section<?>> sections = Sets.newLinkedHashSet();
/**
* Gets the value of the source property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
*
* An ovf:Section to configure the captured vAppTemplate.
* Gets the value of the section property.
*
* <p>
* <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/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
*
*
* <p>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link Section> }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >}
@ -201,13 +186,8 @@ public class CaptureVAppParams
* {@link JAXBElement }{@code <}{@link NetworkSection > }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection > }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection> }{@code >}
*
*
*/
public List<JAXBElement<? extends Section<?>>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends Section<?>>>();
}
public Set<? extends Section<?>> getSections() {
return this.sections;
}

View File

@ -19,11 +19,9 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -33,14 +31,14 @@ import com.google.common.collect.Sets;
/**
* Container for references to VappTemplate and Media objects.
*
* <p/>
* <pre>
* &lt;complexType name="CatalogType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Catalog")
@XmlRootElement(name = "Catalog")
public class Catalog extends EntityType<Catalog> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG;
@ -95,16 +93,7 @@ public class Catalog extends EntityType<Catalog> {
@Override
public Catalog build() {
Catalog catalog = new Catalog(href, name);
catalog.setOwner(owner);
catalog.setCatalogItems(catalogItems);
catalog.setIsPublished(isPublished);
catalog.setDescription(description);
catalog.setId(id);
catalog.setType(type);
catalog.setLinks(links);
catalog.setTasksInProgress(tasksInProgress);
return catalog;
return new Catalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
}
/**
@ -162,7 +151,7 @@ public class Catalog extends EntityType<Catalog> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -171,7 +160,7 @@ public class Catalog extends EntityType<Catalog> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -189,12 +178,16 @@ public class Catalog extends EntityType<Catalog> {
}
}
private Catalog() {
// For JAXB and builder use
public Catalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, Entity owner, CatalogItems catalogItems, Boolean published) {
super(href, type, links, description, tasksInProgress, id, name);
this.owner = owner;
this.catalogItems = catalogItems;
this.isPublished = published;
}
private Catalog(URI href, String name) {
super(href, name);
private Catalog() {
// For JAXB and builder use
}
@XmlElement(name = "Owner")
@ -211,10 +204,6 @@ public class Catalog extends EntityType<Catalog> {
return owner;
}
public void setOwner(Entity value) {
this.owner = value;
}
/**
* Gets the value of the catalogItems property.
*/
@ -222,10 +211,6 @@ public class Catalog extends EntityType<Catalog> {
return catalogItems;
}
public void setCatalogItems(CatalogItems value) {
this.catalogItems = value;
}
/**
* Gets the value of the isPublished property.
*/
@ -233,7 +218,4 @@ public class Catalog extends EntityType<Catalog> {
return isPublished;
}
public void setIsPublished(Boolean value) {
this.isPublished = value;
}
}

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.List;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
*
* Contains a reference to a VappTemplate or Media object and related metadata.
*
* <p/>
* <pre>
* &lt;complexType name="CatalogItemType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItem")
@XmlRootElement(name = "CatalogItem")
public class CatalogItem extends EntityType<CatalogItem> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM;
@ -61,7 +57,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
public static class Builder extends EntityType.Builder<CatalogItem> {
private Reference entity;
private List<Property> properties = Lists.newArrayList();
private Set<Property> properties = Sets.newLinkedHashSet();
/**
* @see CatalogItem#getEntity()
@ -74,8 +70,8 @@ public class CatalogItem extends EntityType<CatalogItem> {
/**
* @see CatalogItem#getProperties()
*/
public Builder properties(List<Property> properties) {
this.properties = Lists.newArrayList(checkNotNull(properties, "properties"));
public Builder properties(Set<Property> properties) {
this.properties = Sets.newLinkedHashSet(checkNotNull(properties, "properties"));
return this;
}
@ -89,14 +85,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
@Override
public CatalogItem build() {
CatalogItem catalog = new CatalogItem(href, name, entity);
catalog.setProperties(properties);
catalog.setDescription(description);
catalog.setId(id);
catalog.setType(type);
catalog.setLinks(links);
catalog.setTasksInProgress(tasksInProgress);
return catalog;
return new CatalogItem(href, type, links, description, tasksInProgress, id, name, entity, properties);
}
/**
@ -154,7 +143,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -163,7 +152,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -181,20 +170,20 @@ public class CatalogItem extends EntityType<CatalogItem> {
}
}
private CatalogItem() {
// For JAXB and builder use
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;
}
private CatalogItem(URI href, String name, Reference entity) {
super(href, name);
this.entity = entity;
this.setProperties(properties);
private CatalogItem() {
// For JAXB and builder use
}
@XmlElement(name = "Entity", required = true)
private Reference entity;
@XmlElement(name = "Property")
private List<Property> properties = Lists.newArrayList();
private Set<Property> properties = Sets.newLinkedHashSet();
/**
* A reference to a VappTemplate or Media object.
@ -205,18 +194,10 @@ public class CatalogItem extends EntityType<CatalogItem> {
/**
* User-specified key/value pair.
*
* <p/>
* This element has been superseded by the {@link Metadata} element, which is the preferred way to specify key/value pairs for objects.
*/
public List<Property> getProperties() {
return this.properties;
}
public void setProperties(List<Property> properties) {
this.properties = Lists.newArrayList(checkNotNull(properties, "properties"));
}
public void addProperty(Property property) {
this.properties.add(checkNotNull(property, "property"));
public Set<Property> getProperties() {
return Collections.unmodifiableSet(this.properties);
}
}

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
* Represents a list of catalog item references.
*
* <p/>
* <pre>
* &lt;complexType name="CatalogItemsType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItems")
@XmlRootElement(name = "CatalogItems")
public class CatalogItems {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
@ -58,13 +54,13 @@ public class CatalogItems {
public static class Builder {
private List<Reference> catalogItems = Lists.newArrayList();
private Set<Reference> catalogItems = Sets.newLinkedHashSet();
/**
* @see CatalogItems#getCatalogItems()
*/
public Builder items(List<Reference> catalogItems) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
public Builder items(Collection<Reference> catalogItems) {
this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems"));
return this;
}
@ -90,24 +86,16 @@ public class CatalogItems {
}
private CatalogItems(Collection<Reference> tasks) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
this.catalogItems = catalogItems;
}
@XmlElement(name = "CatalogItem")
private List<Reference> catalogItems = Lists.newArrayList();
private Set<Reference> catalogItems = Sets.newLinkedHashSet();
/**
* Gets the value of the catalogItems property.
*/
public List<Reference> getCatalogItems() {
return this.catalogItems;
}
public void setCatalogItems(List<Reference> catalogItems) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
}
public void addCatalogItem(Reference catalogItem) {
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
public Set<Reference> getCatalogItems() {
return Collections.unmodifiableSet(this.catalogItems);
}
}

View File

@ -1,12 +1,9 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReference")
@XmlRootElement(name = "CatalogReference")
public class CatalogReference extends ReferenceType<CatalogReference> {
@SuppressWarnings("unchecked")
@ -23,11 +20,7 @@ public class CatalogReference extends ReferenceType<CatalogReference> {
@Override
public CatalogReference build() {
CatalogReference reference = new CatalogReference(href);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
return new CatalogReference(href, id, name, type);
}
/**
@ -76,8 +69,8 @@ public class CatalogReference extends ReferenceType<CatalogReference> {
}
}
protected CatalogReference(URI href) {
super(href);
public CatalogReference(URI href, String id, String name, String type) {
super(href, id, name, type);
}
protected CatalogReference() {

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Container for ReferenceType elements that reference catalogs.
*
* <p/>
* <pre>
* &lt;complexType name="CatalogsListType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogsList")
@XmlRootElement(name = "CatalogsList")
public class CatalogsList {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
@ -58,13 +54,13 @@ public class CatalogsList {
public static class Builder {
private List<Reference> catalogReferences = Lists.newArrayList();
private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
/**
* @see CatalogsList#getCatalogItems()
*/
public Builder catalogs(List<Reference> catalogReferences) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
public Builder catalogs(Collection<Reference> catalogReferences) {
this.catalogReferences = Sets.newLinkedHashSet(checkNotNull(catalogReferences, "catalogReferences"));
return this;
}
@ -81,7 +77,7 @@ public class CatalogsList {
}
public Builder fromCatalogsList(CatalogsList in) {
return catalogs(in.getCatalogsList());
return catalogs(in.getCatalogItems());
}
}
@ -89,25 +85,18 @@ public class CatalogsList {
// For JAXB and builder use
}
private CatalogsList(Collection<Reference> tasks) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
private CatalogsList(Set<Reference> tasks) {
this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences"));
}
@XmlElement(name = "CatalogReference")
private List<Reference> catalogReferences = Lists.newArrayList();
private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
/**
* Gets the value of the catalogReferences property.
*/
public List<Reference> getCatalogsList() {
public Set<Reference> getCatalogItems() {
return this.catalogReferences;
}
public void setCatalogsList(List<Reference> catalogReferences) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
}
public void addCatalog(Reference catalog) {
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
}
}

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,15 +28,14 @@ import com.google.common.base.Objects;
/**
*
* Represents parameters for copying a media resource and optionally
* deleting the source.
*
*
* <p/>
* <p/>
* <p>Java class for CloneMediaParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="CloneMediaParams">
* &lt;complexContent>
@ -52,10 +49,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneMediaParams", propOrder = {
"source",
"isSourceDelete"
@ -87,26 +81,22 @@ public class CloneMediaParams
}
/**
* @see CloneMediaParams#getIsSourceDelete()
* @see CloneMediaParams#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete;
return this;
}
public CloneMediaParams build() {
CloneMediaParams cloneMediaParams = new CloneMediaParams();
cloneMediaParams.setSource(source);
cloneMediaParams.setIsSourceDelete(isSourceDelete);
return cloneMediaParams;
return new CloneMediaParams(description, name, source, isSourceDelete);
}
@Override
public Builder fromParamsType(ParamsType<CloneMediaParams> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCloneMediaParams(CloneMediaParams in) {
return fromParamsType(in)
.source(in.getSource())
@ -114,12 +104,17 @@ public class CloneMediaParams
}
}
private CloneMediaParams(String description, String name, Reference source, Boolean sourceDelete) {
super(description, name);
this.source = source;
isSourceDelete = sourceDelete;
}
private CloneMediaParams() {
// For JAXB and builder use
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
@ -128,51 +123,23 @@ public class CloneMediaParams
/**
* Gets the value of the source property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
* Gets the value of the isSourceDelete property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -19,22 +19,19 @@
package org.jclouds.vcloud.director.v1_5.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
*
* Represents parameters for copying a vApp and optionally deleting the source.
*
*
* <p/>
* <p/>
* <p>Java class for CloneVAppParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="CloneVAppParams">
* &lt;complexContent>
@ -44,10 +41,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppParams")
public class CloneVAppParams
extends InstantiateVAppParamsType<CloneVAppParams>
@ -146,6 +140,7 @@ public class CloneVAppParams
public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<CloneVAppParams> in) {
return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
}
public Builder fromCloneVAppParams(CloneVAppParams in) {
return fromInstantiateVAppParamsType(in);
}

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,15 +28,14 @@ import com.google.common.base.Objects;
/**
*
* Represents parameters for copying a vApp template and optionally
* deleting the source.
*
*
* <p/>
* <p/>
* <p>Java class for CloneVAppTemplateParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="CloneVAppTemplateParams">
* &lt;complexContent>
@ -52,10 +49,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppTemplateParams", propOrder = {
"source",
"isSourceDelete"
@ -87,26 +81,22 @@ public class CloneVAppTemplateParams
}
/**
* @see CloneVAppTemplateParams#getIsSourceDelete()
* @see CloneVAppTemplateParams#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete;
return this;
}
public CloneVAppTemplateParams build() {
CloneVAppTemplateParams cloneVAppTemplateParams = new CloneVAppTemplateParams();
cloneVAppTemplateParams.setSource(source);
cloneVAppTemplateParams.setIsSourceDelete(isSourceDelete);
return cloneVAppTemplateParams;
return new CloneVAppTemplateParams(description, name, source, isSourceDelete);
}
@Override
public Builder fromParamsType(ParamsType<CloneVAppTemplateParams> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCloneVAppTemplateParams(CloneVAppTemplateParams in) {
return fromParamsType(in)
.source(in.getSource())
@ -114,12 +104,17 @@ public class CloneVAppTemplateParams
}
}
public CloneVAppTemplateParams(String description, String name, Reference source, Boolean sourceDelete) {
super(description, name);
this.source = source;
isSourceDelete = sourceDelete;
}
private CloneVAppTemplateParams() {
// For JAXB and builder use
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
@ -128,51 +123,23 @@ public class CloneVAppTemplateParams
/**
* Gets the value of the source property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
* Gets the value of the isSourceDelete property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,29 +20,27 @@
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.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
*
* Represents vApp composition parameters.
*
*
* <p/>
* <p/>
* <p>Java class for ComposeVAppParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="ComposeVAppParams">
* &lt;complexContent>
@ -57,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComposeVAppParams", propOrder = {
"sourcedItem",
"allEULAsAccepted"
@ -83,20 +78,20 @@ public class ComposeVAppParams
public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> {
private List<SourcedCompositionItemParam> sourcedItem;
private Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
private Boolean allEULAsAccepted;
private Boolean linkedClone;
/**
* @see ComposeVAppParams#getSourcedItem()
*/
public Builder sourcedItem(List<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = sourcedItem;
public Builder sourcedItem(Set<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = checkNotNull(sourcedItem, "sourcedItem");
return this;
}
/**
* @see ComposeVAppParams#getAllEULAsAccepted()
* @see ComposeVAppParams#isAllEULAsAccepted()
*/
public Builder allEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted;
@ -104,7 +99,7 @@ public class ComposeVAppParams
}
/**
* @see ComposeVAppParams#getLinkedClone()
* @see ComposeVAppParams#isLinkedClone() ()
*/
public Builder linkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
@ -113,10 +108,8 @@ public class ComposeVAppParams
public ComposeVAppParams build() {
ComposeVAppParams composeVAppParams = new ComposeVAppParams(sourcedItem);
composeVAppParams.setAllEULAsAccepted(allEULAsAccepted);
composeVAppParams.setLinkedClone(linkedClone);
return composeVAppParams;
return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn,
sourcedItem, allEULAsAccepted, linkedClone);
}
@ -124,6 +117,7 @@ public class ComposeVAppParams
public Builder fromVAppCreationParamsType(VAppCreationParamsType<ComposeVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder fromComposeVAppParams(ComposeVAppParams in) {
return fromVAppCreationParamsType(in)
.sourcedItem(in.getSourcedItem())
@ -132,17 +126,21 @@ public class ComposeVAppParams
}
}
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItem, Boolean allEULAsAccepted, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.sourcedItem = ImmutableSet.copyOf(sourcedItem);
this.allEULAsAccepted = allEULAsAccepted;
this.linkedClone = linkedClone;
}
private ComposeVAppParams() {
// For JAXB and builder use
}
private ComposeVAppParams(List<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = sourcedItem;
}
@XmlElement(name = "SourcedItem")
protected List<SourcedCompositionItemParam> sourcedItem;
protected Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
@ -150,87 +148,52 @@ public class ComposeVAppParams
/**
* Gets the value of the sourcedItem property.
*
* <p>
* <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/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSourcedItem().add(newItem);
* </pre>
*
*
* <p>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link SourcedCompositionItemParamType }
*
*
* {@link SourcedCompositionItemParam }
*/
public List<SourcedCompositionItemParam> getSourcedItem() {
if (sourcedItem == null) {
sourcedItem = new ArrayList<SourcedCompositionItemParam>();
}
public Set<SourcedCompositionItemParam> getSourcedItem() {
return this.sourcedItem;
}
/**
*
* Used to confirm acceptance of all EULAs in a
* vApp template. Instantiation fails if this
* element is missing, empty, or set to false
* and one or more EulaSection elements are
* present.
*
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
}
/**
* Sets the value of the allEULAsAccepted property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setAllEULAsAccepted(Boolean value) {
this.allEULAsAccepted = value;
}
/**
* Gets the value of the linkedClone property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isLinkedClone() {
return linkedClone;
}
/**
* Sets the value of the linkedClone property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setLinkedClone(Boolean value) {
this.linkedClone = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents a compute capacity with units.
*
*
* <p/>
* <p/>
* <p>Java class for ComputeCapacity complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="ComputeCapacity">
* &lt;complexContent>
@ -51,10 +48,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComputeCapacity", propOrder = {
"cpu",
"memory"
@ -89,27 +83,26 @@ public class ComputeCapacity {
return this;
}
public ComputeCapacity build() {
ComputeCapacity computeCapacity = new ComputeCapacity();
computeCapacity.setCpu(cpu);
computeCapacity.setMemory(memory);
return computeCapacity;
return new ComputeCapacity(cpu, memory);
}
public Builder fromComputeCapacity(ComputeCapacity in) {
return cpu(in.getCpu())
.memory(in.getMemory());
}
}
private ComputeCapacity(CapacityWithUsage cpu, CapacityWithUsage memory) {
this.cpu = cpu;
this.memory = memory;
}
private ComputeCapacity() {
// For JAXB and builder use
}
@XmlElement(name = "Cpu", required = true)
protected CapacityWithUsage cpu;
@XmlElement(name = "Memory", required = true)
@ -118,51 +111,23 @@ public class ComputeCapacity {
/**
* Gets the value of the cpu property.
*
* @return
* possible object is
* @return possible object is
* {@link CapacityWithUsage }
*
*/
public CapacityWithUsage getCpu() {
return cpu;
}
/**
* Sets the value of the cpu property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setCpu(CapacityWithUsage value) {
this.cpu = value;
}
/**
* Gets the value of the memory property.
*
* @return
* possible object is
* @return possible object is
* {@link CapacityWithUsage }
*
*/
public CapacityWithUsage getMemory() {
return memory;
}
/**
* Sets the value of the memory property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setMemory(CapacityWithUsage value) {
this.memory = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,23 +20,22 @@
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.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
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 org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -64,12 +63,10 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "CustomizationSection")
@XmlType(propOrder = {
"customizeOnInstantiate",
"link",
"any"
"links"
})
public class CustomizationSection extends SectionType<CustomizationSection> {
public static Builder builder() {
@ -82,8 +79,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
public static class Builder extends SectionType.Builder<CustomizationSection> {
private boolean customizeOnInstantiate;
private List<Link> link;
private List<Object> any;
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
@ -96,18 +92,10 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
}
/**
* @see CustomizationSection#getLink()
* @see CustomizationSection#getLinks()
*/
public Builder link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see CustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return this;
}
@ -129,18 +117,13 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
public CustomizationSection build() {
CustomizationSection customizationSection = new CustomizationSection(info, link, any);
customizationSection.setCustomizeOnInstantiate(customizeOnInstantiate);
customizationSection.setHref(href);
customizationSection.setType(type);
return customizationSection;
return new CustomizationSection(info, required, customizeOnInstantiate, links, href, type);
}
public Builder fromCustomizationSection(CustomizationSection in) {
return fromSection(in)
.customizeOnInstantiate(in.isCustomizeOnInstantiate())
.link(in.getLink())
.any(in.getAny())
.links(in.getLinks())
.href(in.getHref())
.type(in.getType());
}
@ -161,12 +144,22 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
private CustomizationSection(String info, List<Link> link, List<Object> any) {
super(info);
this.link = link;
this.any = any;
private CustomizationSection(@Nullable String info, @Nullable Boolean required, boolean customizeOnInstantiate, Set<Link> links,
URI href, String type) {
super(info, required);
this.customizeOnInstantiate = customizeOnInstantiate;
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
}
private CustomizationSection() {
@ -176,9 +169,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
@XmlElement(name = "CustomizeOnInstantiate")
protected boolean customizeOnInstantiate;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@ -193,65 +184,10 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
}
/**
* Sets the value of the customizeOnInstantiate property.
* Gets the value of the links property.
*/
public void setCustomizeOnInstantiate(boolean value) {
this.customizeOnInstantiate = value;
}
/**
* 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 List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any 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 any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
public Set<Link> getLinks() {
return this.links;
}
/**
@ -264,16 +200,6 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return href;
}
/**
* Sets the value of the href property.
*
* @param value allowed object is
* {@link String }
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
@ -284,16 +210,6 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -301,30 +217,30 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
if (o == null || getClass() != o.getClass())
return false;
CustomizationSection that = CustomizationSection.class.cast(o);
return equal(customizeOnInstantiate, that.customizeOnInstantiate) &&
equal(link, that.link) &&
equal(any, that.any) &&
return super.equals(that) &&
equal(customizeOnInstantiate, that.customizeOnInstantiate) &&
equal(links, that.links) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(customizeOnInstantiate,
link,
any,
return Objects.hashCode(
super.hashCode(),
customizeOnInstantiate,
links,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
public Objects.ToStringHelper string() {
return super.string()
.add("customizeOnInstantiate", customizeOnInstantiate)
.add("link", link)
.add("any", any)
.add("links", links)
.add("href", href)
.add("type", type).toString();
.add("type", type);
}
}

View File

@ -29,10 +29,10 @@ import com.google.common.collect.Sets;
* An entity.
*
* @author grkvlt@apache.org
* @author Adam Lowe
*/
public class Entity extends EntityType<Entity> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -46,13 +46,7 @@ public class Entity extends EntityType<Entity> {
@Override
public Entity build() {
Entity entity = new Entity(href, name);
entity.setDescription(description);
entity.setTasksInProgress(tasksInProgress);
entity.setId(id);
entity.setType(type);
entity.setLinks(links);
return entity;
return new Entity(href, type, links, description, tasksInProgress, id, name);
}
/**
@ -110,7 +104,7 @@ public class Entity extends EntityType<Entity> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -119,7 +113,7 @@ public class Entity extends EntityType<Entity> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -137,21 +131,11 @@ public class Entity extends EntityType<Entity> {
}
}
protected Entity(URI href, String name) {
super(href, name);
private Entity(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
super(href, type, links, description, tasksInProgress, id, name);
}
protected Entity() {
private Entity() {
// For JAXB
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Entity that = Entity.class.cast(o);
return super.equals(that);
}
}

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -34,27 +32,19 @@ import com.google.common.collect.Sets;
/**
* Basic entity type in the vCloud object model.
*
* <p/>
* Includes a name, an optional description, and an optional list of links
*
* <p/>
* <pre>
* &lt;xs:complexType name="EntityType"&gt;
* </pre>
*
* @author grkvlt@apache.org
* @author Adam Lowe
*/
public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T> {
public static <T extends EntityType<T>> Builder<T> builder() {
return new Builder<T>();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromEntityType(this);
}
public static class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
public static abstract class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
protected String description;
protected TasksInProgress tasksInProgress;
@ -93,17 +83,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return this;
}
@Override
public EntityType<T> build() {
EntityType<T> entity = new EntityType<T>(href, name);
entity.setDescription(description);
entity.setTasksInProgress(tasksInProgress);
entity.setId(id);
entity.setType(type);
entity.setLinks(links);
return entity;
}
/**
* @see ResourceType#getHref()
*/
@ -156,17 +135,20 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
}
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Description")
@XmlElement(name = "Description")
private String description;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "TasksInProgress")
@XmlElement(name = "TasksInProgress")
private TasksInProgress tasksInProgress;
@XmlAttribute
private String id;
@XmlAttribute(required = true)
private String name;
protected EntityType(URI href, String name) {
super(href);
public EntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
super(href, type, links);
this.description = description;
this.tasksInProgress = tasksInProgress;
this.id = id;
this.name = name;
}
@ -181,10 +163,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return description;
}
public void setDescription(String description) {
this.description = description;
}
/**
* A list of queued, running, or recently completed tasks associated with this entity.
*/
@ -192,13 +170,9 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return tasksInProgress;
}
public void setTasksInProgress(TasksInProgress tasksInProgress) {
this.tasksInProgress = tasksInProgress;
}
/**
* The resource identifier, expressed in URN format.
*
* <p/>
* The value of this attribute uniquely identifies the resource, persists for the life of the
* resource, and is never reused.
*/
@ -206,10 +180,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return id;
}
public void setId(String id) {
this.id = id;
}
/**
* Contains the name of the the entity.
*/
@ -217,10 +187,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,10 +20,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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@ -33,15 +30,14 @@ import com.google.common.base.Objects;
/**
* The standard error message type used in the vCloud REST API.
*
* <p/>
* <pre>
* &lt;xs:complexType name="ErrorType"&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Error")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Error")
public class Error {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ERROR;
@ -103,10 +99,7 @@ public class Error {
}
public Error build() {
Error error = new Error(message, majorErrorCode, minorErrorCode);
error.setVendorSpecificErrorCode(vendorSpecificErrorCode);
error.setStackTrace(stackTrace);
return error;
return new Error(message, majorErrorCode, minorErrorCode, vendorSpecificErrorCode, stackTrace);
}
public Builder fromError(Error in) {
@ -129,10 +122,12 @@ public class Error {
@XmlAttribute
private String stackTrace;
private Error(String message, Integer majorErrorCode, String minorErrorCode) {
private Error(String message, Integer majorErrorCode, String minorErrorCode, String vendorSpecificErrorCode, String stackTrace) {
this.message = checkNotNull(message, "message");
this.majorErrorCode = checkNotNull(majorErrorCode, "majorErrorCode");
this.minorErrorCode = checkNotNull(minorErrorCode, "minorErrorCode");
this.vendorSpecificErrorCode = vendorSpecificErrorCode;
this.stackTrace = stackTrace;
}
private Error() {
@ -155,7 +150,7 @@ public class Error {
/**
* Specific API error code.
*
* <p/>
* For example - can indicate that vApp power on failed by some reason.
*/
public String getMinorErrorCode() {
@ -170,10 +165,6 @@ public class Error {
return vendorSpecificErrorCode;
}
public void setVendorSpecificErrorCode(String vendorSpecificErrorCode) {
this.vendorSpecificErrorCode = vendorSpecificErrorCode;
}
/**
* The stack trace of the exception which when examined might make problem
* diagnostics easier.
@ -182,10 +173,6 @@ public class Error {
return stackTrace;
}
public void setStackTrace(String stackTrace) {
this.stackTrace = stackTrace;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
@ -38,14 +35,13 @@ import com.google.common.collect.Sets;
/**
*
* Represents a file to be transferred (uploaded or downloaded).
*
*
* <p/>
* <p/>
* <p>Java class for File complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="File">
* &lt;complexContent>
@ -58,20 +54,15 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "File")
public class File
extends EntityType<File>
{
public class File extends EntityType<File> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromFile(this);
}
@ -106,16 +97,10 @@ public class File
return this;
}
public File build() {
File file = new File();
file.setSize(size);
file.setBytesTransferred(bytesTransferred);
file.setChecksum(checksum);
return file;
return new File(href, type, links, description, tasksInProgress, id, name, size, bytesTransferred, checksum);
}
/**
* @see EntityType#getId()
*/
@ -153,7 +138,7 @@ public class File
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -162,7 +147,7 @@ public class File
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -175,6 +160,7 @@ public class File
public Builder fromEntityType(EntityType<File> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromFile(File in) {
return fromEntityType(in)
.size(in.getSize())
@ -183,12 +169,19 @@ public class File
}
}
public File(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, Long size, Long bytesTransferred, String checksum) {
super(href, type, links, description, tasksInProgress, id, name);
this.size = size;
this.bytesTransferred = bytesTransferred;
this.checksum = checksum;
}
private File() {
// For JAXB and builder use
}
@XmlAttribute
protected Long size;
@XmlAttribute
@ -201,75 +194,33 @@ public class File
/**
* Gets the value of the size property.
*
* @return
* possible object is
* @return possible object is
* {@link Long }
*
*/
public Long getSize() {
return size;
}
/**
* Sets the value of the size property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setSize(Long value) {
this.size = value;
}
/**
* Gets the value of the bytesTransferred property.
*
* @return
* possible object is
* @return possible object is
* {@link Long }
*
*/
public Long getBytesTransferred() {
return bytesTransferred;
}
/**
* Sets the value of the bytesTransferred property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setBytesTransferred(Long value) {
this.bytesTransferred = value;
}
/**
* Gets the value of the checksum property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getChecksum() {
return checksum;
}
/**
* Sets the value of the checksum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setChecksum(String value) {
this.checksum = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,27 +21,24 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
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;
/**
*
* Represents a list of files to be transferred (uploaded
* or downloaded).
*
*
* <p/>
* <p/>
* <p>Java class for FilesList complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="FilesList">
* &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FilesList", propOrder = {
"files"
})
@ -72,13 +66,13 @@ public class FilesList {
public static class Builder {
private List<File> files;
private Set<File> files = Sets.newLinkedHashSet();
/**
* @see FilesList#getFiles()
*/
public Builder file(List<File> file) {
this.files = file;
public Builder files(Set<File> files) {
this.files = files;
return this;
}
@ -90,7 +84,7 @@ public class FilesList {
public Builder fromFilesList(FilesList in) {
return file(in.getFiles());
return files(in.getFiles());
}
}
@ -98,40 +92,18 @@ public class FilesList {
// For JAXB and builder use
}
private FilesList(List<File> files) {
this.files = files;
private FilesList(Set<File> files) {
this.files = ImmutableSet.copyOf(files);
}
@XmlElement(name = "File", required = true)
protected List<File> files;
protected Set<File> files = Sets.newLinkedHashSet();
/**
* Gets the value of the file property.
*
* <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 file property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFile().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link FileType }
*
*
*/
public List<File> getFiles() {
if (files == null) {
files = new ArrayList<File>();
}
public Set<File> getFiles() {
return this.files;
}

View File

@ -20,13 +20,11 @@
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.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -37,6 +35,8 @@ 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;
/**
@ -77,7 +77,6 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "GuestCustomizationSection")
@XmlType(propOrder = {
"enabled",
@ -94,8 +93,7 @@ import com.google.common.base.Objects;
"resetPasswordRequired",
"customizationScript",
"computerName",
"link",
"any"
"links"
})
public class GuestCustomizationSection extends SectionType<GuestCustomizationSection> {
@SuppressWarnings("unchecked")
@ -108,7 +106,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
}
public static class Builder extends SectionType.Builder<GuestCustomizationSection> {
private Boolean enabled;
private Boolean changeSid;
private String virtualMachineId;
@ -123,8 +120,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
private Boolean resetPasswordRequired;
private String customizationScript;
private String computerName;
private List<Link> link;
private List<Object> any;
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
@ -243,16 +239,8 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink()
*/
public Builder link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return this;
}
@ -274,23 +262,11 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
public GuestCustomizationSection build() {
GuestCustomizationSection guestCustomizationSection = new GuestCustomizationSection(info, resetPasswordRequired, link, any);
guestCustomizationSection.setEnabled(enabled);
guestCustomizationSection.setChangeSid(changeSid);
guestCustomizationSection.setVirtualMachineId(virtualMachineId);
guestCustomizationSection.setJoinDomainEnabled(joinDomainEnabled);
guestCustomizationSection.setUseOrgSettings(useOrgSettings);
guestCustomizationSection.setDomainName(domainName);
guestCustomizationSection.setDomainUserName(domainUserName);
guestCustomizationSection.setDomainUserPassword(domainUserPassword);
guestCustomizationSection.setAdminPasswordEnabled(adminPasswordEnabled);
guestCustomizationSection.setAdminPasswordAuto(adminPasswordAuto);
guestCustomizationSection.setAdminPassword(adminPassword);
guestCustomizationSection.setCustomizationScript(customizationScript);
guestCustomizationSection.setComputerName(computerName);
guestCustomizationSection.setHref(href);
guestCustomizationSection.setType(type);
return guestCustomizationSection;
return new GuestCustomizationSection(info, required, enabled, changeSid, virtualMachineId,
joinDomainEnabled, useOrgSettings, domainName, domainUserName,
domainUserPassword, adminPasswordEnabled, adminPasswordAuto,
adminPassword, resetPasswordRequired, customizationScript,
computerName, links, href, type);
}
public Builder fromGuestCustomizationSection(GuestCustomizationSection in) {
@ -309,8 +285,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
.resetPasswordRequired(in.isResetPasswordRequired())
.customizationScript(in.getCustomizationScript())
.computerName(in.getComputerName())
.link(in.getLink())
.any(in.getAny())
.links(in.getLink())
.href(in.getHref())
.type(in.getType());
}
@ -331,58 +306,80 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
private GuestCustomizationSection(@Nullable String info, @Nullable Boolean required, Boolean enabled, Boolean changeSid, String virtualMachineId,
Boolean joinDomainEnabled, Boolean useOrgSettings, String domainName, String domainUserName,
String domainUserPassword, Boolean adminPasswordEnabled, Boolean adminPasswordAuto,
String adminPassword, Boolean resetPasswordRequired, String customizationScript,
String computerName, Set<Link> links, URI href, String type) {
super(info, required);
this.enabled = enabled;
this.changeSid = changeSid;
this.virtualMachineId = virtualMachineId;
this.joinDomainEnabled = joinDomainEnabled;
this.useOrgSettings = useOrgSettings;
this.domainName = domainName;
this.domainUserName = domainUserName;
this.domainUserPassword = domainUserPassword;
this.adminPasswordEnabled = adminPasswordEnabled;
this.adminPasswordAuto = adminPasswordAuto;
this.adminPassword = adminPassword;
this.resetPasswordRequired = resetPasswordRequired;
this.customizationScript = customizationScript;
this.computerName = computerName;
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
}
private GuestCustomizationSection() {
// For JAXB and builder use
super(null);
}
private GuestCustomizationSection(@Nullable String info, Boolean resetPasswordRequired, List<Link> link, List<Object> any) {
super(info);
this.resetPasswordRequired = resetPasswordRequired;
this.link = link;
this.any = any;
}
@XmlElement(name = "Enabled")
protected Boolean enabled;
private Boolean enabled;
@XmlElement(name = "ChangeSid")
protected Boolean changeSid;
private Boolean changeSid;
@XmlElement(name = "VirtualMachineId")
protected String virtualMachineId;
private String virtualMachineId;
@XmlElement(name = "JoinDomainEnabled")
protected Boolean joinDomainEnabled;
private Boolean joinDomainEnabled;
@XmlElement(name = "UseOrgSettings")
protected Boolean useOrgSettings;
private Boolean useOrgSettings;
@XmlElement(name = "DomainName")
protected String domainName;
private String domainName;
@XmlElement(name = "DomainUserName")
protected String domainUserName;
private String domainUserName;
@XmlElement(name = "DomainUserPassword")
protected String domainUserPassword;
private String domainUserPassword;
@XmlElement(name = "AdminPasswordEnabled")
protected Boolean adminPasswordEnabled;
private Boolean adminPasswordEnabled;
@XmlElement(name = "AdminPasswordAuto")
protected Boolean adminPasswordAuto;
private Boolean adminPasswordAuto;
@XmlElement(name = "AdminPassword")
protected String adminPassword;
private String adminPassword;
@XmlElement(name = "ResetPasswordRequired")
protected Boolean resetPasswordRequired;
private Boolean resetPasswordRequired;
@XmlElement(name = "CustomizationScript")
protected String customizationScript;
private String customizationScript;
@XmlElement(name = "ComputerName")
protected String computerName;
private String computerName;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
private Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
private URI href;
@XmlAttribute
protected String type;
private String type;
/**
* Gets the value of the enabled property.
@ -394,16 +391,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return enabled;
}
/**
* Sets the value of the enabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setEnabled(Boolean value) {
this.enabled = value;
}
/**
* Gets the value of the changeSid property.
*
@ -414,16 +401,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return changeSid;
}
/**
* Sets the value of the changeSid property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setChangeSid(Boolean value) {
this.changeSid = value;
}
/**
* Gets the value of the virtualMachineId property.
*
@ -434,16 +411,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return virtualMachineId;
}
/**
* Sets the value of the virtualMachineId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVirtualMachineId(String value) {
this.virtualMachineId = value;
}
/**
* Gets the value of the joinDomainEnabled property.
*
@ -454,16 +421,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return joinDomainEnabled;
}
/**
* Sets the value of the joinDomainEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setJoinDomainEnabled(Boolean value) {
this.joinDomainEnabled = value;
}
/**
* Gets the value of the useOrgSettings property.
*
@ -474,15 +431,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return useOrgSettings;
}
/**
* Sets the value of the useOrgSettings property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setUseOrgSettings(Boolean value) {
this.useOrgSettings = value;
}
/**
* Gets the value of the domainName property.
@ -494,16 +442,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainName;
}
/**
* Sets the value of the domainName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainName(String value) {
this.domainName = value;
}
/**
* Gets the value of the domainUserName property.
*
@ -514,16 +452,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainUserName;
}
/**
* Sets the value of the domainUserName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserName(String value) {
this.domainUserName = value;
}
/**
* Gets the value of the domainUserPassword property.
*
@ -534,16 +462,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainUserPassword;
}
/**
* Sets the value of the domainUserPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserPassword(String value) {
this.domainUserPassword = value;
}
/**
* Gets the value of the adminPasswordEnabled property.
*
@ -554,16 +472,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPasswordEnabled;
}
/**
* Sets the value of the adminPasswordEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordEnabled(Boolean value) {
this.adminPasswordEnabled = value;
}
/**
* Gets the value of the adminPasswordAuto property.
*
@ -574,16 +482,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPasswordAuto;
}
/**
* Sets the value of the adminPasswordAuto property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordAuto(Boolean value) {
this.adminPasswordAuto = value;
}
/**
* Gets the value of the adminPassword property.
*
@ -594,16 +492,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPassword;
}
/**
* Sets the value of the adminPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setAdminPassword(String value) {
this.adminPassword = value;
}
/**
* Gets the value of the resetPasswordRequired property.
*
@ -614,16 +502,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return resetPasswordRequired;
}
/**
* Sets the value of the resetPasswordRequired property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setResetPasswordRequired(Boolean value) {
this.resetPasswordRequired = value;
}
/**
* Gets the value of the customizationScript property.
*
@ -634,16 +512,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return customizationScript;
}
/**
* Sets the value of the customizationScript property.
*
* @param value allowed object is
* {@link String }
*/
public void setCustomizationScript(String value) {
this.customizationScript = value;
}
/**
* Gets the value of the computerName property.
*
@ -654,69 +522,14 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return computerName;
}
/**
* Sets the value of the computerName property.
*
* @param value allowed object is
* {@link String }
*/
public void setComputerName(String value) {
this.computerName = value;
}
/**
* 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 List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any 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 any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link org.w3c.dom.Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
public Set<Link> getLink() {
return Collections.unmodifiableSet(this.links);
}
/**
@ -726,13 +539,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return href;
}
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
@ -743,16 +549,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -760,7 +556,8 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
if (o == null || getClass() != o.getClass())
return false;
GuestCustomizationSection that = GuestCustomizationSection.class.cast(o);
return equal(enabled, that.enabled) &&
return super.equals(that) &&
equal(enabled, that.enabled) &&
equal(changeSid, that.changeSid) &&
equal(virtualMachineId, that.virtualMachineId) &&
equal(joinDomainEnabled, that.joinDomainEnabled) &&
@ -774,15 +571,15 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
equal(resetPasswordRequired, that.resetPasswordRequired) &&
equal(customizationScript, that.customizationScript) &&
equal(computerName, that.computerName) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(links, that.links) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(enabled,
return Objects.hashCode(super.hashCode(),
enabled,
changeSid,
virtualMachineId,
joinDomainEnabled,
@ -796,15 +593,14 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
resetPasswordRequired,
customizationScript,
computerName,
link,
any,
links,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
public Objects.ToStringHelper string() {
return super.string()
.add("enabled", enabled)
.add("changeSid", changeSid)
.add("virtualMachineId", virtualMachineId)
@ -819,10 +615,9 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
.add("resetPasswordRequired", resetPasswordRequired)
.add("customizationScript", customizationScript)
.add("computerName", computerName)
.add("link", link)
.add("any", any)
.add("links", links)
.add("href", href)
.add("type", type).toString();
.add("type", type);
}
}

View File

@ -20,7 +20,6 @@
package org.jclouds.vcloud.director.v1_5.domain;
/**
* Parameters for Instantiating a vApp
*
@ -43,17 +42,7 @@ public class InstantiateVAppParams
extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> {
public InstantiateVAppParams build() {
InstantiateVAppParams instantiateVAppParams = new InstantiateVAppParams();
instantiateVAppParams.setSource(source);
instantiateVAppParams.setIsSourceDelete(isSourceDelete);
instantiateVAppParams.setLinkedClone(linkedClone);
instantiateVAppParams.setVAppParent(vAppParent);
instantiateVAppParams.setInstantiationParams(instantiationParams);
instantiateVAppParams.setDeploy(deploy);
instantiateVAppParams.setPowerOn(powerOn);
instantiateVAppParams.setDescription(description);
instantiateVAppParams.setName(name);
return instantiateVAppParams;
return new InstantiateVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
}
/**
@ -65,7 +54,7 @@ public class InstantiateVAppParams
}
/**
* @see InstantiateVAppParams#getIsSourceDelete()
* @see InstantiateVAppParams#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete);
@ -73,7 +62,7 @@ public class InstantiateVAppParams
}
/**
* @see InstantiateVAppParams#getLinkedClone()
* @see InstantiateVAppParams#isLinkedClone()
*/
public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone);
@ -113,7 +102,7 @@ public class InstantiateVAppParams
}
/**
* @see VAppCreationParamsType#getDeploy()
* @see VAppCreationParamsType#isDeploy()
*/
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
@ -121,7 +110,7 @@ public class InstantiateVAppParams
}
/**
* @see VAppCreationParamsType#getPowerOn()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
@ -136,11 +125,17 @@ public class InstantiateVAppParams
InstantiateVAppParamsType<InstantiateVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder fromInstantiateVAppParams(InstantiateVAppParams in) {
return fromInstantiateVAppParamsType(in);
}
}
private InstantiateVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
protected InstantiateVAppParams() {
// For JAXB and builder use
}

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/**
*
* Represents vApp instantiation parameters.
*
*
* <p/>
* <p/>
* <p>Java class for InstantiateVAppParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="InstantiateVAppParams">
* &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppParams", propOrder = {
"source",
"isSourceDelete"
@ -93,7 +87,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
/**
* @see InstantiateVAppParamsType#getIsSourceDelete()
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder<T> isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete;
@ -101,26 +95,15 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
/**
* @see InstantiateVAppParamsType#getLinkedClone()
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder<T> linkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
public InstantiateVAppParamsType<T> build() {
InstantiateVAppParamsType<T> instantiateVAppParams = new InstantiateVAppParamsType<T>();
instantiateVAppParams.setSource(source);
instantiateVAppParams.setIsSourceDelete(isSourceDelete);
instantiateVAppParams.setLinkedClone(linkedClone);
instantiateVAppParams.setVAppParent(vAppParent);
instantiateVAppParams.setInstantiationParams(instantiationParams);
instantiateVAppParams.setDeploy(deploy);
instantiateVAppParams.setPowerOn(powerOn);
instantiateVAppParams.setDescription(description);
instantiateVAppParams.setName(name);
return instantiateVAppParams;
return new InstantiateVAppParamsType<T>(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
}
/**
@ -156,7 +139,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
/**
* @see VAppCreationParamsType#getDeploy()
* @see VAppCreationParamsType#isDeploy()
*/
public Builder<T> deploy(Boolean deploy) {
super.deploy(deploy);
@ -164,7 +147,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
/**
* @see VAppCreationParamsType#getPowerOn()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder<T> powerOn(Boolean powerOn) {
super.powerOn(powerOn);
@ -179,6 +162,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder<T> fromInstantiateVAppParamsType(InstantiateVAppParamsType<T> in) {
return fromVAppCreationParamsType(in)
.source(in.getSource())
@ -187,12 +171,19 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
}
public InstantiateVAppParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.source = source;
isSourceDelete = sourceDelete;
this.linkedClone = linkedClone;
}
protected InstantiateVAppParamsType() {
// For JAXB and builder use
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
@ -203,75 +194,33 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
/**
* Gets the value of the source property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
* Gets the value of the isSourceDelete property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
/**
* Gets the value of the linkedClone property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isLinkedClone() {
return linkedClone;
}
/**
* Sets the value of the linkedClone property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setLinkedClone(Boolean value) {
this.linkedClone = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents vApp template instantiation parameters.
*
*
* <p/>
* <p/>
* <p>Java class for InstantiateVAppTemplateParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="InstantiateVAppTemplateParams">
* &lt;complexContent>
@ -50,10 +47,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppTemplateParams", propOrder = {
"allEULAsAccepted"
})
@ -74,7 +68,7 @@ public class InstantiateVAppTemplateParams
private Boolean allEULAsAccepted;
/**
* @see InstantiateVAppTemplateParamsType#getAllEULAsAccepted()
* @see InstantiateVAppTemplateParams#isAllEULAsAccepted()
*/
public Builder allEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted;
@ -82,9 +76,7 @@ public class InstantiateVAppTemplateParams
}
public InstantiateVAppTemplateParams build() {
InstantiateVAppTemplateParams instantiateVAppTemplateParams = new InstantiateVAppTemplateParams();
instantiateVAppTemplateParams.setAllEULAsAccepted(allEULAsAccepted);
return instantiateVAppTemplateParams;
return new InstantiateVAppTemplateParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone, allEULAsAccepted);
}
/**
@ -120,7 +112,7 @@ public class InstantiateVAppTemplateParams
}
/**
* @see VAppCreationParamsType#getDeploy()
* @see VAppCreationParamsType#isDeploy()
*/
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
@ -128,7 +120,7 @@ public class InstantiateVAppTemplateParams
}
/**
* @see VAppCreationParamsType#getPowerOn()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
@ -149,45 +141,34 @@ public class InstantiateVAppTemplateParams
}
}
public InstantiateVAppTemplateParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone, Boolean allEULAsAccepted) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
this.allEULAsAccepted = allEULAsAccepted;
}
private InstantiateVAppTemplateParams() {
// For JAXB and builder use
}
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
/**
*
* Used to confirm acceptance of all EULAs in a
* vApp template. Instantiation fails if this
* element is missing, empty, or set to false
* and one or more EulaSection elements are
* present.
*
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
}
/**
* Sets the value of the allEULAsAccepted property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setAllEULAsAccepted(Boolean value) {
this.allEULAsAccepted = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,13 +20,12 @@
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.ArrayList;
import java.util.List;
import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
@ -38,17 +37,17 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/**
*
* Represents a list of ovf:Section to configure for instantiating a VApp.
*
*
* <p/>
* <p/>
* <p>Java class for InstantiationParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="InstantiationParams">
* &lt;complexContent>
@ -61,10 +60,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiationParams", propOrder = {
"section"
})
@ -78,14 +74,13 @@ public class InstantiationParams {
}
public static class Builder {
private List<JAXBElement<? extends SectionType<?>>> sections;
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
* @see InstantiationParams#getSections()
*/
public Builder sections(List<JAXBElement<? extends SectionType<?>>> sections) {
this.sections = sections;
public Builder sections(Set<? extends SectionType<?>> sections) {
this.sections = checkNotNull(sections, "sections");
return this;
}
@ -105,34 +100,33 @@ public class InstantiationParams {
// For JAXB and builder use
}
private InstantiationParams(List<JAXBElement<? extends SectionType<?>>> sections) {
private InstantiationParams(Set<? extends SectionType<?>> sections) {
this.sections = sections;
}
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected List<JAXBElement<? extends SectionType<?>>> sections;
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
*
* An ovf:Section to configure for instantiation.
*
* <p/>
* Gets the value of the section property.
*
* <p>
* <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/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
*
*
* <p>
* <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 >}
@ -152,13 +146,8 @@ public class InstantiationParams {
* {@link JAXBElement }{@code <}{@link NetworkSection }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*
*
*/
public List<JAXBElement<? extends SectionType<?>>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends SectionType<?>>>();
}
public Set<? extends SectionType<?>> getSections() {
return this.sections;
}

View File

@ -20,10 +20,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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpAddresses")
@XmlRootElement(name = "IpAddresses")
public class IpAddresses {
public static Builder builder() {
@ -83,7 +81,7 @@ public class IpAddresses {
this.ipAddresses = ImmutableSet.copyOf(orgs);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpAddress")
@XmlElement(name = "IpAddress")
private Set<String> ipAddresses = Sets.newLinkedHashSet();
public Set<String> getIpAddresses() {

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRange")
@XmlRootElement(name = "IpRange")
public class IpRange {
public static Builder builder() {
@ -81,10 +80,9 @@ public class IpRange {
this.endAddress = endAddress;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "StartAddress")
@XmlElement(name = "StartAddress")
private String startAddress;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "EndAddress")
@XmlElement(name = "EndAddress")
private String endAddress;
/**

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
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;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRanges")
@XmlRootElement(name = "IpRanges")
public class IpRanges {
public static Builder builder() {
@ -83,7 +81,7 @@ public class IpRanges {
this.ipRanges = ImmutableSet.copyOf(ipRanges);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRange")
@XmlElementRef
private Set<IpRange> ipRanges = Sets.newLinkedHashSet();
public Set<IpRange> getIpRanges() {

View File

@ -19,10 +19,7 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -33,8 +30,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpScope")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "IpScope")
public class IpScope {
public static Builder builder() {
@ -121,15 +117,7 @@ public class IpScope {
}
public IpScope build() {
IpScope ipScope = new IpScope(isInherited);
ipScope.setGateway(gateway);
ipScope.setNetmask(netmask);
ipScope.setDns1(dns1);
ipScope.setDns2(dns2);
ipScope.setDnsSuffix(dnsSuffix);
ipScope.setIpRanges(ipRanges);
ipScope.setAllocatedIpAddresses(allocatedIpAddresses);
return ipScope;
return new IpScope(isInherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
}
public Builder fromIpScope(IpScope in) {
@ -147,25 +135,34 @@ public class IpScope {
// For JAXB and builder use
}
private IpScope(boolean isInherited) {
this.isInherited = isInherited;
public IpScope(boolean inherited, String gateway, String netmask, String dns1, String dns2, String dnsSuffix,
IpRanges ipRanges, IpAddresses allocatedIpAddresses) {
this.isInherited = inherited;
this.gateway = gateway;
this.netmask = netmask;
this.dns1 = dns1;
this.dns2 = dns2;
this.dnsSuffix = dnsSuffix;
this.ipRanges = ipRanges;
this.allocatedIpAddresses = allocatedIpAddresses;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsInherited")
@XmlElement(name = "IsInherited")
private boolean isInherited;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Gateway")
@XmlElement(name = "Gateway")
private String gateway;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Netmask")
@XmlElement(name = "Netmask")
private String netmask;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns1")
@XmlElement(name = "Dns1")
private String dns1;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns2")
@XmlElement(name = "Dns2")
private String dns2;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "DnsSuffix")
@XmlElement(name = "DnsSuffix")
private String dnsSuffix;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRanges")
@XmlElement(name = "IpRanges")
private IpRanges ipRanges;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllocatedIpAddresses")
@XmlElement(name = "AllocatedIpAddresses")
private IpAddresses allocatedIpAddresses;
/**
@ -182,10 +179,6 @@ public class IpScope {
return gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
/**
* @return Network mask.
*/
@ -193,10 +186,6 @@ public class IpScope {
return netmask;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}
/**
* @return Primary DNS server.
*/
@ -204,10 +193,6 @@ public class IpScope {
return dns1;
}
public void setDns1(String dns1) {
this.dns1 = dns1;
}
/**
* @return Secondary DNS server.
*/
@ -215,10 +200,6 @@ public class IpScope {
return dns2;
}
public void setDns2(String dns2) {
this.dns2 = dns2;
}
/**
* @return DNS suffix.
*/
@ -226,10 +207,6 @@ public class IpScope {
return dnsSuffix;
}
public void setDnsSuffix(String dnsSuffix) {
this.dnsSuffix = dnsSuffix;
}
/**
* @return IP ranges used for static pool allocation in the network.
*/
@ -237,10 +214,6 @@ public class IpScope {
return ipRanges;
}
public void setIpRanges(IpRanges ipRanges) {
this.ipRanges = ipRanges;
}
/**
* @return Read-only list of allocated IP addresses in the network.
*/
@ -248,10 +221,6 @@ public class IpScope {
return allocatedIpAddresses;
}
public void setAllocatedIpAddresses(IpAddresses allocatedIpAddresses) {
this.allocatedIpAddresses = allocatedIpAddresses;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,14 +20,11 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -37,9 +34,9 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/**
@ -70,15 +67,13 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "LeaseSettingsSection", namespace = VCLOUD_1_5_NS)
@XmlRootElement(name = "LeaseSettingsSection")
@XmlType(propOrder = {
"link",
"links",
"deploymentLeaseInSeconds",
"storageLeaseInSeconds",
"deploymentLeaseExpiration",
"storageLeaseExpiration",
"any"
"storageLeaseExpiration"
})
public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public static <T extends LeaseSettingsSection> Builder builder() {
@ -90,20 +85,19 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
}
public static class Builder extends SectionType.Builder<LeaseSettingsSection> {
private List<Link> links;
private Set<Link> links = Sets.newLinkedHashSet();
private Integer deploymentLeaseInSeconds;
private Integer storageLeaseInSeconds;
private XMLGregorianCalendar deploymentLeaseExpiration;
private XMLGregorianCalendar storageLeaseExpiration;
private List<Object> any;
private URI href;
private String type;
/**
* @see LeaseSettingsSection#getLinks()
*/
public Builder links(List<Link> links) {
this.links = links;
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return this;
}
@ -139,14 +133,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return this;
}
/**
* @see LeaseSettingsSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this;
}
/**
* @see LeaseSettingsSection#getHref()
*/
@ -165,14 +151,9 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public LeaseSettingsSection build() {
LeaseSettingsSection leaseSettingsSection = new LeaseSettingsSection(info, links, any);
leaseSettingsSection.setDeploymentLeaseInSeconds(deploymentLeaseInSeconds);
leaseSettingsSection.setStorageLeaseInSeconds(storageLeaseInSeconds);
leaseSettingsSection.setDeploymentLeaseExpiration(deploymentLeaseExpiration);
leaseSettingsSection.setStorageLeaseExpiration(storageLeaseExpiration);
leaseSettingsSection.setHref(href);
leaseSettingsSection.setType(type);
return leaseSettingsSection;
return new LeaseSettingsSection(info, required, links, deploymentLeaseInSeconds,
storageLeaseInSeconds, deploymentLeaseExpiration,
storageLeaseExpiration, href, type);
}
public Builder fromLeaseSettingsSection(LeaseSettingsSection in) {
@ -182,7 +163,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
.storageLeaseInSeconds(in.getStorageLeaseInSeconds())
.deploymentLeaseExpiration(in.getDeploymentLeaseExpiration())
.storageLeaseExpiration(in.getStorageLeaseExpiration())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
@ -202,10 +182,18 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
@XmlElement(name = "Link")
protected List<Link> link;
protected Set<Link> links;
@XmlElement(name = "DeploymentLeaseInSeconds")
protected Integer deploymentLeaseInSeconds;
@XmlElement(name = "StorageLeaseInSeconds")
@ -216,18 +204,23 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
@XmlElement(name = "StorageLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar storageLeaseExpiration;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
private LeaseSettingsSection(@Nullable String info, List<Link> link, List<Object> any) {
super(info);
this.link = link;
this.any = any;
private LeaseSettingsSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Integer deploymentLeaseInSeconds,
Integer storageLeaseInSeconds, XMLGregorianCalendar deploymentLeaseExpiration,
XMLGregorianCalendar storageLeaseExpiration, URI href, String type) {
super(info, required);
this.links = links;
this.deploymentLeaseInSeconds = deploymentLeaseInSeconds;
this.storageLeaseInSeconds = storageLeaseInSeconds;
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
this.storageLeaseExpiration = storageLeaseExpiration;
this.href = href;
this.type = type;
}
private LeaseSettingsSection() {
@ -254,11 +247,8 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLinks() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
}
/**
@ -271,16 +261,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return deploymentLeaseInSeconds;
}
/**
* Sets the value of the deploymentLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setDeploymentLeaseInSeconds(Integer value) {
this.deploymentLeaseInSeconds = value;
}
/**
* Gets the value of the storageLeaseInSeconds property.
*
@ -291,16 +271,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return storageLeaseInSeconds;
}
/**
* Sets the value of the storageLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setStorageLeaseInSeconds(Integer value) {
this.storageLeaseInSeconds = value;
}
/**
* Gets the value of the deploymentLeaseExpiration property.
*
@ -311,16 +281,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return deploymentLeaseExpiration;
}
/**
* Sets the value of the deploymentLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setDeploymentLeaseExpiration(XMLGregorianCalendar value) {
this.deploymentLeaseExpiration = value;
}
/**
* Gets the value of the storageLeaseExpiration property.
*
@ -331,44 +291,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return storageLeaseExpiration;
}
/**
* Sets the value of the storageLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setStorageLeaseExpiration(XMLGregorianCalendar value) {
this.storageLeaseExpiration = value;
}
/**
* Gets the value of the any 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 any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* @return the value of the href property.
*/
@ -376,15 +298,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return href;
}
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
@ -395,16 +308,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -412,39 +315,38 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
if (o == null || getClass() != o.getClass())
return false;
LeaseSettingsSection that = LeaseSettingsSection.class.cast(o);
return equal(link, that.link) &&
return super.equals(that) &&
equal(links, that.links) &&
equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
equal(storageLeaseInSeconds, that.storageLeaseInSeconds) &&
equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
equal(storageLeaseExpiration, that.storageLeaseExpiration) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(link,
return Objects.hashCode(super.hashCode(),
links,
deploymentLeaseInSeconds,
storageLeaseInSeconds,
deploymentLeaseExpiration,
storageLeaseExpiration,
any,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("link", link)
public Objects.ToStringHelper string() {
return super.string()
.add("links", links)
.add("deploymentLeaseInSeconds", deploymentLeaseInSeconds)
.add("storageLeaseInSeconds", storageLeaseInSeconds)
.add("deploymentLeaseExpiration", deploymentLeaseExpiration)
.add("storageLeaseExpiration", storageLeaseExpiration)
.add("any", any)
.add("href", href)
.add("type", type).toString();
.add("type", type);
}
}

View File

@ -25,21 +25,22 @@ import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* A link.
*
* <p/>
* <pre>
* &lt;xs:complexType name="LinkType"&gt;
* </pre>
*
* @author Adrian Cole
*/
@XmlRootElement(name = "Link")
public class Link extends ReferenceType<Link> {
public static final class Rel {
@ -60,7 +61,7 @@ public class Link extends ReferenceType<Link> {
/**
* All acceptable {@link Link#getRel()} values.
*
* <p/>
* This list must be updated whenever a new relationship is added.
*/
public static final List<String> ALL = Arrays.asList(
@ -97,11 +98,7 @@ public class Link extends ReferenceType<Link> {
@Override
public Link build() {
Link link = new Link(href, rel);
link.setId(id);
link.setName(name);
link.setType(type);
return link;
return new Link(href, id, name, type, rel);
}
/**
@ -166,8 +163,8 @@ public class Link extends ReferenceType<Link> {
@XmlAttribute(required = true)
private String rel;
private Link(URI href, String rel) {
super(href);
private Link(URI href, String id, String name, String type, String rel) {
super(href, id, name, type);
this.rel = checkNotNull(rel, "rel");
}

View File

@ -19,13 +19,11 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -35,12 +33,12 @@ import com.google.common.base.Objects.ToStringHelper;
/**
* Represents a media.
*
* <p/>
* <pre>
* &lt;complexType name="Media" /&gt;
* </pre>
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Media")
@XmlRootElement(name = "Media")
public class Media extends ResourceEntityType<Media> {
public static final class ImageType {
@ -92,18 +90,7 @@ public class Media extends ResourceEntityType<Media> {
@Override
public Media build() {
Media media = new Media(href, name);
media.setOwner(owner);
media.setImageType(imageType);
media.setSize(size);
media.setFiles(files);
media.setStatus(status);
media.setDescription(description);
media.setTasksInProgress(tasksInProgress);
media.setId(id);
media.setType(type);
media.setLinks(links);
return media;
return new Media(href, type, links, description, tasksInProgress, id, name, files, status, owner, imageType, size);
}
/**
@ -179,7 +166,7 @@ public class Media extends ResourceEntityType<Media> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -188,7 +175,7 @@ public class Media extends ResourceEntityType<Media> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -206,15 +193,20 @@ public class Media extends ResourceEntityType<Media> {
}
}
public Media() {
public Media(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, FilesList files, Integer status, Owner owner, String imageType, long size) {
super(href, type, links, description, tasksInProgress, id, name, files, status);
this.owner = owner;
this.imageType = imageType;
this.size = size;
}
private Media() {
// for JAXB
}
protected Media(URI href, String name) {
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
@XmlElement(name = "Owner")
protected Owner owner;
@XmlAttribute(required = true)
protected String imageType;
@ -228,10 +220,6 @@ public class Media extends ResourceEntityType<Media> {
return owner;
}
public void setOwner(Owner value) {
this.owner = value;
}
/**
* Gets the value of the imageType property.
*/
@ -239,10 +227,6 @@ public class Media extends ResourceEntityType<Media> {
return imageType;
}
public void setImageType(String value) {
this.imageType = value;
}
/**
* Gets the value of the size property.
*/
@ -250,10 +234,6 @@ public class Media extends ResourceEntityType<Media> {
return size;
}
public void setSize(long value) {
this.size = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -37,14 +35,14 @@ import com.google.common.collect.Sets;
/**
* Represents a set of metadata
*
* <p/>
* <pre>
* &lt;xs:complexType name="Metadata"&gt;
* </pre>
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Metadata")
@XmlRootElement(name = "Metadata")
public class Metadata extends ResourceType<Metadata> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA;
@ -81,10 +79,7 @@ public class Metadata extends ResourceType<Metadata> {
@Override
public Metadata build() {
Metadata metadata = new Metadata(href, metadataEntries);
metadata.setType(type);
metadata.setLinks(links);
return metadata;
return new Metadata(href, type, links, metadataEntries);
}
/**
@ -137,15 +132,16 @@ public class Metadata extends ResourceType<Metadata> {
}
private Metadata() {
// For JAXB and builder use
// For JAXB
}
private Metadata(URI href, Set<MetadataEntry> metadataEntries) {
super(href);
private Metadata(URI href, String type, Set<Link> links, Set<MetadataEntry> metadataEntries) {
super(href, type, links);
this.metadataEntries = ImmutableSet.copyOf(metadataEntries);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry")
@XmlElement(name = "MetadataEntry")
private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet();
public Set<MetadataEntry> getMetadataEntries() {

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,14 +34,14 @@ import com.google.common.collect.Sets;
/**
* Represents a metadata entry
*
* <p/>
* <pre>
* &lt;xs:complexType name="MetadataType"&gt;
* </pre>
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry")
@XmlRootElement(name = "MetadataEntry")
public class MetadataEntry extends ResourceType<MetadataEntry> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY;
@ -53,7 +51,6 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromMetadataEntry(this);
}
@ -90,10 +87,7 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
@Override
public MetadataEntry build() {
MetadataEntry metadataEntry = new MetadataEntry(href, key, value);
metadataEntry.setType(type);
metadataEntry.setLinks(links);
return metadataEntry;
return new MetadataEntry(href, type, links, key, value);
}
/**
@ -149,15 +143,15 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
// For JAXB and builder use
}
private MetadataEntry(URI href, String key, String value) {
super(href);
public MetadataEntry(URI href, String type, Set<Link> links, String key, String value) {
super(href, type, links);
this.key = checkNotNull(key, "key");
this.value = checkNotNull(value, "value");
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Key")
@XmlElement(name = "Key")
private String key;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Value")
@XmlElement(name = "Value")
private String value;
/**

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,14 +34,14 @@ import com.google.common.collect.Sets;
/**
* Represents a metadata entry
*
* <p/>
* <pre>
* &lt;xs:complexType name="MetadataType"&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataValue")
@XmlRootElement(name = "MetadataValue")
public class MetadataValue extends ResourceType<MetadataValue> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY;
@ -71,10 +69,7 @@ public class MetadataValue extends ResourceType<MetadataValue> {
@Override
public MetadataValue build() {
MetadataValue metadataValue = new MetadataValue(href, value);
metadataValue.setType(type);
metadataValue.setLinks(links);
return metadataValue;
return new MetadataValue(href, type, links, value);
}
/**
@ -127,15 +122,15 @@ public class MetadataValue extends ResourceType<MetadataValue> {
}
private MetadataValue() {
// For JAXB and builder use
// For JAXB
}
private MetadataValue(URI href, String value) {
super(href);
private MetadataValue(URI href, String type, Set<Link> links, String value) {
super(href, type, links);
this.value = checkNotNull(value, "value");
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Value", required = true)
@XmlElement(name = "Value", required = true)
private String value;
/**

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents mapping between a VM and vApp network.
*
*
* <p/>
* <p/>
* <p>Java class for NetworkAssignment complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="NetworkAssignment">
* &lt;complexContent>
@ -49,10 +46,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkAssignment")
public class NetworkAssignment
@ -87,27 +81,26 @@ public class NetworkAssignment
return this;
}
public NetworkAssignment build() {
NetworkAssignment networkAssignment = new NetworkAssignment();
networkAssignment.setInnerNetwork(innerNetwork);
networkAssignment.setContainerNetwork(containerNetwork);
return networkAssignment;
return new NetworkAssignment(innerNetwork, containerNetwork);
}
public Builder fromNetworkAssignment(NetworkAssignment in) {
return innerNetwork(in.getInnerNetwork())
.containerNetwork(in.getContainerNetwork());
}
}
private NetworkAssignment(String innerNetwork, String containerNetwork) {
this.innerNetwork = innerNetwork;
this.containerNetwork = containerNetwork;
}
private NetworkAssignment() {
// For JAXB and builder use
}
@XmlAttribute(required = true)
protected String innerNetwork;
@XmlAttribute(required = true)
@ -116,51 +109,23 @@ public class NetworkAssignment
/**
* Gets the value of the innerNetwork property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getInnerNetwork() {
return innerNetwork;
}
/**
* Sets the value of the innerNetwork property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInnerNetwork(String value) {
this.innerNetwork = value;
}
/**
* Gets the value of the containerNetwork property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getContainerNetwork() {
return containerNetwork;
}
/**
* Sets the value of the containerNetwork property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContainerNetwork(String value) {
this.containerNetwork = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,14 +20,11 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,9 +33,10 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -66,12 +64,10 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="NetworkConfigSection", namespace = VCLOUD_1_5_NS)
@XmlRootElement(name = "NetworkConfigSection")
@XmlType(propOrder = {
"link",
"networkConfig",
"any"
"links",
"networkConfigs"
})
public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static Builder builder() {
@ -84,33 +80,24 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static class Builder extends SectionType.Builder<NetworkConfigSection> {
private List<Link> link;
private List<VAppNetworkConfiguration<?>> networkConfig;
private List<Object> any;
private Set<Link> links = Sets.newLinkedHashSet();
private Set<VAppNetworkConfiguration<?>> networkConfigs = Sets.newLinkedHashSet();
private URI href;
private String type;
/**
* @see NetworkConfigSection#getLink()
* @see NetworkConfigSection#getLinks()
*/
public Builder link(List<Link> link) {
this.link = link;
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return this;
}
/**
* @see NetworkConfigSection#getNetworkConfig()
* @see NetworkConfigSection#getNetworkConfigs()
*/
public Builder networkConfig(List<VAppNetworkConfiguration<?>> networkConfig) {
this.networkConfig = networkConfig;
return this;
}
/**
* @see NetworkConfigSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
public Builder networkConfig(Set<VAppNetworkConfiguration<?>> networkConfigs) {
this.networkConfigs = checkNotNull(networkConfigs, "networkConfigs");
return this;
}
@ -132,17 +119,13 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public NetworkConfigSection build() {
NetworkConfigSection networkConfigSection = new NetworkConfigSection(info, link, networkConfig, any);
networkConfigSection.setHref(href);
networkConfigSection.setType(type);
return networkConfigSection;
return new NetworkConfigSection(info, required, links, networkConfigs, href, type);
}
public Builder fromNetworkConfigSection(NetworkConfigSection in) {
return fromSection(in)
.link(in.getLink())
.networkConfig(in.getNetworkConfig())
.any(in.getAny())
.links(in.getLinks())
.networkConfig(in.getNetworkConfigs())
.href(in.getHref())
.type(in.getType());
}
@ -163,25 +146,33 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
@XmlElement(name = "Link")
protected List<Link> link;
protected Set<Link> links;
@XmlElement(name = "NetworkConfig")
protected List<VAppNetworkConfiguration<?>> networkConfig;
@XmlAnyElement(lax = true)
protected List<Object> any;
protected Set<VAppNetworkConfiguration<?>> networkConfigs;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
private NetworkConfigSection(@Nullable String info, List<Link> link, List<VAppNetworkConfiguration<?>> networkConfig, List<Object> any) {
super(info);
this.link = link;
this.networkConfig = networkConfig;
this.any = any;
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);
this.networkConfigs = ImmutableSet.copyOf(networkConfigs);
this.href = href;
this.type = type;
}
private NetworkConfigSection() {
@ -190,84 +181,16 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
/**
* 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 List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
}
/**
* Gets the value of the networkConfig 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 networkConfig property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConfig().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link VAppNetworkConfiguration }
*/
public List<VAppNetworkConfiguration<?>> getNetworkConfig() {
if (networkConfig == null) {
networkConfig = new ArrayList<VAppNetworkConfiguration<?>>();
}
return this.networkConfig;
}
/**
* Gets the value of the any 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 any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
public Set<VAppNetworkConfiguration<?>> getNetworkConfigs() {
return Collections.unmodifiableSet(this.networkConfigs);
}
/**
@ -277,13 +200,6 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return href;
}
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
@ -294,16 +210,6 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -311,30 +217,29 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
if (o == null || getClass() != o.getClass())
return false;
NetworkConfigSection that = NetworkConfigSection.class.cast(o);
return equal(link, that.link) &&
equal(networkConfig, that.networkConfig) &&
equal(any, that.any) &&
return super.equals(that) &&
equal(links, that.links) &&
equal(networkConfigs, that.networkConfigs) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(link,
networkConfig,
any,
return Objects.hashCode(super.hashCode(),
links,
networkConfigs,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("link", link)
.add("networkConfig", networkConfig)
.add("any", any)
public Objects.ToStringHelper string() {
return super.string()
.add("links", links)
.add("networkConfigs", networkConfigs)
.add("href", href)
.add("type", type).toString();
.add("type", type);
}
}

View File

@ -19,10 +19,8 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -33,8 +31,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkConfiguration")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "NetworkConfiguration")
public class NetworkConfiguration {
public static Builder builder() {
@ -111,14 +108,7 @@ public class NetworkConfiguration{
}
public NetworkConfiguration build() {
NetworkConfiguration networkConfiguration = new NetworkConfiguration(fenceMode);
networkConfiguration.setIpScope(ipScope);
networkConfiguration.setParentNetwork(parentNetwork);
networkConfiguration.setRetainNetInfoAcrossDeployments(retainNetInfoAcrossDeployments);
networkConfiguration.setNetworkFeatures(features);
networkConfiguration.setSyslogServerSettings(syslogServerSettings);
networkConfiguration.setRouterInfo(routerInfo);
return networkConfiguration;
return new NetworkConfiguration(ipScope, parentNetwork, fenceMode, retainNetInfoAcrossDeployments, features, syslogServerSettings, routerInfo);
}
public Builder fromConfiguration(NetworkConfiguration in) {
@ -130,27 +120,34 @@ public class NetworkConfiguration{
}
}
public NetworkConfiguration(IpScope ipScope, ReferenceType<?> parentNetwork, String fenceMode, boolean retainNetInfoAcrossDeployments,
NetworkFeatures features, SyslogServerSettings syslogServerSettings, RouterInfo routerInfo) {
this.ipScope = ipScope;
this.parentNetwork = parentNetwork;
this.fenceMode = checkNotNull(fenceMode, "fenceMode");
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
this.features = features;
this.syslogServerSettings = syslogServerSettings;
this.routerInfo = routerInfo;
}
private NetworkConfiguration() {
// For JAXB and builder use
}
private NetworkConfiguration(String fenceMode) {
this.fenceMode = fenceMode;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpScope")
@XmlElement(name = "IpScope")
private IpScope ipScope;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "ParentNetwork")
@XmlElement(name = "ParentNetwork")
private ReferenceType<?> parentNetwork;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FenceMode")
@XmlElement(name = "FenceMode")
private String fenceMode;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "RetainNetInfoAcrossDeployments")
@XmlElement(name = "RetainNetInfoAcrossDeployments")
private boolean retainNetInfoAcrossDeployments = false;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Features")
@XmlElement(name = "Features")
private NetworkFeatures features;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings")
@XmlElement(name = "SyslogServerSettings")
private SyslogServerSettings syslogServerSettings;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo")
@XmlElement(name = "RouterInfo")
private RouterInfo routerInfo;
/**
@ -162,10 +159,6 @@ public class NetworkConfiguration{
return ipScope;
}
public void setIpScope(IpScope ipScope) {
this.ipScope = ipScope;
}
/**
* @return reference to parent network.
*/
@ -173,10 +166,6 @@ public class NetworkConfiguration{
return parentNetwork;
}
public void setParentNetwork(ReferenceType<?> parentNetwork) {
this.parentNetwork = parentNetwork;
}
/**
* @return Isolation type of the network. If ParentNetwork is specified, this property
* controls connectivity to the parent. One of: bridged (connected directly to the ParentNetwork),
@ -195,10 +184,6 @@ public class NetworkConfiguration{
return retainNetInfoAcrossDeployments;
}
public void setRetainNetInfoAcrossDeployments(boolean retainNetInfoAcrossDeployments) {
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
}
/**
* @return Network features like DHCP, firewall and NAT rules.
*/
@ -206,10 +191,6 @@ public class NetworkConfiguration{
return features;
}
public void setNetworkFeatures(NetworkFeatures features) {
this.features = features;
}
/**
* @return Syslog server settings for the network.
*/
@ -217,10 +198,6 @@ public class NetworkConfiguration{
return syslogServerSettings;
}
public void setSyslogServerSettings(SyslogServerSettings syslogServerSettings) {
this.syslogServerSettings = syslogServerSettings;
}
/**
* @return router information
*/
@ -228,10 +205,6 @@ public class NetworkConfiguration{
return routerInfo;
}
public void setRouterInfo(RouterInfo routerInfo) {
this.routerInfo = routerInfo;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -31,14 +29,13 @@ import com.google.common.base.Objects;
/**
*
* Represents a network connection.
*
*
* <p/>
* <p/>
* <p>Java class for NetworkConnection complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="NetworkConnection">
* &lt;complexContent>
@ -58,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkConnection", propOrder = {
"networkConnectionIndex",
"ipAddress",
@ -115,7 +109,7 @@ public class NetworkConnection {
}
/**
* @see NetworkConnection#getIsConnected()
* @see NetworkConnection#isConnected()
*/
public Builder isConnected(boolean isConnected) {
this.isConnected = isConnected;
@ -123,7 +117,7 @@ public class NetworkConnection {
}
/**
* @see NetworkConnection#getMacAddress()
* @see NetworkConnection#getMACAddress()
*/
public Builder macAddress(String macAddress) {
this.macAddress = macAddress;
@ -147,7 +141,7 @@ public class NetworkConnection {
}
/**
* @see NetworkConnection#getNeedsCustomization()
* @see NetworkConnection#needsCustomization()
*/
public Builder needsCustomization(Boolean needsCustomization) {
this.needsCustomization = needsCustomization;
@ -156,15 +150,8 @@ public class NetworkConnection {
public NetworkConnection build() {
NetworkConnection networkConnection = new NetworkConnection(macAddress);
networkConnection.setNetworkConnectionIndex(networkConnectionIndex);
networkConnection.setIpAddress(ipAddress);
networkConnection.setExternalIpAddress(externalIpAddress);
networkConnection.setIsConnected(isConnected);
networkConnection.setIpAddressAllocationMode(ipAddressAllocationMode);
networkConnection.setNetwork(network);
networkConnection.setNeedsCustomization(needsCustomization);
return networkConnection;
return new NetworkConnection(networkConnectionIndex, ipAddress, externalIpAddress, isConnected,
macAddress, ipAddressAllocationMode, network, needsCustomization);
}
@ -180,12 +167,20 @@ public class NetworkConnection {
}
}
private NetworkConnection() {
// For JAXB and builder use
public NetworkConnection(int networkConnectionIndex, String ipAddress, String externalIpAddress, boolean connected,
String macAddress, String ipAddressAllocationMode, String network, Boolean needsCustomization) {
this.networkConnectionIndex = networkConnectionIndex;
this.ipAddress = ipAddress;
this.externalIpAddress = externalIpAddress;
isConnected = connected;
this.macAddress = macAddress;
this.ipAddressAllocationMode = ipAddressAllocationMode;
this.network = network;
this.needsCustomization = needsCustomization;
}
private NetworkConnection(String macAddress) {
this.macAddress = macAddress;
private NetworkConnection() {
// For JAXB and builder use
}
@ -208,180 +203,78 @@ public class NetworkConnection {
/**
* Gets the value of the networkConnectionIndex property.
*
*/
public int getNetworkConnectionIndex() {
return networkConnectionIndex;
}
/**
* Sets the value of the networkConnectionIndex property.
*
*/
public void setNetworkConnectionIndex(int value) {
this.networkConnectionIndex = value;
}
/**
* Gets the value of the ipAddress property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getIpAddress() {
return ipAddress;
}
/**
* Sets the value of the ipAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddress(String value) {
this.ipAddress = value;
}
/**
* Gets the value of the externalIpAddress property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Sets the value of the externalIpAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setExternalIpAddress(String value) {
this.externalIpAddress = value;
}
/**
* Gets the value of the isConnected property.
*
*/
public boolean isConnected() {
return isConnected;
}
/**
* Sets the value of the isConnected property.
*
*/
public void setIsConnected(boolean value) {
this.isConnected = value;
}
/**
* Gets the value of the macAddress property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getMACAddress() {
return macAddress;
}
/**
* Sets the value of the macAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMACAddress(String value) {
this.macAddress = value;
}
/**
* Gets the value of the ipAddressAllocationMode property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getIpAddressAllocationMode() {
return ipAddressAllocationMode;
}
/**
* Sets the value of the ipAddressAllocationMode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddressAllocationMode(String value) {
this.ipAddressAllocationMode = value;
}
/**
* Gets the value of the network property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getNetwork() {
return network;
}
/**
* Sets the value of the network property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNetwork(String value) {
this.network = value;
}
/**
* Gets the value of the needsCustomization property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean needsCustomization() {
return needsCustomization;
}
/**
* Sets the value of the needsCustomization property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setNeedsCustomization(Boolean value) {
this.needsCustomization = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,15 +20,10 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -37,9 +32,10 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -68,13 +64,11 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="NetworkConnectionSection", namespace = VCLOUD_1_5_NS)
@XmlRootElement(name = "NetworkConnectionSection")
@XmlType(propOrder = {
"primaryNetworkConnectionIndex",
"networkConnection",
"link",
"any"
"networkConnections",
"links"
})
public class NetworkConnectionSection extends SectionType<NetworkConnectionSection> {
@ -89,9 +83,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public static class Builder extends SectionType.Builder<NetworkConnectionSection> {
private Integer primaryNetworkConnectionIndex;
private List<NetworkConnection> networkConnection;
private List<Link> link;
private List<Object> any;
private Set<NetworkConnection> networkConnection = Sets.newLinkedHashSet();
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
@ -104,26 +97,18 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
}
/**
* @see NetworkConnectionSection#getNetworkConnection()
* @see NetworkConnectionSection#getNetworkConnections()
*/
public Builder networkConnection(List<NetworkConnection> networkConnection) {
this.networkConnection = networkConnection;
public Builder networkConnection(Set<NetworkConnection> networkConnection) {
this.networkConnection = checkNotNull(networkConnection, "networkConnection");
return this;
}
/**
* @see NetworkConnectionSection#getLink()
* @see NetworkConnectionSection#getLinks()
*/
public Builder link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see NetworkConnectionSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return this;
}
@ -145,19 +130,15 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public NetworkConnectionSection build() {
NetworkConnectionSection networkConnectionSection = new NetworkConnectionSection(info, networkConnection, link, any);
networkConnectionSection.setPrimaryNetworkConnectionIndex(primaryNetworkConnectionIndex);
networkConnectionSection.setHref(href);
networkConnectionSection.setType(type);
return networkConnectionSection;
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnection, links, href, type);
}
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnection(in.getNetworkConnection())
.link(in.getLink())
.any(in.getAny())
.networkConnection(in.getNetworkConnections())
.links(in.getLinks())
.href(in.getHref())
.type(in.getType());
}
@ -177,13 +158,25 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
private NetworkConnectionSection(@Nullable String info, List<NetworkConnection> networkConnection, List<Link> link, List<Object> any) {
super(info);
this.networkConnection = networkConnection;
this.link = link;
this.any = any;
}
private NetworkConnectionSection(@Nullable String info, @Nullable Boolean required, Integer primaryNetworkConnectionIndex,
Set<NetworkConnection> networkConnections, Set<Link> links, URI href, String type) {
super(info, required);
this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
this.networkConnections = ImmutableSet.copyOf(networkConnections);
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
}
private NetworkConnectionSection() {
@ -193,11 +186,9 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
@XmlElement(name = "PrimaryNetworkConnectionIndex")
protected Integer primaryNetworkConnectionIndex;
@XmlElement(name = "NetworkConnection")
protected List<NetworkConnection> networkConnection;
protected Set<NetworkConnection> networkConnections = Sets.newLinkedHashSet();
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@ -214,96 +205,24 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return primaryNetworkConnectionIndex;
}
/**
* Sets the value of the primaryNetworkConnectionIndex property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setPrimaryNetworkConnectionIndex(Integer value) {
this.primaryNetworkConnectionIndex = value;
}
/**
* Gets the value of the networkConnection 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 networkConnection property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConnection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkConnection }
*/
public List<NetworkConnection> getNetworkConnection() {
if (networkConnection == null) {
networkConnection = new ArrayList<NetworkConnection>();
}
return this.networkConnection;
public Set<NetworkConnection> getNetworkConnections() {
return this.networkConnections;
}
/**
* 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 List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any 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 any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
public Set<Link> getLinks() {
return this.links;
}
/**
@ -313,15 +232,6 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return href;
}
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
@ -332,16 +242,6 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -349,10 +249,10 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
if (o == null || getClass() != o.getClass())
return false;
NetworkConnectionSection that = NetworkConnectionSection.class.cast(o);
return equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnection, that.networkConnection) &&
equal(link, that.link) &&
equal(any, that.any) &&
return super.equals(that) &&
equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnections, that.networkConnections) &&
equal(links, that.links) &&
equal(href, that.href) &&
equal(type, that.type);
}
@ -360,22 +260,20 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
@Override
public int hashCode() {
return Objects.hashCode(primaryNetworkConnectionIndex,
networkConnection,
link,
any,
networkConnections,
links,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
public Objects.ToStringHelper string() {
return super.string()
.add("primaryNetworkConnectionIndex", primaryNetworkConnectionIndex)
.add("networkConnection", networkConnection)
.add("link", link)
.add("any", any)
.add("networkConnection", networkConnections)
.add("links", links)
.add("href", href)
.add("type", type).toString();
.add("type", type);
}
}

View File

@ -20,10 +20,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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Features")
@XmlRootElement(name = "Features")
public class NetworkFeatures {
public static Builder builder() {
@ -68,9 +66,7 @@ public class NetworkFeatures {
}
public NetworkFeatures build() {
NetworkFeatures networkFeatures = new NetworkFeatures();
networkFeatures.setNetworkServices(services);
return networkFeatures;
return new NetworkFeatures(services);
}
public Builder fromNetworkFeatures(NetworkFeatures in) {
@ -82,7 +78,11 @@ public class NetworkFeatures {
// For JAXB and builder use
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkService")
public NetworkFeatures(Set<NetworkService> services) {
this.services = services;
}
@XmlElement(name = "NetworkService")
private Set<NetworkService> services = Sets.newLinkedHashSet();
/**
@ -93,10 +93,6 @@ public class NetworkFeatures {
return ImmutableSet.copyOf(services);
}
public void setNetworkServices(Set<NetworkService> services) {
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkService")
@XmlRootElement(name = "NetworkService")
public class NetworkService {
public static Builder builder() {
@ -55,9 +54,7 @@ public class NetworkService {
}
public NetworkService build() {
NetworkService networkService = new NetworkService();
networkService.setEnabled(isEnabled);
return networkService;
return new NetworkService(isEnabled);
}
public Builder fromNetworkService(NetworkService in) {
@ -65,11 +62,15 @@ public class NetworkService {
}
}
private NetworkService(boolean enabled) {
isEnabled = enabled;
}
private NetworkService() {
// For JAXB and builder use
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled")
@XmlElement(name = "IsEnabled")
private boolean isEnabled;
/**
@ -79,10 +80,6 @@ public class NetworkService {
return isEnabled;
}
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -32,7 +30,7 @@ import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkType")
@XmlRootElement(name = "NetworkType")
public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
public static <T extends NetworkType<T>> Builder<T> builder() {
@ -58,14 +56,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
@Override
public NetworkType<T> build() {
NetworkType<T> network = new NetworkType<T>(href, name);
network.setConfiguration(networkConfiguration);
network.setDescription(description);
network.setId(id);
network.setType(type);
network.setLinks(links);
network.setTasksInProgress(tasksInProgress);
return network;
return new NetworkType<T>(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
}
/**
@ -123,7 +114,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
@ -132,7 +123,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
@ -154,15 +145,17 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
}
}
public NetworkType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, NetworkConfiguration networkConfiguration) {
super(href, type, links, description, tasksInProgress, id, name);
this.networkConfiguration = networkConfiguration;
}
protected NetworkType() {
// For JAXB and builder use
}
protected NetworkType(URI href, String name) {
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Configuration")
@XmlElement(name = "Configuration")
private NetworkConfiguration networkConfiguration;
/**
@ -172,10 +165,6 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
return networkConfiguration;
}
public void setConfiguration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
}
@Override
public boolean equals(Object o) {
if (!super.equals(o))

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -36,16 +34,16 @@ import com.google.common.collect.Sets;
/**
* iRepresents an organization.
*
* <p/>
* Unit of multi-tenancy and a top-level container. Contain vDCs, TasksList, Catalogs and Shared Network entities.
*
* <p/>
* <pre>
* &lt;xs:complexType name="OrgType"&gt;
* </pre>
*
* @author Adrian Cole
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Org")
@XmlRootElement(name = "Org")
public class Org extends EntityType<Org> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG;
@ -99,14 +97,7 @@ public class Org extends EntityType<Org> {
@Override
public Org build() {
Org org = new Org(href, name, fullName);
org.setDescription(description);
org.setId(id);
org.setType(type);
org.setLinks(links);
org.setTasksInProgress(tasksInProgress);
org.setIsEnabled(isEnabled);
return org;
return new Org(href, type, links, description, tasksInProgress, id, name, fullName, isEnabled);
}
/**
@ -164,7 +155,7 @@ public class Org extends EntityType<Org> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -173,7 +164,7 @@ public class Org extends EntityType<Org> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -195,14 +186,15 @@ public class Org extends EntityType<Org> {
// For JAXB and builder use
}
private Org(URI href, String name, String fullName) {
super(href, name);
public Org(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String fullName, Boolean enabled) {
super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName;
isEnabled = enabled;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FullName", required = true)
@XmlElement(name = "FullName", required = true)
private String fullName;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled")
@XmlElement(name = "IsEnabled")
private Boolean isEnabled;
/**
@ -219,10 +211,6 @@ public class Org extends EntityType<Org> {
return isEnabled;
}
public void setIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,10 +20,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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -38,7 +36,7 @@ import com.google.common.collect.Sets;
*
* @author Adrian Cole
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "OrgList")
@XmlRootElement(name = "OrgList")
public class OrgList {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG_LIST;
@ -88,7 +86,7 @@ public class OrgList {
this.orgs = ImmutableSet.copyOf(orgs);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Org")
@XmlElement(name = "Org")
private Set<Reference> orgs = Sets.newLinkedHashSet();
public Set<Reference> getOrgs() {

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -32,7 +30,7 @@ import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "OrgNetwork")
@XmlRootElement(name = "OrgNetwork")
public class OrgNetwork extends NetworkType<OrgNetwork> {
@SuppressWarnings("unchecked")
@ -68,16 +66,8 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
@Override
public OrgNetwork build() {
OrgNetwork network = new OrgNetwork(href, name);
network.setConfiguration(networkConfiguration);
network.setNetworkPool(networkPool);
network.setAllowedExternalIpAddresses(allowedExternalIpAddresses);
network.setDescription(description);
network.setId(id);
network.setType(type);
network.setLinks(links);
network.setTasksInProgress(tasksInProgress);
return network;
return new OrgNetwork(href, type, links, description, tasksInProgress, id, name, networkConfiguration,
networkPool, allowedExternalIpAddresses);
}
/**
@ -143,7 +133,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -152,7 +142,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -173,16 +163,19 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
}
private OrgNetwork() {
// For JAXB and builder use
// For JAXB
}
private OrgNetwork(URI href, String name) {
super(href, name);
private OrgNetwork(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, NetworkConfiguration networkConfiguration, ReferenceType<?> networkPool, IpAddresses allowedExternalIpAddresses) {
super(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
this.networkPool = networkPool;
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool")
@XmlElement(name = "NetworkPool")
private ReferenceType<?> networkPool;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses")
@XmlElement(name = "AllowedExternalIpAddresses")
private IpAddresses allowedExternalIpAddresses;
/**
@ -192,10 +185,6 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
return networkPool;
}
public void setNetworkPool(ReferenceType<?> networkPool) {
this.networkPool = networkPool;
}
/**
* @return optional network pool
*/
@ -203,10 +192,6 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
return allowedExternalIpAddresses;
}
public void setAllowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) {
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
}
@Override
public boolean equals(Object o) {
if (!super.equals(o))

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@ -36,14 +33,13 @@ import com.google.common.collect.Sets;
/**
*
* Represents the owner of this entity.
*
*
* <p/>
* <p/>
* <p>Java class for Owner complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="Owner">
* &lt;complexContent>
@ -56,10 +52,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Owner")
@XmlType(propOrder = {"user"})
public class Owner
@ -71,6 +64,7 @@ public class Owner
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromOwner(this);
}
@ -89,14 +83,9 @@ public class Owner
public Owner build() {
Owner owner = new Owner(href);
owner.setUser(user);
owner.setType(type);
owner.setLinks(links);
return owner;
return new Owner(href, type, links, user);
}
/**
* @see ResourceType#getHref()
*/
@ -138,6 +127,7 @@ public class Owner
public Builder fromResourceType(ResourceType<Owner> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromOwner(Owner in) {
return fromResourceType(in)
.user(in.getUser());
@ -148,39 +138,24 @@ public class Owner
// For JAXB and builder use
}
private Owner(URI href) {
super(href);
public Owner(URI href, String type, Set<Link> links, Reference user) {
super(href, type, links);
this.user = user;
}
@XmlElement(name = "User", required = true)
protected Reference user;
/**
* Gets the value of the user property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getUser() {
return user;
}
/**
* Sets the value of the user property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setUser(Reference value) {
this.user = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/**
*
* A basic type used to specify parameters for operations.
*
*
* <p/>
* <p/>
* <p>Java class for Params complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="Params">
* &lt;complexContent>
@ -53,19 +50,16 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Params", propOrder = {
"description"
})
@XmlSeeAlso({
// CaptureVAppParams.class,
// CloneVAppTemplateParams.class,
// CloneMediaParams.class,
// UploadVAppTemplateParams.class,
// ImportVmAsVAppTemplateParams.class,
CaptureVAppParams.class,
CloneVAppTemplateParams.class,
CloneMediaParams.class,
UploadVAppTemplateParams.class
//, ImportVmAsVAppTemplateParams.class,
// ImportMediaParams.class,
// UpdateResourcePoolSetParams.class,
// VAppCreationParams.class
@ -102,25 +96,25 @@ public class ParamsType<T extends ParamsType<T>> {
public ParamsType<T> build() {
ParamsType<T> params = new ParamsType<T>();
params.setDescription(description);
params.setName(name);
return params;
return new ParamsType<T>(description, name);
}
public Builder<T> fromParamsType(ParamsType<T> in) {
return description(in.getDescription())
.name(in.getName());
}
}
protected ParamsType(String description, String name) {
this.description = description;
this.name = name;
}
protected ParamsType() {
// For JAXB and builder use
}
@XmlElement(name = "Description")
protected String description;
@XmlAttribute
@ -129,51 +123,23 @@ public class ParamsType<T extends ParamsType<T>> {
/**
* Gets the value of the description property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -23,29 +23,24 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
*
* Essentially a container with a list of product sections.
*
* <p/>
* <p>Java class for ProductSectionList complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="ProductSectionList">
* &lt;complexContent>
@ -58,10 +53,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProductSectionList", propOrder = {
"productSection"
})
@ -74,25 +66,26 @@ public class ProductSectionList
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromProductSectionList(this);
}
public static class Builder extends ResourceType.Builder<ProductSectionList> {
private List<ProductSection> productSection;
private Set<ProductSection> productSections = Sets.newLinkedHashSet();
/**
* @see ProductSectionList#getProductSection()
*/
public Builder productSection(List<ProductSection> productSection) {
this.productSection = productSection;
public Builder productSection(Set<ProductSection> productSections) {
this.productSections = checkNotNull(productSections, "productSection");
return this;
}
public ProductSectionList build() {
ProductSectionList productSectionList = new ProductSectionList(productSection);
ProductSectionList productSectionList = new ProductSectionList(productSections);
return productSectionList;
}
@ -138,6 +131,7 @@ public class ProductSectionList
public Builder fromResourceType(ResourceType<ProductSectionList> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromProductSectionList(ProductSectionList in) {
return fromResourceType(in)
.productSection(in.getProductSection());
@ -148,38 +142,18 @@ public class ProductSectionList
// For JAXB and builder use
}
private ProductSectionList(List<ProductSection> productSection) {
this.productSection = productSection;
private ProductSectionList(Set<ProductSection> productSection) {
this.productSection = ImmutableSet.copyOf(productSection);
}
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected List<ProductSection> productSection;
protected Set<ProductSection> productSection = Sets.newLinkedHashSet();
/**
* Gets the value of the productSection property.
*
* <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 productSection property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getProductSection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ProductSection }
*/
public List<ProductSection> getProductSection() {
if (productSection == null) {
productSection = new ArrayList<ProductSection>();
}
public Set<ProductSection> getProductSection() {
return this.productSection;
}

View File

@ -18,10 +18,6 @@
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
@ -30,15 +26,14 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
/**
* Contains key/value pair as property.
*
* <p/>
* <pre>
* &lt;complexType name="PropertyType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Property")
@XmlRootElement(name = "Property")
public class Property {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.PROPERTY;
@ -83,9 +78,7 @@ public class Property {
}
public Property build() {
Property property = new Property(key);
property.setValue(value);
return property;
return new Property(key, value);
}
public Builder fromProperty(Property in) {
@ -94,10 +87,11 @@ public class Property {
}
private Property() {
// For JAXB and builder use
// For JAXB
}
private Property(String key) {
private Property(String key, String value) {
this.value = value;
this.key = key;
}
@ -113,10 +107,6 @@ public class Property {
return value;
}
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the key property.
*/

View File

@ -41,11 +41,7 @@ public class Reference extends ReferenceType<Reference> {
@Override
public Reference build() {
Reference reference = new Reference(href);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
return new Reference(href, id, name, type);
}
/**
@ -94,8 +90,8 @@ public class Reference extends ReferenceType<Reference> {
}
}
protected Reference(URI href) {
super(href);
public Reference(URI href, String id, String name, String type) {
super(href, id, name, type);
}
protected Reference() {

View File

@ -22,9 +22,6 @@ import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.google.common.base.Objects;
@ -32,16 +29,15 @@ import com.google.common.base.Objects.ToStringHelper;
/**
* A reference to a resource.
*
* <p/>
* Contains an href attribute and optional name and type attributes.
*
* <p/>
* <pre>
* &lt;xs:complexType name="ReferenceType"&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
public static <T extends ReferenceType<T>> Builder<T> builder() {
@ -92,11 +88,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
}
public ReferenceType<T> build() {
ReferenceType<T> reference = new ReferenceType<T>(href);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
return new ReferenceType<T>(href, id, name, type);
}
protected Builder<T> fromReferenceType(ReferenceType<T> in) {
@ -117,8 +109,11 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
@XmlAttribute
private String type;
protected ReferenceType(URI href) {
protected ReferenceType(URI href, String id, String name, String type) {
this.href = href;
this.id = id;
this.name = name;
this.type = type;
}
protected ReferenceType() {
@ -127,7 +122,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
/**
* Contains the URI to the entity.
*
* <p/>
* An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of
* the object, and is never reused. The value of the href attribute is a reference to a view of
@ -144,7 +139,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
/**
* The resource identifier, expressed in URN format.
*
* <p/>
* The value of this attribute uniquely identifies the resource, persists for the life of the
* resource, and is never reused.
*/
@ -152,13 +147,9 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return id;
}
public void setId(String id) {
this.id = id;
}
/**
* Contains the name of the the entity.
*
* <p/>
* The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions.
*
@ -168,13 +159,9 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* Contains the type of the the entity.
*
* <p/>
* The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions.
*
@ -184,10 +171,6 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return type;
}
public void setType(String type) {
this.type = type;
}
/**
* @see URISupplier#getURI()
*/

View File

@ -19,21 +19,18 @@
package org.jclouds.vcloud.director.v1_5.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Parameters to be used for vm relocation.
*
*
* <p/>
* <p/>
* <p>Java class for RelocateParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="RelocateParams">
* &lt;complexContent>
@ -45,10 +42,7 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RelocateParams", propOrder = {
"datastore"
})
@ -60,25 +54,10 @@ public class RelocateParams {
/**
* Gets the value of the datastore property.
*
* @return
* possible object is
* @return possible object is
* {@link ReferenceType }
*
*/
public ReferenceType<?> getDatastore() {
return datastore;
}
/**
* Sets the value of the datastore property.
*
* @param value
* allowed object is
* {@link ReferenceType }
*
*/
public void setDatastore(ReferenceType<?> value) {
this.datastore = value;
}
}

View File

@ -32,7 +32,6 @@ import com.google.common.collect.Sets;
*/
public class Resource extends ResourceType<Resource> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -46,10 +45,7 @@ public class Resource extends ResourceType<Resource> {
@Override
public Resource build() {
Resource reference = new Resource(href);
reference.setType(type);
reference.setLinks(links);
return reference;
return new Resource(href, type, links);
}
/**
@ -98,11 +94,11 @@ public class Resource extends ResourceType<Resource> {
}
}
protected Resource(URI href) {
super(href);
private Resource(URI href, String type, Set<Link> links) {
super(href, type, links);
}
protected Resource() {
private Resource() {
// For JAXB
}

View File

@ -22,26 +22,23 @@ 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.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
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.Lists;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
*
* Represents a list of references to resource entities.
*
*
* <p/>
* <p/>
* <p>Java class for ResourceEntities complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="ResourceEntities">
* &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResourceEntities", propOrder = {
"resourceEntities"
})
@ -72,13 +66,13 @@ public class ResourceEntities {
public static class Builder {
private List<Reference> resourceEntities = Lists.newArrayList();
private Set<Reference> resourceEntities = Sets.newLinkedHashSet();
/**
* @see ResourceEntities#getResourceEntities()
*/
public Builder resourceEntities(List<Reference> resourceEntities) {
this.resourceEntities = Lists.newArrayList(checkNotNull(resourceEntities, "resourceEntities"));
public Builder resourceEntities(Set<Reference> resourceEntities) {
this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
return this;
}
@ -91,8 +85,7 @@ public class ResourceEntities {
}
public ResourceEntities build() {
ResourceEntities resourceEntities = new ResourceEntities(this.resourceEntities);
return resourceEntities;
return new ResourceEntities(this.resourceEntities);
}
@ -105,40 +98,18 @@ public class ResourceEntities {
// For JAXB and builder use
}
private ResourceEntities(List<Reference> resourceEntity) {
this.resourceEntities = resourceEntity;
private ResourceEntities(Set<Reference> resourceEntity) {
this.resourceEntities = ImmutableSet.copyOf(resourceEntity);
}
@XmlElement(name = "ResourceEntity")
protected List<Reference> resourceEntities;
private Set<Reference> resourceEntities = Sets.newLinkedHashSet();
/**
* Gets the value of the resourceEntity property.
*
* <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 resourceEntity property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getResourceEntity().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<Reference> getResourceEntities() {
if (resourceEntities == null) {
resourceEntities = Lists.newArrayList();
}
public Set<Reference> getResourceEntities() {
return this.resourceEntities;
}

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -34,26 +33,17 @@ import com.google.common.collect.Sets;
/**
* Base type that represents a resource entity such as a vApp template or virtual media.
*
* <p/>
* <pre>
* &lt;complexType name="ResourceEntity" &gt;
* </pre>
*
* @author danikov
* @author Adam Lowe
*/
public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> {
public static <T extends ResourceEntityType<T>> Builder<T> builder() {
return new Builder<T>();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromResourceEntityType(this);
}
public static class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> {
public static abstract class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
protected FilesList files;
protected Integer status;
@ -73,19 +63,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return this;
}
@Override
public ResourceEntityType<T> build() {
ResourceEntityType<T> resourceEntity = new ResourceEntityType<T>(href, name);
resourceEntity.setFiles(files);
resourceEntity.setStatus(status);
resourceEntity.setDescription(description);
resourceEntity.setTasksInProgress(tasksInProgress);
resourceEntity.setId(id);
resourceEntity.setType(type);
resourceEntity.setLinks(links);
return resourceEntity;
}
/**
* @see EntityType#getId()
*/
@ -123,7 +100,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
@ -132,7 +109,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
@ -151,19 +128,22 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
}
}
protected ResourceEntityType() {
// for JAXB
}
protected ResourceEntityType(URI href, String name) {
super(href, name);
}
@XmlElement(name = "Files")
protected FilesList files;
@XmlAttribute
protected Integer status;
public ResourceEntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, FilesList files, Integer status) {
super(href, type, links, description, tasksInProgress, id, name);
this.files = files;
this.status = status;
}
protected ResourceEntityType() {
// for JAXB
}
/**
* Gets the value of the files property.
*/
@ -171,10 +151,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return files;
}
public void setFiles(FilesList value) {
this.files = value;
}
/**
* Gets the value of the status property.
*/
@ -182,10 +158,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return status;
}
public void setStatus(Integer value) {
this.status = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,13 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -36,27 +32,20 @@ import com.google.common.collect.Sets;
/**
* The base type for all objects in the vCloud model.
*
* <p/>
* Has an optional list of links and href and type attributes.
*
* <p/>
* <pre>
* &lt;xs:complexType name="ResourceType"&gt;
* </pre>
*
* @author Adrian Cole
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class ResourceType<T extends ResourceType<T>> implements URISupplier {
public abstract class ResourceType<T extends ResourceType<T>> implements URISupplier {
public static <T extends ResourceType<T>> Builder<T> builder() {
return new Builder<T>();
}
public abstract Builder<T> toBuilder();
public Builder<T> toBuilder() {
return new Builder<T>().fromResourceType(this);
}
public static class Builder<T extends ResourceType<T>> {
public static abstract class Builder<T extends ResourceType<T>> {
protected URI href;
protected String type;
@ -94,12 +83,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return this;
}
public ResourceType<T> build() {
ResourceType<T> reference = new ResourceType<T>(href);
reference.setType(type);
reference.setLinks(links);
return reference;
}
public abstract ResourceType<T> build();
protected Builder<T> fromResourceType(ResourceType<T> in) {
return href(in.getHref()).type(in.getType()).links(in.getLinks());
@ -110,11 +94,13 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
private URI href;
@XmlAttribute
private String type;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link")
@XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet();
protected ResourceType(URI href) {
protected ResourceType(URI href, String type, Set<Link> links) {
this.href = href;
this.type = type;
this.links = links;
}
protected ResourceType() {
@ -123,7 +109,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
/**
* Contains the URI to the entity.
*
* <p/>
* An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of
* the object, and is never reused. The value of the href attribute is a reference to a view of
@ -148,7 +134,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
/**
* Contains the type of the the entity.
*
* <p/>
* The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions.
*
@ -158,10 +144,6 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return type;
}
public void setType(String type) {
this.type = type;
}
/**
* Set of optional links to an entity or operation associated with this object.
*/
@ -169,14 +151,6 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return links;
}
public void setLinks(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
}
public void addLink(Link link) {
this.links.add(checkNotNull(link, "link"));
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo")
@XmlRootElement(name = "RouterInfo")
public class RouterInfo {
public static Builder builder() {
return new Builder();
@ -71,7 +70,7 @@ public class RouterInfo {
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "ExternalIp")
@XmlElement(name = "ExternalIp")
private String externalIp;
/**

View File

@ -20,13 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -44,8 +40,7 @@ import com.google.common.collect.Sets;
*
* @author Adrian Cole
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Session")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Session")
public class Session {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.SESSION;
@ -124,7 +119,7 @@ public class Session {
this.links = ImmutableSet.copyOf(links);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link")
@XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute
private String user;
@ -138,7 +133,6 @@ public class Session {
}
/**
*
* @return the user's login name.
*/
public String getUser() {
@ -146,7 +140,6 @@ public class Session {
}
/**
*
* @return is the name of an organization of which the user is a member
*/
public String getOrg() {
@ -154,7 +147,6 @@ public class Session {
}
/**
*
* @return a reference to the current session
*/
public URI getHref() {

View File

@ -21,27 +21,24 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
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;
/**
*
* Represents a composition item.
*
*
* <p/>
* <p/>
* <p>Java class for SourcedCompositionItemParam complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="SourcedCompositionItemParam">
* &lt;complexContent>
@ -58,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SourcedCompositionItemParam", propOrder = {
"source",
"vAppScopedLocalId",
@ -82,7 +76,7 @@ public class SourcedCompositionItemParam {
private Reference source;
private String vAppScopedLocalId;
private InstantiationParams instantiationParams;
private List<NetworkAssignment> networkAssignment;
private Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
private Boolean sourceDelete;
/**
@ -110,50 +104,47 @@ public class SourcedCompositionItemParam {
}
/**
* @see SourcedCompositionItemParam#getNetworkAssignment()
* @see SourcedCompositionItemParam#getNetworkAssignments()
*/
public Builder networkAssignment(List<NetworkAssignment> networkAssignment) {
this.networkAssignment = networkAssignment;
public Builder networkAssignments(Set<NetworkAssignment> networkAssignments) {
this.networkAssignments = networkAssignments;
return this;
}
/**
* @see SourcedCompositionItemParam#getSourceDelete()
* @see SourcedCompositionItemParam#isSourceDelete()
*/
public Builder sourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete;
return this;
}
public SourcedCompositionItemParam build() {
SourcedCompositionItemParam sourcedCompositionItemParam = new SourcedCompositionItemParam(networkAssignment);
sourcedCompositionItemParam.setSource(source);
sourcedCompositionItemParam.setVAppScopedLocalId(vAppScopedLocalId);
sourcedCompositionItemParam.setInstantiationParams(instantiationParams);
sourcedCompositionItemParam.setSourceDelete(sourceDelete);
return sourcedCompositionItemParam;
return new SourcedCompositionItemParam(source, vAppScopedLocalId, instantiationParams, networkAssignments, sourceDelete);
}
public Builder fromSourcedCompositionItemParam(SourcedCompositionItemParam in) {
return source(in.getSource())
.vAppScopedLocalId(in.getVAppScopedLocalId())
.instantiationParams(in.getInstantiationParams())
.networkAssignment(in.getNetworkAssignment())
.networkAssignments(in.getNetworkAssignments())
.sourceDelete(in.isSourceDelete());
}
}
public SourcedCompositionItemParam(Reference source, String vAppScopedLocalId, InstantiationParams instantiationParams,
Set<NetworkAssignment> networkAssignments, Boolean sourceDelete) {
this.source = source;
this.vAppScopedLocalId = vAppScopedLocalId;
this.instantiationParams = instantiationParams;
this.networkAssignments = ImmutableSet.copyOf(networkAssignments);
this.sourceDelete = sourceDelete;
}
private SourcedCompositionItemParam() {
// For JAXB and builder use
}
private SourcedCompositionItemParam(List<NetworkAssignment> networkAssignment) {
this.networkAssignment = networkAssignment;
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "VAppScopedLocalId")
@ -161,135 +152,75 @@ public class SourcedCompositionItemParam {
@XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams;
@XmlElement(name = "NetworkAssignment")
protected List<NetworkAssignment> networkAssignment;
protected Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
@XmlAttribute
protected Boolean sourceDelete;
/**
* Gets the value of the source property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
}
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/**
* Gets the value of the instantiationParams property.
*
* @return
* possible object is
* @return possible object is
* {@link InstantiationParams }
*
*/
public InstantiationParams getInstantiationParams() {
return instantiationParams;
}
/**
* Sets the value of the instantiationParams property.
*
* @param value
* allowed object is
* {@link InstantiationParams }
*
*/
public void setInstantiationParams(InstantiationParams value) {
this.instantiationParams = value;
}
/**
* Gets the value of the networkAssignment property.
*
* <p>
* <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/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkAssignment().add(newItem);
* </pre>
*
*
* <p>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkAssignmentType }
*
*
* {@link NetworkAssignment }
*/
public List<NetworkAssignment> getNetworkAssignment() {
if (networkAssignment == null) {
networkAssignment = new ArrayList<NetworkAssignment>();
}
return this.networkAssignment;
public Set<NetworkAssignment> getNetworkAssignments() {
return this.networkAssignments;
}
/**
* Gets the value of the sourceDelete property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isSourceDelete() {
return sourceDelete;
}
/**
* Sets the value of the sourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setSourceDelete(Boolean value) {
this.sourceDelete = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -300,7 +231,7 @@ public class SourcedCompositionItemParam {
return equal(source, that.source) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(instantiationParams, that.instantiationParams) &&
equal(networkAssignment, that.networkAssignment) &&
equal(networkAssignments, that.networkAssignments) &&
equal(sourceDelete, that.sourceDelete);
}
@ -309,7 +240,7 @@ public class SourcedCompositionItemParam {
return Objects.hashCode(source,
vAppScopedLocalId,
instantiationParams,
networkAssignment,
networkAssignments,
sourceDelete);
}
@ -319,7 +250,7 @@ public class SourcedCompositionItemParam {
.add("source", source)
.add("vAppScopedLocalId", vAppScopedLocalId)
.add("instantiationParams", instantiationParams)
.add("networkAssignment", networkAssignment)
.add("networkAssignments", networkAssignments)
.add("sourceDelete", sourceDelete).toString();
}

View File

@ -22,26 +22,23 @@ 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.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
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.Lists;
import com.google.common.collect.Sets;
/**
*
* Represents a list of supported VM hardware versions.
*
*
* <p/>
* <p/>
* <p>Java class for SupportedHardwareVersions complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="SupportedHardwareVersions">
* &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SupportedHardwareVersions", propOrder = {
"supportedHardwareVersions"
})
@ -72,13 +66,13 @@ public class SupportedHardwareVersions {
public static class Builder {
private List<String> supportedHardwareVersions = Lists.newArrayList();
private Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
/**
* @see SupportedHardwareVersions#getSupportedHardwareVersions()
*/
public Builder supportedHardwareVersions(List<String> supportedHardwareVersions) {
this.supportedHardwareVersions = Lists.newArrayList(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions"));
public Builder supportedHardwareVersions(Set<String> supportedHardwareVersions) {
this.supportedHardwareVersions = Sets.newLinkedHashSet(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions"));
return this;
}
@ -105,41 +99,19 @@ public class SupportedHardwareVersions {
// For JAXB and builder use
}
private SupportedHardwareVersions(List<String> supportedHardwareVersions) {
private SupportedHardwareVersions(Set<String> supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions;
}
@XmlElement(name = "SupportedHardwareVersion")
protected List<String> supportedHardwareVersions;
protected Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
/**
* Gets the value of the supportedHardwareVersion property.
*
* <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 supportedHardwareVersion property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSupportedHardwareVersion().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getSupportedHardwareVersions() {
if (supportedHardwareVersions == null) {
supportedHardwareVersions = Lists.newArrayList();
}
return this.supportedHardwareVersions;
public Set<String> getSupportedHardwareVersions() {
return Collections.unmodifiableSet(supportedHardwareVersions);
}
@Override

View File

@ -19,10 +19,7 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -34,8 +31,7 @@ import com.google.common.base.Objects;
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "SyslogServerSettings")
public class SyslogServerSettings {
public static Builder builder() {
@ -83,9 +79,9 @@ public class SyslogServerSettings {
// For JAXB and builder use
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp1")
@XmlElement(name = "SyslogServerIp1")
private String syslogServerIp1;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp2")
@XmlElement(name = "SyslogServerIp2")
private String syslogServerIp2;
/**
@ -95,10 +91,6 @@ public class SyslogServerSettings {
return syslogServerIp1;
}
public void setSyslogServerIp1(String syslogServerIp1) {
this.syslogServerIp1 = syslogServerIp1;
}
/**
* @return Secondary syslog server.
*/
@ -106,10 +98,6 @@ public class SyslogServerSettings {
return syslogServerIp2;
}
public void setSyslogServerIp2(String syslogServerIp2) {
this.syslogServerIp2 = syslogServerIp2;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,14 +20,12 @@ 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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -40,14 +38,14 @@ import com.google.common.collect.Sets;
/**
* Represents an asynchronous or long-running task in the vCloud environment.
*
* <p/>
* <pre>
* &lt;xs:complexType name="TaskType"&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Task")
@XmlRootElement(name = "Task")
public class Task extends EntityType<Task> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK;
@ -67,7 +65,6 @@ public class Task extends EntityType<Task> {
);
}
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -190,25 +187,8 @@ public class Task extends EntityType<Task> {
@Override
public Task build() {
Task task = new Task(href, name);
task.setDescription(description);
task.setTasksInProgress(tasksInProgress);
task.setId(id);
task.setType(type);
task.setLinks(links);
task.setError(error);
task.setOrg(org);
task.setOwner(owner);
task.setUser(user);
task.setParams(params);
task.setProgress(progress);
task.setStatus(status);
task.setOperation(operation);
task.setOperationName(operationName);
task.setStartTime(startTime);
task.setEndTime(endTime);
task.setExpiryTime(expiryTime);
return task;
return new Task(href, type, links, description, tasksInProgress, id, name,
error, org, progress, owner, user, params, status, operation, operationName, startTime, endTime, expiryTime);
}
/**
@ -266,7 +246,7 @@ public class Task extends EntityType<Task> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -275,7 +255,7 @@ public class Task extends EntityType<Task> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -295,25 +275,41 @@ public class Task extends EntityType<Task> {
}
}
public Task(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, Error error, Reference org, Integer progress, Reference owner,
Reference user, Object params, String status, String operation, String operationName,
Date startTime, Date endTime, Date expiryTime) {
super(href, type, links, description, tasksInProgress, id, name);
this.error = error;
this.org = org;
this.progress = progress;
this.owner = owner;
this.user = user;
this.params = params;
this.status = status;
this.operation = operation;
this.operationName = operationName;
this.startTime = startTime;
this.endTime = endTime;
this.expiryTime = expiryTime;
}
private Task() {
// For JAXB and builder use
}
private Task(URI href, String name) {
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Error")
@XmlElement(name = "Error")
private Error error;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Organization")
@XmlElement(name = "Organization")
private Reference org;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Progress")
@XmlElement(name = "Progress")
private Integer progress;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
@XmlElement(name = "Owner")
private Reference owner;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "User")
@XmlElement(name = "User")
private Reference user;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Params")
@XmlElement(name = "Params")
private Object params;
@XmlAttribute
private String status;
@ -335,10 +331,6 @@ public class Task extends EntityType<Task> {
return error;
}
public void setError(Error error) {
this.error = error;
}
/**
* The organization that started the task.
*/
@ -346,10 +338,6 @@ public class Task extends EntityType<Task> {
return org;
}
public void setOrg(Reference org) {
this.org = org;
}
/**
* Reference to the owner of the task.
*/
@ -357,10 +345,6 @@ public class Task extends EntityType<Task> {
return owner;
}
public void setOwner(Reference owner) {
this.owner = owner;
}
/**
* The user who started the task.
*/
@ -368,10 +352,6 @@ public class Task extends EntityType<Task> {
return user;
}
public void setUser(Reference user) {
this.user = user;
}
/**
* The parameters with which this task has been run.
*/
@ -379,13 +359,9 @@ public class Task extends EntityType<Task> {
return params;
}
public void setParams(Object params) {
this.params = params;
}
/**
* The progress of a long running asynchronous task.
*
* <p/>
* The value is between 0 - 100. Not all tasks have progress, the value is not
* present for task which progress is not available.
*/
@ -393,13 +369,9 @@ public class Task extends EntityType<Task> {
return progress;
}
public void setProgress(Integer progress) {
this.progress = progress;
}
/**
* The execution status of the task.
*
* <p/>
* One of:
* <ul>
* <li>queued - The task has been queued for execution.
@ -415,10 +387,6 @@ public class Task extends EntityType<Task> {
return status;
}
public void setStatus(String status) {
this.status = status;
}
/**
* The display name of the operation that is tracked by this task.
*/
@ -426,10 +394,6 @@ public class Task extends EntityType<Task> {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
/**
* The name of the operation that is tracked by this task.
*/
@ -437,49 +401,33 @@ public class Task extends EntityType<Task> {
return operationName;
}
public void setOperationName(String operationName) {
this.operationName = operationName;
}
/**
* The date and time the system started executing the task.
*
* <p/>
* May not be present if the task hasn't been executed yet.
*/
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
/**
* The date and time that processing of the task was completed.
*
* <p/>
* May not be present if the task is still being executed.
*/
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* The date and time at which the task resource will be destroyed and no longer available for retrieval.
*
* <p/>
* May not be present if the task has not been executed or is still being executed.
*/
public Date getExpiryTime() {
return expiryTime;
}
public void setExpiryTime(Date expiryTime) {
this.expiryTime = expiryTime;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,13 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -37,8 +33,7 @@ import com.google.common.collect.Sets;
/**
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "TasksInProgress")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "TasksInProgress")
public class TasksInProgress {
public static Builder builder() {
@ -86,7 +81,7 @@ public class TasksInProgress {
this.tasks = ImmutableSet.copyOf(tasks);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Task")
@XmlElement(name = "Task")
private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() {

View File

@ -20,11 +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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -40,12 +38,11 @@ import com.google.common.collect.Sets;
*
* @author Adrian Cole
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "TasksList")
@XmlRootElement(name = "TasksList")
public class TasksList extends EntityType<TasksList> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASKS_LIST;
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -77,13 +74,7 @@ public class TasksList extends EntityType<TasksList> {
@Override
public TasksList build() {
TasksList taskslist = new TasksList(href, name, tasks);
taskslist.setDescription(description);
taskslist.setTasksInProgress(tasksInProgress);
taskslist.setId(id);
taskslist.setType(type);
taskslist.setLinks(links);
return taskslist;
return new TasksList(href, type, links, description, tasksInProgress, id, name, tasks);
}
/**
@ -141,7 +132,7 @@ public class TasksList extends EntityType<TasksList> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -150,7 +141,7 @@ public class TasksList extends EntityType<TasksList> {
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -172,12 +163,12 @@ public class TasksList extends EntityType<TasksList> {
// For JAXB and builder use
}
protected TasksList(URI href, String name, Set<Task> tasks) {
super(href, name);
public TasksList(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Set<Task> tasks) {
super(href, type, links, description, tasksInProgress, id, name);
this.tasks = ImmutableSet.copyOf(tasks);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Task")
@XmlElement(name = "Task")
private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() {

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents vApp Template upload parameters.
*
*
* <p/>
* <p/>
* <p>Java class for UploadVAppTemplateParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="UploadVAppTemplateParams">
* &lt;complexContent>
@ -49,10 +46,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UploadVAppTemplateParams")
public class UploadVAppTemplateParams
extends ParamsType<UploadVAppTemplateParams>
@ -81,7 +75,7 @@ public class UploadVAppTemplateParams
}
/**
* @see UploadVAppTemplateParams#getManifestRequired()
* @see UploadVAppTemplateParams#isManifestRequired()
*/
public Builder manifestRequired(Boolean manifestRequired) {
this.manifestRequired = manifestRequired;
@ -90,10 +84,7 @@ public class UploadVAppTemplateParams
public UploadVAppTemplateParams build() {
UploadVAppTemplateParams uploadVAppTemplateParams = new UploadVAppTemplateParams();
uploadVAppTemplateParams.setTransferFormat(transferFormat);
uploadVAppTemplateParams.setManifestRequired(manifestRequired);
return uploadVAppTemplateParams;
return new UploadVAppTemplateParams(description, name, transferFormat, manifestRequired);
}
@ -101,6 +92,7 @@ public class UploadVAppTemplateParams
public Builder fromParamsType(ParamsType<UploadVAppTemplateParams> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromUploadVAppTemplateParams(UploadVAppTemplateParams in) {
return fromParamsType(in)
.transferFormat(in.getTransferFormat())
@ -108,10 +100,15 @@ public class UploadVAppTemplateParams
}
}
private UploadVAppTemplateParams() {
// For JAXB and builder use
public UploadVAppTemplateParams(String description, String name, String transferFormat, Boolean manifestRequired) {
super(description, name);
this.transferFormat = transferFormat;
this.manifestRequired = manifestRequired;
}
private UploadVAppTemplateParams() {
// For JAXB
}
@XmlAttribute
@ -122,51 +119,23 @@ public class UploadVAppTemplateParams
/**
* Gets the value of the transferFormat property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getTransferFormat() {
return transferFormat;
}
/**
* Sets the value of the transferFormat property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTransferFormat(String value) {
this.transferFormat = value;
}
/**
* Gets the value of the manifestRequired property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isManifestRequired() {
return manifestRequired;
}
/**
* Sets the value of the manifestRequired property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setManifestRequired(Boolean value) {
this.manifestRequired = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -23,24 +23,21 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/**
*
* Represents users in the vCloud system.
*
*
* <p/>
* <p/>
* <p>Java class for User complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="User">
* &lt;complexContent>
@ -70,11 +67,9 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User", propOrder = {
@XmlRootElement(name = "User")
@XmlType(propOrder = {
"fullName",
"emailAddress",
"telephone",
@ -98,11 +93,11 @@ public class User
extends EntityType<User>
{
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromUser(this);
}
@ -153,7 +148,7 @@ public class User
}
/**
* @see User#getIsEnabled()
* @see User#isEnabled()
*/
public Builder isEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
@ -161,7 +156,7 @@ public class User
}
/**
* @see User#getIsLocked()
* @see User#isLocked()
*/
public Builder isLocked(Boolean isLocked) {
this.isLocked = isLocked;
@ -169,7 +164,7 @@ public class User
}
/**
* @see User#getIm()
* @see User#getIM()
*/
public Builder im(String im) {
this.im = im;
@ -185,7 +180,7 @@ public class User
}
/**
* @see User#getIsAlertEnabled()
* @see User#isAlertEnabled()
*/
public Builder isAlertEnabled(Boolean isAlertEnabled) {
this.isAlertEnabled = isAlertEnabled;
@ -209,7 +204,7 @@ public class User
}
/**
* @see User#getIsExternal()
* @see User#isExternal()
*/
public Builder isExternal(Boolean isExternal) {
this.isExternal = isExternal;
@ -217,7 +212,7 @@ public class User
}
/**
* @see User#getIsDefaultCached()
* @see User#isDefaultCached()
*/
public Builder isDefaultCached(Boolean isDefaultCached) {
this.isDefaultCached = isDefaultCached;
@ -225,7 +220,7 @@ public class User
}
/**
* @see User#getIsGroupRole()
* @see User#isGroupRole()
*/
public Builder isGroupRole(Boolean isGroupRole) {
this.isGroupRole = isGroupRole;
@ -274,25 +269,11 @@ public class User
public User build() {
User user = new User(im);
user.setFullName(fullName);
user.setEmailAddress(emailAddress);
user.setTelephone(telephone);
user.setIsEnabled(isEnabled);
user.setIsLocked(isLocked);
user.setNameInSource(nameInSource);
user.setIsAlertEnabled(isAlertEnabled);
user.setAlertEmailPrefix(alertEmailPrefix);
user.setAlertEmail(alertEmail);
user.setIsExternal(isExternal);
user.setIsDefaultCached(isDefaultCached);
user.setIsGroupRole(isGroupRole);
user.setStoredVmQuota(storedVmQuota);
user.setDeployedVmQuota(deployedVmQuota);
user.setRole(role);
user.setPassword(password);
user.setGroupReferences(groupReferences);
return user;
return new User(href, type, links, description, tasksInProgress, id,
name, fullName, emailAddress, telephone, isEnabled, isLocked,
im, nameInSource, isAlertEnabled, alertEmailPrefix, alertEmail,
isExternal, isDefaultCached, isGroupRole, storedVmQuota, deployedVmQuota,
role, password, groupReferences);
}
@ -333,7 +314,7 @@ public class User
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -342,7 +323,7 @@ public class User
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
@ -355,6 +336,7 @@ public class User
public Builder fromEntityType(EntityType<User> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromUser(User in) {
return fromEntityType(in)
.fullName(in.getFullName())
@ -378,15 +360,6 @@ public class User
}
}
private User() {
// For JAXB and builder use
}
private User(String im) {
this.im = im;
}
@XmlElement(name = "FullName")
protected String fullName;
@XmlElement(name = "EmailAddress")
@ -424,438 +397,217 @@ public class User
@XmlElement(name = "GroupReferences")
protected Object /* GroupsList */ groupReferences;
public User(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, String fullName, String emailAddress, String telephone, Boolean enabled, Boolean locked,
String im, String nameInSource, Boolean alertEnabled, String alertEmailPrefix, String alertEmail,
Boolean external, Boolean defaultCached, Boolean groupRole, Integer storedVmQuota, Integer deployedVmQuota,
Reference role, String password, Object groupReferences) {
super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName;
this.emailAddress = emailAddress;
this.telephone = telephone;
isEnabled = enabled;
isLocked = locked;
this.im = checkNotNull(im, "im");
this.nameInSource = nameInSource;
isAlertEnabled = alertEnabled;
this.alertEmailPrefix = alertEmailPrefix;
this.alertEmail = alertEmail;
isExternal = external;
isDefaultCached = defaultCached;
isGroupRole = groupRole;
this.storedVmQuota = storedVmQuota;
this.deployedVmQuota = deployedVmQuota;
this.role = role;
this.password = password;
this.groupReferences = groupReferences;
}
private User() {
// For JAXB
}
/**
* Gets the value of the fullName property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getFullName() {
return fullName;
}
/**
* Sets the value of the fullName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFullName(String value) {
this.fullName = value;
}
/**
* Gets the value of the emailAddress property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* Sets the value of the emailAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmailAddress(String value) {
this.emailAddress = value;
}
/**
* Gets the value of the telephone property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getTelephone() {
return telephone;
}
/**
* Sets the value of the telephone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTelephone(String value) {
this.telephone = value;
}
/**
* Gets the value of the isEnabled property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isEnabled() {
return isEnabled;
}
/**
* Sets the value of the isEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsEnabled(Boolean value) {
this.isEnabled = value;
}
/**
* Gets the value of the isLocked property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isLocked() {
return isLocked;
}
/**
* Sets the value of the isLocked property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsLocked(Boolean value) {
this.isLocked = value;
}
/**
* Gets the value of the im property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getIM() {
return im;
}
/**
* Sets the value of the im property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIM(String value) {
this.im = value;
}
/**
* Gets the value of the nameInSource property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getNameInSource() {
return nameInSource;
}
/**
* Sets the value of the nameInSource property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNameInSource(String value) {
this.nameInSource = value;
}
/**
* Gets the value of the isAlertEnabled property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isAlertEnabled() {
return isAlertEnabled;
}
/**
* Sets the value of the isAlertEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsAlertEnabled(Boolean value) {
this.isAlertEnabled = value;
}
/**
* Gets the value of the alertEmailPrefix property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getAlertEmailPrefix() {
return alertEmailPrefix;
}
/**
* Sets the value of the alertEmailPrefix property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlertEmailPrefix(String value) {
this.alertEmailPrefix = value;
}
/**
* Gets the value of the alertEmail property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getAlertEmail() {
return alertEmail;
}
/**
* Sets the value of the alertEmail property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlertEmail(String value) {
this.alertEmail = value;
}
/**
* Gets the value of the isExternal property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isExternal() {
return isExternal;
}
/**
* Sets the value of the isExternal property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsExternal(Boolean value) {
this.isExternal = value;
}
/**
* Gets the value of the isDefaultCached property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isDefaultCached() {
return isDefaultCached;
}
/**
* Sets the value of the isDefaultCached property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsDefaultCached(Boolean value) {
this.isDefaultCached = value;
}
/**
* Gets the value of the isGroupRole property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isGroupRole() {
return isGroupRole;
}
/**
* Sets the value of the isGroupRole property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsGroupRole(Boolean value) {
this.isGroupRole = value;
}
/**
* Gets the value of the storedVmQuota property.
*
* @return
* possible object is
* @return possible object is
* {@link Integer }
*
*/
public Integer getStoredVmQuota() {
return storedVmQuota;
}
/**
* Sets the value of the storedVmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStoredVmQuota(Integer value) {
this.storedVmQuota = value;
}
/**
* Gets the value of the deployedVmQuota property.
*
* @return
* possible object is
* @return possible object is
* {@link Integer }
*
*/
public Integer getDeployedVmQuota() {
return deployedVmQuota;
}
/**
* Sets the value of the deployedVmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setDeployedVmQuota(Integer value) {
this.deployedVmQuota = value;
}
/**
* Gets the value of the role property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getRole() {
return role;
}
/**
* Sets the value of the role property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setRole(Reference value) {
this.role = value;
}
/**
* Gets the value of the password property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the groupReferences property.
*
* @return
* possible object is
* {@link GroupsList }
*
* @return possible object is
* {@link GroupsListType }
*/
public Object /* GroupsList */ getGroupReferences() {
return groupReferences;
}
/**
* Sets the value of the groupReferences property.
*
* @param value
* allowed object is
* {@link GroupsList }
*
*/
public void setGroupReferences(Object /* GroupsList */ value) {
this.groupReferences = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/**
*
* Represents vApp creation parameters.
*
*
* <p/>
* <p/>
* <p>Java class for VAppCreationParams complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="VAppCreationParams">
* &lt;complexContent>
@ -55,10 +52,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppCreationParams", propOrder = {
"vAppParent",
"instantiationParams"
@ -105,7 +99,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
}
/**
* @see VAppCreationParamsType#getDeploy()
* @see VAppCreationParamsType#isDeploy()
*/
public Builder<T> deploy(Boolean deploy) {
this.deploy = deploy;
@ -113,7 +107,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
}
/**
* @see VAppCreationParamsType#getPowerOn()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder<T> powerOn(Boolean powerOn) {
this.powerOn = powerOn;
@ -122,14 +116,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
public VAppCreationParamsType<T> build() {
VAppCreationParamsType<T> vAppCreationParams = new VAppCreationParamsType<T>();
vAppCreationParams.setVAppParent(vAppParent);
vAppCreationParams.setInstantiationParams(instantiationParams);
vAppCreationParams.setDeploy(deploy);
vAppCreationParams.setPowerOn(powerOn);
vAppCreationParams.setDescription(description);
vAppCreationParams.setName(name);
return vAppCreationParams;
return new VAppCreationParamsType<T>(description, name, vAppParent, instantiationParams,deploy, powerOn);
}
/**
@ -156,6 +143,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
public Builder<T> fromParamsType(ParamsType<T> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return fromParamsType(in)
.vAppParent(in.getVAppParent())
@ -165,10 +153,6 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
}
}
protected VAppCreationParamsType() {
// For JAXB and builder use
}
@XmlElement(name = "VAppParent")
protected Reference vAppParent;
@XmlElement(name = "InstantiationParams")
@ -178,102 +162,59 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
@XmlAttribute
protected Boolean powerOn;
public VAppCreationParamsType(String description, String name, Reference vAppParent,
InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn) {
super(description, name);
this.vAppParent = vAppParent;
this.instantiationParams = instantiationParams;
this.deploy = deploy;
this.powerOn = powerOn;
}
protected VAppCreationParamsType() {
// For JAXB and builder use
}
/**
* Gets the value of the vAppParent property.
*
* @return
* possible object is
* @return possible object is
* {@link Reference }
*
*/
public Reference getVAppParent() {
return vAppParent;
}
/**
* Sets the value of the vAppParent property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setVAppParent(Reference value) {
this.vAppParent = value;
}
/**
* Gets the value of the instantiationParams property.
*
* @return
* possible object is
* @return possible object is
* {@link InstantiationParams }
*
*/
public InstantiationParams getInstantiationParams() {
return instantiationParams;
}
/**
* Sets the value of the instantiationParams property.
*
* @param value
* allowed object is
* {@link InstantiationParams }
*
*/
public void setInstantiationParams(InstantiationParams value) {
this.instantiationParams = value;
}
/**
* Gets the value of the deploy property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isDeploy() {
return deploy;
}
/**
* Sets the value of the deploy property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setDeploy(Boolean value) {
this.deploy = value;
}
/**
* Gets the value of the powerOn property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isPowerOn() {
return powerOn;
}
/**
* Sets the value of the powerOn property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setPowerOn(Boolean value) {
this.powerOn = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -36,14 +33,13 @@ import com.google.common.collect.Sets;
/**
*
* Represents a VApp network configuration.
*
*
* <p/>
* <p/>
* <p>Java class for VAppNetworkConfiguration complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="VAppNetworkConfiguration">
* &lt;complexContent>
@ -59,23 +55,18 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppNetworkConfiguration", propOrder = {
"description",
"configuration",
"isDeployed"
})
public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
extends ResourceType<T>
{
public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> extends ResourceType<T> {
public static <T extends VAppNetworkConfiguration<T>> Builder<T> builder() {
return new Builder<T>();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromVAppNetworkConfiguration(this);
}
@ -104,7 +95,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
}
/**
* @see VAppNetworkConfiguration#getIsDeployed()
* @see VAppNetworkConfiguration#isDeployed()
*/
public Builder<T> isDeployed(Boolean isDeployed) {
this.isDeployed = isDeployed;
@ -121,12 +112,8 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
public VAppNetworkConfiguration<T> build() {
VAppNetworkConfiguration<T> vAppNetworkConfiguration = new VAppNetworkConfiguration<T>();
vAppNetworkConfiguration.setDescription(description);
vAppNetworkConfiguration.setConfiguration(configuration);
vAppNetworkConfiguration.setIsDeployed(isDeployed);
vAppNetworkConfiguration.setNetworkName(networkName);
return vAppNetworkConfiguration;
return new VAppNetworkConfiguration<T>(href, type, links,
description, configuration, isDeployed, networkName);
}
@ -173,6 +160,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) {
return fromResourceType(in)
.description(in.getDescription())
@ -182,12 +170,6 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
}
}
private VAppNetworkConfiguration() {
// For JAXB and builder use
}
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "Configuration", required = true)
@ -197,102 +179,59 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
@XmlAttribute(required = true)
protected String networkName;
public VAppNetworkConfiguration(URI href, String type, Set<Link> links, String description,
NetworkConfiguration configuration, Boolean deployed, String networkName) {
super(href, type, links);
this.description = description;
this.configuration = configuration;
isDeployed = deployed;
this.networkName = networkName;
}
private VAppNetworkConfiguration() {
// For JAXB
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the configuration property.
*
* @return
* possible object is
* @return possible object is
* {@link NetworkConfiguration }
*
*/
public NetworkConfiguration getConfiguration() {
return configuration;
}
/**
* Sets the value of the configuration property.
*
* @param value
* allowed object is
* {@link NetworkConfiguration }
*
*/
public void setConfiguration(NetworkConfiguration value) {
this.configuration = value;
}
/**
* Gets the value of the isDeployed property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isDeployed() {
return isDeployed;
}
/**
* Sets the value of the isDeployed property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsDeployed(Boolean value) {
this.isDeployed = value;
}
/**
* Gets the value of the networkName property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getNetworkName() {
return networkName;
}
/**
* Sets the value of the networkName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNetworkName(String value) {
this.networkName = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,20 +20,16 @@
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.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
@ -42,6 +38,8 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -70,7 +68,6 @@ import com.google.common.base.Objects;
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VAppTemplate")
@XmlType(propOrder = {
"owner",
@ -78,23 +75,20 @@ import com.google.common.base.Objects;
"sections",
"vAppScopedLocalId"
})
public class VAppTemplate
extends ResourceEntityType<VAppTemplate>
{
@SuppressWarnings("unchecked")
public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVAppTemplate(this);
}
public static class Builder extends ResourceEntityType.Builder<VAppTemplate> {
private Owner owner;
private VAppTemplateChildren children;
private List<SectionType> sections;
private Set<VAppTemplate> children = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded;
private Boolean goldMaster;
@ -110,15 +104,15 @@ public class VAppTemplate
/**
* @see VAppTemplate#getChildren()
*/
public Builder children(VAppTemplateChildren children) {
this.children = children;
public Builder children(Set<VAppTemplate> children) {
this.children = checkNotNull(children, "children");
return this;
}
/**
* @see VAppTemplate#getSections()
*/
public Builder sections(List<SectionType> sections) {
public Builder sections(Set<SectionType> sections) {
this.sections = sections;
return this;
}
@ -149,18 +143,9 @@ public class VAppTemplate
@Override
public VAppTemplate build() {
VAppTemplate result = new VAppTemplate(href, name, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
result.setFiles(files);
result.setStatus(status);
result.setDescription(description);
result.setTasksInProgress(tasksInProgress);
result.setId(id);
result.setType(type);
result.setLinks(links);
return result;
return new VAppTemplate(href, type, links, description, tasksInProgress, id, name, files, status, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
}
@Override
public Builder fromResourceEntityType(ResourceEntityType<VAppTemplate> in) {
return Builder.class.cast(super.fromResourceEntityType(in));
@ -270,10 +255,10 @@ public class VAppTemplate
@XmlElementRef
protected Owner owner;
@XmlElement(name = "Children")
protected VAppTemplateChildren children;
@XmlElementRef
protected List<SectionType> sections;
protected VAppTemplateChildren children = VAppTemplateChildren.builder().build();
@XmlElementRef
protected Set<SectionType> sections = Sets.newLinkedHashSet();
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlAttribute
@ -281,20 +266,19 @@ public class VAppTemplate
@XmlAttribute
protected Boolean goldMaster;
private VAppTemplate(URI href, String name, @Nullable Owner owner, @Nullable VAppTemplateChildren children,
List<SectionType> sections, @Nullable String vAppScopedLocalId,
@Nullable Boolean ovfDescriptorUploaded, @Nullable Boolean goldMaster) {
super(href, name);
this.sections = sections;
private VAppTemplate(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children, Set<SectionType> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
super(href, type, links, description, tasksInProgress, id, name, files, status);
this.owner = owner;
this.children = children;
this.children = VAppTemplateChildren.builder().vms(children).build();
this.sections = ImmutableSet.copyOf(sections);
this.vAppScopedLocalId = vAppScopedLocalId;
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
this.goldMaster = goldMaster;
}
private VAppTemplate() {
// For JAXB and builder use
// For JAXB
}
/**
@ -307,34 +291,14 @@ public class VAppTemplate
return owner;
}
/**
* Sets the value of the owner property.
*
* @param value allowed object is
* {@link Owner }
*/
public void setOwner(Owner value) {
this.owner = value;
}
/**
* Gets the value of the children property.
*
* @return possible object is
* {@link VAppTemplateChildren }
*/
public VAppTemplateChildren getChildren() {
return children;
}
/**
* Sets the value of the children property.
*
* @param value allowed object is
* {@link VAppTemplateChildren }
*/
public void setChildren(VAppTemplateChildren value) {
this.children = value;
public Set<VAppTemplate> getChildren() {
return children.getVms();
}
/**
@ -375,10 +339,7 @@ public class VAppTemplate
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*/
public List<SectionType> getSections() {
if (sections == null) {
sections = new ArrayList<SectionType>();
}
public Set<SectionType> getSections() {
return this.sections;
}
@ -392,16 +353,6 @@ public class VAppTemplate
return vAppScopedLocalId;
}
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/**
* Gets the value of the ovfDescriptorUploaded property.
*
@ -412,16 +363,6 @@ public class VAppTemplate
return ovfDescriptorUploaded;
}
/**
* Sets the value of the ovfDescriptorUploaded property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setOvfDescriptorUploaded(Boolean value) {
this.ovfDescriptorUploaded = value;
}
/**
* Gets the value of the goldMaster property.
*
@ -436,16 +377,6 @@ public class VAppTemplate
}
}
/**
* Sets the value of the goldMaster property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setGoldMaster(Boolean value) {
this.goldMaster = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,27 +20,26 @@
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.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
*
* Represents vApp template children.
*
*
* <p/>
* <p/>
* <p>Java class for VAppTemplateChildren complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="VAppTemplateChildren">
* &lt;complexContent>
@ -53,12 +52,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppTemplateChildren", propOrder = {
"vm"
@XmlRootElement(name = "Children")
@XmlType(propOrder = {
"vms"
})
public class VAppTemplateChildren {
public static Builder builder() {
@ -70,68 +67,43 @@ public class VAppTemplateChildren {
}
public static class Builder {
private List<VAppTemplate> vm;
private Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/**
* @see VAppTemplateChildren#getVm()
* @see VAppTemplateChildren#getVms()
*/
public Builder vm(List<VAppTemplate> vm) {
this.vm = vm;
public Builder vms(Set<VAppTemplate> vms) {
this.vms = checkNotNull(vms, "vms");
return this;
}
public VAppTemplateChildren build() {
VAppTemplateChildren vAppTemplateChildren = new VAppTemplateChildren(vm);
return vAppTemplateChildren;
return new VAppTemplateChildren(vms);
}
public Builder fromVAppTemplateChildren(VAppTemplateChildren in) {
return vm(in.getVm());
return vms(in.getVms());
}
}
private VAppTemplateChildren(Set<VAppTemplate> vm) {
this.vms = ImmutableSet.copyOf(vm);
}
private VAppTemplateChildren() {
// For JAXB and builder use
// For JAXB
}
private VAppTemplateChildren(List<VAppTemplate> vm) {
this.vm = vm;
}
@XmlElement(name = "Vm")
protected List<VAppTemplate> vm;
protected Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/**
* Gets the value of the vm property.
*
* <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 vm property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getVm().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VAppTemplate }
*
*
*/
public List<VAppTemplate> getVm() {
if (vm == null) {
vm = new ArrayList<VAppTemplate>();
}
return this.vm;
public Set<VAppTemplate> getVms() {
return this.vms;
}
@Override
@ -141,18 +113,18 @@ public class VAppTemplateChildren {
if (o == null || getClass() != o.getClass())
return false;
VAppTemplateChildren that = VAppTemplateChildren.class.cast(o);
return equal(vm, that.vm);
return equal(vms, that.vms);
}
@Override
public int hashCode() {
return Objects.hashCode(vm);
return Objects.hashCode(vms);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("vm", vm).toString();
.add("vms", vms).toString();
}
}

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -38,14 +35,13 @@ import com.google.common.collect.Sets;
/**
*
* Represents a virtual data center (vDC).
*
*
* <p/>
* <p/>
* <p>Java class for Vdc complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="Vdc">
* &lt;complexContent>
@ -68,10 +64,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Vdc")
@XmlType(propOrder = {
"allocationModel",
@ -92,11 +85,11 @@ public class Vdc
extends EntityType<Vdc>
{
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVdc(this);
}
@ -203,21 +196,11 @@ public class Vdc
return this;
}
public Vdc build() {
Vdc vdc = new Vdc();
vdc.setAllocationModel(allocationModel);
vdc.setStorageCapacity(storageCapacity);
vdc.setComputeCapacity(computeCapacity);
vdc.setResourceEntities(resourceEntities);
vdc.setAvailableNetworks(availableNetworks);
vdc.setCapabilities(capabilities);
vdc.setNicQuota(nicQuota);
vdc.setNetworkQuota(networkQuota);
vdc.setVmQuota(vmQuota);
vdc.setIsEnabled(isEnabled);
vdc.setStatus(status);
return vdc;
return new Vdc(
href, type, links, description, tasksInProgress, id, name, allocationModel, storageCapacity,
computeCapacity, resourceEntities, availableNetworks, capabilities, nicQuota, networkQuota,
vmQuota, isEnabled, status);
}
/**
@ -295,6 +278,7 @@ public class Vdc
public Builder fromEntityType(EntityType<Vdc> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromVdc(Vdc in) {
return fromEntityType(in)
.allocationModel(in.getAllocationModel())
@ -311,8 +295,23 @@ public class Vdc
}
}
public Vdc(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String allocationModel, CapacityWithUsage storageCapacity, ComputeCapacity computeCapacity, ResourceEntities resourceEntities, AvailableNetworks availableNetworks, Capabilities capabilities, int nicQuota, int networkQuota, Integer vmQuota, Boolean enabled, Integer status) {
super(href, type, links, description, tasksInProgress, id, name);
this.allocationModel = allocationModel;
this.storageCapacity = storageCapacity;
this.computeCapacity = computeCapacity;
this.resourceEntities = resourceEntities;
this.availableNetworks = availableNetworks;
this.capabilities = capabilities;
this.nicQuota = nicQuota;
this.networkQuota = networkQuota;
this.vmQuota = vmQuota;
isEnabled = enabled;
this.status = status;
}
private Vdc() {
// For JAXB and builder use
// For JAXB
}
@ -342,251 +341,107 @@ public class Vdc
/**
* Gets the value of the allocationModel property.
*
* @return
* possible object is
* @return possible object is
* {@link String }
*
*/
public String getAllocationModel() {
return allocationModel;
}
/**
* Sets the value of the allocationModel property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAllocationModel(String value) {
this.allocationModel = value;
}
/**
* Gets the value of the storageCapacity property.
*
* @return
* possible object is
* @return possible object is
* {@link CapacityWithUsage }
*
*/
public CapacityWithUsage getStorageCapacity() {
return storageCapacity;
}
/**
* Sets the value of the storageCapacity property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setStorageCapacity(CapacityWithUsage value) {
this.storageCapacity = value;
}
/**
* Gets the value of the computeCapacity property.
*
* @return
* possible object is
* @return possible object is
* {@link ComputeCapacity }
*
*/
public ComputeCapacity getComputeCapacity() {
return computeCapacity;
}
/**
* Sets the value of the computeCapacity property.
*
* @param value
* allowed object is
* {@link ComputeCapacity }
*
*/
public void setComputeCapacity(ComputeCapacity value) {
this.computeCapacity = value;
}
/**
* Gets the value of the resourceEntities property.
*
* @return
* possible object is
* @return possible object is
* {@link ResourceEntities }
*
*/
public ResourceEntities getResourceEntities() {
return resourceEntities;
}
/**
* Sets the value of the resourceEntities property.
*
* @param value
* allowed object is
* {@link ResourceEntities }
*
*/
public void setResourceEntities(ResourceEntities value) {
this.resourceEntities = value;
}
/**
* Gets the value of the availableNetworks property.
*
* @return
* possible object is
* @return possible object is
* {@link AvailableNetworks }
*
*/
public AvailableNetworks getAvailableNetworks() {
return availableNetworks;
}
/**
* Sets the value of the availableNetworks property.
*
* @param value
* allowed object is
* {@link AvailableNetworks }
*
*/
public void setAvailableNetworks(AvailableNetworks value) {
this.availableNetworks = value;
}
/**
* Gets the value of the capabilities property.
*
* @return
* possible object is
* @return possible object is
* {@link Capabilities }
*
*/
public Capabilities getCapabilities() {
return capabilities;
}
/**
* Sets the value of the capabilities property.
*
* @param value
* allowed object is
* {@link Capabilities }
*
*/
public void setCapabilities(Capabilities value) {
this.capabilities = value;
}
/**
* Gets the value of the nicQuota property.
*
*/
public int getNicQuota() {
return nicQuota;
}
/**
* Sets the value of the nicQuota property.
*
*/
public void setNicQuota(int value) {
this.nicQuota = value;
}
/**
* Gets the value of the networkQuota property.
*
*/
public int getNetworkQuota() {
return networkQuota;
}
/**
* Sets the value of the networkQuota property.
*
*/
public void setNetworkQuota(int value) {
this.networkQuota = value;
}
/**
* Gets the value of the vmQuota property.
*
* @return
* possible object is
* @return possible object is
* {@link Integer }
*
*/
public Integer getVmQuota() {
return vmQuota;
}
/**
* Sets the value of the vmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setVmQuota(Integer value) {
this.vmQuota = value;
}
/**
* Gets the value of the isEnabled property.
*
* @return
* possible object is
* @return possible object is
* {@link Boolean }
*
*/
public Boolean isEnabled() {
return isEnabled;
}
/**
* Sets the value of the isEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsEnabled(Boolean value) {
this.isEnabled = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* @return possible object is
* {@link Integer }
*
*/
public Integer getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStatus(Integer value) {
this.status = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,11 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
@ -33,7 +30,6 @@ import com.google.common.base.Objects;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = {
"label", "description"
})

View File

@ -19,14 +19,14 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -41,8 +41,7 @@ import com.google.common.collect.Sets;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "DeploymentOptionSection", namespace = VCLOUD_OVF_NS)
@XmlRootElement(name = "DeploymentOptionSection")
public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> {
@SuppressWarnings("unchecked")
@ -82,7 +81,7 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
*/
@Override
public DeploymentOptionSection build() {
return new DeploymentOptionSection(info, configurations);
return new DeploymentOptionSection(info, required, configurations);
}
public Builder fromDeploymentOptionSection(DeploymentOptionSection in) {
@ -105,21 +104,32 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
@XmlElement(name = "Configuration")
protected Set<Configuration> configurations;
private DeploymentOptionSection(String info, Iterable<Configuration> configurations) {
super(info);
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations"));
private DeploymentOptionSection(@Nullable String info, @Nullable Boolean required, Iterable<Configuration> configurations) {
super(info, required);
this.configurations = ImmutableSet.copyOf(configurations);
}
private DeploymentOptionSection() {
// For JAXB
}
public Set<Configuration> getConfigurations() {
return Collections.unmodifiableSet(configurations);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), configurations);
@ -139,9 +149,4 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
protected Objects.ToStringHelper string() {
return super.string().add("configurations", configurations);
}
public Set<Configuration> getConfigurations() {
return configurations;
}
}

View File

@ -18,19 +18,15 @@
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.net.URI;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Disk", namespace = VCLOUD_OVF_NS)
@XmlRootElement(name = "Disk")
public class Disk implements Comparable<Disk>{
public static Builder builder() {
return new Builder();

View File

@ -22,12 +22,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -40,7 +40,6 @@ import com.google.common.collect.Sets;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS)
@XmlType(propOrder = {
"disks"
@ -84,7 +83,7 @@ public class DiskSection extends SectionType<DiskSection> {
*/
@Override
public DiskSection build() {
return new DiskSection(info, disks);
return new DiskSection(info, required, disks);
}
public Builder fromDiskSection(DiskSection in) {
@ -107,12 +106,21 @@ public class DiskSection extends SectionType<DiskSection> {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
@XmlElementRef
private Set<Disk> disks;
private DiskSection(String info, Iterable<Disk> disks) {
super(info);
private DiskSection(@Nullable String info, @Nullable Boolean required, Iterable<Disk> disks) {
super(info, required);
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
}

View File

@ -20,12 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseEnvelope;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem;
import com.google.common.collect.Multimap;
@ -33,7 +30,6 @@ import com.google.common.collect.Multimap;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS)
public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {

View File

@ -19,18 +19,13 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Network", namespace = VCLOUD_OVF_NS)
@XmlRootElement(name = "Network")
public class Network {
public static Builder builder() {
return new Builder();

View File

@ -19,14 +19,12 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -37,8 +35,7 @@ import com.google.common.collect.Sets;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "NetworkSection", namespace = VCLOUD_OVF_NS)
@XmlRootElement(name = "NetworkSection")
public class NetworkSection extends SectionType<NetworkSection> {
@SuppressWarnings("unchecked")
@ -78,7 +75,7 @@ public class NetworkSection extends SectionType<NetworkSection> {
*/
@Override
public NetworkSection build() {
return new NetworkSection(info, networks);
return new NetworkSection(info, required, networks);
}
public Builder fromNetworkSection(NetworkSection in) {
@ -101,12 +98,20 @@ public class NetworkSection extends SectionType<NetworkSection> {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
private Set<Network> networks;
private NetworkSection(String info, Iterable<Network> networks) {
super(info);
private NetworkSection(@Nullable String info, @Nullable Boolean required, Iterable<Network> networks) {
super(info, required);
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
}

View File

@ -18,14 +18,11 @@
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects;
@ -35,7 +32,6 @@ import com.google.common.base.Objects;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection")
public class OperatingSystemSection extends SectionType<OperatingSystemSection> {
@ -86,7 +82,7 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
*/
@Override
public OperatingSystemSection build() {
return new OperatingSystemSection(info, id, version, description);
return new OperatingSystemSection(info, required, id, version, description);
}
public Builder fromOperatingSystemSection(OperatingSystemSection in) {
@ -109,6 +105,13 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
@XmlAttribute
@ -118,8 +121,8 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
@XmlElement
protected String description;
public OperatingSystemSection(@Nullable String info, @Nullable Integer id, @Nullable String version, @Nullable String description) {
super(info);
public OperatingSystemSection(@Nullable String info, @Nullable Boolean required, @Nullable Integer id, @Nullable String version, @Nullable String description) {
super(info, required);
this.id = id;
this.description = description;
this.version = version;

View File

@ -22,10 +22,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -34,10 +34,11 @@ import com.google.common.collect.Sets;
* The ProductSection element specifies product-information for an appliance, such as product name,
* version, and vendor.
*
* TODO this should contain a multitude of other elements!
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ProductSection", namespace = VCLOUD_OVF_NS)
public class ProductSection extends SectionType<ProductSection> {
@ -78,7 +79,7 @@ public class ProductSection extends SectionType<ProductSection> {
*/
@Override
public ProductSection build() {
return new ProductSection(info, properties);
return new ProductSection(info, required, properties);
}
public Builder fromDeploymentOptionSection(ProductSection in) {
@ -100,13 +101,22 @@ public class ProductSection extends SectionType<ProductSection> {
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
protected Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties;
private ProductSection(String info, Iterable<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties) {
super(info);
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> copyOf(checkNotNull(properties, "properties"));
private Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties;
private ProductSection(@Nullable String info, @Nullable Boolean required, Set<Property> properties) {
super(info, required);
this.properties = ImmutableSet.copyOf(checkNotNull(properties, "properties"));
}
private ProductSection() {

View File

@ -20,16 +20,12 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Property", namespace = VCLOUD_OVF_NS)
public class Property {
public static Builder builder() {

View File

@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@ -61,31 +62,42 @@ public abstract class SectionType<T extends SectionType<T>> {
public static abstract class Builder<T extends SectionType<T>> {
protected String info;
protected Boolean required;
public abstract SectionType<T> build();
/**
* @see SectionType#getInfo
* @see SectionType#getInfo()
*/
public Builder<T> info(String info) {
this.info = info;
return this;
}
/**
* @see SectionType#isRequired()
*/
public Builder<T> required(Boolean required) {
this.required = required;
return this;
}
public Builder<T> fromSection(SectionType<T> in) {
return info(in.getInfo());
return info(in.getInfo()).required(in.isRequired());
}
}
@XmlElement(name = "Info", namespace = VCLOUD_OVF_NS)
protected String info;
@XmlElement(name = "Info")
private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private boolean required;
public SectionType(@Nullable String info) {
protected SectionType(@Nullable String info, @Nullable Boolean required) {
this.info = info;
this.required = required;
}
protected SectionType() {
// For Builders and JAXB
// For JAXB
}
/**
@ -98,9 +110,13 @@ public abstract class SectionType<T extends SectionType<T>> {
return info;
}
public Boolean isRequired() {
return required;
}
@Override
public int hashCode() {
return Objects.hashCode(info);
return Objects.hashCode(info, required);
}
@Override
@ -112,7 +128,7 @@ public abstract class SectionType<T extends SectionType<T>> {
if (getClass() != obj.getClass())
return false;
SectionType<?> other = (SectionType<?>) obj;
return Objects.equal(info, other.info);
return Objects.equal(info, other.info) && Objects.equal(required, other.required);
}
@Override
@ -121,7 +137,7 @@ public abstract class SectionType<T extends SectionType<T>> {
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("info", info);
return Objects.toStringHelper("").add("info", info).add("required", required);
}
}

View File

@ -22,10 +22,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
@ -43,7 +42,6 @@ import com.google.common.collect.Sets;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_OVF_NS)
public class VirtualHardwareSection extends SectionType<VirtualHardwareSection> {
@ -111,7 +109,7 @@ public class VirtualHardwareSection extends SectionType<VirtualHardwareSection>
*/
@Override
public VirtualHardwareSection build() {
return new VirtualHardwareSection(info, transports, virtualSystem, items);
return new VirtualHardwareSection(info, required, transports, virtualSystem, items);
}
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
@ -135,15 +133,22 @@ public class VirtualHardwareSection extends SectionType<VirtualHardwareSection>
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
private VirtualSystemSettingData virtualSystem;
private Set<String> transports;
private Set<ResourceAllocationSettingData> items;
private VirtualHardwareSection(String info, Iterable<String> transports, VirtualSystemSettingData virtualSystem,
private VirtualHardwareSection(@Nullable String info, @Nullable Boolean required, Iterable<String> transports, VirtualSystemSettingData virtualSystem,
Iterable<? extends ResourceAllocationSettingData> items) {
super(info);
super(info, required);
this.virtualSystem = virtualSystem;
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(items, "items"));

View File

@ -22,7 +22,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseVirtualSystem;
import com.google.common.collect.Multimap;
@ -50,7 +50,7 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
*/
@Override
public VirtualSystem build() {
return new VirtualSystem(id, info, name, operatingSystem, virtualHardwareSections, productSections,
return new VirtualSystem(id, info, required, name, operatingSystem, virtualHardwareSections, productSections,
additionalSections);
}
@ -120,6 +120,14 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
/**
* {@inheritDoc}
*/
@ -154,11 +162,10 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
}
@SuppressWarnings("unchecked")
private VirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
private VirtualSystem(String id, String info, @Nullable Boolean required, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(id, info, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
super(id, info, required, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
}
private VirtualSystem() {

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
@ -164,10 +165,10 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
private Multimap<String, SectionType> additionalSections;
@SuppressWarnings("unchecked")
protected BaseVirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
protected BaseVirtualSystem(String id, String info, @Nullable Boolean required, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(info);
super(info, required);
this.id = id;
this.name = name;
this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
@ -216,7 +217,7 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
@Override
public int hashCode() {
return Objects.hashCode(id, name, info, operatingSystem, virtualHardwareSections, productSections, additionalSections);
return Objects.hashCode(super.hashCode(), id, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
}
@Override
@ -226,22 +227,17 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
if (getClass() != obj.getClass()) return false;
BaseVirtualSystem<?> other = (BaseVirtualSystem<?>) obj;
return Objects.equal(id, other.id)
return super.equals(other)
&& Objects.equal(id, other.id)
&& Objects.equal(name, other.name)
&& Objects.equal(info, other.info)
&& Objects.equal(operatingSystem, other.operatingSystem)
&& Objects.equal(virtualHardwareSections, other.virtualHardwareSections)
&& Objects.equal(productSections, other.productSections)
&& Objects.equal(additionalSections, other.additionalSections);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("id", id).add("name", name).add("info", info)
return super.string().add("id", id).add("name", name)
.add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections)
.add("productSections", productSections).add("additionalSections", additionalSections)
.add("additionalSections", additionalSections);

View File

@ -20,12 +20,9 @@
package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
@ -35,17 +32,16 @@ import com.google.common.collect.Sets;
/**
* Represents the results from a vCloud query as references.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultReferences" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReferences")
@XmlRootElement(name = "CatalogReferences")
public class CatalogReferences extends QueryResultReferences<CatalogReference> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -59,22 +55,14 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
@Override
public CatalogReferences build() {
CatalogReferences queryResultReferences = new CatalogReferences(href);
queryResultReferences.setReferences(references);
queryResultReferences.setName(name);
queryResultReferences.setPage(page);
queryResultReferences.setPageSize(pageSize);
queryResultReferences.setTotal(total);
queryResultReferences.setType(type);
queryResultReferences.setLinks(links);
return queryResultReferences;
return new CatalogReferences(href, type, links, name, page, pageSize, total, references);
}
/**
* @see QueryResultReferences#getReferences()
*/
@Override
public Builder references(List<CatalogReference> references) {
public Builder references(Set<CatalogReference> references) {
this.references = references;
return this;
}
@ -89,7 +77,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see Container#getName()
* @see CatalogReference#getName()
*/
@Override
public Builder name(String name) {
@ -98,7 +86,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see Container#getPage()
* @see CatalogReference#getPage()
*/
@Override
public Builder page(Integer page) {
@ -107,7 +95,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see Container#getPageSize()
* @see CatalogReference#getPageSize()
*/
@Override
public Builder pageSize(Integer pageSize) {
@ -116,7 +104,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see Container#getTotal()
* @see CatalogReference#getTotal()
*/
@Override
public Builder total(Long total) {
@ -125,7 +113,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see ResourceType#getHref()
* @see CatalogReference#getHref()
*/
@Override
public Builder href(URI href) {
@ -134,7 +122,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see ResourceType#getType()
* @see CatalogReference#getType()
*/
@Override
public Builder type(String type) {
@ -143,7 +131,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see ResourceType#getLinks()
* @see CatalogReference#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -152,7 +140,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see ResourceType#getLinks()
* @see CatalogReference#getLinks()
*/
@Override
public Builder link(Link link) {
@ -170,11 +158,11 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
}
public CatalogReferences(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<CatalogReference> references) {
super(href, type, links, name, page, pageSize, total, references);
}
protected CatalogReferences() {
// For JAXB and builder use
}
protected CatalogReferences(URI href) {
super(href);
}
}

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -36,7 +35,7 @@ import com.google.common.collect.Sets;
/**
* Container for query result sets.
*
* <p/>
* <pre>
* &lt;complexType name="Container" /&gt;
* </pre>
@ -62,7 +61,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
protected Long total;
/**
* @see Container#getName()
* @see ContainerType#getName()
*/
public Builder<T> name(String name) {
this.name = name;
@ -70,7 +69,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
}
/**
* @see Container#getPage()
* @see ContainerType#getPage()
*/
public Builder<T> page(Integer page) {
this.page = page;
@ -78,7 +77,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
}
/**
* @see Container#getPageSize()
* @see ContainerType#getPageSize()
*/
public Builder<T> pageSize(Integer pageSize) {
this.pageSize = pageSize;
@ -86,7 +85,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
}
/**
* @see Container#getTotal()
* @see ContainerType#getTotal()
*/
public Builder<T> total(Long total) {
this.total = total;
@ -95,14 +94,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
@Override
public ContainerType<T> build() {
ContainerType<T> container = new ContainerType<T>(href);
container.setName(name);
container.setPage(page);
container.setPageSize(pageSize);
container.setTotal(total);
container.setType(type);
container.setLinks(links);
return container;
return new ContainerType<T>(href, type, links, name, page, pageSize, total);
}
/**
@ -151,15 +143,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
}
}
protected ContainerType() {
// For JAXB and builder use
}
protected ContainerType(URI href) {
super(href);
}
@XmlAttribute
protected String name;
@XmlAttribute
@ -169,6 +152,18 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
@XmlAttribute
protected Long total;
public ContainerType(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total) {
super(href, type, links);
this.name = name;
this.page = page;
this.pageSize = pageSize;
this.total = total;
}
protected ContainerType() {
// For JAXB and builder use
}
/**
* Query name that generated this result set.
*/
@ -176,10 +171,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return name;
}
public void setName(String value) {
this.name = value;
}
/**
* Page of the result set that this container holds. The first page is page number 1.
*/
@ -187,10 +178,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return page;
}
public void setPage(Integer value) {
this.page = value;
}
/**
* Page size, as a number of records or references.
*/
@ -198,10 +185,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return pageSize;
}
public void setPageSize(Integer value) {
this.pageSize = value;
}
/**
* Total number of records or references in the container.
*/
@ -209,10 +192,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return total;
}
public void setTotal(Long value) {
this.total = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -23,15 +23,14 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects.ToStringHelper;
/**
*
* Container for the list of typed queries available to the
* requesting user.
*
*
* <p/>
* <p/>
* <p>Java class for QueryList complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="QueryList">
* &lt;complexContent>
@ -41,16 +40,15 @@ import com.google.common.base.Objects.ToStringHelper;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlType(name = "QueryList")
public class QueryList extends ContainerType<QueryList> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromQueryList(this);
}
@ -66,6 +64,7 @@ public class QueryList extends ContainerType<QueryList> {
public Builder fromContainerType(ContainerType<QueryList> in) {
return Builder.class.cast(super.fromContainerType(in));
}
public Builder fromQueryList(QueryList in) {
return fromContainerType(in);
}

View File

@ -21,12 +21,10 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Date;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
@ -39,14 +37,14 @@ import com.google.common.collect.Sets;
/**
* Represents the results from a Catalog vCloud query as a record.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultCatalogRecord" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(name = "CatalogRecord", namespace = VCLOUD_1_5_NS)
@XmlRootElement(name = "CatalogRecord")
public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultCatalogRecord> {
@SuppressWarnings("unchecked")
@ -80,7 +78,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsPublished()
* @see QueryResultCatalogRecord#isPublished()
*/
public Builder isPublished(Boolean isPublished) {
this.isPublished = isPublished;
@ -88,7 +86,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsPublished()
* @see QueryResultCatalogRecord#isPublished()
*/
public Builder published() {
this.isPublished = Boolean.TRUE;
@ -96,7 +94,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsPublished()
* @see QueryResultCatalogRecord#isPublished()
*/
public Builder notPublished() {
this.isPublished = Boolean.FALSE;
@ -104,7 +102,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsShared()
* @see QueryResultCatalogRecord#isShared()
*/
public Builder isShared(Boolean isShared) {
this.isShared = isShared;
@ -112,7 +110,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsShared()
* @see QueryResultCatalogRecord#isShared()
*/
public Builder shared() {
this.isShared = Boolean.TRUE;
@ -120,7 +118,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
/**
* @see QueryResultCatalogRecord#getIsShared()
* @see QueryResultCatalogRecord#isShared()
*/
public Builder notShared() {
this.isShared = Boolean.FALSE;
@ -177,20 +175,8 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
@Override
public QueryResultCatalogRecord build() {
QueryResultCatalogRecord queryResultCatalogRecord = new QueryResultCatalogRecord(href);
queryResultCatalogRecord.setName(name);
queryResultCatalogRecord.setIsPublished(isPublished);
queryResultCatalogRecord.setIsShared(isShared);
queryResultCatalogRecord.setCreationDate(creationDate);
queryResultCatalogRecord.setOrgName(orgName);
queryResultCatalogRecord.setOwnerName(ownerName);
queryResultCatalogRecord.setNumberOfVAppTemplates(numberOfVAppTemplates);
queryResultCatalogRecord.setNumberOfMedia(numberOfMedia);
queryResultCatalogRecord.setOwner(owner);
queryResultCatalogRecord.setId(id);
queryResultCatalogRecord.setType(type);
queryResultCatalogRecord.setLinks(links);
return queryResultCatalogRecord;
return new QueryResultCatalogRecord(links, href, id, type,name, isPublished, isShared, creationDate, orgName,
ownerName, numberOfVAppTemplates, numberOfMedia, owner);
}
/**
@ -249,13 +235,26 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
}
private QueryResultCatalogRecord(Set<Link> links, URI href, String id, String type, String name,
Boolean published, Boolean shared, Date creationDate, String orgName,
String ownerName, Integer numberOfVAppTemplates, Integer numberOfMedia,
URI owner) {
super(links, href, id, type);
this.name = name;
isPublished = published;
isShared = shared;
this.creationDate = creationDate;
this.orgName = orgName;
this.ownerName = ownerName;
this.numberOfVAppTemplates = numberOfVAppTemplates;
this.numberOfMedia = numberOfMedia;
this.owner = owner;
}
private QueryResultCatalogRecord() {
// For JAXB and builder use
}
private QueryResultCatalogRecord(URI href) {
super(href);
}
@XmlAttribute
protected String name;
@ -284,32 +283,21 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return name;
}
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the isPublished property.
*/
public Boolean isPublished() {
return isPublished;
}
/**
* Sets the value of the isPublished property.
* Gets the value of the isShared property.
*/
public void setIsPublished(Boolean value) {
this.isPublished = value;
}
public Boolean isShared() {
return isShared;
}
/**
* Sets the value of the isShared property.
*/
public void setIsShared(Boolean value) {
this.isShared = value;
}
/**
* Gets the value of the creationDate property.
*/
@ -317,10 +305,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return creationDate;
}
public void setCreationDate(Date value) {
this.creationDate = value;
}
/**
* Gets the value of the orgName property.
*/
@ -328,10 +312,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return orgName;
}
public void setOrgName(String value) {
this.orgName = value;
}
/**
* Gets the value of the ownerName property.
*/
@ -339,10 +319,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return ownerName;
}
public void setOwnerName(String value) {
this.ownerName = value;
}
/**
* Gets the value of the numberOfVAppTemplates property.
*/
@ -350,10 +326,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return numberOfVAppTemplates;
}
public void setNumberOfVAppTemplates(Integer value) {
this.numberOfVAppTemplates = value;
}
/**
* Gets the value of the numberOfMedia property.
*/
@ -361,10 +333,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return numberOfMedia;
}
public void setNumberOfMedia(Integer value) {
this.numberOfMedia = value;
}
/**
* Gets the value of the owner property.
*/
@ -372,10 +340,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return owner;
}
public void setOwner(URI value) {
this.owner = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -35,7 +34,7 @@ import com.google.common.collect.Sets;
/**
* Represents the results from a Network vCloud query as a record.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultNetworkRecord" /&gt;
* </pre>
@ -146,19 +145,8 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
@Override
public QueryResultNetworkRecord build() {
QueryResultNetworkRecord queryResultNetworkRecord = new QueryResultNetworkRecord(href);
queryResultNetworkRecord.setName(name);
queryResultNetworkRecord.setIpScopeId(ipScopeId);
queryResultNetworkRecord.setGateway(gateway);
queryResultNetworkRecord.setNetmask(netmask);
queryResultNetworkRecord.setDns1(dns1);
queryResultNetworkRecord.setDns2(dns2);
queryResultNetworkRecord.setDnsSuffix(dnsSuffix);
queryResultNetworkRecord.setIsBusy(isBusy);
queryResultNetworkRecord.setId(id);
queryResultNetworkRecord.setType(type);
queryResultNetworkRecord.setLinks(links);
return queryResultNetworkRecord;
return new QueryResultNetworkRecord(links, href, id, type,
name, ipScopeId, gateway, netmask, dns1, dns2, dnsSuffix, isBusy);
}
/**
@ -219,12 +207,21 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
}
}
private QueryResultNetworkRecord() {
// For JAXB and builder use
public QueryResultNetworkRecord(Set<Link> links, URI href, String id, String type, String name, String ipScopeId,
String gateway, String netmask, String dns1, String dns2, String dnsSuffix, Boolean busy) {
super(links, href, id, type);
this.name = name;
this.ipScopeId = ipScopeId;
this.gateway = gateway;
this.netmask = netmask;
this.dns1 = dns1;
this.dns2 = dns2;
this.dnsSuffix = dnsSuffix;
isBusy = busy;
}
private QueryResultNetworkRecord(URI href) {
super(href);
private QueryResultNetworkRecord() {
// For JAXB and builder use
}
@XmlAttribute
@ -251,10 +248,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return name;
}
public void setName(String value) {
this.name = value;
}
/**
* IP scope object of this network.
*/
@ -262,9 +255,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return ipScopeId;
}
public void setIpScopeId(String value) {
this.ipScopeId = value;
}
/**
* Gateway for the network.
@ -273,10 +263,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return gateway;
}
public void setGateway(String value) {
this.gateway = value;
}
/**
* Netmask for the network.
*/
@ -284,10 +270,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return netmask;
}
public void setNetmask(String value) {
this.netmask = value;
}
/**
* Primary DNS for the network.
*/
@ -295,10 +277,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dns1;
}
public void setDns1(String value) {
this.dns1 = value;
}
/**
* Secondary DNS for the network.
*/
@ -306,10 +284,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dns2;
}
public void setDns2(String value) {
this.dns2 = value;
}
/**
* DNS suffix for the network.
*/
@ -317,10 +291,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dnsSuffix;
}
public void setDnsSuffix(String value) {
this.dnsSuffix = value;
}
/**
* Shows whether it is busy.
*/
@ -328,10 +298,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return isBusy;
}
public void setIsBusy(Boolean value) {
this.isBusy = value;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -20,21 +20,13 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.namespace.QName;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -44,14 +36,13 @@ import com.google.common.collect.Sets;
/**
* Base type for query result Records. Subtypes define more specific elements.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultRecordType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({QueryResultCatalogRecord.class, QueryResultNetworkRecord.class})
public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
@ -111,11 +102,7 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
}
public QueryResultRecordType<T> build() {
QueryResultRecordType<T> record = new QueryResultRecordType<T>(href);
record.setId(id);
record.setType(type);
record.setLinks(links);
return record;
return new QueryResultRecordType<T>(links, href, id, type);
}
public Builder<T> fromQueryResultRecordType(QueryResultRecordType<T> in) {
@ -123,7 +110,7 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
}
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link")
@XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute
@XmlSchemaType(name = "anyURI")
@ -132,9 +119,13 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
private String id;
@XmlAttribute
private String type;
@XmlAnyAttribute
// XXX not sure about this
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
public QueryResultRecordType(Set<Link> links, URI href, String id, String type) {
this.links = links;
this.href = href;
this.id = id;
this.type = type;
}
public QueryResultRecordType(URI href) {
this.href = href;
@ -151,14 +142,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return links;
}
public void setLinks(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
}
public void addLink(Link link) {
this.links.add(checkNotNull(link, "link"));
}
/**
* Contains the URI to the entity. An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of the object, and is never
@ -173,10 +156,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return href;
}
public void setHref(URI href) {
this.href = href;
}
/**
* The resource identifier, expressed in URN format. The value of this attribute uniquely identifies the resource, persists for
* the life of the resource, and is never reused.
@ -184,11 +163,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
/**
* Contains the type of the the entity. The object type, specified as a MIME content type, of the object that the link
* references. This attribute is present only for links to objects. It is not present for links to actions.
@ -199,19 +173,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return type;
}
public void setType(String type) {
this.type = type;
}
// XXX not sure about this
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -21,33 +21,31 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.EntityType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Represents the results from a vCloud query as records.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultRecords" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "QueryResultRecords")
@XmlRootElement(name = "QueryResultRecords")
public class QueryResultRecords<T extends QueryResultRecordType<T>> extends ContainerType<QueryResultRecords<T>> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS;
@ -63,13 +61,13 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
public static class Builder<T extends QueryResultRecordType<T>> extends ContainerType.Builder<QueryResultRecords<T>> {
private List<T> records = Lists.newArrayList();
private Set<T> records = Sets.newLinkedHashSet();
/**
* @see QueryResultRecords#getRecords()
*/
public Builder<T> records(List<T> records) {
this.records = records;
public Builder<T> records(Set<T> records) {
this.records = checkNotNull(records, "records");
return this;
}
@ -83,15 +81,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
@Override
public QueryResultRecords<T> build() {
QueryResultRecords<T> queryResultRecords = new QueryResultRecords<T>(href);
queryResultRecords.setRecords(records);
queryResultRecords.setName(name);
queryResultRecords.setPage(page);
queryResultRecords.setPageSize(pageSize);
queryResultRecords.setTotal(total);
queryResultRecords.setType(type);
queryResultRecords.setLinks(links);
return queryResultRecords;
return new QueryResultRecords<T>(href, type, links, name, page, pageSize, total, records);
}
/**
@ -131,7 +121,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
}
/**
* @see ResourceType#getHref()
* @see EntityType#getHref()
*/
@Override
public Builder<T> href(URI href) {
@ -140,7 +130,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
}
/**
* @see ResourceType#getType()
* @see EntityType#getType()
*/
@Override
public Builder<T> type(String type) {
@ -149,7 +139,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
}
/**
* @see ResourceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
@ -158,7 +148,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
}
/**
* @see ResourceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
@ -176,32 +166,25 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
}
}
protected QueryResultRecords() {
// For JAXB and builder use
protected QueryResultRecords(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<T> records) {
super(href, type, links, name, page, pageSize, total);
this.records = ImmutableSet.copyOf(records);
}
protected QueryResultRecords(URI href) {
super(href);
protected QueryResultRecords() {
// For JAXB
}
@XmlElementRef
protected List<T> records;
private Set<T> records = Sets.newLinkedHashSet();
/**
* Set of records representing query results.
*/
public List<T> getRecords() {
public Set<T> getRecords() {
return records;
}
public void setRecords(List<T> records) {
this.records = Lists.newArrayList(checkNotNull(records, "records"));
}
public void addRecords(T record) {
this.records.add(checkNotNull(record, "record"));
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -23,9 +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.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
@ -36,12 +34,12 @@ import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Represents the results from a vCloud query as references.
*
* <p/>
* <pre>
* &lt;complexType name="QueryResultReferences" /&gt;
* </pre>
@ -63,13 +61,13 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
public static class Builder<T extends ReferenceType<T>> extends ContainerType.Builder<QueryResultReferences<T>> {
protected List<T> references = Lists.newArrayList();
protected Set<T> references = Sets.newLinkedHashSet();
/**
* @see QueryResultReferences#getReferences()
*/
public Builder<T> references(List<T> references) {
this.references = references;
public Builder<T> references(Set<T> references) {
this.references = checkNotNull(references, "references");
return this;
}
@ -83,19 +81,11 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
@Override
public QueryResultReferences<T> build() {
QueryResultReferences<T> queryResultReferences = new QueryResultReferences<T>(href);
queryResultReferences.setReferences(references);
queryResultReferences.setName(name);
queryResultReferences.setPage(page);
queryResultReferences.setPageSize(pageSize);
queryResultReferences.setTotal(total);
queryResultReferences.setType(type);
queryResultReferences.setLinks(links);
return queryResultReferences;
return new QueryResultReferences<T>(href, type, links, name, page, pageSize, total, references);
}
/**
* @see Container#getName()
* @see ContainerType#getName()
*/
@Override
public Builder<T> name(String name) {
@ -104,7 +94,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see Container#getPage()
* @see ContainerType#getPage()
*/
@Override
public Builder<T> page(Integer page) {
@ -113,7 +103,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see Container#getPageSize()
* @see ContainerType#getPageSize()
*/
@Override
public Builder<T> pageSize(Integer pageSize) {
@ -122,7 +112,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see Container#getTotal()
* @see ContainerType#getTotal()
*/
@Override
public Builder<T> total(Long total) {
@ -131,7 +121,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see ResourceType#getHref()
* @see ContainerType#getHref()
*/
@Override
public Builder<T> href(URI href) {
@ -140,7 +130,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see ResourceType#getType()
* @see ContainerType#getType()
*/
@Override
public Builder<T> type(String type) {
@ -149,7 +139,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see ResourceType#getLinks()
* @see ContainerType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
@ -158,7 +148,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
/**
* @see ResourceType#getLinks()
* @see ContainerType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
@ -176,35 +166,28 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
}
protected QueryResultReferences() {
// For JAXB and builder use
protected QueryResultReferences(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<T> references) {
super(href, type, links, name, page, pageSize, total);
this.references = ImmutableSet.copyOf(references);
}
protected QueryResultReferences(URI href) {
super(href);
protected QueryResultReferences() {
// For JAXB and builder use
}
// NOTE add other types as they are used. probably not the best way to do this.
@XmlElementRefs({
@XmlElementRef(type = CatalogReference.class)
})
protected List<T> references = Lists.newArrayList();
private Set<T> references = Sets.newLinkedHashSet();
/**
* Set of references representing query results.
*/
public List<T> getReferences() {
public Set<T> getReferences() {
return references;
}
public void setReferences(List<T> references) {
this.references = Lists.newArrayList(checkNotNull(references, "references"));
}
public void addReference(T reference) {
this.references.add(checkNotNull(reference, "reference"));
}
@Override
public boolean equals(Object o) {
if (this == o)

View File

@ -23,15 +23,16 @@ import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType;
/**
* Represents a base type for VAppType and VmType.
*
* <p/>
* <pre>
* &lt;complexType name="AbstractVAppType" &gt;
* </pre>
*
* @author grkvlt@apache.org
*/
public abstract class AbstractVAppType extends ResourceEntityType<AbstractVAppType> {
public abstract class AbstractVAppType<T extends AbstractVAppType<T>> extends ResourceEntityType<T> {
public static abstract class Builder<T extends AbstractVAppType<T>> extends ResourceEntityType.Builder<T> {}
// @XmlElement(name = "VAppParent")
// protected ReferenceType vAppParent;
// @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)

View File

@ -20,25 +20,27 @@ package org.jclouds.vcloud.director.v1_5.domain.vapp;
/**
* Represents a vApp.
*
* <p/>
* <pre>
* &lt;complexType name="VApp" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
public class VApp extends AbstractVAppType {
public class VApp extends AbstractVAppType<VApp> {
//
// @SuppressWarnings("unchecked")
// public static Builder builder() {
// return new Builder();
// }
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
//
// public Builder toBuilder() {
// return new Builder().fromVApp(this);
// }
//
// public static class Builder extends AbstractVAppType.Builder<VApp> {
@Override
public Builder toBuilder() {
return new Builder().fromVApp(this);
}
public static class Builder extends AbstractVAppType.Builder<VApp> {
//
// private Owner owner;
// private Boolean inMaintenanceMode;
@ -78,7 +80,10 @@ public class VApp extends AbstractVAppType {
// }
//
//
// public VApp build() {
public VApp build() {
return new VApp();
}
// VApp vApp = new VApp();
// vApp.setOwner(owner);
// vApp.setInMaintenanceMode(inMaintenanceMode);
@ -92,18 +97,20 @@ public class VApp extends AbstractVAppType {
// public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) {
// return Builder.class.cast(super.fromAbstractVAppType(in));
// }
// public Builder fromVApp(VApp in) {
public Builder fromVApp(VApp in) {
return new Builder();
}
// return fromAbstractVAppType(in)
// .owner(in.getOwner())
// .inMaintenanceMode(in.getInMaintenanceMode())
// .children(in.getChildren())
// .ovfDescriptorUploaded(in.getOvfDescriptorUploaded());
// }
// }
//
// private VApp() {
// // For JAXB and builder use
// }
}
private VApp() {
// For JAXB and builder use
}
//
//
//