diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AvailableNetworks.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AvailableNetworks.java index 3d7af6ea12..4f1bef9acd 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AvailableNetworks.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AvailableNetworks.java @@ -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. + *

+ *

*

Java class for AvailableNetworks complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="AvailableNetworks">
  *   <complexContent>
@@ -54,12 +51,9 @@ import com.google.common.collect.Lists;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 networks = Lists.newArrayList(); + private Set networks = Sets.newLinkedHashSet(); /** * @see AvailableNetworks#getNetworks() */ - public Builder networks(List networks) { - this.networks = Lists.newArrayList(checkNotNull(networks, "networks")); + public Builder networks(Collection 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 networks = Sets.newLinkedHashSet(); - private AvailableNetworks(List networks) { + private AvailableNetworks(Set networks) { this.networks = networks; } + private AvailableNetworks() { + // For JAXB + } - @XmlElement(name = "Network") - protected List networks; - - /** - * Gets the value of the network property. - * - *

- * 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 set method for the network property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNetwork().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ReferenceType } - * - * - */ - public List getNetworks() { - if (networks == null) { - networks = Lists.newArrayList(); - } - return this.networks; - } + /** + * Gets the value of the network property. + */ + public Set 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java index 7c8c8b6770..b6b21fa2e0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java @@ -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. + *

+ *

*

Java class for Capabilities complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="Capabilities">
  *   <complexContent>
@@ -50,12 +47,9 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java index b6e968103f..887410d52e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java @@ -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. + *

+ *

*

Java class for Capacity complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="Capacity">
  *   <complexContent>
@@ -53,20 +50,17 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Capacity", propOrder = { - "units", - "allocated", - "limit" + "units", + "allocated", + "limit" }) @XmlSeeAlso({ -// CapacityWithUsageType.class + CapacityWithUsage.class }) public class CapacityType> { - + public static > Builder builder() { return new Builder(); } @@ -76,7 +70,7 @@ public class CapacityType> { } public static class Builder> { - + protected String units; protected Long allocated; protected Long limit; @@ -107,119 +101,78 @@ public class CapacityType> { public CapacityType build() { - CapacityType capacity = new CapacityType(); - capacity.setUnits(units); - capacity.setAllocated(allocated); - capacity.setLimit(limit); - return capacity; + return new CapacityType(units, allocated, limit); } public Builder fromCapacityType(CapacityType 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java index f80e445147..2c4ad4dd91 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java @@ -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. + *

+ *

*

Java class for CapacityWithUsage complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="CapacityWithUsage">
  *   <complexContent>
@@ -51,13 +48,10 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CapacityWithUsage", propOrder = { - "used", - "overhead" + "used", + "overhead" }) public class CapacityWithUsage extends CapacityType @@ -72,7 +66,7 @@ public class CapacityWithUsage extends CapacityType } public static class Builder extends CapacityType.Builder { - + private Long used; private Long overhead; @@ -91,15 +85,10 @@ public class CapacityWithUsage extends CapacityType 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 this.limit = limit; return this; } - + @Override public Builder fromCapacityType(CapacityType 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java index 2fd98e8812..32b9c72159 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java @@ -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. + *

+ *

*

Java class for CaptureVAppParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="CaptureVAppParams">
  *   <complexContent>
@@ -64,16 +62,13 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CaptureVAppParams", propOrder = { - "source", - "section" + "source", + "section" }) public class CaptureVAppParams - extends ParamsType + extends ParamsType { @SuppressWarnings("unchecked") @@ -86,9 +81,9 @@ public class CaptureVAppParams } public static class Builder extends ParamsType.Builder { - + private Reference source; - private List>> sections; + private Set> sections = ImmutableSet.of(); /** * @see CaptureVAppParams#getSource() @@ -101,130 +96,115 @@ public class CaptureVAppParams /** * @see CaptureVAppParams#getSections() */ - public Builder sections(List>> sections) { - this.sections = sections; + public Builder sections(Set> 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 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> sections) { + super(description, name); + this.source = source; + this.sections = sections; + } + private CaptureVAppParams() { // For JAXB and builder use } - private CaptureVAppParams(List>> sections) { - this.sections = sections; + private CaptureVAppParams(Set> 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>> sections; + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElementRef + protected Set> 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. - * - *

- * 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 set method for the section property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSection().add(newItem);
-     * 
- * - * - *

- * 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>> getSections() { - if (sections == null) { - sections = new ArrayList>>(); - } - return this.sections; - } + /** + * An ovf:Section to configure the captured vAppTemplate. + * Gets the value of the section property. + *

+ *

+ * 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 set method for the section property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+    *    getSection().add(newItem);
+    * 
+ *

+ *

+ *

+ * 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> 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java index c7d0d92773..4495669a1d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java @@ -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. - * + *

*

  * <complexType name="CatalogType" />
  * 
* * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Catalog") +@XmlRootElement(name = "Catalog") public class Catalog extends EntityType { public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG; @@ -95,16 +93,7 @@ public class Catalog extends EntityType { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -171,7 +160,7 @@ public class Catalog extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -189,12 +178,16 @@ public class Catalog extends EntityType { } } - private Catalog() { - // For JAXB and builder use + public Catalog(URI href, String type, Set 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 { 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 { 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 { return isPublished; } - public void setIsPublished(Boolean value) { - this.isPublished = value; - } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java index 4d42e39cc8..7720193d3b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java @@ -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. - * + *

*

  * <complexType name="CatalogItemType" />
  * 
* * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItem") +@XmlRootElement(name = "CatalogItem") public class CatalogItem extends EntityType { public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM; @@ -61,7 +57,7 @@ public class CatalogItem extends EntityType { public static class Builder extends EntityType.Builder { private Reference entity; - private List properties = Lists.newArrayList(); + private Set properties = Sets.newLinkedHashSet(); /** * @see CatalogItem#getEntity() @@ -74,8 +70,8 @@ public class CatalogItem extends EntityType { /** * @see CatalogItem#getProperties() */ - public Builder properties(List properties) { - this.properties = Lists.newArrayList(checkNotNull(properties, "properties")); + public Builder properties(Set properties) { + this.properties = Sets.newLinkedHashSet(checkNotNull(properties, "properties")); return this; } @@ -89,14 +85,7 @@ public class CatalogItem extends EntityType { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -163,7 +152,7 @@ public class CatalogItem extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -181,20 +170,20 @@ public class CatalogItem extends EntityType { } } - private CatalogItem() { - // For JAXB and builder use + private CatalogItem(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, String name, Reference entity, Set 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 properties = Lists.newArrayList(); + private Set properties = Sets.newLinkedHashSet(); /** * A reference to a VappTemplate or Media object. @@ -205,18 +194,10 @@ public class CatalogItem extends EntityType { /** * User-specified key/value pair. - * + *

* This element has been superseded by the {@link Metadata} element, which is the preferred way to specify key/value pairs for objects. */ - public List getProperties() { - return this.properties; - } - - public void setProperties(List properties) { - this.properties = Lists.newArrayList(checkNotNull(properties, "properties")); - } - - public void addProperty(Property property) { - this.properties.add(checkNotNull(property, "property")); + public Set getProperties() { + return Collections.unmodifiableSet(this.properties); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java index 96ff754e8c..01037a1dfa 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java @@ -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. - * + *

*

  * <complexType name="CatalogItemsType" />
  * 
* * @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 catalogItems = Lists.newArrayList(); + private Set catalogItems = Sets.newLinkedHashSet(); /** * @see CatalogItems#getCatalogItems() */ - public Builder items(List catalogItems) { - this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems")); + public Builder items(Collection catalogItems) { + this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems")); return this; } @@ -90,24 +86,16 @@ public class CatalogItems { } private CatalogItems(Collection tasks) { - this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems")); + this.catalogItems = catalogItems; } @XmlElement(name = "CatalogItem") - private List catalogItems = Lists.newArrayList(); + private Set catalogItems = Sets.newLinkedHashSet(); /** * Gets the value of the catalogItems property. */ - public List getCatalogItems() { - return this.catalogItems; - } - - public void setCatalogItems(List catalogItems) { - this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems")); - } - - public void addCatalogItem(Reference catalogItem) { - this.catalogItems.add(checkNotNull(catalogItem, "catalogItem")); + public Set getCatalogItems() { + return Collections.unmodifiableSet(this.catalogItems); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java index 1bbc50dc03..91179152d6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java @@ -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 { @SuppressWarnings("unchecked") @@ -23,11 +20,7 @@ public class CatalogReference extends ReferenceType { @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 { } } - protected CatalogReference(URI href) { - super(href); + public CatalogReference(URI href, String id, String name, String type) { + super(href, id, name, type); } protected CatalogReference() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java index 52e0b471e7..bd4ec005ed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java @@ -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. - * + *

*

  * <complexType name="CatalogsListType" />
  * 
* * @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 catalogReferences = Lists.newArrayList(); + private Set catalogReferences = Sets.newLinkedHashSet(); /** * @see CatalogsList#getCatalogItems() */ - public Builder catalogs(List catalogReferences) { - this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences")); + public Builder catalogs(Collection 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 tasks) { - this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences")); + private CatalogsList(Set tasks) { + this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences")); } @XmlElement(name = "CatalogReference") - private List catalogReferences = Lists.newArrayList(); + private Set catalogReferences = Sets.newLinkedHashSet(); /** * Gets the value of the catalogReferences property. */ - public List getCatalogsList() { + public Set getCatalogItems() { return this.catalogReferences; } - public void setCatalogsList(List catalogReferences) { - this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences")); - } - - public void addCatalog(Reference catalog) { - this.catalogReferences.add(checkNotNull(catalog, "catalog")); - } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java index f0434a1a42..f55c034512 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java @@ -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. + *

+ *

*

Java class for CloneMediaParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="CloneMediaParams">
  *   <complexContent>
@@ -52,16 +49,13 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CloneMediaParams", propOrder = { - "source", - "isSourceDelete" + "source", + "isSourceDelete" }) public class CloneMediaParams - extends ParamsType + extends ParamsType { @SuppressWarnings("unchecked") @@ -74,7 +68,7 @@ public class CloneMediaParams } public static class Builder extends ParamsType.Builder { - + 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java index 69559ff598..8ccfc0575a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java @@ -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. + *

+ *

*

Java class for CloneVAppParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="CloneVAppParams">
  *   <complexContent>
@@ -44,13 +41,10 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CloneVAppParams") public class CloneVAppParams - extends InstantiateVAppParamsType + extends InstantiateVAppParamsType { @SuppressWarnings("unchecked") @@ -63,7 +57,7 @@ public class CloneVAppParams } public static class Builder extends InstantiateVAppParamsType.Builder { - + 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 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java index 36d4b1de62..14a61345ab 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java @@ -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. + *

+ *

*

Java class for CloneVAppTemplateParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="CloneVAppTemplateParams">
  *   <complexContent>
@@ -52,16 +49,13 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CloneVAppTemplateParams", propOrder = { - "source", - "isSourceDelete" + "source", + "isSourceDelete" }) public class CloneVAppTemplateParams - extends ParamsType + extends ParamsType { @SuppressWarnings("unchecked") @@ -74,7 +68,7 @@ public class CloneVAppTemplateParams } public static class Builder extends ParamsType.Builder { - + 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java index de601f35c3..e9ebb23274 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java @@ -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. + *

+ *

*

Java class for ComposeVAppParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="ComposeVAppParams">
  *   <complexContent>
@@ -57,19 +55,16 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ComposeVAppParams", propOrder = { - "sourcedItem", - "allEULAsAccepted" + "sourcedItem", + "allEULAsAccepted" }) @XmlSeeAlso({ // RecomposeVAppParamsType.class }) public class ComposeVAppParams - extends VAppCreationParamsType + extends VAppCreationParamsType { @SuppressWarnings("unchecked") @@ -82,21 +77,21 @@ public class ComposeVAppParams } public static class Builder extends VAppCreationParamsType.Builder { - - private List sourcedItem; + + private Set sourcedItem = Sets.newLinkedHashSet(); private Boolean allEULAsAccepted; private Boolean linkedClone; /** * @see ComposeVAppParams#getSourcedItem() */ - public Builder sourcedItem(List sourcedItem) { - this.sourcedItem = sourcedItem; + public Builder sourcedItem(Set 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 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 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 sourcedItem) { - this.sourcedItem = sourcedItem; + + @XmlElement(name = "SourcedItem") + protected Set sourcedItem = Sets.newLinkedHashSet(); + @XmlElement(name = "AllEULAsAccepted") + protected Boolean allEULAsAccepted; + @XmlAttribute + protected Boolean linkedClone; + + /** + * Gets the value of the sourcedItem property. + *

+ *

+ * 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 set method for the sourcedItem property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+    *    getSourcedItem().add(newItem);
+    * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link SourcedCompositionItemParam } + */ + public Set 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 sourcedItem; - @XmlElement(name = "AllEULAsAccepted") - protected Boolean allEULAsAccepted; - @XmlAttribute - protected Boolean linkedClone; - - /** - * Gets the value of the sourcedItem property. - * - *

- * 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 set method for the sourcedItem property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSourcedItem().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SourcedCompositionItemParamType } - * - * - */ - public List getSourcedItem() { - if (sourcedItem == null) { - sourcedItem = new ArrayList(); - } - 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java index 0de0b3376c..5d0556740c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java @@ -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. + *

+ *

*

Java class for ComputeCapacity complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="ComputeCapacity">
  *   <complexContent>
@@ -51,13 +48,10 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java index d2c85622b3..6e0b618691 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java @@ -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; * </complexType> * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "CustomizationSection") @XmlType(propOrder = { "customizeOnInstantiate", - "link", - "any" + "links" }) public class CustomizationSection extends SectionType { public static Builder builder() { @@ -82,8 +79,7 @@ public class CustomizationSection extends SectionType { public static class Builder extends SectionType.Builder { private boolean customizeOnInstantiate; - private List link; - private List any; + private Set links = Sets.newLinkedHashSet(); private URI href; private String type; @@ -96,18 +92,10 @@ public class CustomizationSection extends SectionType { } /** - * @see CustomizationSection#getLink() + * @see CustomizationSection#getLinks() */ - public Builder link(List link) { - this.link = link; - return this; - } - - /** - * @see CustomizationSection#getAny() - */ - public Builder any(List any) { - this.any = any; + public Builder links(Set links) { + this.links = checkNotNull(links, "links"); return this; } @@ -129,18 +117,13 @@ public class CustomizationSection extends SectionType { 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 { 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, List any) { - super(info); - this.link = link; - this.any = any; + private CustomizationSection(@Nullable String info, @Nullable Boolean required, boolean customizeOnInstantiate, Set 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 { @XmlElement(name = "CustomizeOnInstantiate") protected boolean customizeOnInstantiate; @XmlElement(name = "Link") - protected List link; - @XmlAnyElement(lax = true) - protected List any; + protected Set links = Sets.newLinkedHashSet(); @XmlAttribute @XmlSchemaType(name = "anyURI") protected URI href; @@ -193,65 +184,10 @@ public class CustomizationSection extends SectionType { } /** - * 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. - *

- *

- * 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 set method for the link property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getLink().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Link } - */ - public List getLink() { - if (link == null) { - link = new ArrayList(); - } - return this.link; - } - - /** - * Gets the value of the any property. - *

- *

- * 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 set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getAny().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; + public Set getLinks() { + return this.links; } /** @@ -264,16 +200,6 @@ public class CustomizationSection extends SectionType { 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 { 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 { 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); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java index 4410fb0649..801375b9c0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java @@ -29,10 +29,10 @@ import com.google.common.collect.Sets; * An entity. * * @author grkvlt@apache.org + * @author Adam Lowe */ public class Entity extends EntityType { - @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); } @@ -46,13 +46,7 @@ public class Entity extends EntityType { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -119,7 +113,7 @@ public class Entity extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -137,21 +131,11 @@ public class Entity extends EntityType { } } - protected Entity(URI href, String name) { - super(href, name); + private Entity(URI href, String type, Set 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); - } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java index 62208ab026..077e4ad1e0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java @@ -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. - * + *

* Includes a name, an optional description, and an optional list of links - * + *

*

  * <xs:complexType name="EntityType">
  * 
* * @author grkvlt@apache.org + * @author Adam Lowe */ -public class EntityType> extends ResourceType { +public abstract class EntityType> extends ResourceType { - public static > Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return new Builder().fromEntityType(this); - } - - public static class Builder> extends ResourceType.Builder { + public static abstract class Builder> extends ResourceType.Builder { protected String description; protected TasksInProgress tasksInProgress; @@ -93,17 +83,6 @@ public class EntityType> extends ResourceType { return this; } - @Override - public EntityType build() { - EntityType entity = new EntityType(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> extends ResourceType { public Builder fromEntityType(EntityType 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 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> extends ResourceType { 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> extends ResourceType { return tasksInProgress; } - public void setTasksInProgress(TasksInProgress tasksInProgress) { - this.tasksInProgress = tasksInProgress; - } - /** * 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. */ @@ -206,20 +180,12 @@ public class EntityType> extends ResourceType { 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) { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java index 17891e8c45..b167f7f108 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java @@ -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. - * + *

*

  * <xs:complexType name="ErrorType">
  * 
* * @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. - * + *

* 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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java index ea9369ecb1..b9e455dcb0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java @@ -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). + *

+ *

*

Java class for File complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="File">
  *   <complexContent>
@@ -58,26 +54,21 @@ import com.google.common.collect.Sets;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "File") -public class File - extends EntityType - -{ +public class File extends EntityType { @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 { - + 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 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 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java index 6a196bde57..050ecd1d86 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java @@ -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). + *

+ *

*

Java class for FilesList complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="FilesList">
  *   <complexContent>
@@ -54,12 +51,9 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 files; + + private Set files = Sets.newLinkedHashSet(); /** * @see FilesList#getFiles() */ - public Builder file(List file) { - this.files = file; + public Builder files(Set 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 files) { - this.files = files; + private FilesList(Set files) { + this.files = ImmutableSet.copyOf(files); } - @XmlElement(name = "File", required = true) - protected List files; + @XmlElement(name = "File", required = true) + protected Set files = Sets.newLinkedHashSet(); - /** - * Gets the value of the file property. - * - *

- * 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 set method for the file property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getFile().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link FileType } - * - * - */ - public List getFiles() { - if (files == null) { - files = new ArrayList(); - } - return this.files; - } + /** + * Gets the value of the file property. + */ + public Set 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java index afb85241b1..e10406e68f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java @@ -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; * </complexType> * */ -@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 { @SuppressWarnings("unchecked") @@ -108,7 +106,6 @@ public class GuestCustomizationSection extends SectionType { - private Boolean enabled; private Boolean changeSid; private String virtualMachineId; @@ -123,8 +120,7 @@ public class GuestCustomizationSection extends SectionType link; - private List any; + private Set links = Sets.newLinkedHashSet(); private URI href; private String type; @@ -243,16 +239,8 @@ public class GuestCustomizationSection extends SectionType link) { - this.link = link; - return this; - } - - /** - * @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getAny() - */ - public Builder any(List any) { - this.any = any; + public Builder links(Set links) { + this.links = checkNotNull(links, "links"); return this; } @@ -274,25 +262,13 @@ public class GuestCustomizationSection extends SectionType 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, List 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; - @XmlAnyElement(lax = true) - protected List any; + private Set 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 - *

- * 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 set method for the link property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getLink().add(newItem);
-    * 
- *

- *

- *

* Objects of the following type(s) are allowed in the list * {@link Link } */ - public List getLink() { - if (link == null) { - link = new ArrayList(); - } - return this.link; - } - - /** - * Gets the value of the any property. - *

- *

- * 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 set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getAny().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link org.w3c.dom.Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; + public Set getLink() { + return Collections.unmodifiableSet(this.links); } /** @@ -726,13 +539,6 @@ public class GuestCustomizationSection extends SectionType { - + extends InstantiateVAppParamsType { + @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 { + public static class Builder + extends InstantiateVAppParamsType.Builder { 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 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 } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java index 4f35618a76..1cc06daf5d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java @@ -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. + *

+ *

*

Java class for InstantiateVAppParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="InstantiateVAppParams">
  *   <complexContent>
@@ -54,20 +51,17 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "InstantiateVAppParams", propOrder = { - "source", - "isSourceDelete" + "source", + "isSourceDelete" }) @XmlSeeAlso({ // InstantiateVAppTemplateParamsType.class, // CloneVAppParamsType.class }) public class InstantiateVAppParamsType> - extends VAppCreationParamsType + extends VAppCreationParamsType { public static > Builder builder() { @@ -79,7 +73,7 @@ public class InstantiateVAppParamsType> } public static class Builder> extends VAppCreationParamsType.Builder { - + protected Reference source; protected Boolean isSourceDelete; protected Boolean linkedClone; @@ -93,7 +87,7 @@ public class InstantiateVAppParamsType> } /** - * @see InstantiateVAppParamsType#getIsSourceDelete() + * @see InstantiateVAppParamsType#isSourceDelete() */ public Builder isSourceDelete(Boolean isSourceDelete) { this.isSourceDelete = isSourceDelete; @@ -101,28 +95,17 @@ public class InstantiateVAppParamsType> } /** - * @see InstantiateVAppParamsType#getLinkedClone() + * @see InstantiateVAppParamsType#isLinkedClone() */ public Builder linkedClone(Boolean linkedClone) { this.linkedClone = linkedClone; return this; } - public InstantiateVAppParamsType build() { - InstantiateVAppParamsType instantiateVAppParams = new InstantiateVAppParamsType(); - 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(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone); } - + /** * @see ParamsType#getDescription() */ @@ -138,7 +121,7 @@ public class InstantiateVAppParamsType> super.name(name); return this; } - + /** * @see VAppCreationParamsType#getVAppParent() */ @@ -156,7 +139,7 @@ public class InstantiateVAppParamsType> } /** - * @see VAppCreationParamsType#getDeploy() + * @see VAppCreationParamsType#isDeploy() */ public Builder deploy(Boolean deploy) { super.deploy(deploy); @@ -164,7 +147,7 @@ public class InstantiateVAppParamsType> } /** - * @see VAppCreationParamsType#getPowerOn() + * @see VAppCreationParamsType#isPowerOn() */ public Builder powerOn(Boolean powerOn) { super.powerOn(powerOn); @@ -177,118 +160,84 @@ public class InstantiateVAppParamsType> @SuppressWarnings("unchecked") @Override public Builder fromVAppCreationParamsType(VAppCreationParamsType in) { - return Builder.class.cast(super.fromVAppCreationParamsType(in)); + return Builder.class.cast(super.fromVAppCreationParamsType(in)); } + public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java index ce7e905f34..cedbfba1cc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java @@ -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. + *

+ *

*

Java class for InstantiateVAppTemplateParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="InstantiateVAppTemplateParams">
  *   <complexContent>
@@ -50,16 +47,13 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "InstantiateVAppTemplateParams", propOrder = { - "allEULAsAccepted" + "allEULAsAccepted" }) public class InstantiateVAppTemplateParams - extends InstantiateVAppParamsType { - + extends InstantiateVAppParamsType { + @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); @@ -70,11 +64,11 @@ public class InstantiateVAppTemplateParams } public static class Builder extends InstantiateVAppParamsType.Builder { - + 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 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java index aca8d92e07..6154a70e67 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java @@ -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. + *

+ *

*

Java class for InstantiationParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="InstantiationParams">
  *   <complexContent>
@@ -61,12 +60,9 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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>> sections; + private Set> sections = Sets.newLinkedHashSet(); /** * @see InstantiationParams#getSections() */ - public Builder sections(List>> sections) { - this.sections = sections; + public Builder sections(Set> sections) { + this.sections = checkNotNull(sections, "sections"); return this; } @@ -105,67 +100,61 @@ public class InstantiationParams { // For JAXB and builder use } - private InstantiationParams(List>> sections) { + private InstantiationParams(Set> sections) { this.sections = sections; } - @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) - protected List>> sections; + @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) + protected Set> sections = Sets.newLinkedHashSet(); - /** - * - * An ovf:Section to configure for instantiation. - * - * Gets the value of the section property. - * - *

- * 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 set method for the section property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSection().add(newItem);
-     * 
- * - * - *

- * 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>> getSections() { - if (sections == null) { - sections = new ArrayList>>(); - } - return this.sections; - } + /** + * An ovf:Section to configure for instantiation. + *

+ * Gets the value of the section property. + *

+ *

+ * 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 set method for the section property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+    *    getSection().add(newItem);
+    * 
+ *

+ *

+ *

+ * 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> 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java index b2ade6616f..0d2d4b1302 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java @@ -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 ipAddresses = Sets.newLinkedHashSet(); public Set getIpAddresses() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java index fa4a45a456..43941e6981 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java @@ -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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java index 4b44ca5deb..f1dd1b0165 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java @@ -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 ipRanges = Sets.newLinkedHashSet(); public Set getIpRanges() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java index ba8db803a5..c1acd7ff5b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java @@ -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(); } - + } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java index fcae07baa4..84a905f3a9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java @@ -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; * </complexType> * */ -@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 { public static Builder builder() { @@ -90,20 +85,19 @@ public class LeaseSettingsSection extends SectionType { } public static class Builder extends SectionType.Builder { - private List links; + private Set links = Sets.newLinkedHashSet(); private Integer deploymentLeaseInSeconds; private Integer storageLeaseInSeconds; private XMLGregorianCalendar deploymentLeaseExpiration; private XMLGregorianCalendar storageLeaseExpiration; - private List any; private URI href; private String type; /** * @see LeaseSettingsSection#getLinks() */ - public Builder links(List links) { - this.links = links; + public Builder links(Set links) { + this.links = checkNotNull(links, "links"); return this; } @@ -139,14 +133,6 @@ public class LeaseSettingsSection extends SectionType { return this; } - /** - * @see LeaseSettingsSection#getAny() - */ - public Builder any(List any) { - this.any = any; - return this; - } - /** * @see LeaseSettingsSection#getHref() */ @@ -165,14 +151,9 @@ public class LeaseSettingsSection extends SectionType { 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 { .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 { 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; + protected Set links; @XmlElement(name = "DeploymentLeaseInSeconds") protected Integer deploymentLeaseInSeconds; @XmlElement(name = "StorageLeaseInSeconds") @@ -216,18 +204,23 @@ public class LeaseSettingsSection extends SectionType { @XmlElement(name = "StorageLeaseExpiration") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar storageLeaseExpiration; - @XmlAnyElement(lax = true) - protected List any; @XmlAttribute @XmlSchemaType(name = "anyURI") protected URI href; @XmlAttribute protected String type; - private LeaseSettingsSection(@Nullable String info, List link, List any) { - super(info); - this.link = link; - this.any = any; + private LeaseSettingsSection(@Nullable String info, @Nullable Boolean required, Set 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 { * Objects of the following type(s) are allowed in the list * {@link Link } */ - public List getLinks() { - if (link == null) { - link = new ArrayList(); - } - return this.link; + public Set getLinks() { + return Collections.unmodifiableSet(this.links); } /** @@ -271,16 +261,6 @@ public class LeaseSettingsSection extends SectionType { 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 { 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 { 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 { 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. - *

- *

- * 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 set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getAny().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - /** * @return the value of the href property. */ @@ -376,15 +298,6 @@ public class LeaseSettingsSection extends SectionType { 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 { 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 { 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); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java index 28a0aa253a..9ccebe4d19 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java @@ -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. - * + *

*

  * <xs:complexType name="LinkType">
  * 
* * @author Adrian Cole */ +@XmlRootElement(name = "Link") public class Link extends ReferenceType { public static final class Rel { @@ -58,16 +59,16 @@ public class Link extends ReferenceType { 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 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. + *

+ * This list must be updated whenever a new relationship is added. + */ + public static final List 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 { @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 { @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 { * 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() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java index e9370582df..8c794d3e54 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java @@ -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. - * + *

*

  * <complexType name="Media" />
  * 
*/ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Media") +@XmlRootElement(name = "Media") public class Media extends ResourceEntityType { public static final class ImageType { @@ -92,18 +90,7 @@ public class Media extends ResourceEntityType { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -188,7 +175,7 @@ public class Media extends ResourceEntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -206,15 +193,20 @@ public class Media extends ResourceEntityType { } } - public Media() { - // for JAXB - } - - protected Media(URI href, String name) { - super(href, name); + + public Media(URI href, String type, Set 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 { 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 { 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 { return size; } - public void setSize(long value) { - this.size = value; - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java index 2b59c1ae76..b0580abca5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java @@ -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 - * + *

*

  * <xs:complexType name="Metadata">
  * 
* * @author danikov */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Metadata") +@XmlRootElement(name = "Metadata") public class Metadata extends ResourceType { - + public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA; @SuppressWarnings("unchecked") @@ -78,15 +76,12 @@ public class Metadata extends ResourceType { 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 { } private Metadata() { - // For JAXB and builder use + // For JAXB } - private Metadata(URI href, Set metadataEntries) { - super(href); + private Metadata(URI href, String type, Set links, Set metadataEntries) { + super(href, type, links); this.metadataEntries = ImmutableSet.copyOf(metadataEntries); } - @XmlElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry") + + @XmlElement(name = "MetadataEntry") private Set metadataEntries = Sets.newLinkedHashSet(); public Set getMetadataEntries() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java index 362e48a635..aa4193abd4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java @@ -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 - * + *

*

  * <xs:complexType name="MetadataType">
  * 
* * @author danikov */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry") +@XmlRootElement(name = "MetadataEntry") public class MetadataEntry extends ResourceType { - + public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY; @SuppressWarnings("unchecked") @@ -53,7 +51,6 @@ public class MetadataEntry extends ResourceType { return new Builder(); } - @Override public Builder toBuilder() { return new Builder().fromMetadataEntry(this); } @@ -87,15 +84,12 @@ public class MetadataEntry extends ResourceType { 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 { // For JAXB and builder use } - private MetadataEntry(URI href, String key, String value) { - super(href); + public MetadataEntry(URI href, String type, Set 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 { public String getValue() { return value; } - + @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java index 2150e8db9a..7f9cd87b79 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java @@ -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 - * + *

*

  * <xs:complexType name="MetadataType">
  * 
* * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataValue") +@XmlRootElement(name = "MetadataValue") public class MetadataValue extends ResourceType { - + public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY; @SuppressWarnings("unchecked") @@ -68,15 +66,12 @@ public class MetadataValue extends ResourceType { 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 { } private MetadataValue() { - // For JAXB and builder use + // For JAXB } - private MetadataValue(URI href, String value) { - super(href); + private MetadataValue(URI href, String type, Set 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 { public String getValue() { return value; } - + @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java index 77eec2e6e6..9bee51fce8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java @@ -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. + *

+ *

*

Java class for NetworkAssignment complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="NetworkAssignment">
  *   <complexContent>
@@ -49,13 +46,10 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java index a0873d62ce..5397647130 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java @@ -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; * </complexType> * */ -@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 { public static Builder builder() { @@ -84,33 +80,24 @@ public class NetworkConfigSection extends SectionType { public static class Builder extends SectionType.Builder { - private List link; - private List> networkConfig; - private List any; + private Set links = Sets.newLinkedHashSet(); + private Set> networkConfigs = Sets.newLinkedHashSet(); private URI href; private String type; /** - * @see NetworkConfigSection#getLink() + * @see NetworkConfigSection#getLinks() */ - public Builder link(List link) { - this.link = link; + public Builder links(Set links) { + this.links = checkNotNull(links, "links"); return this; } /** - * @see NetworkConfigSection#getNetworkConfig() + * @see NetworkConfigSection#getNetworkConfigs() */ - public Builder networkConfig(List> networkConfig) { - this.networkConfig = networkConfig; - return this; - } - - /** - * @see NetworkConfigSection#getAny() - */ - public Builder any(List any) { - this.any = any; + public Builder networkConfig(Set> networkConfigs) { + this.networkConfigs = checkNotNull(networkConfigs, "networkConfigs"); return this; } @@ -132,17 +119,13 @@ public class NetworkConfigSection extends SectionType { 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 { 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; + protected Set links; @XmlElement(name = "NetworkConfig") - protected List> networkConfig; - @XmlAnyElement(lax = true) - protected List any; + protected Set> networkConfigs; @XmlAttribute @XmlSchemaType(name = "anyURI") protected URI href; @XmlAttribute protected String type; - - private NetworkConfigSection(@Nullable String info, List link, List> networkConfig, List any) { - super(info); - this.link = link; - this.networkConfig = networkConfig; - this.any = any; + + public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set links, Set> 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. - *

- *

- * 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 set method for the link property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getLink().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Link } */ - public List getLink() { - if (link == null) { - link = new ArrayList(); - } - return this.link; + public Set getLinks() { + return Collections.unmodifiableSet(this.links); } /** * Gets the value of the networkConfig property. - *

- *

- * 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 set method for the networkConfig property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getNetworkConfig().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link VAppNetworkConfiguration } */ - public List> getNetworkConfig() { - if (networkConfig == null) { - networkConfig = new ArrayList>(); - } - return this.networkConfig; - } - - /** - * Gets the value of the any property. - *

- *

- * 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 set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getAny().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; + public Set> getNetworkConfigs() { + return Collections.unmodifiableSet(this.networkConfigs); } /** @@ -277,13 +200,6 @@ public class NetworkConfigSection extends SectionType { 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 { 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 { 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); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java index a611eceb47..5b623ccef7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java @@ -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) { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnection.java index 303cd362ee..364b79ee34 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnection.java @@ -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. + *

+ *

*

Java class for NetworkConnection complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="NetworkConnection">
  *   <complexContent>
@@ -58,17 +55,14 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java index a8a85e906f..ce7d5b535e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java @@ -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; * </complexType> * */ -@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 { @@ -89,9 +83,8 @@ public class NetworkConnectionSection extends SectionType { private Integer primaryNetworkConnectionIndex; - private List networkConnection; - private List link; - private List any; + private Set networkConnection = Sets.newLinkedHashSet(); + private Set links = Sets.newLinkedHashSet(); private URI href; private String type; @@ -104,26 +97,18 @@ public class NetworkConnectionSection extends SectionType networkConnection) { - this.networkConnection = networkConnection; + public Builder networkConnection(Set networkConnection) { + this.networkConnection = checkNotNull(networkConnection, "networkConnection"); return this; } /** - * @see NetworkConnectionSection#getLink() + * @see NetworkConnectionSection#getLinks() */ - public Builder link(List link) { - this.link = link; - return this; - } - - /** - * @see NetworkConnectionSection#getAny() - */ - public Builder any(List any) { - this.any = any; + public Builder links(Set links) { + this.links = checkNotNull(links, "links"); return this; } @@ -145,19 +130,15 @@ public class NetworkConnectionSection extends SectionType networkConnection, List link, List any) { - super(info); - this.networkConnection = networkConnection; - this.link = link; - this.any = any; + private NetworkConnectionSection(@Nullable String info, @Nullable Boolean required, Integer primaryNetworkConnectionIndex, + Set networkConnections, Set 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 networkConnection; + protected Set networkConnections = Sets.newLinkedHashSet(); @XmlElement(name = "Link") - protected List link; - @XmlAnyElement(lax = true) - protected List any; + protected Set links = Sets.newLinkedHashSet(); @XmlAttribute @XmlSchemaType(name = "anyURI") protected URI href; @@ -214,96 +205,24 @@ public class NetworkConnectionSection extends SectionType - *

- * 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 set method for the networkConnection property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getNetworkConnection().add(newItem);
-    * 
- *

- *

- *

* Objects of the following type(s) are allowed in the list * {@link NetworkConnection } */ - public List getNetworkConnection() { - if (networkConnection == null) { - networkConnection = new ArrayList(); - } - return this.networkConnection; + public Set getNetworkConnections() { + return this.networkConnections; } /** * Gets the value of the link property. *

- *

- * 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 set method for the link property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getLink().add(newItem);
-    * 
- *

- *

- *

* Objects of the following type(s) are allowed in the list * {@link Link } */ - public List getLink() { - if (link == null) { - link = new ArrayList(); - } - return this.link; - } - - /** - * Gets the value of the any property. - *

- *

- * 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 set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-    *    getAny().add(newItem);
-    * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; + public Set getLinks() { + return this.links; } /** @@ -313,15 +232,6 @@ public class NetworkConnectionSection extends SectionType services) { + this.services = services; + } + + @XmlElement(name = "NetworkService") private Set 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 getNetworkServices() { return ImmutableSet.copyOf(services); } - - public void setNetworkServices(Set services) { - this.services = Sets.newLinkedHashSet(checkNotNull(services, "services")); - } @Override public boolean equals(Object o) { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java index c5321ac165..56111c741d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java @@ -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) { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkType.java index 528a30f825..54052b9b18 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkType.java @@ -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> extends EntityType { - + public static > Builder builder() { return new Builder(); } @@ -47,7 +45,7 @@ public class NetworkType> extends EntityType { public static class Builder> extends EntityType.Builder { protected NetworkConfiguration networkConfiguration; - + /** * @see NetworkType#getConfiguration() */ @@ -55,17 +53,10 @@ public class NetworkType> extends EntityType { this.networkConfiguration = networkConfiguration; return this; } - + @Override public NetworkType build() { - NetworkType network = new NetworkType(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(href, type, links, description, tasksInProgress, id, name, networkConfiguration); } /** @@ -123,7 +114,7 @@ public class NetworkType> extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -132,7 +123,7 @@ public class NetworkType> extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -154,15 +145,17 @@ public class NetworkType> extends EntityType { } } + public NetworkType(URI href, String type, Set 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> extends EntityType { public NetworkConfiguration getConfiguration() { return networkConfiguration; } - - public void setConfiguration(NetworkConfiguration networkConfiguration) { - this.networkConfiguration = networkConfiguration; - } - + @Override public boolean equals(Object o) { if (!super.equals(o)) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java index afcd87cb23..6c2713d061 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java @@ -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. - * + *

* Unit of multi-tenancy and a top-level container. Contain vDCs, TasksList, Catalogs and Shared Network entities. - * + *

*

  * <xs:complexType name="OrgType">
  * 
* * @author Adrian Cole */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Org") +@XmlRootElement(name = "Org") public class Org extends EntityType { - + public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG; @SuppressWarnings("unchecked") @@ -99,14 +97,7 @@ public class Org extends EntityType { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -173,7 +164,7 @@ public class Org extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -195,14 +186,15 @@ public class Org extends EntityType { // For JAXB and builder use } - private Org(URI href, String name, String fullName) { - super(href, name); + public Org(URI href, String type, Set 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 { return isEnabled; } - public void setIsEnabled(Boolean isEnabled) { - this.isEnabled = isEnabled; - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java index 827ffc0529..1c74e8bace 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java @@ -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 orgs = Sets.newLinkedHashSet(); public Set getOrgs() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java index 3e56987900..c2d841ffbe 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java @@ -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 { - + @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); @@ -49,7 +47,7 @@ public class OrgNetwork extends NetworkType { private ReferenceType networkPool; private IpAddresses allowedExternalIpAddresses; - + /** * @see OrgNetwork#getNetworkPool() */ @@ -65,21 +63,13 @@ public class OrgNetwork extends NetworkType { 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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -152,7 +142,7 @@ public class OrgNetwork extends NetworkType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -173,16 +163,19 @@ public class OrgNetwork extends NetworkType { } 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 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 { 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); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java index 18708835c9..b20e2fdee4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java @@ -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. + *

+ *

*

Java class for Owner complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="Owner">
  *   <complexContent>
@@ -56,14 +52,11 @@ import com.google.common.collect.Sets;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Owner") @XmlType(propOrder = {"user"}) public class Owner - extends ResourceType + extends ResourceType { @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 { - + 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 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 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java index a2f8d4e7ce..98aaea6fed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java @@ -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. + *

+ *

*

Java class for Params complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="Params">
  *   <complexContent>
@@ -53,19 +50,16 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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> { return new Builder().fromParamsType(this); } - public static class Builder>{ - + public static class Builder> { + protected String description; protected String name; @@ -102,93 +96,65 @@ public class ParamsType> { public ParamsType build() { - ParamsType params = new ParamsType(); - params.setDescription(description); - params.setName(name); - return params; + return new ParamsType(description, name); } - public Builder fromParamsType(ParamsType 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java index f232674fcf..d5cd569e17 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java @@ -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. - * + *

*

Java class for ProductSectionList complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="ProductSectionList">
  *   <complexContent>
@@ -58,15 +53,12 @@ import com.google.common.collect.Sets;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ProductSectionList", propOrder = { - "productSection" + "productSection" }) public class ProductSectionList - extends ResourceType + extends ResourceType { @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 { - - private List productSection; + + private Set productSections = Sets.newLinkedHashSet(); /** * @see ProductSectionList#getProductSection() */ - public Builder productSection(List productSection) { - this.productSection = productSection; + public Builder productSection(Set 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 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) { - this.productSection = productSection; + private ProductSectionList(Set productSection) { + this.productSection = ImmutableSet.copyOf(productSection); } - @XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1") - protected List productSection; + @XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1") + protected Set productSection = Sets.newLinkedHashSet(); - /** - * Gets the value of the productSection property. - * - *

- * 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 set method for the productSection property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProductSection().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProductSection } - */ - public List getProductSection() { - if (productSection == null) { - productSection = new ArrayList(); - } - return this.productSection; - } + /** + * Gets the value of the productSection property. + */ + public Set 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Property.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Property.java index a6c01018b9..6d73e4ba74 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Property.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Property.java @@ -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. - * + *

*

  * <complexType name="PropertyType" />
  * 
* * @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. */ diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java index 1e3af67113..e055bb5264 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java @@ -22,7 +22,7 @@ import java.net.URI; /** * A reference to a resource. - * + * * @author grkvlt@apache.org */ public class Reference extends ReferenceType { @@ -41,11 +41,7 @@ public class Reference extends ReferenceType { @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 { } } - protected Reference(URI href) { - super(href); + public Reference(URI href, String id, String name, String type) { + super(href, id, name, type); } protected Reference() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java index bbed73839b..f6a340cdc3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java @@ -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. - * + *

* Contains an href attribute and optional name and type attributes. - * + *

*

  * <xs:complexType name="ReferenceType">
  * 
- * + * * @author grkvlt@apache.org */ -@XmlAccessorType(XmlAccessType.FIELD) public class ReferenceType> implements URISupplier { public static > Builder builder() { @@ -92,11 +88,7 @@ public class ReferenceType> implements URISupplier { } public ReferenceType build() { - ReferenceType reference = new ReferenceType(href); - reference.setId(id); - reference.setName(name); - reference.setType(type); - return reference; + return new ReferenceType(href, id, name, type); } protected Builder fromReferenceType(ReferenceType in) { @@ -117,8 +109,11 @@ public class ReferenceType> 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> implements URISupplier { /** * 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 reused. The value of the href attribute is a reference to a view of @@ -135,7 +130,7 @@ public class ReferenceType> 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> implements URISupplier { /** * 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. */ @@ -152,42 +147,30 @@ public class ReferenceType> implements URISupplier { return id; } - public void setId(String id) { - this.id = id; - } - /** * Contains the name 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 getName() { return name; } - public void setName(String name) { - this.name = name; - } - /** * 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; - } - /** * @see URISupplier#getURI() */ diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RelocateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RelocateParams.java index e58847c5e6..aeb036e2c5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RelocateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RelocateParams.java @@ -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. + *

+ *

*

Java class for RelocateParams complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="RelocateParams">
  *   <complexContent>
@@ -45,40 +42,22 @@ import javax.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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; + } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java index b380e200e0..61e0d5ea15 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java @@ -27,12 +27,11 @@ import com.google.common.collect.Sets; /** * A resource. - * + * * @author grkvlt@apache.org */ public class Resource extends ResourceType { - @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); } @@ -46,10 +45,7 @@ public class Resource extends ResourceType { @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 { } } - protected Resource(URI href) { - super(href); + private Resource(URI href, String type, Set links) { + super(href, type, links); } - protected Resource() { + private Resource() { // For JAXB } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java index ef562758c2..6bcf21db4d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java @@ -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. + *

+ *

*

Java class for ResourceEntities complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="ResourceEntities">
  *   <complexContent>
@@ -54,12 +51,9 @@ import com.google.common.collect.Lists;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 resourceEntities = Lists.newArrayList(); - + + private Set resourceEntities = Sets.newLinkedHashSet(); + /** * @see ResourceEntities#getResourceEntities() */ - public Builder resourceEntities(List resourceEntities) { - this.resourceEntities = Lists.newArrayList(checkNotNull(resourceEntities, "resourceEntities")); + public Builder resourceEntities(Set 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 resourceEntity) { - this.resourceEntities = resourceEntity; + private ResourceEntities(Set resourceEntity) { + this.resourceEntities = ImmutableSet.copyOf(resourceEntity); } - @XmlElement(name = "ResourceEntity") - protected List resourceEntities; + @XmlElement(name = "ResourceEntity") + private Set resourceEntities = Sets.newLinkedHashSet(); - /** - * Gets the value of the resourceEntity property. - * - *

- * 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 set method for the resourceEntity property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getResourceEntity().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ReferenceType } - * - * - */ - public List getResourceEntities() { - if (resourceEntities == null) { - resourceEntities = Lists.newArrayList(); - } - return this.resourceEntities; - } + /** + * Gets the value of the resourceEntity property. + */ + public Set 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java index 43bfebe723..78afcce32f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java @@ -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. - * + *

*

  * <complexType name="ResourceEntity" >
  * 
- * + * * @author danikov + * @author Adam Lowe */ -public class ResourceEntityType> extends EntityType { - - public static > Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return new Builder().fromResourceEntityType(this); - } - - public static class Builder> extends EntityType.Builder { +public abstract class ResourceEntityType> extends EntityType { + public static abstract class Builder> extends EntityType.Builder { protected FilesList files; protected Integer status; @@ -73,19 +63,6 @@ public class ResourceEntityType> extends EntityT return this; } - @Override - public ResourceEntityType build() { - ResourceEntityType resourceEntity = new ResourceEntityType(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> extends EntityT } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -132,7 +109,7 @@ public class ResourceEntityType> extends EntityT } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -151,19 +128,22 @@ public class ResourceEntityType> 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 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> 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> extends EntityT return status; } - public void setStatus(Integer value) { - this.status = value; - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java index bb61f6ffc3..a4d5745ff2 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java @@ -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. - * + *

* Has an optional list of links and href and type attributes. - * + *

*

  * <xs:complexType name="ResourceType">
  * 
- * + * * @author Adrian Cole */ -@XmlAccessorType(XmlAccessType.FIELD) -public class ResourceType> implements URISupplier { +public abstract class ResourceType> implements URISupplier { - public static > Builder builder() { - return new Builder(); - } + public abstract Builder toBuilder(); - public Builder toBuilder() { - return new Builder().fromResourceType(this); - } - - public static class Builder> { + public static abstract class Builder> { protected URI href; protected String type; @@ -94,12 +83,7 @@ public class ResourceType> implements URISupplier { return this; } - public ResourceType build() { - ResourceType reference = new ResourceType(href); - reference.setType(type); - reference.setLinks(links); - return reference; - } + public abstract ResourceType build(); protected Builder fromResourceType(ResourceType in) { return href(in.getHref()).type(in.getType()).links(in.getLinks()); @@ -110,11 +94,13 @@ public class ResourceType> implements URISupplier { private URI href; @XmlAttribute private String type; - @XmlElement(namespace = VCLOUD_1_5_NS, name = "Link") + @XmlElement(name = "Link") private Set links = Sets.newLinkedHashSet(); - protected ResourceType(URI href) { + protected ResourceType(URI href, String type, Set links) { this.href = href; + this.type = type; + this.links = links; } protected ResourceType() { @@ -123,7 +109,7 @@ public class ResourceType> implements URISupplier { /** * 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 reused. The value of the href attribute is a reference to a view of @@ -131,7 +117,7 @@ public class ResourceType> 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> implements URISupplier { /** * 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; - } - /** * Set of optional links to an entity or operation associated with this object. */ @@ -169,14 +151,6 @@ public class ResourceType> implements URISupplier { return links; } - public void setLinks(Set 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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java index 7ae387f1ca..29b32fb9e3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java @@ -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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java index 27e3f27dea..e72bd5797e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java @@ -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 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(); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java index 98bfa1d05b..c3782614f2 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java @@ -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() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java index c52936f972..d699a9096f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java @@ -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. + *

+ *

*

Java class for SourcedCompositionItemParam complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="SourcedCompositionItemParam">
  *   <complexContent>
@@ -58,15 +55,12 @@ import com.google.common.base.Objects;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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; + private Set networkAssignments = Sets.newLinkedHashSet(); private Boolean sourceDelete; /** @@ -110,207 +104,144 @@ public class SourcedCompositionItemParam { } /** - * @see SourcedCompositionItemParam#getNetworkAssignment() + * @see SourcedCompositionItemParam#getNetworkAssignments() */ - public Builder networkAssignment(List networkAssignment) { - this.networkAssignment = networkAssignment; + public Builder networkAssignments(Set 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 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) { - 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 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; - @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. + *

+ *

+ * 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 set method for the networkAssignment property. + *

+ *

+ * For example, to add a new item, do as follows: + *

+    *    getNetworkAssignment().add(newItem);
+    * 
+ *

+ *

+ *

+ * Objects of the following type(s) are allowed in the list + * {@link NetworkAssignment } + */ + public Set 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. - * - *

- * 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 set method for the networkAssignment property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNetworkAssignment().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NetworkAssignmentType } - * - * - */ - public List getNetworkAssignment() { - if (networkAssignment == null) { - networkAssignment = new ArrayList(); - } - 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(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java index 3275252631..e74dea141f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java @@ -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. + *

+ *

*

Java class for SupportedHardwareVersions complex type. - * + *

*

The following schema fragment specifies the expected content contained within this class. - * + *

*

  * <complexType name="SupportedHardwareVersions">
  *   <complexContent>
@@ -54,12 +51,9 @@ import com.google.common.collect.Lists;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ -@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 supportedHardwareVersions = Lists.newArrayList(); + + private Set supportedHardwareVersions = Sets.newLinkedHashSet(); /** * @see SupportedHardwareVersions#getSupportedHardwareVersions() */ - public Builder supportedHardwareVersions(List supportedHardwareVersions) { - this.supportedHardwareVersions = Lists.newArrayList(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions")); + public Builder supportedHardwareVersions(Set 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 supportedHardwareVersions) { + private SupportedHardwareVersions(Set supportedHardwareVersions) { this.supportedHardwareVersions = supportedHardwareVersions; } - @XmlElement(name = "SupportedHardwareVersion") - protected List supportedHardwareVersions; + @XmlElement(name = "SupportedHardwareVersion") + protected Set supportedHardwareVersions = Sets.newLinkedHashSet(); - /** - * Gets the value of the supportedHardwareVersion property. - * - *

- * 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 set method for the supportedHardwareVersion property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSupportedHardwareVersion().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getSupportedHardwareVersions() { - if (supportedHardwareVersions == null) { - supportedHardwareVersions = Lists.newArrayList(); - } - return this.supportedHardwareVersions; - } + /** + * Gets the value of the supportedHardwareVersion property. + */ + public Set 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java index d2a2736ddd..ffbb8c536f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java @@ -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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java index 25219f95d0..a791f8dcd8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java @@ -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. - * + *

*

  * <xs:complexType name="TaskType">
  * 
* * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Task") +@XmlRootElement(name = "Task") public class Task extends EntityType { - - 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 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 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 { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -275,7 +255,7 @@ public class Task extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -290,30 +270,46 @@ public class Task extends EntityType { 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 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 { private Date endTime; @XmlAttribute private Date expiryTime; - + /** * Represents an error information if the task failed. */ @@ -335,10 +331,6 @@ public class Task extends EntityType { 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 { 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 { 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 { 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 { return params; } - public void setParams(Object params) { - this.params = params; - } - /** * The progress of a long running asynchronous task. - * + *

* 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 { return progress; } - public void setProgress(Integer progress) { - this.progress = progress; - } - /** * The execution status of the task. - * + *

* One of: *

    *
  • queued - The task has been queued for execution. @@ -414,10 +386,6 @@ public class Task extends EntityType { 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 { 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 { return operationName; } - public void setOperationName(String operationName) { - this.operationName = operationName; - } - /** * The date and time the system started executing the task. - * + *

    * 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. - * + *

    * 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. - * + *

    * 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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksInProgress.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksInProgress.java index cfda84935e..b3fe5b4d28 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksInProgress.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksInProgress.java @@ -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 tasks = Sets.newLinkedHashSet(); public Set getTasks() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java index d441c86a6f..93a366277e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java @@ -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 { - + 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 { @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 { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -150,7 +141,7 @@ public class TasksList extends EntityType { } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -172,12 +163,12 @@ public class TasksList extends EntityType { // For JAXB and builder use } - protected TasksList(URI href, String name, Set tasks) { - super(href, name); + public TasksList(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, String name, Set 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 tasks = Sets.newLinkedHashSet(); public Set getTasks() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java index 9ec25e2d77..825e2728e6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java @@ -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. + *

    + *

    *

    Java class for UploadVAppTemplateParams complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="UploadVAppTemplateParams">
      *   <complexContent>
    @@ -49,13 +46,10 @@ import com.google.common.base.Objects;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UploadVAppTemplateParams") public class UploadVAppTemplateParams - extends ParamsType + extends ParamsType { @SuppressWarnings("unchecked") @@ -68,7 +62,7 @@ public class UploadVAppTemplateParams } public static class Builder extends ParamsType.Builder { - + 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java index 467f57ad1e..ecfd64f0d1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java @@ -23,24 +23,21 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.net.URI; import java.util.Set; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.google.common.base.Objects; import com.google.common.collect.Sets; /** - * - * Represents users in the vCloud system. - * - * + * Represents users in the vCloud system. + *

    + *

    *

    Java class for User complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="User">
      *   <complexContent>
    @@ -70,45 +67,43 @@ import com.google.common.collect.Sets;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "User", propOrder = { - "fullName", - "emailAddress", - "telephone", - "isEnabled", - "isLocked", - "im", - "nameInSource", - "isAlertEnabled", - "alertEmailPrefix", - "alertEmail", - "isExternal", - "isDefaultCached", - "isGroupRole", - "storedVmQuota", - "deployedVmQuota", - "role", - "password", - "groupReferences" +@XmlRootElement(name = "User") +@XmlType(propOrder = { + "fullName", + "emailAddress", + "telephone", + "isEnabled", + "isLocked", + "im", + "nameInSource", + "isAlertEnabled", + "alertEmailPrefix", + "alertEmail", + "isExternal", + "isDefaultCached", + "isGroupRole", + "storedVmQuota", + "deployedVmQuota", + "role", + "password", + "groupReferences" }) public class User - extends EntityType + extends EntityType { - @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromUser(this); } public static class Builder extends EntityType.Builder { - + private String fullName; private String emailAddress; private String telephone; @@ -153,7 +148,7 @@ public class User } /** - * @see User#getIsEnabled() + * @see User#isEnabled() */ public Builder isEnabled(Boolean isEnabled) { this.isEnabled = isEnabled; @@ -161,7 +156,7 @@ public class User } /** - * @see User#getIsLocked() + * @see User#isLocked() */ public Builder isLocked(Boolean isLocked) { this.isLocked = isLocked; @@ -169,7 +164,7 @@ public class User } /** - * @see User#getIm() + * @see User#getIM() */ public Builder im(String im) { this.im = im; @@ -185,7 +180,7 @@ public class User } /** - * @see User#getIsAlertEnabled() + * @see User#isAlertEnabled() */ public Builder isAlertEnabled(Boolean isAlertEnabled) { this.isAlertEnabled = isAlertEnabled; @@ -209,7 +204,7 @@ public class User } /** - * @see User#getIsExternal() + * @see User#isExternal() */ public Builder isExternal(Boolean isExternal) { this.isExternal = isExternal; @@ -217,7 +212,7 @@ public class User } /** - * @see User#getIsDefaultCached() + * @see User#isDefaultCached() */ public Builder isDefaultCached(Boolean isDefaultCached) { this.isDefaultCached = isDefaultCached; @@ -225,7 +220,7 @@ public class User } /** - * @see User#getIsGroupRole() + * @see User#isGroupRole() */ public Builder isGroupRole(Boolean isGroupRole) { this.isGroupRole = isGroupRole; @@ -274,25 +269,11 @@ public class User public User build() { - User user = new User(im); - user.setFullName(fullName); - user.setEmailAddress(emailAddress); - user.setTelephone(telephone); - user.setIsEnabled(isEnabled); - user.setIsLocked(isLocked); - user.setNameInSource(nameInSource); - user.setIsAlertEnabled(isAlertEnabled); - user.setAlertEmailPrefix(alertEmailPrefix); - user.setAlertEmail(alertEmail); - user.setIsExternal(isExternal); - user.setIsDefaultCached(isDefaultCached); - user.setIsGroupRole(isGroupRole); - user.setStoredVmQuota(storedVmQuota); - user.setDeployedVmQuota(deployedVmQuota); - user.setRole(role); - user.setPassword(password); - user.setGroupReferences(groupReferences); - return user; + return new User(href, type, links, description, tasksInProgress, id, + name, fullName, emailAddress, telephone, isEnabled, isLocked, + im, nameInSource, isAlertEnabled, alertEmailPrefix, alertEmail, + isExternal, isDefaultCached, isGroupRole, storedVmQuota, deployedVmQuota, + role, password, groupReferences); } @@ -333,7 +314,7 @@ public class User } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -342,7 +323,7 @@ public class User } /** - * @see ReferenceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -353,556 +334,327 @@ public class User @Override public Builder fromEntityType(EntityType in) { - return Builder.class.cast(super.fromEntityType(in)); + return Builder.class.cast(super.fromEntityType(in)); } + public Builder fromUser(User in) { return fromEntityType(in) - .fullName(in.getFullName()) - .emailAddress(in.getEmailAddress()) - .telephone(in.getTelephone()) - .isEnabled(in.isEnabled()) - .isLocked(in.isLocked()) - .im(in.getIM()) - .nameInSource(in.getNameInSource()) - .isAlertEnabled(in.isAlertEnabled()) - .alertEmailPrefix(in.getAlertEmailPrefix()) - .alertEmail(in.getAlertEmail()) - .isExternal(in.isExternal()) - .isDefaultCached(in.isDefaultCached()) - .isGroupRole(in.isGroupRole()) - .storedVmQuota(in.getStoredVmQuota()) - .deployedVmQuota(in.getDeployedVmQuota()) - .role(in.getRole()) - .password(in.getPassword()) - .groupReferences(in.getGroupReferences()); + .fullName(in.getFullName()) + .emailAddress(in.getEmailAddress()) + .telephone(in.getTelephone()) + .isEnabled(in.isEnabled()) + .isLocked(in.isLocked()) + .im(in.getIM()) + .nameInSource(in.getNameInSource()) + .isAlertEnabled(in.isAlertEnabled()) + .alertEmailPrefix(in.getAlertEmailPrefix()) + .alertEmail(in.getAlertEmail()) + .isExternal(in.isExternal()) + .isDefaultCached(in.isDefaultCached()) + .isGroupRole(in.isGroupRole()) + .storedVmQuota(in.getStoredVmQuota()) + .deployedVmQuota(in.getDeployedVmQuota()) + .role(in.getRole()) + .password(in.getPassword()) + .groupReferences(in.getGroupReferences()); } } + @XmlElement(name = "FullName") + protected String fullName; + @XmlElement(name = "EmailAddress") + protected String emailAddress; + @XmlElement(name = "Telephone") + protected String telephone; + @XmlElement(name = "IsEnabled") + protected Boolean isEnabled; + @XmlElement(name = "IsLocked") + protected Boolean isLocked; + @XmlElement(name = "IM") + protected String im; + @XmlElement(name = "NameInSource") + protected String nameInSource; + @XmlElement(name = "IsAlertEnabled") + protected Boolean isAlertEnabled; + @XmlElement(name = "AlertEmailPrefix") + protected String alertEmailPrefix; + @XmlElement(name = "AlertEmail") + protected String alertEmail; + @XmlElement(name = "IsExternal") + protected Boolean isExternal; + @XmlElement(name = "IsDefaultCached") + protected Boolean isDefaultCached; + @XmlElement(name = "IsGroupRole") + protected Boolean isGroupRole; + @XmlElement(name = "StoredVmQuota") + protected Integer storedVmQuota; + @XmlElement(name = "DeployedVmQuota") + protected Integer deployedVmQuota; + @XmlElement(name = "Role") + protected Reference role; + @XmlElement(name = "Password") + protected String password; + @XmlElement(name = "GroupReferences") + protected Object /* GroupsList */ groupReferences; + + public User(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, + String name, String fullName, String emailAddress, String telephone, Boolean enabled, Boolean locked, + String im, String nameInSource, Boolean alertEnabled, String alertEmailPrefix, String alertEmail, + Boolean external, Boolean defaultCached, Boolean groupRole, Integer storedVmQuota, Integer deployedVmQuota, + Reference role, String password, Object groupReferences) { + super(href, type, links, description, tasksInProgress, id, name); + this.fullName = fullName; + this.emailAddress = emailAddress; + this.telephone = telephone; + isEnabled = enabled; + isLocked = locked; + this.im = checkNotNull(im, "im"); + this.nameInSource = nameInSource; + isAlertEnabled = alertEnabled; + this.alertEmailPrefix = alertEmailPrefix; + this.alertEmail = alertEmail; + isExternal = external; + isDefaultCached = defaultCached; + isGroupRole = groupRole; + this.storedVmQuota = storedVmQuota; + this.deployedVmQuota = deployedVmQuota; + this.role = role; + this.password = password; + this.groupReferences = groupReferences; + } + private User() { - // For JAXB and builder use - } - - private User(String im) { - this.im = im; + // For JAXB } - @XmlElement(name = "FullName") - protected String fullName; - @XmlElement(name = "EmailAddress") - protected String emailAddress; - @XmlElement(name = "Telephone") - protected String telephone; - @XmlElement(name = "IsEnabled") - protected Boolean isEnabled; - @XmlElement(name = "IsLocked") - protected Boolean isLocked; - @XmlElement(name = "IM") - protected String im; - @XmlElement(name = "NameInSource") - protected String nameInSource; - @XmlElement(name = "IsAlertEnabled") - protected Boolean isAlertEnabled; - @XmlElement(name = "AlertEmailPrefix") - protected String alertEmailPrefix; - @XmlElement(name = "AlertEmail") - protected String alertEmail; - @XmlElement(name = "IsExternal") - protected Boolean isExternal; - @XmlElement(name = "IsDefaultCached") - protected Boolean isDefaultCached; - @XmlElement(name = "IsGroupRole") - protected Boolean isGroupRole; - @XmlElement(name = "StoredVmQuota") - protected Integer storedVmQuota; - @XmlElement(name = "DeployedVmQuota") - protected Integer deployedVmQuota; - @XmlElement(name = "Role") - protected Reference role; - @XmlElement(name = "Password") - protected String password; - @XmlElement(name = "GroupReferences") - protected Object /* GroupsList */ groupReferences; + /** + * Gets the value of the fullName property. + * + * @return possible object is + * {@link String } + */ + public String getFullName() { + return fullName; + } - /** - * Gets the value of the fullName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFullName() { - return fullName; - } + /** + * Gets the value of the emailAddress property. + * + * @return possible object is + * {@link String } + */ + public String getEmailAddress() { + return emailAddress; + } - /** - * Sets the value of the fullName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFullName(String value) { - this.fullName = value; - } + /** + * Gets the value of the telephone property. + * + * @return possible object is + * {@link String } + */ + public String getTelephone() { + return telephone; + } - /** - * Gets the value of the emailAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmailAddress() { - return emailAddress; - } + /** + * Gets the value of the isEnabled property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isEnabled() { + return isEnabled; + } - /** - * Sets the value of the emailAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmailAddress(String value) { - this.emailAddress = value; - } + /** + * Gets the value of the isLocked property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isLocked() { + return isLocked; + } - /** - * Gets the value of the telephone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTelephone() { - return telephone; - } + /** + * Gets the value of the im property. + * + * @return possible object is + * {@link String } + */ + public String getIM() { + return im; + } - /** - * Sets the value of the telephone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTelephone(String value) { - this.telephone = value; - } + /** + * Gets the value of the nameInSource property. + * + * @return possible object is + * {@link String } + */ + public String getNameInSource() { + return nameInSource; + } - /** - * Gets the value of the isEnabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isEnabled() { - return isEnabled; - } + /** + * Gets the value of the isAlertEnabled property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isAlertEnabled() { + return isAlertEnabled; + } - /** - * 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 alertEmailPrefix property. + * + * @return possible object is + * {@link String } + */ + public String getAlertEmailPrefix() { + return alertEmailPrefix; + } - /** - * Gets the value of the isLocked property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isLocked() { - return isLocked; - } + /** + * Gets the value of the alertEmail property. + * + * @return possible object is + * {@link String } + */ + public String getAlertEmail() { + return alertEmail; + } - /** - * Sets the value of the isLocked property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsLocked(Boolean value) { - this.isLocked = value; - } + /** + * Gets the value of the isExternal property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isExternal() { + return isExternal; + } - /** - * Gets the value of the im property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIM() { - return im; - } + /** + * Gets the value of the isDefaultCached property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isDefaultCached() { + return isDefaultCached; + } - /** - * Sets the value of the im property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIM(String value) { - this.im = value; - } + /** + * Gets the value of the isGroupRole property. + * + * @return possible object is + * {@link Boolean } + */ + public Boolean isGroupRole() { + return isGroupRole; + } - /** - * Gets the value of the nameInSource property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameInSource() { - return nameInSource; - } + /** + * Gets the value of the storedVmQuota property. + * + * @return possible object is + * {@link Integer } + */ + public Integer getStoredVmQuota() { + return storedVmQuota; + } - /** - * Sets the value of the nameInSource property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameInSource(String value) { - this.nameInSource = value; - } + /** + * Gets the value of the deployedVmQuota property. + * + * @return possible object is + * {@link Integer } + */ + public Integer getDeployedVmQuota() { + return deployedVmQuota; + } - /** - * Gets the value of the isAlertEnabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isAlertEnabled() { - return isAlertEnabled; - } + /** + * Gets the value of the role property. + * + * @return possible object is + * {@link Reference } + */ + public Reference getRole() { + return role; + } - /** - * Sets the value of the isAlertEnabled property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsAlertEnabled(Boolean value) { - this.isAlertEnabled = value; - } + /** + * Gets the value of the password property. + * + * @return possible object is + * {@link String } + */ + public String getPassword() { + return password; + } - /** - * Gets the value of the alertEmailPrefix property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertEmailPrefix() { - return alertEmailPrefix; - } - - /** - * Sets the value of the alertEmailPrefix property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertEmailPrefix(String value) { - this.alertEmailPrefix = value; - } - - /** - * Gets the value of the alertEmail property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertEmail() { - return alertEmail; - } - - /** - * Sets the value of the alertEmail property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertEmail(String value) { - this.alertEmail = value; - } - - /** - * Gets the value of the isExternal property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isExternal() { - return isExternal; - } - - /** - * Sets the value of the isExternal property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsExternal(Boolean value) { - this.isExternal = value; - } - - /** - * Gets the value of the isDefaultCached property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isDefaultCached() { - return isDefaultCached; - } - - /** - * Sets the value of the isDefaultCached property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefaultCached(Boolean value) { - this.isDefaultCached = value; - } - - /** - * Gets the value of the isGroupRole property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isGroupRole() { - return isGroupRole; - } - - /** - * Sets the value of the isGroupRole property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsGroupRole(Boolean value) { - this.isGroupRole = value; - } - - /** - * Gets the value of the storedVmQuota property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getStoredVmQuota() { - return storedVmQuota; - } - - /** - * Sets the value of the storedVmQuota property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setStoredVmQuota(Integer value) { - this.storedVmQuota = value; - } - - /** - * Gets the value of the deployedVmQuota property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getDeployedVmQuota() { - return deployedVmQuota; - } - - /** - * Sets the value of the deployedVmQuota property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setDeployedVmQuota(Integer value) { - this.deployedVmQuota = value; - } - - /** - * Gets the value of the role property. - * - * @return - * possible object is - * {@link Reference } - * - */ - public Reference getRole() { - return role; - } - - /** - * Sets the value of the role property. - * - * @param value - * allowed object is - * {@link Reference } - * - */ - public void setRole(Reference value) { - this.role = value; - } - - /** - * Gets the value of the password property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPassword() { - return password; - } - - /** - * Sets the value of the password property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPassword(String value) { - this.password = value; - } - - /** - * Gets the value of the groupReferences property. - * - * @return - * possible object is - * {@link GroupsList } - * - */ - public Object /* GroupsList */ getGroupReferences() { - return groupReferences; - } - - /** - * Sets the value of the groupReferences property. - * - * @param value - * allowed object is - * {@link GroupsList } - * - */ - public void setGroupReferences(Object /* GroupsList */ value) { - this.groupReferences = value; - } + /** + * Gets the value of the groupReferences property. + * + * @return possible object is + * {@link GroupsListType } + */ + public Object /* GroupsList */ getGroupReferences() { + return groupReferences; + } @Override public boolean equals(Object o) { if (this == o) - return true; + return true; if (o == null || getClass() != o.getClass()) return false; User that = User.class.cast(o); - return equal(fullName, that.fullName) && - equal(emailAddress, that.emailAddress) && - equal(telephone, that.telephone) && - equal(isEnabled, that.isEnabled) && - equal(isLocked, that.isLocked) && - equal(im, that.im) && - equal(nameInSource, that.nameInSource) && - equal(isAlertEnabled, that.isAlertEnabled) && - equal(alertEmailPrefix, that.alertEmailPrefix) && - equal(alertEmail, that.alertEmail) && - equal(isExternal, that.isExternal) && - equal(isDefaultCached, that.isDefaultCached) && - equal(isGroupRole, that.isGroupRole) && - equal(storedVmQuota, that.storedVmQuota) && - equal(deployedVmQuota, that.deployedVmQuota) && - equal(role, that.role) && - equal(password, that.password) && - equal(groupReferences, that.groupReferences); + return equal(fullName, that.fullName) && + equal(emailAddress, that.emailAddress) && + equal(telephone, that.telephone) && + equal(isEnabled, that.isEnabled) && + equal(isLocked, that.isLocked) && + equal(im, that.im) && + equal(nameInSource, that.nameInSource) && + equal(isAlertEnabled, that.isAlertEnabled) && + equal(alertEmailPrefix, that.alertEmailPrefix) && + equal(alertEmail, that.alertEmail) && + equal(isExternal, that.isExternal) && + equal(isDefaultCached, that.isDefaultCached) && + equal(isGroupRole, that.isGroupRole) && + equal(storedVmQuota, that.storedVmQuota) && + equal(deployedVmQuota, that.deployedVmQuota) && + equal(role, that.role) && + equal(password, that.password) && + equal(groupReferences, that.groupReferences); } @Override public int hashCode() { - return Objects.hashCode(fullName, - emailAddress, - telephone, - isEnabled, - isLocked, - im, - nameInSource, - isAlertEnabled, - alertEmailPrefix, - alertEmail, - isExternal, - isDefaultCached, - isGroupRole, - storedVmQuota, - deployedVmQuota, - role, - password, - groupReferences); + return Objects.hashCode(fullName, + emailAddress, + telephone, + isEnabled, + isLocked, + im, + nameInSource, + isAlertEnabled, + alertEmailPrefix, + alertEmail, + isExternal, + isDefaultCached, + isGroupRole, + storedVmQuota, + deployedVmQuota, + role, + password, + groupReferences); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java index ea90248696..d7a1888e2d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java @@ -1,5 +1,5 @@ package org.jclouds.vcloud.director.v1_5.domain; public class VApp { - // Placeholder for merge + // Placeholder for merge } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java index 2488b79dc7..8843b7d125 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java @@ -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. + *

    + *

    *

    Java class for VAppCreationParams complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="VAppCreationParams">
      *   <complexContent>
    @@ -55,13 +52,10 @@ import com.google.common.base.Objects;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@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> - extends ParamsType + extends ParamsType { public static > Builder builder() { @@ -82,7 +76,7 @@ public class VAppCreationParamsType> } public static class Builder> extends ParamsType.Builder { - + protected Reference vAppParent; protected InstantiationParams instantiationParams; protected Boolean deploy; @@ -105,7 +99,7 @@ public class VAppCreationParamsType> } /** - * @see VAppCreationParamsType#getDeploy() + * @see VAppCreationParamsType#isDeploy() */ public Builder deploy(Boolean deploy) { this.deploy = deploy; @@ -113,7 +107,7 @@ public class VAppCreationParamsType> } /** - * @see VAppCreationParamsType#getPowerOn() + * @see VAppCreationParamsType#isPowerOn() */ public Builder powerOn(Boolean powerOn) { this.powerOn = powerOn; @@ -122,16 +116,9 @@ public class VAppCreationParamsType> public VAppCreationParamsType build() { - VAppCreationParamsType vAppCreationParams = new VAppCreationParamsType(); - vAppCreationParams.setVAppParent(vAppParent); - vAppCreationParams.setInstantiationParams(instantiationParams); - vAppCreationParams.setDeploy(deploy); - vAppCreationParams.setPowerOn(powerOn); - vAppCreationParams.setDescription(description); - vAppCreationParams.setName(name); - return vAppCreationParams; + return new VAppCreationParamsType(description, name, vAppParent, instantiationParams,deploy, powerOn); } - + /** * @see ParamsType#getDescription() */ @@ -154,145 +141,99 @@ public class VAppCreationParamsType> @SuppressWarnings("unchecked") @Override public Builder fromParamsType(ParamsType in) { - return Builder.class.cast(super.fromParamsType(in)); + return Builder.class.cast(super.fromParamsType(in)); } + public Builder fromVAppCreationParamsType(VAppCreationParamsType 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java index d5f4e2642d..8cbb058911 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java @@ -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. + *

    + *

    *

    Java class for VAppNetworkConfiguration complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="VAppNetworkConfiguration">
      *   <complexContent>
    @@ -59,29 +55,24 @@ import com.google.common.collect.Sets;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VAppNetworkConfiguration", propOrder = { - "description", - "configuration", - "isDeployed" + "description", + "configuration", + "isDeployed" }) -public class VAppNetworkConfiguration> - extends ResourceType - -{ +public class VAppNetworkConfiguration> extends ResourceType { public static > Builder builder() { return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromVAppNetworkConfiguration(this); } public static class Builder> extends ResourceType.Builder { - + private String description; private NetworkConfiguration configuration; private Boolean isDeployed; @@ -104,7 +95,7 @@ public class VAppNetworkConfiguration> } /** - * @see VAppNetworkConfiguration#getIsDeployed() + * @see VAppNetworkConfiguration#isDeployed() */ public Builder isDeployed(Boolean isDeployed) { this.isDeployed = isDeployed; @@ -121,15 +112,11 @@ public class VAppNetworkConfiguration> public VAppNetworkConfiguration build() { - VAppNetworkConfiguration vAppNetworkConfiguration = new VAppNetworkConfiguration(); - vAppNetworkConfiguration.setDescription(description); - vAppNetworkConfiguration.setConfiguration(configuration); - vAppNetworkConfiguration.setIsDeployed(isDeployed); - vAppNetworkConfiguration.setNetworkName(networkName); - return vAppNetworkConfiguration; + return new VAppNetworkConfiguration(href, type, links, + description, configuration, isDeployed, networkName); } - + /** * @see ResourceType#getHref() */ @@ -171,147 +158,99 @@ public class VAppNetworkConfiguration> */ @SuppressWarnings("unchecked") public Builder fromResourceType(ResourceType in) { - return Builder.class.cast(super.fromResourceType(in)); + return Builder.class.cast(super.fromResourceType(in)); } + public Builder fromVAppNetworkConfiguration(VAppNetworkConfiguration 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java index cb548b38df..7ff348efc9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java @@ -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; * </complexType> * */ -@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 - -{ - @SuppressWarnings("unchecked") +public class VAppTemplate extends ResourceEntityType { public static Builder builder() { return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromVAppTemplate(this); } public static class Builder extends ResourceEntityType.Builder { private Owner owner; - private VAppTemplateChildren children; - private List sections; + private Set children = Sets.newLinkedHashSet(); + private Set 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 children) { + this.children = checkNotNull(children, "children"); return this; } /** * @see VAppTemplate#getSections() */ - public Builder sections(List sections) { + public Builder sections(Set 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 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 sections; + protected VAppTemplateChildren children = VAppTemplateChildren.builder().build(); + @XmlElementRef + protected Set 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 sections, @Nullable String vAppScopedLocalId, - @Nullable Boolean ovfDescriptorUploaded, @Nullable Boolean goldMaster) { - super(href, name); - this.sections = sections; + private VAppTemplate(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, + String id, String name, FilesList files, Integer status, Owner owner, Set children, Set 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 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 getSections() { - if (sections == null) { - sections = new ArrayList(); - } + public Set 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) && diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java index d08798b220..6a39be85c8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java @@ -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. + *

    + *

    *

    Java class for VAppTemplateChildren complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="VAppTemplateChildren">
      *   <complexContent>
    @@ -53,12 +52,10 @@ import com.google.common.base.Objects;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@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 vm; + private Set vms = Sets.newLinkedHashSet(); /** - * @see VAppTemplateChildren#getVm() + * @see VAppTemplateChildren#getVms() */ - public Builder vm(List vm) { - this.vm = vm; + public Builder vms(Set 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 vm) { + this.vms = ImmutableSet.copyOf(vm); + } + private VAppTemplateChildren() { - // For JAXB and builder use + // For JAXB } - private VAppTemplateChildren(List vm) { - this.vm = vm; + @XmlElement(name = "Vm") + protected Set vms = Sets.newLinkedHashSet(); + + /** + * Gets the value of the vm property. + */ + public Set getVms() { + return this.vms; } - - @XmlElement(name = "Vm") - protected List vm; - - /** - * Gets the value of the vm property. - * - *

    - * 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 set method for the vm property. - * - *

    - * For example, to add a new item, do as follows: - *

    -     *    getVm().add(newItem);
    -     * 
    - * - * - *

    - * Objects of the following type(s) are allowed in the list - * {@link VAppTemplate } - * - * - */ - public List getVm() { - if (vm == null) { - vm = new ArrayList(); - } - 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(); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java index e89ea51350..e10b8702ae 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java @@ -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). + *

    + *

    *

    Java class for Vdc complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="Vdc">
      *   <complexContent>
    @@ -68,41 +64,38 @@ import com.google.common.collect.Sets;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ -@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 + extends EntityType { - @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 { - + 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 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 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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java index 8e9f9f0127..e826eba2ed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java @@ -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" }) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java index a3e79b5afd..38c52a2738 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java @@ -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 { @SuppressWarnings("unchecked") @@ -82,7 +81,7 @@ public class DeploymentOptionSection extends SectionType configurations; - private DeploymentOptionSection(String info, Iterable configurations) { - super(info); - this.configurations = ImmutableSet.copyOf(checkNotNull(configurations, "configurations")); - + private DeploymentOptionSection(@Nullable String info, @Nullable Boolean required, Iterable configurations) { + super(info, required); + this.configurations = ImmutableSet.copyOf(configurations); } private DeploymentOptionSection() { // For JAXB } + public Set getConfigurations() { + return Collections.unmodifiableSet(configurations); + } + @Override public int hashCode() { return Objects.hashCode(super.hashCode(), configurations); @@ -139,9 +149,4 @@ public class DeploymentOptionSection extends SectionType getConfigurations() { - return configurations; - } - } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java index 320e44a81a..674efe6607 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java @@ -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{ public static Builder builder() { return new Builder(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java index 66bd9f6dac..79805f9ecb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java @@ -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 { */ @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 { return Builder.class.cast(super.info(info)); } + /** + * {@inheritDoc} + */ + @Override + public Builder required(Boolean required) { + return Builder.class.cast(super.required(required)); + } + } + @XmlElementRef private Set disks; - private DiskSection(String info, Iterable disks) { - super(info); + private DiskSection(@Nullable String info, @Nullable Boolean required, Iterable disks) { + super(info, required); this.disks = ImmutableSet.copyOf(checkNotNull(disks, "disks")); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java index 4a06c75bce..561a3940f9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java @@ -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 { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java index 3a673266e6..4df71fec5b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java @@ -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(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java index dff0a198ca..9394a34615 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java @@ -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 { @SuppressWarnings("unchecked") @@ -78,7 +75,7 @@ public class NetworkSection extends SectionType { */ @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 { return Builder.class.cast(super.info(info)); } + /** + * {@inheritDoc} + */ + @Override + public Builder required(Boolean required) { + return Builder.class.cast(super.required(required)); + } + } private Set networks; - private NetworkSection(String info, Iterable networks) { - super(info); + private NetworkSection(@Nullable String info, @Nullable Boolean required, Iterable networks) { + super(info, required); this.networks = ImmutableSet. copyOf(checkNotNull(networks, "networks")); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java index a1826c8888..0983bff042 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java @@ -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 { @@ -86,7 +82,7 @@ public class OperatingSystemSection extends SectionType */ @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 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 @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; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java index c27e6015d9..76e9ceb6df 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java @@ -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 { @@ -78,7 +79,7 @@ public class ProductSection extends SectionType { */ @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 { 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 properties; + + private Set properties; - private ProductSection(String info, Iterable properties) { - super(info); - this.properties = ImmutableSet. copyOf(checkNotNull(properties, "properties")); + private ProductSection(@Nullable String info, @Nullable Boolean required, Set properties) { + super(info, required); + this.properties = ImmutableSet.copyOf(checkNotNull(properties, "properties")); } private ProductSection() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java index 2860a9d941..ab64d90500 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java @@ -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() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java index d9efdd6b75..30235d377b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java @@ -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> { public abstract Builder toBuilder(); public static abstract class Builder> { protected String info; - + protected Boolean required; + public abstract SectionType build(); /** - * @see SectionType#getInfo + * @see SectionType#getInfo() */ public Builder info(String info) { this.info = info; return this; } + /** + * @see SectionType#isRequired() + */ + public Builder required(Boolean required) { + this.required = required; + return this; + } public Builder fromSection(SectionType 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> { 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> { 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> { } protected Objects.ToStringHelper string() { - return Objects.toStringHelper("").add("info", info); + return Objects.toStringHelper("").add("info", info).add("required", required); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java index 956ecd031e..ca20e9b228 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java @@ -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 { @@ -111,7 +109,7 @@ public class VirtualHardwareSection extends SectionType */ @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 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 transports; private Set items; - private VirtualHardwareSection(String info, Iterable transports, VirtualSystemSettingData virtualSystem, + private VirtualHardwareSection(@Nullable String info, @Nullable Boolean required, Iterable transports, VirtualSystemSettingData virtualSystem, Iterable items) { - super(info); + super(info, required); this.virtualSystem = virtualSystem; this.transports = ImmutableSet.copyOf(checkNotNull(transports, "transports")); this.items = ImmutableSet.copyOf(checkNotNull(items, "items")); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java index 428ea9731a..beec809be4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java @@ -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 { */ @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 { 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 { } - @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 virtualHardwareSections, Iterable productSections, Multimap additionalSections) { - super(id, info, name, operatingSystem, virtualHardwareSections, productSections, additionalSections); + super(id, info, required, name, operatingSystem, virtualHardwareSections, productSections, additionalSections); } private VirtualSystem() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java index c44bd90bd9..171b73af13 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java @@ -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> extends private Multimap 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 virtualHardwareSections, Iterable productSections, Multimap 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> 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> 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); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/CatalogReferences.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/CatalogReferences.java index 943d320838..dba4c37e9c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/CatalogReferences.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/CatalogReferences.java @@ -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. - * + *

    *

      * <complexType name="QueryResultReferences" />
      * 
    - * + * * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReferences") +@XmlRootElement(name = "CatalogReferences") public class CatalogReferences extends QueryResultReferences { - @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); } @@ -59,22 +55,14 @@ public class CatalogReferences extends QueryResultReferences { @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 references) { + public Builder references(Set references) { this.references = references; return this; } @@ -89,7 +77,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see Container#getName() + * @see CatalogReference#getName() */ @Override public Builder name(String name) { @@ -98,7 +86,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see Container#getPage() + * @see CatalogReference#getPage() */ @Override public Builder page(Integer page) { @@ -107,7 +95,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see Container#getPageSize() + * @see CatalogReference#getPageSize() */ @Override public Builder pageSize(Integer pageSize) { @@ -116,7 +104,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see Container#getTotal() + * @see CatalogReference#getTotal() */ @Override public Builder total(Long total) { @@ -125,7 +113,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see ResourceType#getHref() + * @see CatalogReference#getHref() */ @Override public Builder href(URI href) { @@ -134,7 +122,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see ResourceType#getType() + * @see CatalogReference#getType() */ @Override public Builder type(String type) { @@ -143,7 +131,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see ResourceType#getLinks() + * @see CatalogReference#getLinks() */ @Override public Builder links(Set links) { @@ -152,7 +140,7 @@ public class CatalogReferences extends QueryResultReferences { } /** - * @see ResourceType#getLinks() + * @see CatalogReference#getLinks() */ @Override public Builder link(Link link) { @@ -170,11 +158,11 @@ public class CatalogReferences extends QueryResultReferences { } } + public CatalogReferences(URI href, String type, Set links, String name, Integer page, Integer pageSize, Long total, Set references) { + super(href, type, links, name, page, pageSize, total, references); + } + protected CatalogReferences() { // For JAXB and builder use } - - protected CatalogReferences(URI href) { - super(href); - } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/ContainerType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/ContainerType.java index 90dd0408e9..6ff53f823c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/ContainerType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/ContainerType.java @@ -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. - * + *

    *

      * <complexType name="Container" />
      * 
    @@ -62,7 +61,7 @@ public class ContainerType> extends ResourceType { protected Long total; /** - * @see Container#getName() + * @see ContainerType#getName() */ public Builder name(String name) { this.name = name; @@ -70,7 +69,7 @@ public class ContainerType> extends ResourceType { } /** - * @see Container#getPage() + * @see ContainerType#getPage() */ public Builder page(Integer page) { this.page = page; @@ -78,7 +77,7 @@ public class ContainerType> extends ResourceType { } /** - * @see Container#getPageSize() + * @see ContainerType#getPageSize() */ public Builder pageSize(Integer pageSize) { this.pageSize = pageSize; @@ -86,7 +85,7 @@ public class ContainerType> extends ResourceType { } /** - * @see Container#getTotal() + * @see ContainerType#getTotal() */ public Builder total(Long total) { this.total = total; @@ -95,14 +94,7 @@ public class ContainerType> extends ResourceType { @Override public ContainerType build() { - ContainerType container = new ContainerType(href); - container.setName(name); - container.setPage(page); - container.setPageSize(pageSize); - container.setTotal(total); - container.setType(type); - container.setLinks(links); - return container; + return new ContainerType(href, type, links, name, page, pageSize, total); } /** @@ -151,15 +143,6 @@ public class ContainerType> extends ResourceType { } } - 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> extends ResourceType { @XmlAttribute protected Long total; + public ContainerType(URI href, String type, Set 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> extends ResourceType { 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> extends ResourceType { 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> extends ResourceType { 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> extends ResourceType { return total; } - public void setTotal(Long value) { - this.total = value; - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java index b40238e019..71e934ea95 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java @@ -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. + *

    + *

    *

    Java class for QueryList complex type. - * + *

    *

    The following schema fragment specifies the expected content contained within this class. - * + *

    *

      * <complexType name="QueryList">
      *   <complexContent>
    @@ -41,16 +40,15 @@ import com.google.common.base.Objects.ToStringHelper;
      *   </complexContent>
      * </complexType>
      * 
    - * - * */ @XmlType(name = "QueryList") public class QueryList extends ContainerType { - @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 { @Override public Builder fromContainerType(ContainerType 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 { @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 diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultCatalogRecord.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultCatalogRecord.java index 59f4674843..2f134d5e8e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultCatalogRecord.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultCatalogRecord.java @@ -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. - * + *

    *

      * <complexType name="QueryResultCatalogRecord" />
      * 
    - * + * * @author grkvlt@apache.org */ -@XmlRootElement(name = "CatalogRecord", namespace = VCLOUD_1_5_NS) +@XmlRootElement(name = "CatalogRecord") public class QueryResultCatalogRecord extends QueryResultRecordType { @SuppressWarnings("unchecked") @@ -80,7 +78,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType 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 *
      * <complexType name="QueryResultNetworkRecord" />
      * 
    - * + * * @author grkvlt@apache.org */ public class QueryResultNetworkRecord extends QueryResultRecordType { @@ -146,19 +145,8 @@ public class QueryResultNetworkRecord extends QueryResultRecordType 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 *
      * <complexType name="QueryResultRecordType" />
      * 
    - * + * * @author grkvlt@apache.org */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlSeeAlso({ QueryResultCatalogRecord.class, QueryResultNetworkRecord.class }) +@XmlSeeAlso({QueryResultCatalogRecord.class, QueryResultNetworkRecord.class}) public class QueryResultRecordType> { public static > Builder builder() { @@ -111,11 +102,7 @@ public class QueryResultRecordType> { } public QueryResultRecordType build() { - QueryResultRecordType record = new QueryResultRecordType(href); - record.setId(id); - record.setType(type); - record.setLinks(links); - return record; + return new QueryResultRecordType(links, href, id, type); } public Builder fromQueryResultRecordType(QueryResultRecordType in) { @@ -123,7 +110,7 @@ public class QueryResultRecordType> { } } - @XmlElement(namespace = VCLOUD_1_5_NS, name = "Link") + @XmlElement(name = "Link") private Set links = Sets.newLinkedHashSet(); @XmlAttribute @XmlSchemaType(name = "anyURI") @@ -132,9 +119,13 @@ public class QueryResultRecordType> { private String id; @XmlAttribute private String type; - @XmlAnyAttribute - // XXX not sure about this - private Map otherAttributes = new HashMap(); + + public QueryResultRecordType(Set 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> { return links; } - public void setLinks(Set 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> { * 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> { 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 getOtherAttributes() { - return otherAttributes; - } - @Override public boolean equals(Object o) { if (this == o) @@ -234,7 +195,7 @@ public class QueryResultRecordType> { } 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); + } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultRecords.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultRecords.java index cf440a64e0..978d5c193b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultRecords.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultRecords.java @@ -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. - * + *

    *

      * <complexType name="QueryResultRecords" />
      * 
    - * + * * @author grkvlt@apache.org */ -@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "QueryResultRecords") +@XmlRootElement(name = "QueryResultRecords") public class QueryResultRecords> extends ContainerType> { public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS; @@ -63,13 +61,13 @@ public class QueryResultRecords> extends Cont public static class Builder> extends ContainerType.Builder> { - private List records = Lists.newArrayList(); + private Set records = Sets.newLinkedHashSet(); /** * @see QueryResultRecords#getRecords() */ - public Builder records(List records) { - this.records = records; + public Builder records(Set records) { + this.records = checkNotNull(records, "records"); return this; } @@ -83,15 +81,7 @@ public class QueryResultRecords> extends Cont @Override public QueryResultRecords build() { - QueryResultRecords queryResultRecords = new QueryResultRecords(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(href, type, links, name, page, pageSize, total, records); } /** @@ -131,7 +121,7 @@ public class QueryResultRecords> extends Cont } /** - * @see ResourceType#getHref() + * @see EntityType#getHref() */ @Override public Builder href(URI href) { @@ -140,7 +130,7 @@ public class QueryResultRecords> extends Cont } /** - * @see ResourceType#getType() + * @see EntityType#getType() */ @Override public Builder type(String type) { @@ -149,7 +139,7 @@ public class QueryResultRecords> extends Cont } /** - * @see ResourceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder links(Set links) { @@ -158,7 +148,7 @@ public class QueryResultRecords> extends Cont } /** - * @see ResourceType#getLinks() + * @see EntityType#getLinks() */ @Override public Builder link(Link link) { @@ -176,32 +166,25 @@ public class QueryResultRecords> extends Cont } } - protected QueryResultRecords() { - // For JAXB and builder use + protected QueryResultRecords(URI href, String type, Set links, String name, Integer page, Integer pageSize, Long total, Set 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 records; + private Set records = Sets.newLinkedHashSet(); /** * Set of records representing query results. */ - public List getRecords() { + public Set getRecords() { return records; } - public void setRecords(List 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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultReferences.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultReferences.java index 5241eab9a7..c557d0ca1b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultReferences.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultReferences.java @@ -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. - * + *

    *

      * <complexType name="QueryResultReferences" />
      * 
    - * + * * @author grkvlt@apache.org */ public class QueryResultReferences> extends ContainerType> { @@ -63,13 +61,13 @@ public class QueryResultReferences> extends Container public static class Builder> extends ContainerType.Builder> { - protected List references = Lists.newArrayList(); + protected Set references = Sets.newLinkedHashSet(); /** * @see QueryResultReferences#getReferences() */ - public Builder references(List references) { - this.references = references; + public Builder references(Set references) { + this.references = checkNotNull(references, "references"); return this; } @@ -83,19 +81,11 @@ public class QueryResultReferences> extends Container @Override public QueryResultReferences build() { - QueryResultReferences queryResultReferences = new QueryResultReferences(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(href, type, links, name, page, pageSize, total, references); } /** - * @see Container#getName() + * @see ContainerType#getName() */ @Override public Builder name(String name) { @@ -104,7 +94,7 @@ public class QueryResultReferences> extends Container } /** - * @see Container#getPage() + * @see ContainerType#getPage() */ @Override public Builder page(Integer page) { @@ -113,7 +103,7 @@ public class QueryResultReferences> extends Container } /** - * @see Container#getPageSize() + * @see ContainerType#getPageSize() */ @Override public Builder pageSize(Integer pageSize) { @@ -122,7 +112,7 @@ public class QueryResultReferences> extends Container } /** - * @see Container#getTotal() + * @see ContainerType#getTotal() */ @Override public Builder total(Long total) { @@ -131,7 +121,7 @@ public class QueryResultReferences> extends Container } /** - * @see ResourceType#getHref() + * @see ContainerType#getHref() */ @Override public Builder href(URI href) { @@ -140,7 +130,7 @@ public class QueryResultReferences> extends Container } /** - * @see ResourceType#getType() + * @see ContainerType#getType() */ @Override public Builder type(String type) { @@ -149,7 +139,7 @@ public class QueryResultReferences> extends Container } /** - * @see ResourceType#getLinks() + * @see ContainerType#getLinks() */ @Override public Builder links(Set links) { @@ -158,7 +148,7 @@ public class QueryResultReferences> extends Container } /** - * @see ResourceType#getLinks() + * @see ContainerType#getLinks() */ @Override public Builder link(Link link) { @@ -176,35 +166,28 @@ public class QueryResultReferences> extends Container } } + protected QueryResultReferences(URI href, String type, Set links, String name, Integer page, Integer pageSize, Long total, Set 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 references = Lists.newArrayList(); + private Set references = Sets.newLinkedHashSet(); /** * Set of references representing query results. */ - public List getReferences() { + public Set getReferences() { return references; } - public void setReferences(List 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) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/AbstractVAppType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/AbstractVAppType.java index bfe81d4b1b..7a1e6013f3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/AbstractVAppType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/AbstractVAppType.java @@ -23,15 +23,16 @@ import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType; /** * Represents a base type for VAppType and VmType. - * + *

    *

      * <complexType name="AbstractVAppType" >
      * 
    - * + * * @author grkvlt@apache.org */ -public abstract class AbstractVAppType extends ResourceEntityType { +public abstract class AbstractVAppType> extends ResourceEntityType { + public static abstract class Builder> extends ResourceEntityType.Builder {} // @XmlElement(name = "VAppParent") // protected ReferenceType vAppParent; // @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/VApp.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/VApp.java index 5eead42ddc..23c87fbc48 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/VApp.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/vapp/VApp.java @@ -20,26 +20,28 @@ package org.jclouds.vcloud.director.v1_5.domain.vapp; /** * Represents a vApp. - * + *

    *

      * <complexType name="VApp" />
      * 
    - * + * * @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 { -// +public class VApp extends AbstractVAppType { + // + @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 { + // // 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 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 + } // // //