Update usage of collections of OVF sections

This commit is contained in:
Andrew Donald Kennedy 2012-04-10 13:13:25 +01:00
parent 74b5ef76e7
commit 98f0c51b28
8 changed files with 286 additions and 277 deletions

View File

@ -137,7 +137,7 @@ public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEn
return virtualSystem;
}
public Set<? extends DiskSection> getDiskSections() {
public Set<DiskSection> getDiskSections() {
return diskSections;
}

View File

@ -74,7 +74,7 @@ public abstract class BaseVirtualSystem extends SectionType {
/**
* @see BaseVirtualSystem#getProductSections()
*/
public B productSections(Iterable<? extends ProductSection> productSections) {
public B productSections(Iterable<ProductSection> productSections) {
this.productSections = Sets.newLinkedHashSet(checkNotNull(productSections, "productSections"));
return self();
}
@ -109,9 +109,9 @@ public abstract class BaseVirtualSystem extends SectionType {
@XmlElement(name = "Name")
private String name;
@XmlElement(name = "ProductSection")
private Set<? extends ProductSection> productSections;
private Set<ProductSection> productSections;
@XmlElementRef
private Set<? extends SectionType> additionalSections;
private Set<SectionType> additionalSections;
protected BaseVirtualSystem(Builder<?> builder) {
super(builder);
@ -137,11 +137,11 @@ public abstract class BaseVirtualSystem extends SectionType {
* Specifies product-information for a package, such as product name and version, along with a
* set of properties that can be configured
*/
public Set<? extends ProductSection> getProductSections() {
public Set<ProductSection> getProductSections() {
return productSections;
}
public Set<? extends SectionType> getAdditionalSections() {
public Set<SectionType> getAdditionalSections() {
return additionalSections;
}

View File

@ -21,19 +21,28 @@ 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 java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.DMTFConstants;
import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
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 a base type for VAppType and VmType.
@ -63,7 +72,7 @@ public abstract class AbstractVAppType extends ResourceEntityType {
private Boolean deployed;
private Reference vAppParent;
private List<SectionType> sections = Lists.newArrayList();
private Set<SectionType> sections = Sets.newLinkedHashSet();
/**
* @see AbstractVAppType#isDeployed()
@ -101,7 +110,7 @@ public abstract class AbstractVAppType extends ResourceEntityType {
* @see AbstractVAppType#getSections()
*/
public B sections(Iterable<? extends SectionType> sections) {
this.sections = Lists.newArrayList(checkNotNull(sections, "sections"));
this.sections = Sets.newLinkedHashSet(checkNotNull(sections, "sections"));
return self();
}
@ -109,8 +118,6 @@ public abstract class AbstractVAppType extends ResourceEntityType {
* @see AbstractVAppType#getSections()
*/
public B section(SectionType section) {
if (this.sections == null)
this.sections = Lists.newArrayList();
this.sections.add(checkNotNull(section, "section"));
return self();
}
@ -122,8 +129,26 @@ public abstract class AbstractVAppType extends ResourceEntityType {
@XmlElement(name = "VAppParent")
private Reference vAppParent;
@XmlElementRef(namespace = DMTFConstants.OVF_NS)
private List<? extends SectionType> sections = Lists.newArrayList();
@XmlElementRefs({
@XmlElementRef(type = VirtualHardwareSection.class),
@XmlElementRef(type = LeaseSettingsSection.class),
// @XmlElementRef(type = EulaSection.class),
@XmlElementRef(type = RuntimeInfoSection.class),
// @XmlElementRef(type = AnnotationSection.class),
@XmlElementRef(type = DeploymentOptionSection.class),
@XmlElementRef(type = StartupSection.class),
// @XmlElementRef(type = ResourceAllocationSection.class),
@XmlElementRef(type = NetworkConnectionSection.class),
@XmlElementRef(type = CustomizationSection.class),
@XmlElementRef(type = ProductSection.class),
@XmlElementRef(type = GuestCustomizationSection.class),
@XmlElementRef(type = OperatingSystemSection.class),
@XmlElementRef(type = NetworkConfigSection.class),
@XmlElementRef(type = NetworkSection.class),
// @XmlElementRef(type = InstallSection.class),
@XmlElementRef(type = DiskSection.class)
})
private Set<SectionType> sections = Sets.newLinkedHashSet();
@XmlAttribute
private Boolean deployed;
@ -134,7 +159,7 @@ public abstract class AbstractVAppType extends ResourceEntityType {
protected AbstractVAppType(Builder<?> builder) {
super(builder);
this.vAppParent = builder.vAppParent;
this.sections = builder.sections;
this.sections = builder.sections.isEmpty() ? null : ImmutableSet.copyOf(builder.sections);
this.deployed = builder.deployed;
}
@ -146,32 +171,31 @@ public abstract class AbstractVAppType extends ResourceEntityType {
}
/**
* Specific ovf:Section with additional information for the vApp.
* Specific {@code ovf:Section} with additional information for the vApp.
*
* Objects of the following type(s) are allowed in the list:
* <ul>
* <li>SectionType
* <li>VirtualHardwareSectionType
* <li>LeaseSettingsSectionType
* <li>EulaSectionType
* <li>RuntimeInfoSectionType
* <li>AnnotationSectionType
* <li>DeploymentOptionSectionType
* <li>StartupSectionType
* <li>ResourceAllocationSectionType
* <li>NetworkConnectionSectionType
* <li>CustomizationSectionType
* <li>ProductSectionType
* <li>GuestCustomizationSectionType
* <li>OperatingSystemSectionType
* <li>NetworkConfigSectionType
* <li>NetworkSectionType
* <li>DiskSectionType
* <li>InstallSectionType
* <li>{@link VirtualHardwareSectionType}
* <li>{@link LeaseSettingsSectionType}
* <li>{@link EulaSectionType}
* <li>{@link RuntimeInfoSectionType}
* <li>{@link AnnotationSectionType}
* <li>{@link DeploymentOptionSectionType}
* <li>{@link StartupSectionType}
* <li>{@link ResourceAllocationSectionType}
* <li>{@link NetworkConnectionSectionType}
* <li>{@link CustomizationSectionType}
* <li>{@link ProductSectionType}
* <li>{@link GuestCustomizationSectionType}
* <li>{@link OperatingSystemSectionType}
* <li>{@link NetworkConfigSectionType}
* <li>{@link NetworkSectionType}
* <li>{@link DiskSectionType}
* <li>{@link InstallSectionType}
* </ul>
*/
public List<? extends SectionType> getSections() {
return this.sections;
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
}
/**

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
@ -28,24 +27,26 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Represents the parameters for capturing a vApp to a vApp template.
* <p/>
* <p/>
* <p>Java class for CaptureVAppParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="CaptureVAppParams">
* &lt;complexContent>
@ -82,7 +83,7 @@ public class CaptureVAppParams extends ParamsType {
public static abstract class Builder<B extends Builder<B>> extends ParamsType.Builder<B> {
private Reference source;
private Set<? extends SectionType> sections = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
/**
* @see CaptureVAppParams#getSource()
@ -105,8 +106,16 @@ public class CaptureVAppParams extends ParamsType {
/**
* @see CaptureVAppParams#getSections()
*/
public B sections(Set<? extends SectionType> sections) {
this.sections = checkNotNull(sections, "sections");
public B section(SectionType section) {
this.sections.add(checkNotNull(section, "section"));
return self();
}
/**
* @see CaptureVAppParams#getSections()
*/
public B sections(Iterable<? extends SectionType> sections) {
this.sections = Sets.newLinkedHashSet(checkNotNull(sections, "sections"));
return self();
}
@ -125,7 +134,7 @@ public class CaptureVAppParams extends ParamsType {
private CaptureVAppParams(Builder<?> builder) {
super(builder);
this.source = builder.source;
this.sections = builder.sections;
this.sections = builder.sections.isEmpty() ? null : ImmutableSet.copyOf(builder.sections);
}
private CaptureVAppParams() {
@ -138,46 +147,60 @@ public class CaptureVAppParams extends ParamsType {
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElementRef
protected Set<? extends SectionType> sections = Sets.newLinkedHashSet();
@XmlElementRefs({
@XmlElementRef(type = VirtualHardwareSection.class),
@XmlElementRef(type = LeaseSettingsSection.class),
// @XmlElementRef(type = EulaSection.class),
@XmlElementRef(type = RuntimeInfoSection.class),
// @XmlElementRef(type = AnnotationSection.class),
@XmlElementRef(type = DeploymentOptionSection.class),
@XmlElementRef(type = StartupSection.class),
// @XmlElementRef(type = ResourceAllocationSection.class),
@XmlElementRef(type = NetworkConnectionSection.class),
@XmlElementRef(type = CustomizationSection.class),
@XmlElementRef(type = ProductSection.class),
@XmlElementRef(type = GuestCustomizationSection.class),
@XmlElementRef(type = OperatingSystemSection.class),
@XmlElementRef(type = NetworkConfigSection.class),
@XmlElementRef(type = NetworkSection.class),
// @XmlElementRef(type = InstallSection.class),
@XmlElementRef(type = DiskSection.class)
})
protected Set<SectionType> sections = Sets.newLinkedHashSet();
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
return source;
}
/**
* An ovf:Section to configure the captured vAppTemplate.
* An {@code ovf:Section} to configure the captured vAppTemplate.
*
* Gets the value of the section property.
*
* Objects of the following type(s) are allowed in the list
* {@link SectionType }
* {@link VirtualHardwareSection }
* {@link LeaseSettingsSection }
* {@link EulaSection }
* {@link RuntimeInfoSection }
* {@link AnnotationSection }
* {@link DeploymentOptionSection }
* {@link StartupSection }
* {@link ResourceAllocationSection }
* {@link NetworkConnectionSection }
* {@link CustomizationSection }
* {@link ProductSection }
* {@link GuestCustomizationSection }
* {@link OperatingSystemSection }
* {@link NetworkConfigSection }
* {@link NetworkSection }
* {@link DiskSection }
* {@link InstallSection }
* Objects of the following type(s) are allowed in the list:
* <ul>
* <li>{@link VirtualHardwareSectionType}
* <li>{@link LeaseSettingsSectionType}
* <li>{@link EulaSectionType}
* <li>{@link RuntimeInfoSectionType}
* <li>{@link AnnotationSectionType}
* <li>{@link DeploymentOptionSectionType}
* <li>{@link StartupSectionType}
* <li>{@link ResourceAllocationSectionType}
* <li>{@link NetworkConnectionSectionType}
* <li>{@link CustomizationSectionType}
* <li>{@link ProductSectionType}
* <li>{@link GuestCustomizationSectionType}
* <li>{@link OperatingSystemSectionType}
* <li>{@link NetworkConfigSectionType}
* <li>{@link NetworkSectionType}
* <li>{@link DiskSectionType}
* <li>{@link InstallSectionType}
* </ul>
*/
public Set<? extends SectionType> getSections() {
return Collections.unmodifiableSet(this.sections);
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
}
@Override
@ -187,8 +210,8 @@ public class CaptureVAppParams extends ParamsType {
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

View File

@ -21,20 +21,31 @@ 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.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Represents a list of ovf:Section to configure for instantiating a VApp.
* Represents a list of {@code ovf:Section} to configure for instantiating a VApp.
*
* @author grkvlt@apache.org
* @see <a href="http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/types/InstantiationParamsType.html">
@ -43,7 +54,7 @@ import com.google.common.collect.Sets;
*/
@XmlRootElement(name = "InstantiationParams")
@XmlType(name = "InstantiationParamsType")
public class InstantiationParams {
public class InstantiationParams implements Set<SectionType> {
public static Builder builder() {
return new Builder();
@ -87,18 +98,35 @@ public class InstantiationParams {
}
private InstantiationParams(Set<? extends SectionType> sections) {
this.sections = ImmutableSet.copyOf(sections);
this.sections = sections.isEmpty() ? null : ImmutableSet.copyOf(sections);
}
@XmlElementRef
protected Set<? extends SectionType> sections = Sets.newLinkedHashSet();
@XmlElementRefs({
@XmlElementRef(type = VirtualHardwareSection.class),
@XmlElementRef(type = LeaseSettingsSection.class),
// @XmlElementRef(type = EulaSection.class),
@XmlElementRef(type = RuntimeInfoSection.class),
// @XmlElementRef(type = AnnotationSection.class),
@XmlElementRef(type = DeploymentOptionSection.class),
@XmlElementRef(type = StartupSection.class),
// @XmlElementRef(type = ResourceAllocationSection.class),
@XmlElementRef(type = NetworkConnectionSection.class),
@XmlElementRef(type = CustomizationSection.class),
@XmlElementRef(type = ProductSection.class),
@XmlElementRef(type = GuestCustomizationSection.class),
@XmlElementRef(type = OperatingSystemSection.class),
@XmlElementRef(type = NetworkConfigSection.class),
@XmlElementRef(type = NetworkSection.class),
// @XmlElementRef(type = InstallSection.class),
@XmlElementRef(type = DiskSection.class)
})
protected Set<SectionType> sections = Sets.newLinkedHashSet();
/**
* An {@code ovf:Section} to configure for instantiation.
*
* Objects of the following type(s) are allowed in the list
* Objects of the following type(s) are allowed in the list:
* <ul>
* <li>{@link SectionType}
* <li>{@link VirtualHardwareSection}
* <li>{@link LeaseSettingsSection}
* <li>{@link EulaSection}
@ -118,8 +146,8 @@ public class InstantiationParams {
* <li>{@link InstallSection}
* </ul>
*/
public Set<? extends SectionType> getSections() {
return sections;
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
}
@Override
@ -141,4 +169,81 @@ public class InstantiationParams {
public String toString() {
return Objects.toStringHelper("").add("sections", sections).toString();
}
/**
* The delegate always returns a {@link Set} even if {@link #sections} is {@literal null}.
*
* The delegated {@link Set} is used by the methods implementing its interface.
* <p>
* NOTE Annoying lack of multiple inheritance for using ForwardingList!
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private Set<SectionType> delegate() {
return (Set) getSections();
}
@Override
public boolean add(SectionType arg0) {
return delegate().add(arg0);
}
@Override
public boolean addAll(Collection<? extends SectionType> arg0) {
return delegate().addAll(arg0);
}
@Override
public void clear() {
delegate().clear();
}
@Override
public boolean contains(Object arg0) {
return delegate().contains(arg0);
}
@Override
public boolean containsAll(Collection<?> arg0) {
return delegate().containsAll(arg0);
}
@Override
public boolean isEmpty() {
return delegate().isEmpty();
}
@Override
public Iterator<SectionType> iterator() {
return delegate().iterator();
}
@Override
public boolean remove(Object arg0) {
return delegate().remove(arg0);
}
@Override
public boolean removeAll(Collection<?> arg0) {
return delegate().removeAll(arg0);
}
@Override
public boolean retainAll(Collection<?> arg0) {
return delegate().retainAll(arg0);
}
@Override
public int size() {
return delegate().size();
}
@Override
public Object[] toArray() {
return delegate().toArray();
}
@Override
public <T> T[] toArray(T[] arg0) {
return delegate().toArray(arg0);
}
}

View File

@ -28,8 +28,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection;
@ -69,7 +69,7 @@ public class VAppTemplate extends ResourceEntityType {
public static abstract class Builder<B extends Builder<B>> extends ResourceEntityType.Builder<B> {
private Owner owner;
private Set<VAppTemplate> children = Sets.newLinkedHashSet();
private Set<? extends SectionType> sections = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded;
private Boolean goldMaster;
@ -85,16 +85,16 @@ public class VAppTemplate extends ResourceEntityType {
/**
* @see VAppTemplate#getChildren()
*/
public B children(Set<VAppTemplate> children) {
this.children = checkNotNull(children, "children");
public B children(Iterable<VAppTemplate> children) {
this.children = Sets.newLinkedHashSet(checkNotNull(children, "children"));
return self();
}
/**
* @see VAppTemplate#getSections()
*/
public B sections(Set<? extends SectionType> sections) {
this.sections = checkNotNull(sections, "sections");
public B sections(Iterable<? extends SectionType> sections) {
this.sections = Sets.newLinkedHashSet(checkNotNull(sections, "sections"));
return self();
}
@ -140,10 +140,10 @@ public class VAppTemplate extends ResourceEntityType {
@XmlElement(name = "Owner")
private Owner owner;
@XmlElement(name = "Children")
private VAppTemplateChildren children = VAppTemplateChildren.builder().build();
@XmlElementWrapper(name = "Children")
@XmlElement(name = "Vm")
private Set<VAppTemplate> children = Sets.newLinkedHashSet();
@XmlElementRefs({
@XmlElementRef(type = SectionType.class),
@XmlElementRef(type = VirtualHardwareSection.class),
@XmlElementRef(type = LeaseSettingsSection.class),
// @XmlElementRef(type = EulaSection.class),
@ -162,7 +162,7 @@ public class VAppTemplate extends ResourceEntityType {
// @XmlElementRef(type = InstallSection.class),
@XmlElementRef(type = DiskSection.class)
})
private Set<? extends SectionType> sections = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
@XmlElement(name = "VAppScopedLocalId")
private String vAppScopedLocalId;
@XmlAttribute
@ -173,8 +173,8 @@ public class VAppTemplate extends ResourceEntityType {
protected VAppTemplate(Builder<?> builder) {
super(builder);
this.owner = builder.owner;
this.children = VAppTemplateChildren.builder().vms(builder.children).build();
this.sections = ImmutableSet.copyOf(builder.sections);
this.children = builder.children.isEmpty() ? Collections.<VAppTemplate>emptySet() : ImmutableSet.copyOf(builder.children);
this.sections = builder.sections.isEmpty() ? null : ImmutableSet.copyOf(builder.sections);
this.vAppScopedLocalId = builder.vAppScopedLocalId;
this.ovfDescriptorUploaded = builder.ovfDescriptorUploaded;
this.goldMaster = builder.goldMaster;
@ -186,9 +186,6 @@ public class VAppTemplate extends ResourceEntityType {
/**
* Gets the value of the owner property.
*
* @return possible object is
* {@link Owner }
*/
public Owner getOwner() {
return owner;
@ -196,47 +193,41 @@ public class VAppTemplate extends ResourceEntityType {
/**
* Gets the value of the children property.
*
* @return possible object is
* {@link VAppTemplateChildren }
*/
public Set<VAppTemplate> getChildren() {
return children.getVms();
return children;
}
/**
* Contains ovf sections for vApp template.
* Gets the value of the section property.
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link SectionType }
* {@link VirtualHardwareSection }
* {@link LeaseSettingsSection }
* {@link EulaSection }
* {@link RuntimeInfoSection }
* {@link AnnotationSection }
* {@link DeploymentOptionSection }
* {@link StartupSection }
* {@link ResourceAllocationSection }
* {@link NetworkConnectionSection }
* {@link CustomizationSection }
* {@link ProductSection }
* {@link GuestCustomizationSection }
* {@link OperatingSystemSection }
* {@link NetworkConfigSection }
* {@link NetworkSection }
* {@link DiskSection }
* {@link InstallSection }
*
* Objects of the following type(s) are allowed in the list:
* <ul>
* <li>{@link VirtualHardwareSectionType}
* <li>{@link LeaseSettingsSectionType}
* <li>{@link EulaSectionType}
* <li>{@link RuntimeInfoSectionType}
* <li>{@link AnnotationSectionType}
* <li>{@link DeploymentOptionSectionType}
* <li>{@link StartupSectionType}
* <li>{@link ResourceAllocationSectionType}
* <li>{@link NetworkConnectionSectionType}
* <li>{@link CustomizationSectionType}
* <li>{@link ProductSectionType}
* <li>{@link GuestCustomizationSectionType}
* <li>{@link OperatingSystemSectionType}
* <li>{@link NetworkConfigSectionType}
* <li>{@link NetworkSectionType}
* <li>{@link DiskSectionType}
* <li>{@link InstallSectionType}
* </ul>
*/
public Set<? extends SectionType> getSections() {
return Collections.unmodifiableSet(this.sections);
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
}
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return possible object is
* {@link String }
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
@ -244,9 +235,6 @@ public class VAppTemplate extends ResourceEntityType {
/**
* Gets the value of the ovfDescriptorUploaded property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isOvfDescriptorUploaded() {
return ovfDescriptorUploaded;
@ -254,9 +242,6 @@ public class VAppTemplate extends ResourceEntityType {
/**
* Gets the value of the goldMaster property.
*
* @return possible object is
* {@link Boolean }
*/
public boolean isGoldMaster() {
if (goldMaster == null) {

View File

@ -1,132 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Represents vApp template children.
* <p/>
* <p/>
* <p>Java class for VAppTemplateChildren complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="VAppTemplateChildren">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Vm" type="{http://www.vmware.com/vcloud/v1.5}VAppTemplateType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "Children")
@XmlType(propOrder = {
"vms"
})
public class VAppTemplateChildren {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVAppTemplateChildren(this);
}
public static class Builder {
private Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/**
* @see VAppTemplateChildren#getVms()
*/
public Builder vms(Set<VAppTemplate> vms) {
this.vms = checkNotNull(vms, "vms");
return this;
}
public VAppTemplateChildren build() {
return new VAppTemplateChildren(vms);
}
public Builder fromVAppTemplateChildren(VAppTemplateChildren in) {
return vms(in.getVms());
}
}
private VAppTemplateChildren(Set<VAppTemplate> vm) {
this.vms = ImmutableSet.copyOf(vm);
}
private VAppTemplateChildren() {
// For JAXB
}
@XmlElement(name = "Vm")
protected Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/**
* Gets the value of the vm property.
*/
public Set<VAppTemplate> getVms() {
return Collections.unmodifiableSet(this.vms);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppTemplateChildren that = VAppTemplateChildren.class.cast(o);
return equal(vms, that.vms);
}
@Override
public int hashCode() {
return Objects.hashCode(vms);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("vms", vms).toString();
}
}

View File

@ -33,6 +33,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import java.io.IOException;
import java.net.URI;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -68,8 +69,11 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VAppNetworkConfiguration;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.xml.internal.JAXBParser;
import org.testng.annotations.Test;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
/**