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.
*
*
* 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,12 +51,9 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AvailableNetworks", propOrder = {
"networks"
"networks"
})
public class AvailableNetworks {
public static Builder builder() {
@ -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,51 +94,28 @@ 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;
}
private AvailableNetworks() {
// For JAXB
}
@XmlElement(name = "Network")
protected List<Reference> networks;
/**
* 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();
}
return this.networks;
}
/**
* Gets the value of the network property.
*/
public Set<Reference> getNetworks() {
return this.networks;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
AvailableNetworks that = AvailableNetworks.class.cast(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;
/**
*
* Collection of supported hardware capabilities.
*
*
* 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,12 +47,9 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capabilities", propOrder = {
"supportedHardwareVersions"
"supportedHardwareVersions"
})
public class Capabilities {
public static Builder builder() {
@ -67,7 +61,7 @@ public class Capabilities {
}
public static class Builder {
private SupportedHardwareVersions 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,43 +83,32 @@ public class Capabilities {
}
}
private Capabilities(SupportedHardwareVersions supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions;
}
private Capabilities() {
// For JAXB and builder use
// For JAXB
}
@XmlElement(name = "SupportedHardwareVersions")
protected SupportedHardwareVersions supportedHardwareVersions;
@XmlElement(name = "SupportedHardwareVersions")
protected SupportedHardwareVersions supportedHardwareVersions;
/**
* Gets the value of the supportedHardwareVersions property.
*
* @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;
}
/**
* Gets the value of the supportedHardwareVersions property.
*
* @return possible object is
* {@link SupportedHardwareVersions }
*/
public SupportedHardwareVersions getSupportedHardwareVersions() {
return supportedHardwareVersions;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
Capabilities that = Capabilities.class.cast(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.
*
*
* 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,20 +50,17 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capacity", propOrder = {
"units",
"allocated",
"limit"
"units",
"allocated",
"limit"
})
@XmlSeeAlso({
// CapacityWithUsageType.class
CapacityWithUsage.class
})
public class CapacityType<T extends CapacityType<T>> {
public static <T extends CapacityType<T>> Builder<T> builder() {
return new Builder<T>();
}
@ -76,7 +70,7 @@ public class CapacityType<T extends CapacityType<T>> {
}
public static class Builder<T extends CapacityType<T>> {
protected String units;
protected Long allocated;
protected Long limit;
@ -107,119 +101,78 @@ 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);
}
public Builder<T> fromCapacityType(CapacityType<T> in) {
return units(in.getUnits())
.allocated(in.getAllocated())
.limit(in.getLimit());
.allocated(in.getAllocated())
.limit(in.getLimit());
}
}
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")
protected Long allocated;
@XmlElement(name = "Limit")
protected Long limit;
/**
* Gets the value of the units property.
*
* @return possible object is
* {@link String }
*/
public String getUnits() {
return units;
}
/**
* Gets the value of the allocated property.
*
* @return possible object is
* {@link Long }
*/
public Long getAllocated() {
return allocated;
}
@XmlElement(name = "Units", required = true)
protected String units;
@XmlElement(name = "Allocated")
protected Long allocated;
@XmlElement(name = "Limit")
protected Long limit;
/**
* Gets the value of the units property.
*
* @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
* {@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;
}
/**
* Gets the value of the limit property.
*/
public Long getLimit() {
return limit;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CapacityType<?> that = CapacityType.class.cast(o);
return equal(units, that.units) &&
equal(allocated, that.allocated) &&
equal(limit, that.limit);
return equal(units, that.units) &&
equal(allocated, that.allocated) &&
equal(limit, that.limit);
}
@Override
public int hashCode() {
return Objects.hashCode(units,
allocated,
limit);
return Objects.hashCode(units,
allocated,
limit);
}
@Override

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.
*
*
* 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,13 +48,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CapacityWithUsage", propOrder = {
"used",
"overhead"
"used",
"overhead"
})
public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
@ -72,7 +66,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
}
public static class Builder extends CapacityType.Builder<CapacityWithUsage> {
private Long used;
private Long overhead;
@ -91,15 +85,10 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
this.overhead = overhead;
return this;
}
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);
}
/**
@ -125,96 +114,70 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
this.limit = limit;
return this;
}
@Override
public Builder fromCapacityType(CapacityType<CapacityWithUsage> in) {
return Builder.class.cast(super.fromCapacityType(in));
return Builder.class.cast(super.fromCapacityType(in));
}
public Builder fromCapacityWithUsage(CapacityWithUsage in) {
return fromCapacityType(in)
.used(in.getUsed())
.overhead(in.getOverhead());
.used(in.getUsed())
.overhead(in.getOverhead());
}
}
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")
protected Long overhead;
/**
* Gets the value of the used property.
*
* @return possible object is
* {@link Long }
*/
public Long getUsed() {
return used;
}
@XmlElement(name = "Used")
protected Long used;
@XmlElement(name = "Overhead")
protected Long overhead;
/**
* Gets the value of the used property.
*
* @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
* {@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;
}
/**
* Gets the value of the overhead property.
*
* @return possible object is
* {@link Long }
*/
public Long getOverhead() {
return overhead;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CapacityWithUsage that = CapacityWithUsage.class.cast(o);
return equal(used, that.used) &&
equal(overhead, that.overhead);
return equal(used, that.used) &&
equal(overhead, that.overhead);
}
@Override
public int hashCode() {
return Objects.hashCode(used,
overhead);
return Objects.hashCode(used,
overhead);
}
@Override

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.
*
*
* 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,16 +62,13 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CaptureVAppParams", propOrder = {
"source",
"section"
"source",
"section"
})
public class CaptureVAppParams
extends ParamsType<CaptureVAppParams>
extends ParamsType<CaptureVAppParams>
{
@SuppressWarnings("unchecked")
@ -86,9 +81,9 @@ 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,130 +96,115 @@ 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);
}
@Override
public Builder fromParamsType(ParamsType<CaptureVAppParams> in) {
return Builder.class.cast(super.fromParamsType(in));
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCaptureVAppParams(CaptureVAppParams in) {
return fromParamsType(in)
.source(in.getSource())
.sections(in.getSections());
.source(in.getSource())
.sections(in.getSections());
}
}
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;
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElementRef
protected Set<? extends Section<?>> sections = Sets.newLinkedHashSet();
/**
* Gets the value of the source property.
*
* @return
* possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the source property.
*
* @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>
* 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>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link Section> }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection> }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection> }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection> }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection > }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection> }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection> }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection > }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link OperatingSystemSection > }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSection> }{@code >}
* {@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<?>>>();
}
return this.sections;
}
/**
* An ovf:Section to configure the captured vAppTemplate.
* Gets the value of the section property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link Section> }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection> }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection> }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection> }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection > }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection> }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection> }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection > }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection> }{@code >}
* {@link JAXBElement }{@code <}{@link OperatingSystemSection > }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSection> }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkSection > }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection > }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection> }{@code >}
*/
public Set<? extends Section<?>> getSections() {
return this.sections;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CaptureVAppParams that = CaptureVAppParams.class.cast(o);
return equal(source, that.source) &&
equal(sections, that.sections);
return equal(source, that.source) &&
equal(sections, that.sections);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
return Objects.hashCode(source,
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.
*
*
* 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,16 +49,13 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneMediaParams", propOrder = {
"source",
"isSourceDelete"
"source",
"isSourceDelete"
})
public class CloneMediaParams
extends ParamsType<CloneMediaParams>
extends ParamsType<CloneMediaParams>
{
@SuppressWarnings("unchecked")
@ -74,7 +68,7 @@ public class CloneMediaParams
}
public static class Builder extends ParamsType.Builder<CloneMediaParams> {
private Reference source;
private Boolean isSourceDelete;
@ -87,107 +81,80 @@ 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));
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCloneMediaParams(CloneMediaParams in) {
return fromParamsType(in)
.source(in.getSource())
.isSourceDelete(in.isSourceDelete());
.source(in.getSource())
.isSourceDelete(in.isSourceDelete());
}
}
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")
protected Boolean isSourceDelete;
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
protected Boolean isSourceDelete;
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the source property.
*
* @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
* {@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 isSourceDelete property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CloneMediaParams that = CloneMediaParams.class.cast(o);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
isSourceDelete);
return Objects.hashCode(source,
isSourceDelete);
}
@Override

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.
*
*
* 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,13 +41,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppParams")
public class CloneVAppParams
extends InstantiateVAppParamsType<CloneVAppParams>
extends InstantiateVAppParamsType<CloneVAppParams>
{
@SuppressWarnings("unchecked")
@ -63,7 +57,7 @@ public class CloneVAppParams
}
public static class Builder extends InstantiateVAppParamsType.Builder<CloneVAppParams> {
public CloneVAppParams build() {
CloneVAppParams cloneVAppParams = new CloneVAppParams();
@ -85,7 +79,7 @@ public class CloneVAppParams
super.name(name);
return this;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@ -117,7 +111,7 @@ public class CloneVAppParams
super.powerOn(powerOn);
return this;
}
/**
* @see InstantiateVAppParamsType#getSource()
*/
@ -144,8 +138,9 @@ public class CloneVAppParams
@Override
public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<CloneVAppParams> in) {
return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
}
public Builder fromCloneVAppParams(CloneVAppParams in) {
return fromInstantiateVAppParamsType(in);
}
@ -158,7 +153,7 @@ public class CloneVAppParams
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CloneVAppParams that = CloneVAppParams.class.cast(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,15 +28,14 @@ import com.google.common.base.Objects;
/**
*
* Represents parameters for copying a vApp template and optionally
* deleting the source.
*
*
* 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,16 +49,13 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppTemplateParams", propOrder = {
"source",
"isSourceDelete"
"source",
"isSourceDelete"
})
public class CloneVAppTemplateParams
extends ParamsType<CloneVAppTemplateParams>
extends ParamsType<CloneVAppTemplateParams>
{
@SuppressWarnings("unchecked")
@ -74,7 +68,7 @@ public class CloneVAppTemplateParams
}
public static class Builder extends ParamsType.Builder<CloneVAppTemplateParams> {
private Reference source;
private Boolean isSourceDelete;
@ -87,107 +81,80 @@ 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));
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromCloneVAppTemplateParams(CloneVAppTemplateParams in) {
return fromParamsType(in)
.source(in.getSource())
.isSourceDelete(in.isSourceDelete());
.source(in.getSource())
.isSourceDelete(in.isSourceDelete());
}
}
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")
protected Boolean isSourceDelete;
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
protected Boolean isSourceDelete;
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the source property.
*
* @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
* {@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 isSourceDelete property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
CloneVAppTemplateParams that = CloneVAppTemplateParams.class.cast(o);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
isSourceDelete);
return Objects.hashCode(source,
isSourceDelete);
}
@Override

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.
*
*
* 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,19 +55,16 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComposeVAppParams", propOrder = {
"sourcedItem",
"allEULAsAccepted"
"sourcedItem",
"allEULAsAccepted"
})
@XmlSeeAlso({
// RecomposeVAppParamsType.class
})
public class ComposeVAppParams
extends VAppCreationParamsType<ComposeVAppParams>
extends VAppCreationParamsType<ComposeVAppParams>
{
@SuppressWarnings("unchecked")
@ -82,21 +77,21 @@ 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,141 +108,109 @@ 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);
}
@Override
public Builder fromVAppCreationParamsType(VAppCreationParamsType<ComposeVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder fromComposeVAppParams(ComposeVAppParams in) {
return fromVAppCreationParamsType(in)
.sourcedItem(in.getSourcedItem())
.allEULAsAccepted(in.isAllEULAsAccepted())
.linkedClone(in.isLinkedClone());
.sourcedItem(in.getSourcedItem())
.allEULAsAccepted(in.isAllEULAsAccepted())
.linkedClone(in.isLinkedClone());
}
}
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItem, Boolean allEULAsAccepted, Boolean linkedClone) {
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 Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
protected Boolean linkedClone;
/**
* Gets the value of the sourcedItem property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the sourcedItem property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSourcedItem().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link SourcedCompositionItemParam }
*/
public Set<SourcedCompositionItemParam> getSourcedItem() {
return this.sourcedItem;
}
/**
* 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
* {@link Boolean }
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
}
@XmlElement(name = "SourcedItem")
protected List<SourcedCompositionItemParam> sourcedItem;
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
protected Boolean linkedClone;
/**
* Gets the value of the sourcedItem 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 sourcedItem property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSourcedItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SourcedCompositionItemParamType }
*
*
*/
public List<SourcedCompositionItemParam> getSourcedItem() {
if (sourcedItem == null) {
sourcedItem = new ArrayList<SourcedCompositionItemParam>();
}
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
* {@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
* {@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;
}
/**
* Gets the value of the linkedClone property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isLinkedClone() {
return linkedClone;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
ComposeVAppParams that = ComposeVAppParams.class.cast(o);
return equal(sourcedItem, that.sourcedItem) &&
equal(allEULAsAccepted, that.allEULAsAccepted) &&
equal(linkedClone, that.linkedClone);
return equal(sourcedItem, that.sourcedItem) &&
equal(allEULAsAccepted, that.allEULAsAccepted) &&
equal(linkedClone, that.linkedClone);
}
@Override
public int hashCode() {
return Objects.hashCode(sourcedItem,
allEULAsAccepted,
linkedClone);
return Objects.hashCode(sourcedItem,
allEULAsAccepted,
linkedClone);
}
@Override

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.
*
*
* 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,13 +48,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComputeCapacity", propOrder = {
"cpu",
"memory"
"cpu",
"memory"
})
public class ComputeCapacity {
public static Builder builder() {
@ -69,7 +63,7 @@ public class ComputeCapacity {
}
public static class Builder {
private CapacityWithUsage cpu;
private CapacityWithUsage memory;
@ -89,95 +83,66 @@ 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());
.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)
protected CapacityWithUsage memory;
@XmlElement(name = "Cpu", required = true)
protected CapacityWithUsage cpu;
@XmlElement(name = "Memory", required = true)
protected CapacityWithUsage memory;
/**
* Gets the value of the cpu property.
*
* @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
* {@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;
}
/**
* Gets the value of the cpu property.
*
* @return possible object is
* {@link CapacityWithUsage }
*/
public CapacityWithUsage getCpu() {
return cpu;
}
/**
* Gets the value of the memory property.
*
* @return possible object is
* {@link CapacityWithUsage }
*/
public CapacityWithUsage getMemory() {
return memory;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
ComputeCapacity that = ComputeCapacity.class.cast(o);
return equal(cpu, that.cpu) &&
equal(memory, that.memory);
return equal(cpu, that.cpu) &&
equal(memory, that.memory);
}
@Override
public int hashCode() {
return Objects.hashCode(cpu,
memory);
return Objects.hashCode(cpu,
memory);
}
@Override

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());
}
@ -160,13 +143,23 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
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 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()
*/
@ -151,22 +130,25 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
public Builder<T> fromEntityType(EntityType<T> in) {
return fromResourceType(in)
.description(in.getDescription()).tasksInProgress(in.getTasksInProgress())
.id(in.getId()).name(in.getName());
.description(in.getDescription()).tasksInProgress(in.getTasksInProgress())
.id(in.getId()).name(in.getName());
}
}
@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,20 +180,12 @@ 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.
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object 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,17 +30,16 @@ 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;
public static Builder builder() {
@ -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).
*
*
* 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,26 +54,21 @@ 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);
}
public static class Builder extends EntityType.Builder<File> {
private Long size;
private Long bytesTransferred;
private String checksum;
@ -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) {
@ -173,120 +158,86 @@ public class File
@Override
public Builder fromEntityType(EntityType<File> in) {
return Builder.class.cast(super.fromEntityType(in));
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromFile(File in) {
return fromEntityType(in)
.size(in.getSize())
.bytesTransferred(in.getBytesTransferred())
.checksum(in.getChecksum());
.size(in.getSize())
.bytesTransferred(in.getBytesTransferred())
.checksum(in.getChecksum());
}
}
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
protected Long bytesTransferred;
@XmlAttribute
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlSchemaType(name = "normalizedString")
protected String checksum;
@XmlAttribute
protected Long size;
@XmlAttribute
protected Long bytesTransferred;
@XmlAttribute
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlSchemaType(name = "normalizedString")
protected String checksum;
/**
* Gets the value of the size property.
*
* @return possible object is
* {@link Long }
*/
public Long getSize() {
return size;
}
/**
* Gets the value of the size property.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getSize() {
return size;
}
/**
* Gets the value of the bytesTransferred property.
*
* @return possible object is
* {@link Long }
*/
public Long getBytesTransferred() {
return bytesTransferred;
}
/**
* 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
* {@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
* {@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;
}
/**
* Gets the value of the checksum property.
*
* @return possible object is
* {@link String }
*/
public String getChecksum() {
return checksum;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
File that = File.class.cast(o);
return equal(size, that.size) &&
equal(bytesTransferred, that.bytesTransferred) &&
equal(checksum, that.checksum);
return equal(size, that.size) &&
equal(bytesTransferred, that.bytesTransferred) &&
equal(checksum, that.checksum);
}
@Override
public int hashCode() {
return Objects.hashCode(size,
bytesTransferred,
checksum);
return Objects.hashCode(size,
bytesTransferred,
checksum);
}
@Override

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).
*
*
* 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,12 +51,9 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FilesList", propOrder = {
"files"
"files"
})
public class FilesList {
public static Builder builder() {
@ -71,14 +65,14 @@ 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,47 +92,25 @@ 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;
@XmlElement(name = "File", required = true)
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>();
}
return this.files;
}
/**
* Gets the value of the file property.
*/
public Set<File> getFiles() {
return this.files;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
FilesList that = FilesList.class.cast(o);

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,25 +262,13 @@ 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) {
return fromSection(in)
.enabled(in.isEnabled())
@ -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,15 +20,14 @@
package org.jclouds.vcloud.director.v1_5.domain;
/**
* Parameters for Instantiating a vApp
*
*
* @author danikov
*/
public class InstantiateVAppParams
extends InstantiateVAppParamsType<InstantiateVAppParams> {
extends InstantiateVAppParamsType<InstantiateVAppParams> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
@ -39,23 +38,13 @@ public class InstantiateVAppParams
return new Builder();
}
public static class Builder
extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> {
public static class Builder
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);
}
/**
* @see InstantiateVAppParams#getSource()
*/
@ -65,7 +54,7 @@ public class InstantiateVAppParams
}
/**
* @see InstantiateVAppParams#getIsSourceDelete()
* @see InstantiateVAppParams#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete);
@ -73,13 +62,13 @@ public class InstantiateVAppParams
}
/**
* @see InstantiateVAppParams#getLinkedClone()
* @see InstantiateVAppParams#isLinkedClone()
*/
public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone);
return this;
}
/**
* @see ParamsType#getDescription()
*/
@ -95,7 +84,7 @@ public class InstantiateVAppParams
super.name(name);
return this;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@ -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);
@ -134,13 +123,19 @@ public class InstantiateVAppParams
@Override
public Builder fromInstantiateVAppParamsType(
InstantiateVAppParamsType<InstantiateVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(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.
*
*
* 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,20 +51,17 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppParams", propOrder = {
"source",
"isSourceDelete"
"source",
"isSourceDelete"
})
@XmlSeeAlso({
// InstantiateVAppTemplateParamsType.class,
// CloneVAppParamsType.class
})
public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
extends VAppCreationParamsType<T>
extends VAppCreationParamsType<T>
{
public static <T extends InstantiateVAppParamsType<T>> Builder<T> builder() {
@ -79,7 +73,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
public static class Builder<T extends InstantiateVAppParamsType<T>> extends VAppCreationParamsType.Builder<T> {
protected Reference source;
protected Boolean isSourceDelete;
protected Boolean linkedClone;
@ -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,28 +95,17 @@ 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);
}
/**
* @see ParamsType#getDescription()
*/
@ -138,7 +121,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
super.name(name);
return this;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@ -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);
@ -177,118 +160,84 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder<T> fromInstantiateVAppParamsType(InstantiateVAppParamsType<T> in) {
return fromVAppCreationParamsType(in)
.source(in.getSource())
.isSourceDelete(in.isSourceDelete())
.linkedClone(in.isLinkedClone());
.source(in.getSource())
.isSourceDelete(in.isSourceDelete())
.linkedClone(in.isLinkedClone());
}
}
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")
protected Boolean isSourceDelete;
@XmlAttribute
protected Boolean linkedClone;
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "IsSourceDelete")
protected Boolean isSourceDelete;
@XmlAttribute
protected Boolean linkedClone;
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the source property.
*
* @return
* possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the isSourceDelete property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isSourceDelete() {
return isSourceDelete;
}
/**
* 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
* {@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
* {@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;
}
/**
* Gets the value of the linkedClone property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isLinkedClone() {
return linkedClone;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
InstantiateVAppParamsType<?> that = InstantiateVAppParamsType.class.cast(o);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete) &&
equal(linkedClone, that.linkedClone);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete) &&
equal(linkedClone, that.linkedClone);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
isSourceDelete,
linkedClone);
return Objects.hashCode(source,
isSourceDelete,
linkedClone);
}
@Override

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.
*
*
* 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,16 +47,13 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppTemplateParams", propOrder = {
"allEULAsAccepted"
"allEULAsAccepted"
})
public class InstantiateVAppTemplateParams
extends InstantiateVAppParamsType<InstantiateVAppTemplateParams> {
extends InstantiateVAppParamsType<InstantiateVAppTemplateParams> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
@ -70,11 +64,11 @@ public class InstantiateVAppTemplateParams
}
public static class Builder extends InstantiateVAppParamsType.Builder<InstantiateVAppTemplateParams> {
private Boolean allEULAsAccepted;
/**
* @see InstantiateVAppTemplateParamsType#getAllEULAsAccepted()
* @see InstantiateVAppTemplateParams#isAllEULAsAccepted()
*/
public Builder allEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted;
@ -82,11 +76,9 @@ 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);
}
/**
* @see ParamsType#getDescription()
*/
@ -102,7 +94,7 @@ public class InstantiateVAppTemplateParams
super.name(name);
return this;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@ -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);
@ -140,58 +132,47 @@ public class InstantiateVAppTemplateParams
*/
@Override
public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<InstantiateVAppTemplateParams> in) {
return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
}
public Builder fromInstantiateVAppTemplateParams(InstantiateVAppTemplateParams in) {
return fromInstantiateVAppParamsType(in)
.allEULAsAccepted(in.isAllEULAsAccepted());
.allEULAsAccepted(in.isAllEULAsAccepted());
}
}
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;
@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
* {@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;
}
/**
* 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
* {@link Boolean }
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
InstantiateVAppTemplateParams that = InstantiateVAppTemplateParams.class.cast(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.
*
*
* 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,12 +60,9 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiationParams", propOrder = {
"section"
"section"
})
public class InstantiationParams {
public static Builder builder() {
@ -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,67 +100,61 @@ 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;
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
*
* An ovf:Section to configure for instantiation.
*
* Gets the value of the section 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 section property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link org.jclouds.ovf.OperatingSystemSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSection }{@code >}
* {@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<?>>>();
}
return this.sections;
}
/**
* An ovf:Section to configure for instantiation.
* <p/>
* Gets the value of the section property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link org.jclouds.ovf.OperatingSystemSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkSection }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*/
public Set<? extends SectionType<?>> getSections() {
return this.sections;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
InstantiationParams that = InstantiationParams.class.cast(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;
@ -33,10 +31,10 @@ import com.google.common.collect.Sets;
/**
* A list of IpAddresses.
*
*
* @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;
@ -28,12 +27,12 @@ import com.google.common.base.Objects;
/**
* Represents a range of IP addresses, start and end inclusive.
*
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRange")
@XmlRootElement(name = "IpRange")
public class IpRange {
public static Builder builder() {
return new Builder();
}
@ -43,7 +42,7 @@ public class IpRange {
}
public static class Builder {
private String startAddress;
private String endAddress;
@ -71,7 +70,7 @@ public class IpRange {
return startAddress(in.getStartAddress()).endAddress(in.getEndAddress());
}
}
private IpRange() {
// For JAXB and builder use
}
@ -80,27 +79,26 @@ public class IpRange {
this.startAddress = startAddress;
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;
/**
* @return Start address of the IP range.
*/
public String getStartAddress() {
return startAddress;
}
/**
* @return End address of the IP range.
*/
public String getEndAddress() {
return endAddress;
}
@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.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;
@ -33,10 +31,10 @@ import com.google.common.collect.Sets;
/**
* A list of IpAddresses.
*
*
* @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;
@ -30,13 +27,12 @@ import com.google.common.base.Objects;
/**
* Specify network settings like gateway, network mask, DNS servers, IP ranges, etc.
*
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpScope")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "IpScope")
public class IpScope {
public static Builder builder() {
return new Builder();
}
@ -46,7 +42,7 @@ public class IpScope {
}
public static class Builder {
private boolean isInherited;
private String gateway;
private String netmask;
@ -111,7 +107,7 @@ public class IpScope {
this.ipRanges = ipRanges;
return this;
}
/**
* @see IpScope#getAllocatedIpAddresses()
*/
@ -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) {
@ -142,30 +130,39 @@ public class IpScope {
.allocatedIpAddresses(in.getAllocatedIpAddresses());
}
}
private 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;
/**
@ -174,17 +171,13 @@ public class IpScope {
public boolean isInherited() {
return isInherited;
}
/**
* @return Gateway of the network..
*/
public String getGateway() {
return gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
/**
* @return Network mask.
@ -192,10 +185,6 @@ public class IpScope {
public String getNetmask() {
return netmask;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}
/**
* @return Primary DNS server.
@ -203,21 +192,13 @@ public class IpScope {
public String getDns1() {
return dns1;
}
public void setDns1(String dns1) {
this.dns1 = dns1;
}
/**
* @return Secondary DNS server.
*/
public String getDns2() {
return dns2;
}
public void setDns2(String dns2) {
this.dns2 = dns2;
}
/**
* @return DNS suffix.
@ -225,33 +206,21 @@ public class IpScope {
public String getDnsSuffix() {
return dnsSuffix;
}
public void setDnsSuffix(String dnsSuffix) {
this.dnsSuffix = dnsSuffix;
}
/**
* @return IP ranges used for static pool allocation in the network.
*/
public IpRanges getIpRanges() {
return ipRanges;
}
public void setIpRanges(IpRanges ipRanges) {
this.ipRanges = ipRanges;
}
/**
* @return Read-only list of allocated IP addresses in the network.
*/
public IpAddresses getAllocatedIpAddresses() {
return allocatedIpAddresses;
}
public void setAllocatedIpAddresses(IpAddresses allocatedIpAddresses) {
this.allocatedIpAddresses = allocatedIpAddresses;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -285,5 +254,5 @@ public class IpScope {
.add("ipRanges", ipRanges)
.add("allocatedIpAddresses", allocatedIpAddresses).toString();
}
}

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 {
@ -58,16 +59,16 @@ public class Link extends ReferenceType<Link> {
public static final String FIRST_PAGE = "firstPage";
public static final String CONTROL_ACCESS = "controlAccess";
/**
* All acceptable {@link Link#getRel()} values.
*
* This list must be updated whenever a new relationship is added.
*/
public static final List<String> ALL = Arrays.asList(
UP, DOWN, EDIT, ADD, DELETE, REMOVE, CATALOG_ITEM, TASK_CANCEL,
ALTERNATE, NEXT_PAGE, PREVIOUS_PAGE, LAST_PAGE, FIRST_PAGE,
CONTROL_ACCESS
);
/**
* 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(
UP, DOWN, EDIT, ADD, DELETE, REMOVE, CATALOG_ITEM, TASK_CANCEL,
ALTERNATE, NEXT_PAGE, PREVIOUS_PAGE, LAST_PAGE, FIRST_PAGE,
CONTROL_ACCESS
);
}
@SuppressWarnings("unchecked")
@ -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");
}
@ -180,7 +177,7 @@ public class Link extends ReferenceType<Link> {
* name of an operation on the object, a reference to a contained or containing object, or a
* reference to an alternate representation of the object. The relationship value implies the
* HTTP verb to use when you use the link's href value as a request URL.
*
*
* @return relationship of the link to the object that contains it.
*/
public String getRel() {

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() {
// for JAXB
}
protected Media(URI href, String name) {
super(href, name);
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;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
private Media() {
// for JAXB
}
@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,16 +35,16 @@ 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;
@SuppressWarnings("unchecked")
@ -78,15 +76,12 @@ public class Metadata extends ResourceType<Metadata> {
metadataEntries.add(checkNotNull(metadataEntry, "metadataEntry"));
return this;
}
@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);
}
/**
* @see ResourceType#getHref()
*/
@ -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,16 +34,16 @@ 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;
@SuppressWarnings("unchecked")
@ -53,7 +51,6 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromMetadataEntry(this);
}
@ -87,15 +84,12 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
this.value = value;
return this;
}
@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);
}
/**
* @see ResourceType#getHref()
*/
@ -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;
/**
@ -173,7 +167,7 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
public String getValue() {
return 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;
@ -36,16 +34,16 @@ 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;
@SuppressWarnings("unchecked")
@ -68,15 +66,12 @@ public class MetadataValue extends ResourceType<MetadataValue> {
this.value = value;
return this;
}
@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);
}
/**
* @see ResourceType#getHref()
*/
@ -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;
/**
@ -144,7 +139,7 @@ public class MetadataValue extends ResourceType<MetadataValue> {
public String getValue() {
return 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.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/**
*
* Represents mapping between a VM and vApp network.
*
*
* 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,13 +46,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkAssignment")
public class NetworkAssignment
{
public static Builder builder() {
@ -67,7 +61,7 @@ public class NetworkAssignment
}
public static class Builder {
private String innerNetwork;
private String containerNetwork;
@ -87,95 +81,66 @@ 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());
.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)
protected String containerNetwork;
@XmlAttribute(required = true)
protected String innerNetwork;
@XmlAttribute(required = true)
protected String containerNetwork;
/**
* Gets the value of the innerNetwork property.
*
* @return possible object is
* {@link String }
*/
public String getInnerNetwork() {
return innerNetwork;
}
/**
* Gets the value of the innerNetwork property.
*
* @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
* {@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;
}
/**
* Gets the value of the containerNetwork property.
*
* @return possible object is
* {@link String }
*/
public String getContainerNetwork() {
return containerNetwork;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
NetworkAssignment that = NetworkAssignment.class.cast(o);
return equal(innerNetwork, that.innerNetwork) &&
equal(containerNetwork, that.containerNetwork);
return equal(innerNetwork, that.innerNetwork) &&
equal(containerNetwork, that.containerNetwork);
}
@Override
public int hashCode() {
return Objects.hashCode(innerNetwork,
containerNetwork);
return Objects.hashCode(innerNetwork,
containerNetwork);
}
@Override

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)
@XmlType( propOrder = {
"link",
"networkConfig",
"any"
@XmlRootElement(name = "NetworkConfigSection")
@XmlType(propOrder = {
"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,111 +146,51 @@ 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() {
// For JAXB
}
/**
* 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;
@ -30,12 +28,11 @@ import com.google.common.base.Objects;
/**
* Returns a network configuration
*
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkConfiguration")
@XmlAccessorType(XmlAccessType.FIELD)
public class NetworkConfiguration{
@XmlRootElement(name = "NetworkConfiguration")
public class NetworkConfiguration {
public static Builder builder() {
return new 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,41 +120,44 @@ 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;
/**
* @return IP level configuration items such as gateway, dns, subnet,
* IP address pool to be used for allocation. Note that the pool of IP addresses
* needs to fall within the subnet/mask of the IpScope.
* @return IP level configuration items such as gateway, dns, subnet,
* IP address pool to be used for allocation. Note that the pool of IP addresses
* needs to fall within the subnet/mask of the IpScope.
*/
public IpScope getIpScope() {
return ipScope;
}
public void setIpScope(IpScope ipScope) {
this.ipScope = ipScope;
}
/**
* @return reference to parent network.
@ -172,32 +165,24 @@ public class NetworkConfiguration{
public ReferenceType<?> getParentNetwork() {
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),
* isolated (not connected to any other network), natRouted (connected to the ParentNetwork via a
* NAT service)
* @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),
* isolated (not connected to any other network), natRouted (connected to the ParentNetwork via a
* NAT service)
*/
public String getFenceMode() {
return fenceMode;
}
/**
* @return whether the network resources such as IP/MAC of router will be retained
* across deployments. Default is false.
* @return whether the network resources such as IP/MAC of router will be retained
* across deployments. Default is false.
*/
public boolean getRetainNetInfoAcrossDeployments() {
return retainNetInfoAcrossDeployments;
}
public void setRetainNetInfoAcrossDeployments(boolean retainNetInfoAcrossDeployments) {
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
}
/**
* @return Network features like DHCP, firewall and NAT rules.
@ -205,10 +190,6 @@ public class NetworkConfiguration{
public NetworkFeatures getNetworkFeatures() {
return features;
}
public void setNetworkFeatures(NetworkFeatures features) {
this.features = features;
}
/**
* @return Syslog server settings for the network.
@ -216,10 +197,6 @@ public class NetworkConfiguration{
public SyslogServerSettings getSyslogServerSettings() {
return syslogServerSettings;
}
public void setSyslogServerSettings(SyslogServerSettings syslogServerSettings) {
this.syslogServerSettings = syslogServerSettings;
}
/**
* @return router information
@ -227,10 +204,6 @@ public class NetworkConfiguration{
public RouterInfo getRouterInfo() {
return routerInfo;
}
public void setRouterInfo(RouterInfo routerInfo) {
this.routerInfo = routerInfo;
}
@Override
public boolean equals(Object 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.
*
*
* 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,17 +55,14 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkConnection", propOrder = {
"networkConnectionIndex",
"ipAddress",
"externalIpAddress",
"isConnected",
"macAddress",
"ipAddressAllocationMode"
"networkConnectionIndex",
"ipAddress",
"externalIpAddress",
"isConnected",
"macAddress",
"ipAddressAllocationMode"
})
public class NetworkConnection {
public static Builder builder() {
@ -80,7 +74,7 @@ public class NetworkConnection {
}
public static class Builder {
private int networkConnectionIndex;
private String ipAddress;
private String externalIpAddress;
@ -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,259 +150,158 @@ 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);
}
public Builder fromNetworkConnection(NetworkConnection in) {
return networkConnectionIndex(in.getNetworkConnectionIndex())
.ipAddress(in.getIpAddress())
.externalIpAddress(in.getExternalIpAddress())
.isConnected(in.isConnected())
.macAddress(in.getMACAddress())
.ipAddressAllocationMode(in.getIpAddressAllocationMode())
.network(in.getNetwork())
.needsCustomization(in.needsCustomization());
.ipAddress(in.getIpAddress())
.externalIpAddress(in.getExternalIpAddress())
.isConnected(in.isConnected())
.macAddress(in.getMACAddress())
.ipAddressAllocationMode(in.getIpAddressAllocationMode())
.network(in.getNetwork())
.needsCustomization(in.needsCustomization());
}
}
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() {
// For JAXB and builder use
}
private NetworkConnection(String macAddress) {
this.macAddress = macAddress;
@XmlElement(name = "NetworkConnectionIndex")
protected int networkConnectionIndex;
@XmlElement(name = "IpAddress")
protected String ipAddress;
@XmlElement(name = "ExternalIpAddress")
protected String externalIpAddress;
@XmlElement(name = "IsConnected")
protected boolean isConnected;
@XmlElement(name = "MACAddress")
protected String macAddress;
@XmlElement(name = "IpAddressAllocationMode", required = true)
protected String ipAddressAllocationMode;
@XmlAttribute(required = true)
protected String network;
@XmlAttribute
protected Boolean needsCustomization;
/**
* Gets the value of the networkConnectionIndex property.
*/
public int getNetworkConnectionIndex() {
return networkConnectionIndex;
}
/**
* Gets the value of the ipAddress property.
*
* @return possible object is
* {@link String }
*/
public String getIpAddress() {
return ipAddress;
}
@XmlElement(name = "NetworkConnectionIndex")
protected int networkConnectionIndex;
@XmlElement(name = "IpAddress")
protected String ipAddress;
@XmlElement(name = "ExternalIpAddress")
protected String externalIpAddress;
@XmlElement(name = "IsConnected")
protected boolean isConnected;
@XmlElement(name = "MACAddress")
protected String macAddress;
@XmlElement(name = "IpAddressAllocationMode", required = true)
protected String ipAddressAllocationMode;
@XmlAttribute(required = true)
protected String network;
@XmlAttribute
protected Boolean needsCustomization;
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the networkConnectionIndex property.
*
*/
public int getNetworkConnectionIndex() {
return networkConnectionIndex;
}
/**
* Gets the value of the isConnected property.
*/
public boolean isConnected() {
return isConnected;
}
/**
* Sets the value of the networkConnectionIndex property.
*
*/
public void setNetworkConnectionIndex(int value) {
this.networkConnectionIndex = value;
}
/**
* Gets the value of the macAddress property.
*
* @return possible object is
* {@link String }
*/
public String getMACAddress() {
return macAddress;
}
/**
* Gets the value of the ipAddress property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIpAddress() {
return ipAddress;
}
/**
* Gets the value of the ipAddressAllocationMode property.
*
* @return possible object is
* {@link String }
*/
public String getIpAddressAllocationMode() {
return ipAddressAllocationMode;
}
/**
* 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 network property.
*
* @return possible object is
* {@link String }
*/
public String getNetwork() {
return network;
}
/**
* Gets the value of the externalIpAddress property.
*
* @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
* {@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
* {@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
* {@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
* {@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;
}
/**
* Gets the value of the needsCustomization property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean needsCustomization() {
return needsCustomization;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
NetworkConnection that = NetworkConnection.class.cast(o);
return equal(networkConnectionIndex, that.networkConnectionIndex) &&
equal(ipAddress, that.ipAddress) &&
equal(externalIpAddress, that.externalIpAddress) &&
equal(isConnected, that.isConnected) &&
equal(macAddress, that.macAddress) &&
equal(ipAddressAllocationMode, that.ipAddressAllocationMode) &&
equal(network, that.network) &&
equal(needsCustomization, that.needsCustomization);
return equal(networkConnectionIndex, that.networkConnectionIndex) &&
equal(ipAddress, that.ipAddress) &&
equal(externalIpAddress, that.externalIpAddress) &&
equal(isConnected, that.isConnected) &&
equal(macAddress, that.macAddress) &&
equal(ipAddressAllocationMode, that.ipAddressAllocationMode) &&
equal(network, that.network) &&
equal(needsCustomization, that.needsCustomization);
}
@Override
public int hashCode() {
return Objects.hashCode(networkConnectionIndex,
ipAddress,
externalIpAddress,
isConnected,
macAddress,
ipAddressAllocationMode,
network,
needsCustomization);
return Objects.hashCode(networkConnectionIndex,
ipAddress,
externalIpAddress,
isConnected,
macAddress,
ipAddressAllocationMode,
network,
needsCustomization);
}
@Override

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;
@ -33,10 +31,10 @@ import com.google.common.collect.Sets;
/**
* Represents features of a network.
*
*
* @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,20 +78,20 @@ 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();
/**
* @return a Network service. May be any of DhcpService, NatService, IpsecVpnService,
* DhcpService, or StaticRoutingService.
* @return a Network service. May be any of DhcpService, NatService, IpsecVpnService,
* DhcpService, or StaticRoutingService.
*/
public Set<NetworkService> getNetworkServices() {
return ImmutableSet.copyOf(services);
}
public void setNetworkServices(Set<NetworkService> services) {
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
}
@Override
public boolean equals(Object 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;
@ -28,10 +27,10 @@ import com.google.common.base.Objects;
/**
* Represents a network service
*
*
* @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;
/**
@ -78,10 +79,6 @@ public class NetworkService {
public boolean isEnabled() {
return isEnabled;
}
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override
public boolean equals(Object 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,9 +30,9 @@ 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() {
return new Builder<T>();
}
@ -47,7 +45,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
public static class Builder<T extends NetworkType<T>> extends EntityType.Builder<T> {
protected NetworkConfiguration networkConfiguration;
/**
* @see NetworkType#getConfiguration()
*/
@ -55,17 +53,10 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
this.networkConfiguration = networkConfiguration;
return this;
}
@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;
/**
@ -171,11 +164,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
public NetworkConfiguration getConfiguration() {
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,18 +34,18 @@ 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;
@SuppressWarnings("unchecked")
@ -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;
@ -35,12 +33,12 @@ import com.google.common.collect.Sets;
/**
* A list of organizations.
*
*
* @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;
public static Builder builder() {
@ -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,9 +30,9 @@ 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")
public static Builder builder() {
return new Builder();
@ -49,7 +47,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
private ReferenceType<?> networkPool;
private IpAddresses allowedExternalIpAddresses;
/**
* @see OrgNetwork#getNetworkPool()
*/
@ -65,21 +63,13 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
return this;
}
@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);
}
/**
* @see NetworkType#getConfiguration()
*/
@ -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
}
private OrgNetwork(URI href, String name) {
super(href, name);
// For JAXB
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool")
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(name = "NetworkPool")
private ReferenceType<?> networkPool;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses")
@XmlElement(name = "AllowedExternalIpAddresses")
private IpAddresses allowedExternalIpAddresses;
/**
@ -191,28 +184,20 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
public ReferenceType<?> getNetworkPool() {
return networkPool;
}
public void setNetworkPool(ReferenceType<?> networkPool) {
this.networkPool = networkPool;
}
/**
* @return optional network pool
*/
public IpAddresses getAllowedExternalIpAddresses() {
return allowedExternalIpAddresses;
}
public void setAllowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) {
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
}
@Override
public boolean equals(Object o) {
if (!super.equals(o))
return false;
OrgNetwork that = OrgNetwork.class.cast(o);
return super.equals(that) && equal(networkPool, that.networkPool) &&
return super.equals(that) && equal(networkPool, that.networkPool) &&
equal(allowedExternalIpAddresses, that.allowedExternalIpAddresses);
}

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.
*
*
* 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,14 +52,11 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Owner")
@XmlType(propOrder = {"user"})
public class Owner
extends ResourceType<Owner>
extends ResourceType<Owner>
{
@SuppressWarnings("unchecked")
@ -71,12 +64,13 @@ public class Owner
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromOwner(this);
}
public static class Builder extends ResourceType.Builder<Owner> {
private Reference user;
/**
@ -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()
*/
@ -136,55 +125,41 @@ public class Owner
@Override
public Builder fromResourceType(ResourceType<Owner> in) {
return Builder.class.cast(super.fromResourceType(in));
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromOwner(Owner in) {
return fromResourceType(in)
.user(in.getUser());
.user(in.getUser());
}
}
private 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;
@XmlElement(name = "User", required = true)
protected Reference user;
/**
* Gets the value of the user property.
*
* @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;
}
/**
* Gets the value of the user property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getUser() {
return user;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
Owner that = Owner.class.cast(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.
*
*
* 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"
"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
@ -79,8 +73,8 @@ public class ParamsType<T extends ParamsType<T>> {
return new Builder<T>().fromParamsType(this);
}
public static class Builder<T extends ParamsType<T>>{
public static class Builder<T extends ParamsType<T>> {
protected String description;
protected String name;
@ -102,93 +96,65 @@ 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());
.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
protected String name;
@XmlElement(name = "Description")
protected String description;
@XmlAttribute
protected String name;
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
}
/**
* Gets the value of the description property.
*
* @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
* {@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;
}
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
ParamsType<?> that = ParamsType.class.cast(o);
return equal(description, that.description) &&
equal(name, that.name);
return equal(description, that.description) &&
equal(name, that.name);
}
@Override
public int hashCode() {
return Objects.hashCode(description,
name);
return Objects.hashCode(description,
name);
}
@Override

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,15 +53,12 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProductSectionList", propOrder = {
"productSection"
"productSection"
})
public class ProductSectionList
extends ResourceType<ProductSectionList>
extends ResourceType<ProductSectionList>
{
@SuppressWarnings("unchecked")
@ -74,29 +66,30 @@ 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;
}
/**
* @see ResourceType#getHref()
*/
@ -136,11 +129,12 @@ public class ProductSectionList
@Override
public Builder fromResourceType(ResourceType<ProductSectionList> in) {
return Builder.class.cast(super.fromResourceType(in));
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromProductSectionList(ProductSectionList in) {
return fromResourceType(in)
.productSection(in.getProductSection());
.productSection(in.getProductSection());
}
}
@ -148,45 +142,25 @@ 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;
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
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>();
}
return this.productSection;
}
/**
* Gets the value of the productSection property.
*/
public Set<ProductSection> getProductSection() {
return this.productSection;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
ProductSectionList that = ProductSectionList.class.cast(o);

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

@ -22,7 +22,7 @@ import java.net.URI;
/**
* A reference to a resource.
*
*
* @author grkvlt@apache.org
*/
public class Reference extends ReferenceType<Reference> {
@ -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
@ -135,7 +130,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each href as an opaque string. The rules that govern how
* the server constructs href strings might change in future releases.
*
*
* @return an opaque reference and should never be parsed
*/
public URI getHref() {
@ -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,42 +147,30 @@ 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.
*
*
* @return type definition, type, expressed as an HTTP Content-Type
*/
public String getName() {
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.
*
*
* @return type definition, type, expressed as an HTTP Content-Type
*/
public String getType() {
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.
*
*
* 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,40 +42,22 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RelocateParams", propOrder = {
"datastore"
"datastore"
})
public class RelocateParams {
@XmlElement(name = "Datastore", required = true)
protected ReferenceType<?> datastore;
/**
* Gets the value of the datastore property.
*
* @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;
}
@XmlElement(name = "Datastore", required = true)
protected ReferenceType<?> datastore;
/**
* Gets the value of the datastore property.
*
* @return possible object is
* {@link ReferenceType }
*/
public ReferenceType<?> getDatastore() {
return datastore;
}
}

View File

@ -27,12 +27,11 @@ import com.google.common.collect.Sets;
/**
* A resource.
*
*
* @author grkvlt@apache.org
*/
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.
*
*
* 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,12 +51,9 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResourceEntities", propOrder = {
"resourceEntities"
"resourceEntities"
})
public class ResourceEntities {
public static Builder builder() {
@ -71,14 +65,14 @@ 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,47 +98,25 @@ 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;
@XmlElement(name = "ResourceEntity")
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();
}
return this.resourceEntities;
}
/**
* Gets the value of the resourceEntity property.
*/
public Set<Reference> getResourceEntities() {
return this.resourceEntities;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
ResourceEntities that = ResourceEntities.class.cast(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 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
@ -131,7 +117,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each href as an opaque string. The rules that govern how
* the server constructs href strings might change in future releases.
*
*
* @return an opaque reference and should never be parsed
*/
public URI getHref() {
@ -148,20 +134,16 @@ 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.
*
*
* @return type definition, type, expressed as an HTTP Content-Type
*/
public String getType() {
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;
@ -28,10 +27,10 @@ import com.google.common.base.Objects;
/**
* Specifies router information.
*
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo")
@XmlRootElement(name = "RouterInfo")
public class RouterInfo {
public static Builder builder() {
return new Builder();
@ -42,7 +41,7 @@ public class RouterInfo {
}
public static class Builder {
private String externalIp;
/**
@ -61,7 +60,7 @@ public class RouterInfo {
return externalIp(in.getExternalIp());
}
}
private RouterInfo() {
// For JAXB and builder use
}
@ -69,18 +68,18 @@ public class RouterInfo {
private RouterInfo(String externalIp) {
this.externalIp = externalIp;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "ExternalIp")
@XmlElement(name = "ExternalIp")
private String externalIp;
/**
* @return the external IP of the router. Applicable for NAT Routed / Fenced networks only.
*/
public String getExternalIp() {
return externalIp;
}
@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;
import javax.xml.bind.annotation.XmlRootElement;
@ -41,13 +37,12 @@ import com.google.common.collect.Sets;
* Returns a representation of the current session that can serve as a single entry point to the
* system, as it provides user, admin, and extension (sysadmin) entry links depending on the
* privileges of the current user.
*
*
* @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;
public static Builder builder() {
@ -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() {
@ -179,6 +171,6 @@ public class Session {
@Override
public String toString() {
return Objects.toStringHelper("").add("user", user).add("org", org).add("href", href).add("links", links)
.toString();
.toString();
}
}

View File

@ -24,7 +24,7 @@ import com.google.common.base.Objects;
/**
* Session and its corresponding token
*
*
* @author Adrian Cole
*/
public class SessionWithToken {
@ -95,7 +95,7 @@ public class SessionWithToken {
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each token as an opaque string. The rules that govern
* how the server constructs token strings might change in future releases.
*
*
* @return an opaque reference and should never be parsed
*/
public String getToken() {

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.
*
*
* 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,15 +55,12 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SourcedCompositionItemParam", propOrder = {
"source",
"vAppScopedLocalId",
"instantiationParams",
"networkAssignment"
"source",
"vAppScopedLocalId",
"instantiationParams",
"networkAssignment"
})
public class SourcedCompositionItemParam {
public static Builder builder() {
@ -78,11 +72,11 @@ public class SourcedCompositionItemParam {
}
public static class Builder {
private Reference source;
private String vAppScopedLocalId;
private InstantiationParams instantiationParams;
private List<NetworkAssignment> networkAssignment;
private Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
private Boolean sourceDelete;
/**
@ -110,207 +104,144 @@ 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())
.sourceDelete(in.isSourceDelete());
.vAppScopedLocalId(in.getVAppScopedLocalId())
.instantiationParams(in.getInstantiationParams())
.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")
protected String vAppScopedLocalId;
@XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams;
@XmlElement(name = "NetworkAssignment")
protected Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
@XmlAttribute
protected Boolean sourceDelete;
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
return source;
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams;
@XmlElement(name = "NetworkAssignment")
protected List<NetworkAssignment> networkAssignment;
@XmlAttribute
protected Boolean sourceDelete;
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return possible object is
* {@link String }
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
}
/**
* Gets the value of the source property.
*
* @return
* possible object is
* {@link Reference }
*
*/
public Reference getSource() {
return source;
}
/**
* Gets the value of the instantiationParams property.
*
* @return possible object is
* {@link InstantiationParams }
*/
public InstantiationParams getInstantiationParams() {
return instantiationParams;
}
/**
* 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 networkAssignment property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkAssignment property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkAssignment().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkAssignment }
*/
public Set<NetworkAssignment> getNetworkAssignments() {
return this.networkAssignments;
}
/**
* Gets the value of the vAppScopedLocalId property.
*
* @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
* {@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>
* 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>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkAssignment().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link NetworkAssignmentType }
*
*
*/
public List<NetworkAssignment> getNetworkAssignment() {
if (networkAssignment == null) {
networkAssignment = new ArrayList<NetworkAssignment>();
}
return this.networkAssignment;
}
/**
* Gets the value of the sourceDelete property.
*
* @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;
}
/**
* Gets the value of the sourceDelete property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isSourceDelete() {
return sourceDelete;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
SourcedCompositionItemParam that = SourcedCompositionItemParam.class.cast(o);
return equal(source, that.source) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(instantiationParams, that.instantiationParams) &&
equal(networkAssignment, that.networkAssignment) &&
equal(sourceDelete, that.sourceDelete);
return equal(source, that.source) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(instantiationParams, that.instantiationParams) &&
equal(networkAssignments, that.networkAssignments) &&
equal(sourceDelete, that.sourceDelete);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
vAppScopedLocalId,
instantiationParams,
networkAssignment,
sourceDelete);
return Objects.hashCode(source,
vAppScopedLocalId,
instantiationParams,
networkAssignments,
sourceDelete);
}
@Override
@ -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.
*
*
* 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,12 +51,9 @@ import com.google.common.collect.Lists;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SupportedHardwareVersions", propOrder = {
"supportedHardwareVersions"
"supportedHardwareVersions"
})
public class SupportedHardwareVersions {
public static Builder builder() {
@ -71,17 +65,17 @@ 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;
}
/**
* @see SupportedHardwareVersions#getSupportedHardwareVersions()
*/
@ -105,47 +99,25 @@ 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;
@XmlElement(name = "SupportedHardwareVersion")
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;
}
/**
* Gets the value of the supportedHardwareVersion property.
*/
public Set<String> getSupportedHardwareVersions() {
return Collections.unmodifiableSet(supportedHardwareVersions);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
SupportedHardwareVersions that = SupportedHardwareVersions.class.cast(o);

View File

@ -19,23 +19,19 @@
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;
import com.google.common.base.Objects;
/**
* Syslog server settings. If logging is configured for firewall rules, the logs
* Syslog server settings. If logging is configured for firewall rules, the logs
* will be directed to these syslog servers.
*
*
* @author danikov
*/
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "SyslogServerSettings")
public class SyslogServerSettings {
public static Builder builder() {
@ -47,7 +43,7 @@ public class SyslogServerSettings {
}
public static class Builder {
private String syslogServerIp1;
private String syslogServerIp2;
@ -78,38 +74,30 @@ public class SyslogServerSettings {
return syslogServerIp1(in.getSyslogServerIp1()).syslogServerIp2(in.getSyslogServerIp2());
}
}
private 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;
/**
* @return Primary syslog server.
*/
public String getSyslogServerIp1() {
return syslogServerIp1;
}
public void setSyslogServerIp1(String syslogServerIp1) {
this.syslogServerIp1 = syslogServerIp1;
}
/**
* @return Secondary syslog server.
*/
public String getSyslogServerIp2() {
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,34 +38,33 @@ 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;
public static class Status {
public static final String QUEUED = "queued";
public static final String PRE_RUNNING = "preRunning";
public static final String RUNNING = "running";
public static final String SUCCESS = "success";
public static final String ERROR = "error";
public static final String CANCELED = "canceled";
public static final String ABORTED = "aborted";
public static final List<String> ALL = Arrays.asList(
QUEUED, PRE_RUNNING, RUNNING, SUCCESS,
ERROR, CANCELED, ABORTED
);
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK;
public static class Status {
public static final String QUEUED = "queued";
public static final String PRE_RUNNING = "preRunning";
public static final String RUNNING = "running";
public static final String SUCCESS = "success";
public static final String ERROR = "error";
public static final String CANCELED = "canceled";
public static final String ABORTED = "aborted";
public static final List<String> ALL = Arrays.asList(
QUEUED, PRE_RUNNING, RUNNING, SUCCESS,
ERROR, CANCELED, ABORTED
);
}
@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) {
@ -290,30 +270,46 @@ public class Task extends EntityType<Task> {
public Builder fromTask(Task in) {
return fromEntityType(in)
.error(in.getError()).org(in.getOrg()).progress(in.getProgress()).status(in.getStatus())
.operation(in.getOperation()).operationName(in.getOperationName());
.error(in.getError()).org(in.getOrg()).progress(in.getProgress()).status(in.getStatus())
.operation(in.getOperation()).operationName(in.getOperationName());
}
}
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;
@ -327,7 +323,7 @@ public class Task extends EntityType<Task> {
private Date endTime;
@XmlAttribute
private Date expiryTime;
/**
* Represents an error information if the task failed.
*/
@ -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.
@ -414,10 +386,6 @@ public class Task extends EntityType<Task> {
public String getStatus() {
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;
@ -37,15 +35,14 @@ import com.google.common.collect.Sets;
/**
* A list of tasks.
*
*
* @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.
*
*
* 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,13 +46,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UploadVAppTemplateParams")
public class UploadVAppTemplateParams
extends ParamsType<UploadVAppTemplateParams>
extends ParamsType<UploadVAppTemplateParams>
{
@SuppressWarnings("unchecked")
@ -68,7 +62,7 @@ public class UploadVAppTemplateParams
}
public static class Builder extends ParamsType.Builder<UploadVAppTemplateParams> {
private String transferFormat;
private Boolean manifestRequired;
@ -81,7 +75,7 @@ public class UploadVAppTemplateParams
}
/**
* @see UploadVAppTemplateParams#getManifestRequired()
* @see UploadVAppTemplateParams#isManifestRequired()
*/
public Builder manifestRequired(Boolean manifestRequired) {
this.manifestRequired = manifestRequired;
@ -90,98 +84,73 @@ 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);
}
@Override
public Builder fromParamsType(ParamsType<UploadVAppTemplateParams> in) {
return Builder.class.cast(super.fromParamsType(in));
return Builder.class.cast(super.fromParamsType(in));
}
public Builder fromUploadVAppTemplateParams(UploadVAppTemplateParams in) {
return fromParamsType(in)
.transferFormat(in.getTransferFormat())
.manifestRequired(in.isManifestRequired());
.transferFormat(in.getTransferFormat())
.manifestRequired(in.isManifestRequired());
}
}
public UploadVAppTemplateParams(String description, String name, String transferFormat, Boolean manifestRequired) {
super(description, name);
this.transferFormat = transferFormat;
this.manifestRequired = manifestRequired;
}
private UploadVAppTemplateParams() {
// For JAXB and builder use
// For JAXB
}
@XmlAttribute
protected String transferFormat;
@XmlAttribute
protected Boolean manifestRequired;
@XmlAttribute
protected String transferFormat;
@XmlAttribute
protected Boolean manifestRequired;
/**
* Gets the value of the transferFormat property.
*
* @return possible object is
* {@link String }
*/
public String getTransferFormat() {
return transferFormat;
}
/**
* Gets the value of the transferFormat property.
*
* @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
* {@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;
}
/**
* Gets the value of the manifestRequired property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isManifestRequired() {
return manifestRequired;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
UploadVAppTemplateParams that = UploadVAppTemplateParams.class.cast(o);
return equal(transferFormat, that.transferFormat) &&
equal(manifestRequired, that.manifestRequired);
return equal(transferFormat, that.transferFormat) &&
equal(manifestRequired, that.manifestRequired);
}
@Override
public int hashCode() {
return Objects.hashCode(transferFormat,
manifestRequired);
return Objects.hashCode(transferFormat,
manifestRequired);
}
@Override

View File

@ -1,5 +1,5 @@
package org.jclouds.vcloud.director.v1_5.domain;
public class VApp {
// Placeholder for merge
// Placeholder for merge
}

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.
*
*
* 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,13 +52,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppCreationParams", propOrder = {
"vAppParent",
"instantiationParams"
"vAppParent",
"instantiationParams"
})
@XmlSeeAlso({
// InstantiateOvfParamsType.class,
@ -70,7 +64,7 @@ import com.google.common.base.Objects;
// ImportVmAsVAppParamsType.class
})
public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
extends ParamsType<T>
extends ParamsType<T>
{
public static <T extends VAppCreationParamsType<T>> Builder<T> builder() {
@ -82,7 +76,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
}
public static class Builder<T extends VAppCreationParamsType<T>> extends ParamsType.Builder<T> {
protected Reference vAppParent;
protected InstantiationParams instantiationParams;
protected Boolean deploy;
@ -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,16 +116,9 @@ 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);
}
/**
* @see ParamsType#getDescription()
*/
@ -154,145 +141,99 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromParamsType(ParamsType<T> in) {
return Builder.class.cast(super.fromParamsType(in));
return Builder.class.cast(super.fromParamsType(in));
}
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return fromParamsType(in)
.vAppParent(in.getVAppParent())
.instantiationParams(in.getInstantiationParams())
.deploy(in.isDeploy())
.powerOn(in.isPowerOn());
.vAppParent(in.getVAppParent())
.instantiationParams(in.getInstantiationParams())
.deploy(in.isDeploy())
.powerOn(in.isPowerOn());
}
}
@XmlElement(name = "VAppParent")
protected Reference vAppParent;
@XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams;
@XmlAttribute
protected Boolean deploy;
@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
}
@XmlElement(name = "VAppParent")
protected Reference vAppParent;
@XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams;
@XmlAttribute
protected Boolean deploy;
@XmlAttribute
protected Boolean powerOn;
/**
* Gets the value of the vAppParent property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getVAppParent() {
return vAppParent;
}
/**
* Gets the value of the vAppParent property.
*
* @return
* possible object is
* {@link Reference }
*
*/
public Reference getVAppParent() {
return vAppParent;
}
/**
* Gets the value of the instantiationParams property.
*
* @return possible object is
* {@link InstantiationParams }
*/
public InstantiationParams getInstantiationParams() {
return instantiationParams;
}
/**
* 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 deploy property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isDeploy() {
return deploy;
}
/**
* Gets the value of the instantiationParams property.
*
* @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
* {@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
* {@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;
}
/**
* Gets the value of the powerOn property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isPowerOn() {
return powerOn;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppCreationParamsType<?> that = VAppCreationParamsType.class.cast(o);
return equal(vAppParent, that.vAppParent) &&
equal(instantiationParams, that.instantiationParams) &&
equal(deploy, that.deploy) &&
equal(powerOn, that.powerOn);
return equal(vAppParent, that.vAppParent) &&
equal(instantiationParams, that.instantiationParams) &&
equal(deploy, that.deploy) &&
equal(powerOn, that.powerOn);
}
@Override
public int hashCode() {
return Objects.hashCode(vAppParent,
instantiationParams,
deploy,
powerOn);
return Objects.hashCode(vAppParent,
instantiationParams,
deploy,
powerOn);
}
@Override

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.
*
*
* 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,29 +55,24 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppNetworkConfiguration", propOrder = {
"description",
"configuration",
"isDeployed"
"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);
}
public static class Builder<T extends VAppNetworkConfiguration<T>> extends ResourceType.Builder<T> {
private String description;
private NetworkConfiguration configuration;
private Boolean isDeployed;
@ -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,15 +112,11 @@ 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);
}
/**
* @see ResourceType#getHref()
*/
@ -171,147 +158,99 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
*/
@SuppressWarnings("unchecked")
public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in));
return Builder.class.cast(super.fromResourceType(in));
}
public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) {
return fromResourceType(in)
.description(in.getDescription())
.configuration(in.getConfiguration())
.isDeployed(in.isDeployed())
.networkName(in.getNetworkName());
.description(in.getDescription())
.configuration(in.getConfiguration())
.isDeployed(in.isDeployed())
.networkName(in.getNetworkName());
}
}
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "Configuration", required = true)
protected NetworkConfiguration configuration;
@XmlElement(name = "IsDeployed")
protected Boolean isDeployed;
@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 and builder use
// For JAXB
}
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
}
/**
* Gets the value of the configuration property.
*
* @return possible object is
* {@link NetworkConfiguration }
*/
public NetworkConfiguration getConfiguration() {
return configuration;
}
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "Configuration", required = true)
protected NetworkConfiguration configuration;
@XmlElement(name = "IsDeployed")
protected Boolean isDeployed;
@XmlAttribute(required = true)
protected String networkName;
/**
* Gets the value of the isDeployed property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isDeployed() {
return isDeployed;
}
/**
* Gets the value of the description property.
*
* @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
* {@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
* {@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
* {@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;
}
/**
* Gets the value of the networkName property.
*
* @return possible object is
* {@link String }
*/
public String getNetworkName() {
return networkName;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppNetworkConfiguration<?> that = VAppNetworkConfiguration.class.cast(o);
return equal(description, that.description) &&
equal(configuration, that.configuration) &&
equal(isDeployed, that.isDeployed) &&
equal(networkName, that.networkName);
return equal(description, that.description) &&
equal(configuration, that.configuration) &&
equal(isDeployed, that.isDeployed) &&
equal(networkName, that.networkName);
}
@Override
public int hashCode() {
return Objects.hashCode(description,
configuration,
isDeployed,
networkName);
return Objects.hashCode(description,
configuration,
isDeployed,
networkName);
}
@Override

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)
@ -453,7 +384,7 @@ public class VAppTemplate
if (o == null || getClass() != o.getClass())
return false;
VAppTemplate that = VAppTemplate.class.cast(o);
return super.equals(that) &&
return super.equals(that) &&
equal(owner, that.owner) &&
equal(children, that.children) &&
equal(sections, that.sections) &&

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.
*
*
* 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,89 +67,64 @@ 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 Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/**
* Gets the value of the vm property.
*/
public Set<VAppTemplate> getVms() {
return this.vms;
}
@XmlElement(name = "Vm")
protected List<VAppTemplate> vm;
/**
* 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;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
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).
*
*
* 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,41 +64,38 @@ import com.google.common.collect.Sets;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Vdc")
@XmlType(propOrder = {
"allocationModel",
"storageCapacity",
"computeCapacity",
"resourceEntities",
"availableNetworks",
"capabilities",
"nicQuota",
"networkQuota",
"vmQuota",
"isEnabled"
"allocationModel",
"storageCapacity",
"computeCapacity",
"resourceEntities",
"availableNetworks",
"capabilities",
"nicQuota",
"networkQuota",
"vmQuota",
"isEnabled"
})
@XmlSeeAlso({
// AdminVdc.class
})
public class Vdc
extends EntityType<Vdc>
extends EntityType<Vdc>
{
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVdc(this);
}
public static class Builder extends EntityType.Builder<Vdc> {
private String allocationModel;
private CapacityWithUsage storageCapacity;
private ComputeCapacity computeCapacity;
@ -203,23 +196,13 @@ 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);
}
/**
* @see EntityType#getName()
*/
@ -293,333 +276,205 @@ public class Vdc
@Override
public Builder fromEntityType(EntityType<Vdc> in) {
return Builder.class.cast(super.fromEntityType(in));
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromVdc(Vdc in) {
return fromEntityType(in)
.allocationModel(in.getAllocationModel())
.storageCapacity(in.getStorageCapacity())
.computeCapacity(in.getComputeCapacity())
.resourceEntities(in.getResourceEntities())
.availableNetworks(in.getAvailableNetworks())
.capabilities(in.getCapabilities())
.nicQuota(in.getNicQuota())
.networkQuota(in.getNetworkQuota())
.vmQuota(in.getVmQuota())
.isEnabled(in.isEnabled())
.status(in.getStatus());
.allocationModel(in.getAllocationModel())
.storageCapacity(in.getStorageCapacity())
.computeCapacity(in.getComputeCapacity())
.resourceEntities(in.getResourceEntities())
.availableNetworks(in.getAvailableNetworks())
.capabilities(in.getCapabilities())
.nicQuota(in.getNicQuota())
.networkQuota(in.getNetworkQuota())
.vmQuota(in.getVmQuota())
.isEnabled(in.isEnabled())
.status(in.getStatus());
}
}
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
}
@XmlElement(name = "AllocationModel", required = true)
protected String allocationModel;
@XmlElement(name = "StorageCapacity", required = true)
protected CapacityWithUsage storageCapacity;
@XmlElement(name = "ComputeCapacity", required = true)
protected ComputeCapacity computeCapacity;
@XmlElement(name = "ResourceEntities")
protected ResourceEntities resourceEntities;
@XmlElement(name = "AvailableNetworks")
protected AvailableNetworks availableNetworks;
@XmlElement(name = "Capabilities")
protected Capabilities capabilities;
@XmlElement(name = "NicQuota")
protected int nicQuota;
@XmlElement(name = "NetworkQuota")
protected int networkQuota;
@XmlElement(name = "VmQuota")
protected Integer vmQuota;
@XmlElement(name = "IsEnabled")
protected Boolean isEnabled;
@XmlAttribute
protected Integer status;
@XmlElement(name = "AllocationModel", required = true)
protected String allocationModel;
@XmlElement(name = "StorageCapacity", required = true)
protected CapacityWithUsage storageCapacity;
@XmlElement(name = "ComputeCapacity", required = true)
protected ComputeCapacity computeCapacity;
@XmlElement(name = "ResourceEntities")
protected ResourceEntities resourceEntities;
@XmlElement(name = "AvailableNetworks")
protected AvailableNetworks availableNetworks;
@XmlElement(name = "Capabilities")
protected Capabilities capabilities;
@XmlElement(name = "NicQuota")
protected int nicQuota;
@XmlElement(name = "NetworkQuota")
protected int networkQuota;
@XmlElement(name = "VmQuota")
protected Integer vmQuota;
@XmlElement(name = "IsEnabled")
protected Boolean isEnabled;
@XmlAttribute
protected Integer status;
/**
* Gets the value of the allocationModel property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAllocationModel() {
return allocationModel;
}
/**
* Gets the value of the allocationModel property.
*
* @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
* {@link CapacityWithUsage }
*/
public CapacityWithUsage getStorageCapacity() {
return storageCapacity;
}
/**
* Gets the value of the storageCapacity property.
*
* @return
* possible object is
* {@link CapacityWithUsage }
*
*/
public CapacityWithUsage getStorageCapacity() {
return storageCapacity;
}
/**
* Gets the value of the computeCapacity property.
*
* @return possible object is
* {@link ComputeCapacity }
*/
public ComputeCapacity getComputeCapacity() {
return computeCapacity;
}
/**
* 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 resourceEntities property.
*
* @return possible object is
* {@link ResourceEntities }
*/
public ResourceEntities getResourceEntities() {
return resourceEntities;
}
/**
* Gets the value of the computeCapacity property.
*
* @return
* possible object is
* {@link ComputeCapacity }
*
*/
public ComputeCapacity getComputeCapacity() {
return computeCapacity;
}
/**
* Gets the value of the availableNetworks property.
*
* @return possible object is
* {@link AvailableNetworks }
*/
public AvailableNetworks getAvailableNetworks() {
return availableNetworks;
}
/**
* 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 capabilities property.
*
* @return possible object is
* {@link Capabilities }
*/
public Capabilities getCapabilities() {
return capabilities;
}
/**
* Gets the value of the resourceEntities property.
*
* @return
* possible object is
* {@link ResourceEntities }
*
*/
public ResourceEntities getResourceEntities() {
return resourceEntities;
}
/**
* Gets the value of the nicQuota property.
*/
public int getNicQuota() {
return nicQuota;
}
/**
* 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 networkQuota property.
*/
public int getNetworkQuota() {
return networkQuota;
}
/**
* Gets the value of the availableNetworks property.
*
* @return
* possible object is
* {@link AvailableNetworks }
*
*/
public AvailableNetworks getAvailableNetworks() {
return availableNetworks;
}
/**
* Gets the value of the vmQuota property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getVmQuota() {
return vmQuota;
}
/**
* 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 isEnabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isEnabled() {
return isEnabled;
}
/**
* Gets the value of the capabilities property.
*
* @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
* {@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
* {@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
* {@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;
}
/**
* Gets the value of the status property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getStatus() {
return status;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
Vdc that = Vdc.class.cast(o);
return equal(allocationModel, that.allocationModel) &&
equal(storageCapacity, that.storageCapacity) &&
equal(computeCapacity, that.computeCapacity) &&
equal(resourceEntities, that.resourceEntities) &&
equal(availableNetworks, that.availableNetworks) &&
equal(capabilities, that.capabilities) &&
equal(nicQuota, that.nicQuota) &&
equal(networkQuota, that.networkQuota) &&
equal(vmQuota, that.vmQuota) &&
equal(isEnabled, that.isEnabled) &&
equal(status, that.status);
return equal(allocationModel, that.allocationModel) &&
equal(storageCapacity, that.storageCapacity) &&
equal(computeCapacity, that.computeCapacity) &&
equal(resourceEntities, that.resourceEntities) &&
equal(availableNetworks, that.availableNetworks) &&
equal(capabilities, that.capabilities) &&
equal(nicQuota, that.nicQuota) &&
equal(networkQuota, that.networkQuota) &&
equal(vmQuota, that.vmQuota) &&
equal(isEnabled, that.isEnabled) &&
equal(status, that.status);
}
@Override
public int hashCode() {
return Objects.hashCode(allocationModel,
storageCapacity,
computeCapacity,
resourceEntities,
availableNetworks,
capabilities,
nicQuota,
networkQuota,
vmQuota,
isEnabled,
status);
return Objects.hashCode(allocationModel,
storageCapacity,
computeCapacity,
resourceEntities,
availableNetworks,
capabilities,
nicQuota,
networkQuota,
vmQuota,
isEnabled,
status);
}
@Override

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 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 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;
@ -44,48 +45,59 @@ import com.google.common.base.Objects;
// TODO why do I have to declare these?
@XmlSeeAlso(
{CustomizationSection.class,
DeploymentOptionSection.class,
DiskSection.class,
LeaseSettingsSection.class,
GuestCustomizationSection.class,
NetworkSection.class,
NetworkConfigSection.class,
NetworkConnectionSection.class,
ProductSection.class,
VirtualHardwareSection.class,
VirtualSystem.class })
{CustomizationSection.class,
DeploymentOptionSection.class,
DiskSection.class,
LeaseSettingsSection.class,
GuestCustomizationSection.class,
NetworkSection.class,
NetworkConfigSection.class,
NetworkConnectionSection.class,
ProductSection.class,
VirtualHardwareSection.class,
VirtualSystem.class})
public abstract class SectionType<T extends SectionType<T>> {
public abstract Builder<T> toBuilder();
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.
*
*
* 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);
}
@ -64,8 +62,9 @@ public class QueryList extends ContainerType<QueryList> {
@Override
public Builder fromContainerType(ContainerType<QueryList> in) {
return Builder.class.cast(super.fromContainerType(in));
return Builder.class.cast(super.fromContainerType(in));
}
public Builder fromQueryList(QueryList in) {
return fromContainerType(in);
}
@ -78,11 +77,11 @@ public class QueryList extends ContainerType<QueryList> {
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
QueryList that = QueryList.class.cast(o);
return super.equals(that) ;
return super.equals(that);
}
@Override

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,11 +34,11 @@ 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>
*
*
* @author grkvlt@apache.org
*/
public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultNetworkRecord> {
@ -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,15 +36,14 @@ 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 })
@XmlSeeAlso({QueryResultCatalogRecord.class, QueryResultNetworkRecord.class})
public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
public static <T extends QueryResultRecordType<T>> Builder<T> builder() {
@ -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
@ -166,17 +149,13 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
* the object that is valid in a particular context. Although URLs have a well-known syntax and a well-understood interpretation,
* a client should treat each href as an opaque string. The rules that govern how the server constructs href strings might change
* in future releases.
*
*
* @return an opaque reference and should never be parsed
*/
public URI getHref() {
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,34 +163,16 @@ 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.
*
*
* @return type definition, type, expressed as an HTTP Content-Type
*/
public String getType() {
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)
@ -234,7 +195,7 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
}
protected ToStringHelper string() {
return Objects.toStringHelper("").add("href", href).add("id", id)
.add("type", type).add("links", links);
}
return Objects.toStringHelper("").add("href", href).add("id", id)
.add("type", type).add("links", links);
}
}

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,16 +34,16 @@ 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>
*
*
* @author grkvlt@apache.org
*/
public class QueryResultReferences<T extends ReferenceType<T>> extends ContainerType<QueryResultReferences<T>> {
@ -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(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() {
// For JAXB and builder use
}
protected QueryResultReferences(URI href) {
super(href);
}
// NOTE add other types as they are used. probably not the best way to do this.
@XmlElementRefs({
@XmlElementRef(type = CatalogReference.class)
@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,26 +20,28 @@ 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 {
//
// @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> {
//
public class VApp extends AbstractVAppType<VApp> {
//
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
//
@Override
public Builder toBuilder() {
return new Builder().fromVApp(this);
}
public static class Builder extends AbstractVAppType.Builder<VApp> {
//
// private Owner owner;
// private Boolean inMaintenanceMode;
// private VAppChildren children;
@ -78,8 +80,11 @@ public class VApp extends AbstractVAppType {
// }
//
//
// public VApp build() {
// VApp vApp = new VApp();
public VApp build() {
return new VApp();
}
// VApp vApp = new VApp();
// vApp.setOwner(owner);
// vApp.setInMaintenanceMode(inMaintenanceMode);
// vApp.setChildren(children);
@ -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
}
//
//
//