Merge pull request #403 from aplowe/master

Issue 830: vCloud Director vAppTemplate tests and fixing clients so they take URIs
This commit is contained in:
Adrian Cole 2012-03-06 10:17:28 -08:00
commit ac045496c1
133 changed files with 5402 additions and 1220 deletions

View File

@ -43,6 +43,7 @@ import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.Difference;
import org.custommonkey.xmlunit.DifferenceConstants;
import org.custommonkey.xmlunit.DifferenceListener;
import org.custommonkey.xmlunit.NodeDetail;
import org.custommonkey.xmlunit.XMLUnit;
import org.jclouds.Constants;
import org.jclouds.concurrent.MoreExecutors;
@ -378,12 +379,21 @@ public abstract class BaseRestClientExpectTest<S> {
Diff diff = XMLUnit.compareXML(Strings2.toStringAndClose(a.getPayload().getInput()),
Strings2.toStringAndClose(b.getPayload().getInput()));
// Ignoring xsi:schemaLocation and differences in namespace prefixes
// Ignoring whitespace in elements that have other children, xsi:schemaLocation and differences in namespace prefixes
diff.overrideDifferenceListener(new DifferenceListener() {
@Override
public int differenceFound(Difference difference) {
if (difference.getId() == DifferenceConstants.SCHEMA_LOCATION_ID ||
difference.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.SCHEMA_LOCATION_ID ||
diff.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
if (diff.getId() == DifferenceConstants.TEXT_VALUE_ID) {
for (NodeDetail detail : ImmutableSet.of(diff.getControlNodeDetail(), diff.getTestNodeDetail())) {
if (detail.getNode().getParentNode().getChildNodes().getLength() < 2 ||
!detail.getValue().trim().isEmpty()) {
return RETURN_ACCEPT_DIFFERENCE;
}
}
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;

View File

@ -109,21 +109,21 @@ public class VCloudDirectorMediaType {
public static final String VAPP_TEMPLATE = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.customizationSection+xml";
public static final String GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.guestCustomizationSection+xml";
public static final String NETWORK_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_SECTION = "application/vnd.vmware.vcloud.networkSection+xml";
public static final String NETWORK_CONFIG_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_CONFIG_SECTION = "application/vnd.vmware.vcloud.networkConfigSection+xml";
public static final String NETWORK_CONNECTION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_CONNECTION_SECTION = "application/vnd.vmware.vcloud.networkConnectionSection+xml";
public static final String PRODUCT_SECTION_LIST = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String PRODUCT_SECTION_LIST = "application/vnd.vmware.vcloud.productSection+xml";
public static final String RELOCATE_TEMPLATE = "application/vnd.vmware.vcloud.relocateTemplate+xml";
public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leastSettingsSection+xml";
public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leaseSettingsSection+xml";
public static final String ENVELOPE = "application/vnd.???";

View File

@ -23,11 +23,13 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -98,7 +100,7 @@ public class AvailableNetworks {
protected Set<Reference> networks = Sets.newLinkedHashSet();
private AvailableNetworks(Set<Reference> networks) {
this.networks = networks;
this.networks = ImmutableSet.copyOf(networks);
}
private AvailableNetworks() {
@ -109,7 +111,7 @@ public class AvailableNetworks {
* Gets the value of the network property.
*/
public Set<Reference> getNetworks() {
return this.networks;
return Collections.unmodifiableSet(this.networks);
}
@Override

View File

@ -119,7 +119,7 @@ public class CapacityType<T extends CapacityType<T>> {
}
protected CapacityType() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Units", required = true)

View File

@ -135,7 +135,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
}
private CapacityWithUsage() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Used")

View File

@ -22,8 +22,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
@ -101,12 +102,10 @@ public class CaptureVAppParams
return this;
}
public CaptureVAppParams build() {
return new CaptureVAppParams(description, name, source, sections);
}
@Override
public Builder fromParamsType(ParamsType<CaptureVAppParams> in) {
return Builder.class.cast(super.fromParamsType(in));
@ -126,14 +125,13 @@ public class CaptureVAppParams
}
private CaptureVAppParams() {
// For JAXB and builder use
// for JAXB
}
private CaptureVAppParams(Set<? extends Section<?>> sections) {
this.sections = ImmutableSet.copyOf(sections);
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElementRef
@ -151,44 +149,31 @@ public class CaptureVAppParams
/**
* An ovf:Section to configure the captured vAppTemplate.
*
* Gets the value of the section property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
*
* 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 >}
* {@link Section }
* {@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 }
*/
public Set<? extends Section<?>> getSections() {
return this.sections;
return Collections.unmodifiableSet(this.sections);
}
@Override

View File

@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -173,11 +174,11 @@ public class CatalogItem extends EntityType<CatalogItem> {
private CatalogItem(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Reference entity, Set<Property> properties) {
super(href, type, links, description, tasksInProgress, id, name);
this.entity = entity;
this.properties = properties;
this.properties = ImmutableSet.copyOf(properties);
}
private CatalogItem() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Entity", required = true)

View File

@ -32,6 +32,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -86,11 +87,11 @@ public class CatalogItems {
}
private CatalogItems() {
// For JAXB and builder use
// For JAXB
}
private CatalogItems(Set<Reference> catalogItems) {
this.catalogItems = catalogItems;
this.catalogItems = ImmutableSet.copyOf(catalogItems);
}
@XmlElement(name = "CatalogItem")

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -62,16 +63,8 @@ public class CatalogsList {
/**
* @see CatalogsList#getCatalogItems()
*/
public Builder catalogs(Collection<Reference> catalogReferences) {
this.catalogReferences = Sets.newLinkedHashSet(checkNotNull(catalogReferences, "catalogReferences"));
return this;
}
/**
* @see CatalogsList#getCatalogItems()
*/
public Builder catalog(Reference catalog) {
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
public Builder catalogs(Set<Reference> catalogReferences) {
this.catalogReferences = checkNotNull(catalogReferences, "catalogReferences");
return this;
}
@ -85,7 +78,7 @@ public class CatalogsList {
}
private CatalogsList() {
// For JAXB and builder use
// for JAXB
}
private CatalogsList(Set<Reference> tasks) {
@ -99,7 +92,7 @@ public class CatalogsList {
* Gets the value of the catalogReferences property.
*/
public Set<Reference> getCatalogItems() {
return this.catalogReferences;
return Collections.unmodifiableSet(this.catalogReferences);
}
@Override

View File

@ -129,7 +129,7 @@ public class CloneMediaParams
}
private CloneMediaParams() {
// For JAXB and builder use
// for JAXB
}

View File

@ -44,10 +44,8 @@ import com.google.common.base.Objects;
*/
@XmlType(name = "CloneVAppParams")
public class CloneVAppParams
extends InstantiateVAppParamsType<CloneVAppParams>
extends InstantiateVAppParamsType<CloneVAppParams> {
{
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -58,10 +56,8 @@ public class CloneVAppParams
public static class Builder extends InstantiateVAppParamsType.Builder<CloneVAppParams> {
public CloneVAppParams build() {
CloneVAppParams cloneVAppParams = new CloneVAppParams();
return cloneVAppParams;
return new CloneVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
}
/**
@ -97,7 +93,7 @@ public class CloneVAppParams
}
/**
* @see VAppCreationParamsType#getDeploy()
* @see VAppCreationParamsType#isDeploy()
*/
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
@ -105,7 +101,7 @@ public class CloneVAppParams
}
/**
* @see VAppCreationParamsType#getPowerOn()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
@ -121,7 +117,7 @@ public class CloneVAppParams
}
/**
* @see InstantiateVAppParamsType#getIsSourceDelete()
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete);
@ -129,7 +125,7 @@ public class CloneVAppParams
}
/**
* @see InstantiateVAppParamsType#getLinkedClone()
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone);
@ -146,28 +142,12 @@ public class CloneVAppParams
}
}
private CloneVAppParams(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);
}
private CloneVAppParams() {
// For JAXB and builder use
// For JAXB
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
CloneVAppParams that = CloneVAppParams.class.cast(o);
return super.equals(that);
}
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode("");
}
@Override
public String toString() {
return Objects.toStringHelper("").toString();
}
}

View File

@ -111,7 +111,7 @@ public class CloneVAppTemplateParams
}
private CloneVAppTemplateParams() {
// For JAXB and builder use
// for JAXB
}

View File

@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -57,7 +58,7 @@ import com.google.common.collect.Sets;
* </pre>
*/
@XmlType(name = "ComposeVAppParams", propOrder = {
"sourcedItem",
"sourcedItems",
"allEULAsAccepted"
})
@XmlSeeAlso({
@ -78,15 +79,15 @@ public class ComposeVAppParams
public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> {
private Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
private Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
private Boolean allEULAsAccepted;
private Boolean linkedClone;
/**
* @see ComposeVAppParams#getSourcedItem()
* @see ComposeVAppParams#getSourcedItems()
*/
public Builder sourcedItem(Set<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = checkNotNull(sourcedItem, "sourcedItem");
public Builder sourcedItems(Set<SourcedCompositionItemParam> sourcedItems) {
this.sourcedItems = checkNotNull(sourcedItems, "sourcedItems");
return this;
}
@ -109,7 +110,7 @@ public class ComposeVAppParams
public ComposeVAppParams build() {
return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn,
sourcedItem, allEULAsAccepted, linkedClone);
sourcedItems, allEULAsAccepted, linkedClone);
}
@ -120,27 +121,27 @@ public class ComposeVAppParams
public Builder fromComposeVAppParams(ComposeVAppParams in) {
return fromVAppCreationParamsType(in)
.sourcedItem(in.getSourcedItem())
.sourcedItems(in.getSourcedItems())
.allEULAsAccepted(in.isAllEULAsAccepted())
.linkedClone(in.isLinkedClone());
}
}
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItem, Boolean allEULAsAccepted, Boolean linkedClone) {
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItems, Boolean allEULAsAccepted, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.sourcedItem = ImmutableSet.copyOf(sourcedItem);
this.sourcedItems = ImmutableSet.copyOf(sourcedItems);
this.allEULAsAccepted = allEULAsAccepted;
this.linkedClone = linkedClone;
}
private ComposeVAppParams() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "SourcedItem")
protected Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
protected Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
@ -148,26 +149,9 @@ public class ComposeVAppParams
/**
* Gets the value of the sourcedItem property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the sourcedItem property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSourcedItem().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link SourcedCompositionItemParam }
*/
public Set<SourcedCompositionItemParam> getSourcedItem() {
return this.sourcedItem;
public Set<SourcedCompositionItemParam> getSourcedItems() {
return Collections.unmodifiableSet(this.sourcedItems);
}
/**
@ -201,14 +185,14 @@ public class ComposeVAppParams
if (o == null || getClass() != o.getClass())
return false;
ComposeVAppParams that = ComposeVAppParams.class.cast(o);
return equal(sourcedItem, that.sourcedItem) &&
return equal(sourcedItems, that.sourcedItems) &&
equal(allEULAsAccepted, that.allEULAsAccepted) &&
equal(linkedClone, that.linkedClone);
}
@Override
public int hashCode() {
return Objects.hashCode(sourcedItem,
return Objects.hashCode(sourcedItems,
allEULAsAccepted,
linkedClone);
}
@ -216,7 +200,7 @@ public class ComposeVAppParams
@Override
public String toString() {
return Objects.toStringHelper("")
.add("sourcedItem", sourcedItem)
.add("sourcedItem", sourcedItems)
.add("allEULAsAccepted", allEULAsAccepted)
.add("linkedClone", linkedClone).toString();
}

View File

@ -99,7 +99,7 @@ public class ComputeCapacity {
}
private ComputeCapacity() {
// For JAXB and builder use
// for JAXB
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -187,7 +188,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
* Gets the value of the links property.
*/
public Set<Link> getLinks() {
return this.links;
return Collections.unmodifiableSet(this.links);
}
/**

View File

@ -0,0 +1,172 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents a DHCP network service.
*
* <p>Java class for DhcpService complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DhcpService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="DefaultLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="MaxLeaseTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="IpRange" type="{http://www.vmware.com/vcloud/v1.5}IpRangeType" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
* @author Adam Lowe
*/
@XmlRootElement(name = "DhcpService")
@XmlType(propOrder = {
"defaultLeaseTime",
"maxLeaseTime",
"ipRange"
})
public class DhcpService extends NetworkServiceType<DhcpService> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromDhcpService(this);
}
public static class Builder extends NetworkServiceType.Builder<DhcpService> {
private int defaultLeaseTime;
private int maxLeaseTime;
private IpRange ipRange;
public Builder defaultLeaseTime(int defaultLeaseTime) {
this.defaultLeaseTime = defaultLeaseTime;
return this;
}
public Builder maxLeaseTime(int maxLeaseTime) {
this.maxLeaseTime = maxLeaseTime;
return this;
}
public Builder ipRange(IpRange ipRange) {
this.ipRange = ipRange;
return this;
}
public DhcpService build() {
return new DhcpService(isEnabled, defaultLeaseTime, maxLeaseTime, ipRange);
}
public Builder fromDhcpService(DhcpService in) {
return fromNetworkService(in).defaultLeaseTime(in.getDefaultLeaseTime()).maxLeaseTime(in.getMaxLeaseTime())
.ipRange(in.getIpRange());
}
public Builder fromNetworkService(NetworkServiceType<DhcpService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
@Override
public Builder enabled(boolean enabled) {
this.isEnabled = enabled;
return this;
}
}
@XmlElement(name = "DefaultLeaseTime")
private int defaultLeaseTime;
@XmlElement(name = "MaxLeaseTime")
private int maxLeaseTime;
@XmlElement(name = "IpRange")
private IpRange ipRange;
private DhcpService(boolean enabled, int defaultLeaseTime, int maxLeaseTime, IpRange ipRange) {
super(enabled);
this.defaultLeaseTime = defaultLeaseTime;
this.maxLeaseTime = maxLeaseTime;
this.ipRange = ipRange;
}
private DhcpService() {
// for JAXB
}
/**
* @return default lease in seconds for DHCP addresses.
*/
public int getDefaultLeaseTime() {
return defaultLeaseTime;
}
/**
* @return Max lease in seconds for DHCP addresses.
*/
public int getMaxLeaseTime() {
return maxLeaseTime;
}
/**
* @return IP range for DHCP addresses.
*/
public IpRange getIpRange() {
return ipRange;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
DhcpService that = DhcpService.class.cast(o);
return super.equals(that)
&& equal(defaultLeaseTime, that.defaultLeaseTime)
&& equal(maxLeaseTime, that.maxLeaseTime)
&& equal(ipRange, that.ipRange);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), defaultLeaseTime, maxLeaseTime, ipRange);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("defaultLeastTime", defaultLeaseTime).add("maxLeaseTime", maxLeaseTime).add("ipRange", ipRange);
}
}

View File

@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@ -97,7 +98,7 @@ public class FilesList {
}
private FilesList() {
// For JAXB and builder use
// for JAXB
}
private FilesList(List<File> files) {
@ -112,7 +113,7 @@ public class FilesList {
* Gets the value of the file property.
*/
public List<File> getFiles() {
return this.files;
return Collections.unmodifiableList(this.files);
}
@Override

View File

@ -0,0 +1,392 @@
/**
* 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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents a firewall rule.
* <p/>
* <p/>
* <p>Java class for FirewallRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="FirewallRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Protocols" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice>
* &lt;sequence>
* &lt;element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/choice>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="Port" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="DestinationIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
* &lt;element name="SourcePort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="SourceIp" type="{http://www.vmware.com/vcloud/v1.5}FirewallIpAddressType"/>
* &lt;element name="Direction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="EnableLogging" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "FirewallRule", propOrder = {
"isEnabled",
"description",
"policy",
"protocols",
"port",
"destinationIp",
"sourcePort",
"sourceIp",
"direction",
"enableLogging"
})
public class FirewallRule {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromFirewallRule(this);
}
public static class Builder {
private Boolean isEnabled;
private String description;
private String policy;
private FirewallRuleProtocols protocols;
private Integer port;
private String destinationIp;
private Integer sourcePort;
private String sourceIp;
private String direction;
private Boolean enableLogging;
/**
* @see FirewallRule#isEnabled()
*/
public Builder isEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* @see FirewallRule#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see FirewallRule#getPolicy()
*/
public Builder policy(String policy) {
this.policy = policy;
return this;
}
/**
* @see FirewallRule#getProtocols()
*/
public Builder protocols(FirewallRuleProtocols protocols) {
this.protocols = protocols;
return this;
}
/**
* @see FirewallRule#getPort()
*/
public Builder port(int port) {
this.port = port;
return this;
}
/**
* @see FirewallRule#getDestinationIp()
*/
public Builder destinationIp(String destinationIp) {
this.destinationIp = destinationIp;
return this;
}
/**
* @see FirewallRule#getSourcePort()
*/
public Builder sourcePort(int sourcePort) {
this.sourcePort = sourcePort;
return this;
}
/**
* @see FirewallRule#getSourceIp()
*/
public Builder sourceIp(String sourceIp) {
this.sourceIp = sourceIp;
return this;
}
/**
* @see FirewallRule#getDirection()
*/
public Builder direction(String direction) {
this.direction = direction;
return this;
}
/**
* @see FirewallRule#isEnableLogging()
*/
public Builder enableLogging(Boolean enableLogging) {
this.enableLogging = enableLogging;
return this;
}
public FirewallRule build() {
return new FirewallRule(
isEnabled, description, policy, protocols, port, destinationIp, sourcePort, sourceIp, direction, enableLogging);
}
public Builder fromFirewallRule(FirewallRule in) {
return isEnabled(in.isEnabled())
.description(in.getDescription())
.policy(in.getPolicy())
.protocols(in.getProtocols())
.port(in.getPort())
.destinationIp(in.getDestinationIp())
.sourcePort(in.getSourcePort())
.sourceIp(in.getSourceIp())
.direction(in.getDirection())
.enableLogging(in.isEnableLogging());
}
}
private FirewallRule(Boolean enabled, String description, String policy, FirewallRuleProtocols protocols, Integer port,
String destinationIp, Integer sourcePort, String sourceIp, String direction, Boolean enableLogging) {
isEnabled = enabled;
this.description = description;
this.policy = policy;
this.protocols = protocols;
this.port = port;
this.destinationIp = destinationIp;
this.sourcePort = sourcePort;
this.sourceIp = sourceIp;
this.direction = direction;
this.enableLogging = enableLogging;
}
private FirewallRule() {
// For JAXB
}
@XmlElement(name = "IsEnabled")
protected Boolean isEnabled;
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "Policy")
protected String policy;
@XmlElement(name = "Protocols")
protected FirewallRuleProtocols protocols;
@XmlElement(name = "Port")
protected Integer port;
@XmlElement(name = "DestinationIp", required = true)
protected String destinationIp;
@XmlElement(name = "SourcePort")
protected Integer sourcePort;
@XmlElement(name = "SourceIp", required = true)
protected String sourceIp;
@XmlElement(name = "Direction")
protected String direction;
@XmlElement(name = "EnableLogging")
protected Boolean enableLogging;
/**
* Gets the value of the isEnabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isEnabled() {
return isEnabled;
}
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
}
/**
* Gets the value of the policy property.
*
* @return possible object is
* {@link String }
*/
public String getPolicy() {
return policy;
}
/**
* Gets the value of the protocols property.
*
* @return possible object is
* {@link FirewallRuleProtocols }
*/
public FirewallRuleProtocols getProtocols() {
return protocols;
}
/**
* Gets the value of the port property.
*/
public int getPort() {
return port;
}
/**
* Gets the value of the destinationIp property.
*
* @return possible object is
* {@link String }
*/
public String getDestinationIp() {
return destinationIp;
}
/**
* Gets the value of the sourcePort property.
*/
public int getSourcePort() {
return sourcePort;
}
/**
* Gets the value of the sourceIp property.
*
* @return possible object is
* {@link String }
*/
public String getSourceIp() {
return sourceIp;
}
/**
* Gets the value of the direction property.
*
* @return possible object is
* {@link String }
*/
public String getDirection() {
return direction;
}
/**
* Gets the value of the enableLogging property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isEnableLogging() {
return enableLogging;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
FirewallRule that = FirewallRule.class.cast(o);
return equal(isEnabled, that.isEnabled) &&
equal(description, that.description) &&
equal(policy, that.policy) &&
equal(protocols, that.protocols) &&
equal(port, that.port) &&
equal(destinationIp, that.destinationIp) &&
equal(sourcePort, that.sourcePort) &&
equal(sourceIp, that.sourceIp) &&
equal(direction, that.direction) &&
equal(enableLogging, that.enableLogging);
}
@Override
public int hashCode() {
return Objects.hashCode(isEnabled,
description,
policy,
protocols,
port,
destinationIp,
sourcePort,
sourceIp,
direction,
enableLogging);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("isEnabled", isEnabled)
.add("description", description)
.add("policy", policy)
.add("protocols", protocols)
.add("port", port)
.add("destinationIp", destinationIp)
.add("sourcePort", sourcePort)
.add("sourceIp", sourceIp)
.add("direction", direction)
.add("enableLogging", enableLogging).toString();
}
}

View File

@ -0,0 +1,190 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* <p>Java class for anonymous complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice>
* &lt;sequence>
* &lt;element name="Tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Udp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;element name="Icmp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="Any" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/choice>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(propOrder = {
"tcp",
"udp",
"icmp",
"any"
})
public class FirewallRuleProtocols {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromProtocols(this);
}
public static class Builder {
private Boolean tcp;
private Boolean udp;
private Boolean icmp;
private Boolean any;
public Builder tcp(Boolean tcp) {
this.tcp = tcp;
return this;
}
public Builder udp(Boolean udp) {
this.udp = udp;
return this;
}
public Builder icmp(Boolean icmp) {
this.icmp = icmp;
return this;
}
public Builder any(Boolean any) {
this.any = any;
return this;
}
public Builder fromProtocols(FirewallRuleProtocols in) {
return tcp(in.isTcp()).udp(in.isUdp()).icmp(in.isIcmp()).any(in.isAny());
}
public FirewallRuleProtocols build() {
return new FirewallRuleProtocols(tcp, udp, icmp, any);
}
}
@XmlElement(name = "Tcp")
private Boolean tcp;
@XmlElement(name = "Udp")
private Boolean udp;
@XmlElement(name = "Icmp")
private Boolean icmp;
@XmlElement(name = "Any")
private Boolean any;
private FirewallRuleProtocols(Boolean tcp, Boolean udp, Boolean icmp, Boolean any) {
this.tcp = tcp;
this.udp = udp;
this.icmp = icmp;
this.any = any;
}
private FirewallRuleProtocols() {
// for JAXB
}
/**
* Gets the value of the tcp property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isTcp() {
return tcp;
}
/**
* Gets the value of the udp property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isUdp() {
return udp;
}
/**
* Gets the value of the icmp property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isIcmp() {
return icmp;
}
/**
* Gets the value of the any property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isAny() {
return any;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
FirewallRuleProtocols that = FirewallRuleProtocols.class.cast(o);
return equal(tcp, that.tcp) &&
equal(udp, that.udp) &&
equal(icmp, that.icmp) &&
equal(any, that.any);
}
@Override
public int hashCode() {
return Objects.hashCode(tcp, udp, icmp, any);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("tcp", tcp)
.add("udp", udp)
.add("icmp", icmp)
.add("any", any).toString();
}
}

View File

@ -0,0 +1,201 @@
/**
* 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 a network firewall service.
* <p/>
* <p/>
* <p>Java class for FirewallService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="FirewallService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="DefaultAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="LogDefaultAction" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="FirewallRule" type="{http://www.vmware.com/vcloud/v1.5}FirewallRuleType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "FirewallService")
@XmlType(propOrder = {
"defaultAction",
"logDefaultAction",
"firewallRules"
})
public class FirewallService extends NetworkServiceType<FirewallService> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromFirewallService(this);
}
public static class Builder extends NetworkServiceType.Builder<FirewallService> {
private String defaultAction;
private Boolean logDefaultAction;
private Set<FirewallRule> firewallRules = Sets.newLinkedHashSet();
/**
* @see FirewallService#getDefaultAction()
*/
public Builder defaultAction(String defaultAction) {
this.defaultAction = defaultAction;
return this;
}
/**
* @see FirewallService#isLogDefaultAction()
*/
public Builder logDefaultAction(Boolean logDefaultAction) {
this.logDefaultAction = logDefaultAction;
return this;
}
/**
* @see FirewallService#getFirewallRules()
*/
public Builder firewallRules(Set<FirewallRule> firewallRules) {
this.firewallRules = checkNotNull(firewallRules, "firewallRules");
return this;
}
public FirewallService build() {
return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<FirewallService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
public Builder fromFirewallService(FirewallService in) {
return fromNetworkServiceType(in)
.defaultAction(in.getDefaultAction())
.logDefaultAction(in.isLogDefaultAction())
.firewallRules(in.getFirewallRules());
}
@Override
public Builder enabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
}
private FirewallService(boolean enabled, String defaultAction, Boolean logDefaultAction, Set<FirewallRule> firewallRules) {
super(enabled);
this.defaultAction = defaultAction;
this.logDefaultAction = logDefaultAction;
this.firewallRules = ImmutableSet.copyOf(firewallRules);
}
private FirewallService() {
// for JAXB
}
@XmlElement(name = "DefaultAction")
protected String defaultAction;
@XmlElement(name = "LogDefaultAction")
protected Boolean logDefaultAction;
@XmlElement(name = "FirewallRule")
protected Set<FirewallRule> firewallRules = Sets.newLinkedHashSet();
/**
* Gets the value of the defaultAction property.
*
* @return possible object is
* {@link String }
*/
public String getDefaultAction() {
return defaultAction;
}
/**
* Gets the value of the logDefaultAction property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isLogDefaultAction() {
return logDefaultAction;
}
/**
* Gets the value of the firewallRule property.
*/
public Set<FirewallRule> getFirewallRules() {
return Collections.unmodifiableSet(this.firewallRules);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
FirewallService that = FirewallService.class.cast(o);
return equal(defaultAction, that.defaultAction) &&
equal(logDefaultAction, that.logDefaultAction) &&
equal(firewallRules, that.firewallRules);
}
@Override
public int hashCode() {
return Objects.hashCode(defaultAction,
logDefaultAction,
firewallRules);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("defaultAction", defaultAction)
.add("logDefaultAction", logDefaultAction)
.add("firewallRules", firewallRules).toString();
}
}

View File

@ -237,7 +237,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink()
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLinks()
*/
public Builder links(Set<Link> links) {
this.links = checkNotNull(links, "links");
@ -285,7 +285,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
.resetPasswordRequired(in.isResetPasswordRequired())
.customizationScript(in.getCustomizationScript())
.computerName(in.getComputerName())
.links(in.getLink())
.links(in.getLinks())
.href(in.getHref())
.type(in.getType());
}
@ -341,7 +341,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
}
private GuestCustomizationSection() {
// For JAXB and builder use
// for JAXB
}
@ -528,7 +528,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public Set<Link> getLink() {
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
}

View File

@ -137,7 +137,7 @@ public class InstantiateVAppParams
}
protected InstantiateVAppParams() {
// For JAXB and builder use
// for JAXB
}
@Override

View File

@ -171,7 +171,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
}
public InstantiateVAppParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
protected 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;
@ -180,16 +180,16 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
}
protected InstantiateVAppParamsType() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Source", required = true)
protected Reference source;
private Reference source;
@XmlElement(name = "IsSourceDelete")
protected Boolean isSourceDelete;
private Boolean isSourceDelete;
@XmlAttribute
protected Boolean linkedClone;
private Boolean linkedClone;
/**
* Gets the value of the source property.

View File

@ -148,7 +148,7 @@ public class InstantiateVAppTemplateParams
}
private InstantiateVAppTemplateParams() {
// For JAXB and builder use
// for JAXB
}

View File

@ -22,10 +22,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
@ -97,7 +96,7 @@ public class InstantiationParams {
}
private InstantiationParams() {
// For JAXB and builder use
// for JAXB
}
private InstantiationParams(Set<? extends SectionType<?>> sections) {
@ -105,7 +104,7 @@ public class InstantiationParams {
}
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
@XmlElementRef
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
@ -113,42 +112,28 @@ public class InstantiationParams {
* <p/>
* Gets the value of the section property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
* {@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 >}
* {@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 org.jclouds.ovf.OperatingSystemSection }
* {@link NetworkConfigSection }
* {@link NetworkSection }
* {@link DiskSection }
* {@link InstallSection }
*/
public Set<? extends SectionType<?>> getSections() {
return this.sections;
return Collections.unmodifiableSet(this.sections);
}
@Override

View File

@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -74,7 +75,7 @@ public class IpAddresses {
}
private IpAddresses() {
// For JAXB and builder use
// for JAXB
}
private IpAddresses(Set<String> orgs) {
@ -85,7 +86,7 @@ public class IpAddresses {
private Set<String> ipAddresses = Sets.newLinkedHashSet();
public Set<String> getIpAddresses() {
return ImmutableSet.copyOf(ipAddresses);
return Collections.unmodifiableSet(ipAddresses);
}
@Override

View File

@ -72,7 +72,7 @@ public class IpRange {
}
private IpRange() {
// For JAXB and builder use
// for JAXB
}
private IpRange(String startAddress, String endAddress) {

View File

@ -21,8 +21,10 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects;
@ -74,18 +76,18 @@ public class IpRanges {
}
private IpRanges() {
// For JAXB and builder use
// for JAXB
}
private IpRanges(Set<IpRange> ipRanges) {
this.ipRanges = ImmutableSet.copyOf(ipRanges);
}
@XmlElementRef
@XmlElement(name = "IpRange")
private Set<IpRange> ipRanges = Sets.newLinkedHashSet();
public Set<IpRange> getIpRanges() {
return ImmutableSet.copyOf(ipRanges);
return Collections.unmodifiableSet(ipRanges);
}
@Override

View File

@ -132,7 +132,7 @@ public class IpScope {
}
private IpScope() {
// For JAXB and builder use
// For JAXB
}
public IpScope(boolean inherited, String gateway, String netmask, String dns1, String dns2, String dnsSuffix,

View File

@ -0,0 +1,93 @@
/**
* 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 javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Gives more details of local peer end point.
*
*
* <p>Java class for IpsecVpnLocalPeer complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="IpsecVpnLocalPeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlRootElement(name = "IpsecVpnLocalPeer")
public class IpsecVpnLocalPeer
extends IpsecVpnManagedPeerType<IpsecVpnLocalPeer>
{
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnLocalPeer(this);
}
public static class Builder extends IpsecVpnManagedPeerType.Builder<IpsecVpnLocalPeer> {
public IpsecVpnLocalPeer build() {
return new IpsecVpnLocalPeer(id, name);
}
@Override
public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<IpsecVpnLocalPeer> in) {
return Builder.class.cast(super.fromIpsecVpnManagedPeerType(in));
}
public Builder fromIpsecVpnLocalPeer(IpsecVpnLocalPeer in) {
return fromIpsecVpnManagedPeerType(in);
}
@Override
public Builder id(String id) {
return Builder.class.cast(super.id(id));
}
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
}
private IpsecVpnLocalPeer(String id, String name) {
super(id, name);
}
private IpsecVpnLocalPeer() {
// For JAXB
}
}

View File

@ -0,0 +1,111 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.google.common.base.Objects;
/**
*/
@XmlSeeAlso(
IpsecVpnLocalPeer.class
)
public abstract class IpsecVpnManagedPeerType<T extends IpsecVpnManagedPeerType<T>> extends IpsecVpnPeerType<T> {
public static abstract class Builder<T extends IpsecVpnManagedPeerType<T>> {
protected String id;
protected String name;
/**
* @see IpRange#getStartAddress()
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see IpRange#getEndAddress()
*/
public Builder name(String name) {
this.name = name;
return this;
}
public Builder<T> fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<T> in) {
return id(in.getId()).name(in.getName());
}
}
@XmlElement(name = "Id", required = true)
protected String id;
@XmlElement(name = "Name", required = true)
protected String name;
protected IpsecVpnManagedPeerType(String id, String name) {
this.id = id;
this.name = name;
}
protected IpsecVpnManagedPeerType() {
// for JAXB
}
/**
* @return id of peer network
*/
public String getId() {
return id;
}
/**
* @return the name of the peer network
*/
public String getName() {
return name;
}
@Override
public int hashCode() {
return Objects.hashCode(id, name);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
IpsecVpnManagedPeerType<?> that = IpsecVpnManagedPeerType.class.cast(o);
return equal(id, that.id) && equal(name, that.name);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("id", id).add("name", name);
}
}

View File

@ -16,25 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions;
package org.jclouds.vcloud.director.v1_5.domain;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* @author danikov
*/
public class URISupplierToEndpoint implements Function<Object, URI> {
@Override
public URI apply(Object input) {
Preconditions.checkNotNull(input);
Preconditions.checkArgument(input instanceof URISupplier);
URISupplier provider = (URISupplier) input;
return provider.getURI();
};
@XmlSeeAlso({
IpsecVpnLocalPeer.class,
IpsecVpnRemotePeer.class,
IpsecVpnThirdPartyPeer.class
})
public abstract class IpsecVpnPeerType<T extends IpsecVpnPeerType<T>> {
}

View File

@ -0,0 +1,205 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Gives more details of remote peer end point.
* <p/>
* <p/>
* <p>Java class for IpsecVpnRemotePeer complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnRemotePeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnManagedPeerType">
* &lt;sequence>
* &lt;element name="VcdUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VcdOrganization" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VcdUsername" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "IpsecVpnRemotePeer")
@XmlType(propOrder = {
"vcdUrl",
"vcdOrganization",
"vcdUsername"
})
public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType<IpsecVpnRemotePeer> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnRemotePeer(this);
}
public static class Builder extends IpsecVpnManagedPeerType.Builder<IpsecVpnRemotePeer> {
private String vcdUrl;
private String vcdOrganization;
private String vcdUsername;
/**
* @see IpsecVpnRemotePeer#getVcdUrl()
*/
public Builder vcdUrl(String vcdUrl) {
this.vcdUrl = vcdUrl;
return this;
}
/**
* @see IpsecVpnRemotePeer#getVcdOrganization()
*/
public Builder vcdOrganization(String vcdOrganization) {
this.vcdOrganization = vcdOrganization;
return this;
}
/**
* @see IpsecVpnRemotePeer#getVcdUsername()
*/
public Builder vcdUsername(String vcdUsername) {
this.vcdUsername = vcdUsername;
return this;
}
public IpsecVpnRemotePeer build() {
return new IpsecVpnRemotePeer(id, name, vcdUrl, vcdOrganization, vcdUsername);
}
@Override
public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<IpsecVpnRemotePeer> in) {
return Builder.class.cast(super.fromIpsecVpnManagedPeerType(in));
}
public Builder fromIpsecVpnRemotePeer(IpsecVpnRemotePeer in) {
return fromIpsecVpnManagedPeerType(in)
.vcdUrl(in.getVcdUrl())
.vcdOrganization(in.getVcdOrganization())
.vcdUsername(in.getVcdUsername());
}
@Override
public Builder id(String id) {
return Builder.class.cast(super.id(id));
}
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
}
private IpsecVpnRemotePeer(String id, String name, String vcdUrl, String vcdOrganization, String vcdUsername) {
super(id, name);
this.vcdUrl = vcdUrl;
this.vcdOrganization = vcdOrganization;
this.vcdUsername = vcdUsername;
}
private IpsecVpnRemotePeer() {
// for JAXB
}
@XmlElement(name = "VcdUrl", required = true)
protected String vcdUrl;
@XmlElement(name = "VcdOrganization", required = true)
protected String vcdOrganization;
@XmlElement(name = "VcdUsername", required = true)
protected String vcdUsername;
/**
* Gets the value of the vcdUrl property.
*
* @return possible object is
* {@link String }
*/
public String getVcdUrl() {
return vcdUrl;
}
/**
* Gets the value of the vcdOrganization property.
*
* @return possible object is
* {@link String }
*/
public String getVcdOrganization() {
return vcdOrganization;
}
/**
* Gets the value of the vcdUsername property.
*
* @return possible object is
* {@link String }
*/
public String getVcdUsername() {
return vcdUsername;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
IpsecVpnRemotePeer that = IpsecVpnRemotePeer.class.cast(o);
return super.equals(that)
&& equal(vcdUrl, that.vcdUrl)
&& equal(vcdOrganization, that.vcdOrganization)
&& equal(vcdUsername, that.vcdUsername);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(),
vcdUrl,
vcdOrganization,
vcdUsername);
}
@Override
protected Objects.ToStringHelper string() {
return super.string()
.add("vcdUrl", vcdUrl)
.add("vcdOrganization", vcdOrganization)
.add("vcdUsername", vcdUsername);
}
}

View File

@ -0,0 +1,204 @@
/**
* 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.List;
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.ImmutableList;
import com.google.common.collect.Lists;
/**
* Represents an IPSec-VPN network service.
* <p/>
* <p/>
* <p>Java class for IpsecVpnService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="PublicIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="IpsecVpnTunnel" type="{http://www.vmware.com/vcloud/v1.5}IpsecVpnTunnelType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "IpsecVpnService")
@XmlType(propOrder = {
"externalIpAddress",
"publicIpAddress",
"ipsecVpnTunnels"
})
public class IpsecVpnService extends NetworkServiceType<IpsecVpnService> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnService(this);
}
public static class Builder extends NetworkServiceType.Builder<IpsecVpnService> {
private String externalIpAddress;
private String publicIpAddress;
private List<IpsecVpnTunnel> ipsecVpnTunnels;
/**
* @see IpsecVpnService#getExternalIpAddress()
*/
public Builder externalIpAddress(String externalIpAddress) {
this.externalIpAddress = externalIpAddress;
return this;
}
/**
* @see IpsecVpnService#getPublicIpAddress()
*/
public Builder publicIpAddress(String publicIpAddress) {
this.publicIpAddress = publicIpAddress;
return this;
}
/**
* @see IpsecVpnService#getIpsecVpnTunnels()
*/
public Builder ipsecVpnTunnels(List<IpsecVpnTunnel> ipsecVpnTunnels) {
this.ipsecVpnTunnels = checkNotNull(ipsecVpnTunnels, "ipsecVpnTunnels");
return this;
}
public IpsecVpnService build() {
return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<IpsecVpnService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
public Builder fromIpsecVpnService(IpsecVpnService in) {
return fromNetworkServiceType(in)
.externalIpAddress(in.getExternalIpAddress())
.publicIpAddress(in.getPublicIpAddress())
.ipsecVpnTunnels(in.getIpsecVpnTunnels());
}
@Override
public Builder enabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
}
private IpsecVpnService(boolean enabled, String externalIpAddress, String publicIpAddress, List<IpsecVpnTunnel> ipsecVpnTunnel) {
super(enabled);
this.externalIpAddress = externalIpAddress;
this.publicIpAddress = publicIpAddress;
this.ipsecVpnTunnels = ImmutableList.copyOf(ipsecVpnTunnel);
}
private IpsecVpnService() {
// for JAXB
}
@XmlElement(name = "ExternalIpAddress")
protected String externalIpAddress;
@XmlElement(name = "PublicIpAddress")
protected String publicIpAddress;
@XmlElement(name = "IpsecVpnTunnel")
protected List<IpsecVpnTunnel> ipsecVpnTunnels = Lists.newArrayList();
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the publicIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getPublicIpAddress() {
return publicIpAddress;
}
/**
* Gets the value of the ipsecVpnTunnel property.
*/
public List<IpsecVpnTunnel> getIpsecVpnTunnels() {
return Collections.unmodifiableList(this.ipsecVpnTunnels);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
IpsecVpnService that = IpsecVpnService.class.cast(o);
return super.equals(that) &&
equal(externalIpAddress, that.externalIpAddress) &&
equal(publicIpAddress, that.publicIpAddress) &&
equal(ipsecVpnTunnels, that.ipsecVpnTunnels);
}
@Override
public int hashCode() {
return Objects.hashCode(
super.hashCode(),
externalIpAddress,
publicIpAddress,
ipsecVpnTunnels);
}
@Override
protected Objects.ToStringHelper string() {
return super.string()
.add("externalIpAddress", externalIpAddress)
.add("publicIpAddress", publicIpAddress)
.add("ipsecVpnTunnels", ipsecVpnTunnels);
}
}

View File

@ -0,0 +1,68 @@
/**
* 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 javax.xml.bind.annotation.XmlRootElement;
/**
*
* Gives more details of third party peer end point.
*
*
* <p>Java class for IpsecVpnThirdPartyPeer complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="IpsecVpnThirdPartyPeer">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}IpsecVpnUnmanagedPeerType">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlRootElement(name = "IpsecVpnThirdPartyPeer")
public class IpsecVpnThirdPartyPeer extends IpsecVpnUnmanagedPeerType<IpsecVpnThirdPartyPeer> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnThirdPartyPeer(this);
}
public static class Builder {
public IpsecVpnThirdPartyPeer build() {
return new IpsecVpnThirdPartyPeer();
}
public Builder fromIpsecVpnThirdPartyPeer(IpsecVpnThirdPartyPeer in) {
return new Builder();
}
}
private IpsecVpnThirdPartyPeer() {
// for JAXB
}
}

View File

@ -0,0 +1,401 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents details of an IPSec-VPN tunnel.
* <p/>
* <p/>
* <p>Java class for IpsecVpnTunnel complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="IpsecVpnTunnel">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element ref="{http://www.vmware.com/vcloud/v1.5}IpsecVpnPeer"/>
* &lt;element name="PeerIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="PeerNetworkAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="PeerNetworkMask" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="SharedSecret" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="EncryptionProtocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Mtu" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="IsOperational" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="ErrorDetails" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "IpsecVpnTunnel", propOrder = {
"name",
"description",
"ipsecVpnPeer",
"peerIpAddress",
"peerNetworkAddress",
"peerNetworkMask",
"sharedSecret",
"encryptionProtocol",
"mtu",
"isEnabled",
"isOperational",
"errorDetails"
})
public class IpsecVpnTunnel {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromIpsecVpnTunnel(this);
}
public static class Builder {
private String name;
private String description;
private IpsecVpnPeerType<?> ipsecVpnPeer;
private String peerIpAddress;
private String peerNetworkAddress;
private String peerNetworkMask;
private String sharedSecret;
private String encryptionProtocol;
private int mtu;
private boolean isEnabled;
private Boolean isOperational;
private String errorDetails;
/**
* @see IpsecVpnTunnel#getName()
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see IpsecVpnTunnel#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see IpsecVpnTunnel#getIpsecVpnPeer()
*/
public Builder ipsecVpnPeer(IpsecVpnPeerType<?> ipsecVpnPeer) {
this.ipsecVpnPeer = ipsecVpnPeer;
return this;
}
/**
* @see IpsecVpnTunnel#getPeerIpAddress()
*/
public Builder peerIpAddress(String peerIpAddress) {
this.peerIpAddress = peerIpAddress;
return this;
}
/**
* @see IpsecVpnTunnel#getPeerNetworkAddress()
*/
public Builder peerNetworkAddress(String peerNetworkAddress) {
this.peerNetworkAddress = peerNetworkAddress;
return this;
}
/**
* @see IpsecVpnTunnel#getPeerNetworkMask()
*/
public Builder peerNetworkMask(String peerNetworkMask) {
this.peerNetworkMask = peerNetworkMask;
return this;
}
/**
* @see IpsecVpnTunnel#getSharedSecret()
*/
public Builder sharedSecret(String sharedSecret) {
this.sharedSecret = sharedSecret;
return this;
}
/**
* @see IpsecVpnTunnel#getEncryptionProtocol()
*/
public Builder encryptionProtocol(String encryptionProtocol) {
this.encryptionProtocol = encryptionProtocol;
return this;
}
/**
* @see IpsecVpnTunnel#getMtu()
*/
public Builder mtu(int mtu) {
this.mtu = mtu;
return this;
}
/**
* @see IpsecVpnTunnel#isEnabled()
*/
public Builder isEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* @see IpsecVpnTunnel#isOperational()
*/
public Builder isOperational(Boolean isOperational) {
this.isOperational = isOperational;
return this;
}
/**
* @see IpsecVpnTunnel#getErrorDetails()
*/
public Builder errorDetails(String errorDetails) {
this.errorDetails = errorDetails;
return this;
}
public IpsecVpnTunnel build() {
return new IpsecVpnTunnel
(name, description, ipsecVpnPeer, peerIpAddress, peerNetworkAddress, peerNetworkMask, sharedSecret,
encryptionProtocol, mtu, isEnabled, isOperational, errorDetails);
}
public Builder fromIpsecVpnTunnel(IpsecVpnTunnel in) {
return name(in.getName())
.description(in.getDescription())
.peerIpAddress(in.getPeerIpAddress())
.peerNetworkAddress(in.getPeerNetworkAddress())
.peerNetworkMask(in.getPeerNetworkMask())
.sharedSecret(in.getSharedSecret())
.encryptionProtocol(in.getEncryptionProtocol())
.mtu(in.getMtu())
.isEnabled(in.isEnabled())
.isOperational(in.isOperational())
.errorDetails(in.getErrorDetails());
}
}
private IpsecVpnTunnel(String name, String description, IpsecVpnPeerType<?> ipsecVpnPeer, String peerIpAddress,
String peerNetworkAddress, String peerNetworkMask, String sharedSecret, String encryptionProtocol, int mtu, boolean enabled, Boolean operational, String errorDetails) {
this.name = name;
this.description = description;
this.ipsecVpnPeer = ipsecVpnPeer;
this.peerIpAddress = peerIpAddress;
this.peerNetworkAddress = peerNetworkAddress;
this.peerNetworkMask = peerNetworkMask;
this.sharedSecret = sharedSecret;
this.encryptionProtocol = encryptionProtocol;
this.mtu = mtu;
isEnabled = enabled;
isOperational = operational;
this.errorDetails = errorDetails;
}
private IpsecVpnTunnel() {
// for JAXB
}
@XmlElement(name = "Name", required = true)
protected String name;
@XmlElement(name = "Description")
protected String description;
@XmlElementRef
protected IpsecVpnPeerType<?> ipsecVpnPeer;
@XmlElement(name = "PeerIpAddress", required = true)
protected String peerIpAddress;
@XmlElement(name = "PeerNetworkAddress", required = true)
protected String peerNetworkAddress;
@XmlElement(name = "PeerNetworkMask", required = true)
protected String peerNetworkMask;
@XmlElement(name = "SharedSecret", required = true)
protected String sharedSecret;
@XmlElement(name = "EncryptionProtocol", required = true)
protected String encryptionProtocol;
@XmlElement(name = "Mtu")
protected int mtu;
@XmlElement(name = "IsEnabled")
protected boolean isEnabled;
@XmlElement(name = "IsOperational")
protected Boolean isOperational;
@XmlElement(name = "ErrorDetails")
protected String errorDetails;
/**
* Gets the value of the name property.
*/
public String getName() {
return name;
}
/**
* Gets the value of the description property.
*/
public String getDescription() {
return description;
}
/**
* Details about the peer network.
*/
public IpsecVpnPeerType<?> getIpsecVpnPeer() {
return ipsecVpnPeer;
}
/**
* Gets the value of the peerIpAddress property.
*/
public String getPeerIpAddress() {
return peerIpAddress;
}
/**
* Gets the value of the peerNetworkAddress property.
*/
public String getPeerNetworkAddress() {
return peerNetworkAddress;
}
/**
* Gets the value of the peerNetworkMask property.
*/
public String getPeerNetworkMask() {
return peerNetworkMask;
}
/**
* Gets the value of the sharedSecret property.
*/
public String getSharedSecret() {
return sharedSecret;
}
/**
* Gets the value of the encryptionProtocol property.
*/
public String getEncryptionProtocol() {
return encryptionProtocol;
}
/**
* Gets the value of the mtu property.
*/
public int getMtu() {
return mtu;
}
/**
* Gets the value of the isEnabled property.
*/
public boolean isEnabled() {
return isEnabled;
}
/**
* Gets the value of the isOperational property.
*/
public Boolean isOperational() {
return isOperational;
}
/**
* Gets the value of the errorDetails property.
*/
public String getErrorDetails() {
return errorDetails;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
IpsecVpnTunnel that = IpsecVpnTunnel.class.cast(o);
return equal(name, that.name) &&
equal(description, that.description) &&
equal(peerIpAddress, that.peerIpAddress) &&
equal(peerNetworkAddress, that.peerNetworkAddress) &&
equal(peerNetworkMask, that.peerNetworkMask) &&
equal(sharedSecret, that.sharedSecret) &&
equal(encryptionProtocol, that.encryptionProtocol) &&
equal(mtu, that.mtu) &&
equal(isEnabled, that.isEnabled) &&
equal(isOperational, that.isOperational) &&
equal(errorDetails, that.errorDetails);
}
@Override
public int hashCode() {
return Objects.hashCode(name,
description,
peerIpAddress,
peerNetworkAddress,
peerNetworkMask,
sharedSecret,
encryptionProtocol,
mtu,
isEnabled,
isOperational,
errorDetails);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("name", name)
.add("description", description)
.add("peerIpAddress", peerIpAddress)
.add("peerNetworkAddress", peerNetworkAddress)
.add("peerNetworkMask", peerNetworkMask)
.add("sharedSecret", sharedSecret)
.add("encryptionProtocol", encryptionProtocol)
.add("mtu", mtu)
.add("isEnabled", isEnabled)
.add("isOperational", isOperational)
.add("errorDetails", errorDetails).toString();
}
}

View File

@ -16,27 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.functions;
package org.jclouds.vcloud.director.v1_5.domain;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* @author grkvlt@apache.org
*/
@Deprecated
public class ReferenceToEndpoint implements Function<Object, URI> {
@Override
public URI apply(Object input) {
Preconditions.checkNotNull(input);
Preconditions.checkArgument(input instanceof URISupplier);
URISupplier reference = (URISupplier) input;
return reference.getURI();
};
@XmlSeeAlso(
IpsecVpnThirdPartyPeer.class
)
public abstract class IpsecVpnUnmanagedPeerType<T extends IpsecVpnUnmanagedPeerType<T>> extends IpsecVpnPeerType<T> {
}

View File

@ -24,18 +24,20 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Date;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -88,8 +90,8 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
private Set<Link> links = Sets.newLinkedHashSet();
private Integer deploymentLeaseInSeconds;
private Integer storageLeaseInSeconds;
private XMLGregorianCalendar deploymentLeaseExpiration;
private XMLGregorianCalendar storageLeaseExpiration;
private Date deploymentLeaseExpiration;
private Date storageLeaseExpiration;
private URI href;
private String type;
@ -120,7 +122,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
/**
* @see LeaseSettingsSection#getDeploymentLeaseExpiration()
*/
public Builder deploymentLeaseExpiration(XMLGregorianCalendar deploymentLeaseExpiration) {
public Builder deploymentLeaseExpiration(Date deploymentLeaseExpiration) {
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
return this;
}
@ -128,7 +130,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
/**
* @see LeaseSettingsSection#getStorageLeaseExpiration()
*/
public Builder storageLeaseExpiration(XMLGregorianCalendar storageLeaseExpiration) {
public Builder storageLeaseExpiration(Date storageLeaseExpiration) {
this.storageLeaseExpiration = storageLeaseExpiration;
return this;
}
@ -200,10 +202,10 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
protected Integer storageLeaseInSeconds;
@XmlElement(name = "DeploymentLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar deploymentLeaseExpiration;
protected Date deploymentLeaseExpiration;
@XmlElement(name = "StorageLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar storageLeaseExpiration;
protected Date storageLeaseExpiration;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@ -211,10 +213,10 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
protected String type;
private LeaseSettingsSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Integer deploymentLeaseInSeconds,
Integer storageLeaseInSeconds, XMLGregorianCalendar deploymentLeaseExpiration,
XMLGregorianCalendar storageLeaseExpiration, URI href, String type) {
Integer storageLeaseInSeconds, Date deploymentLeaseExpiration,
Date storageLeaseExpiration, URI href, String type) {
super(info, required);
this.links = links;
this.links = ImmutableSet.copyOf(links);
this.deploymentLeaseInSeconds = deploymentLeaseInSeconds;
this.storageLeaseInSeconds = storageLeaseInSeconds;
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
@ -229,23 +231,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
@ -273,21 +258,15 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
/**
* Gets the value of the deploymentLeaseExpiration property.
*
* @return possible object is
* {@link XMLGregorianCalendar }
*/
public XMLGregorianCalendar getDeploymentLeaseExpiration() {
public Date getDeploymentLeaseExpiration() {
return deploymentLeaseExpiration;
}
/**
* Gets the value of the storageLeaseExpiration property.
*
* @return possible object is
* {@link XMLGregorianCalendar }
*/
public XMLGregorianCalendar getStorageLeaseExpiration() {
public Date getStorageLeaseExpiration() {
return storageLeaseExpiration;
}

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -105,8 +106,7 @@ public class Metadata extends ResourceType<Metadata> {
*/
@Override
public Builder links(Set<Link> links) {
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
return this;
return Builder.class.cast(super.links(links));
}
/**
@ -145,7 +145,7 @@ public class Metadata extends ResourceType<Metadata> {
private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet();
public Set<MetadataEntry> getMetadataEntries() {
return ImmutableSet.copyOf(metadataEntries);
return Collections.unmodifiableSet(metadataEntries);
}
@Override

View File

@ -140,7 +140,7 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
}
private MetadataEntry() {
// For JAXB and builder use
// for JAXB
}
public MetadataEntry(URI href, String type, Set<Link> links, String key, String value) {

View File

@ -0,0 +1,185 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents the NAT basic rule for one to one mapping of internal
* and external IP addresses from a network.
* <p/>
* <p/>
* <p>Java class for NatOneToOneBasicRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatOneToOneBasicRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "NatOneToOneBasicRule", propOrder = {
"mappingMode",
"externalIpAddress",
"internalIpAddress"
})
public class NatOneToOneBasicRule {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNatOneToOneBasicRule(this);
}
public static class Builder {
private String mappingMode;
private String externalIpAddress;
private String internalIpAddress;
/**
* @see NatOneToOneBasicRule#getMappingMode()
*/
public Builder mappingMode(String mappingMode) {
this.mappingMode = mappingMode;
return this;
}
/**
* @see NatOneToOneBasicRule#getExternalIpAddress()
*/
public Builder externalIpAddress(String externalIpAddress) {
this.externalIpAddress = externalIpAddress;
return this;
}
/**
* @see NatOneToOneBasicRule#getInternalIpAddress()
*/
public Builder internalIpAddress(String internalIpAddress) {
this.internalIpAddress = internalIpAddress;
return this;
}
public NatOneToOneBasicRule build() {
return new NatOneToOneBasicRule(mappingMode, externalIpAddress, internalIpAddress);
}
public Builder fromNatOneToOneBasicRule(NatOneToOneBasicRule in) {
return mappingMode(in.getMappingMode())
.externalIpAddress(in.getExternalIpAddress())
.internalIpAddress(in.getInternalIpAddress());
}
}
private NatOneToOneBasicRule(String mappingMode, String externalIpAddress, String internalIpAddress) {
this.mappingMode = mappingMode;
this.externalIpAddress = externalIpAddress;
this.internalIpAddress = internalIpAddress;
}
private NatOneToOneBasicRule() {
// For JAXB
}
@XmlElement(name = "MappingMode", required = true)
protected String mappingMode;
@XmlElement(name = "ExternalIpAddress", required = true)
protected String externalIpAddress;
@XmlElement(name = "InternalIpAddress", required = true)
protected String internalIpAddress;
/**
* Gets the value of the mappingMode property.
*
* @return possible object is
* {@link String }
*/
public String getMappingMode() {
return mappingMode;
}
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the internalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getInternalIpAddress() {
return internalIpAddress;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatOneToOneBasicRule that = NatOneToOneBasicRule.class.cast(o);
return equal(mappingMode, that.mappingMode) &&
equal(externalIpAddress, that.externalIpAddress) &&
equal(internalIpAddress, that.internalIpAddress);
}
@Override
public int hashCode() {
return Objects.hashCode(mappingMode,
externalIpAddress,
internalIpAddress);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("mappingMode", mappingMode)
.add("externalIpAddress", externalIpAddress)
.add("internalIpAddress", internalIpAddress).toString();
}
}

View File

@ -0,0 +1,209 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents the NAT rule for one to one mapping of VM NIC and
* external IP addresses from a network.
* <p/>
* <p/>
* <p>Java class for NatOneToOneVmRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatOneToOneVmRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="MappingMode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "NatOneToOneVmRule", propOrder = {
"mappingMode",
"externalIpAddress",
"vAppScopedVmId",
"vmNicId"
})
public class NatOneToOneVmRule {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNatOneToOneVmRule(this);
}
public static class Builder {
private String mappingMode;
private String externalIpAddress;
private String vAppScopedVmId;
private int vmNicId;
/**
* @see NatOneToOneVmRule#getMappingMode()
*/
public Builder mappingMode(String mappingMode) {
this.mappingMode = mappingMode;
return this;
}
/**
* @see NatOneToOneVmRule#getExternalIpAddress()
*/
public Builder externalIpAddress(String externalIpAddress) {
this.externalIpAddress = externalIpAddress;
return this;
}
/**
* @see NatOneToOneVmRule#getVAppScopedVmId()
*/
public Builder vAppScopedVmId(String vAppScopedVmId) {
this.vAppScopedVmId = vAppScopedVmId;
return this;
}
/**
* @see NatOneToOneVmRule#getVmNicId()
*/
public Builder vmNicId(int vmNicId) {
this.vmNicId = vmNicId;
return this;
}
public NatOneToOneVmRule build() {
return new NatOneToOneVmRule(mappingMode, externalIpAddress, vAppScopedVmId, vmNicId);
}
public Builder fromNatOneToOneVmRule(NatOneToOneVmRule in) {
return mappingMode(in.getMappingMode())
.externalIpAddress(in.getExternalIpAddress())
.vAppScopedVmId(in.getVAppScopedVmId())
.vmNicId(in.getVmNicId());
}
}
private NatOneToOneVmRule(String mappingMode, String externalIpAddress, String vAppScopedVmId, int vmNicId) {
this.mappingMode = mappingMode;
this.externalIpAddress = externalIpAddress;
this.vAppScopedVmId = vAppScopedVmId;
this.vmNicId = vmNicId;
}
private NatOneToOneVmRule() {
// For JAXB
}
@XmlElement(name = "MappingMode", required = true)
protected String mappingMode;
@XmlElement(name = "ExternalIpAddress")
protected String externalIpAddress;
@XmlElement(name = "VAppScopedVmId", required = true)
protected String vAppScopedVmId;
@XmlElement(name = "VmNicId")
protected int vmNicId;
/**
* Gets the value of the mappingMode property.
*
* @return possible object is
* {@link String }
*/
public String getMappingMode() {
return mappingMode;
}
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the vAppScopedVmId property.
*
* @return possible object is
* {@link String }
*/
public String getVAppScopedVmId() {
return vAppScopedVmId;
}
/**
* Gets the value of the vmNicId property.
*/
public int getVmNicId() {
return vmNicId;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatOneToOneVmRule that = NatOneToOneVmRule.class.cast(o);
return equal(mappingMode, that.mappingMode) &&
equal(externalIpAddress, that.externalIpAddress) &&
equal(vAppScopedVmId, that.vAppScopedVmId) &&
equal(vmNicId, that.vmNicId);
}
@Override
public int hashCode() {
return Objects.hashCode(mappingMode,
externalIpAddress,
vAppScopedVmId,
vmNicId);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("mappingMode", mappingMode)
.add("externalIpAddress", externalIpAddress)
.add("vAppScopedVmId", vAppScopedVmId)
.add("vmNicId", vmNicId).toString();
}
}

View File

@ -0,0 +1,234 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents the NAT rule for port forwarding between internal
* IP/port and external IP/port.
* <p/>
* <p/>
* <p>Java class for NatPortForwardingRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatPortForwardingRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="InternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "NatPortForwardingRule", propOrder = {
"externalIpAddress",
"externalPort",
"internalIpAddress",
"internalPort",
"protocol"
})
public class NatPortForwardingRule {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNatPortForwardingRule(this);
}
public static class Builder {
private String externalIpAddress;
private int externalPort;
private String internalIpAddress;
private int internalPort;
private String protocol;
/**
* @see NatPortForwardingRule#getExternalIpAddress()
*/
public Builder externalIpAddress(String externalIpAddress) {
this.externalIpAddress = externalIpAddress;
return this;
}
/**
* @see NatPortForwardingRule#getExternalPort()
*/
public Builder externalPort(int externalPort) {
this.externalPort = externalPort;
return this;
}
/**
* @see NatPortForwardingRule#getInternalIpAddress()
*/
public Builder internalIpAddress(String internalIpAddress) {
this.internalIpAddress = internalIpAddress;
return this;
}
/**
* @see NatPortForwardingRule#getInternalPort()
*/
public Builder internalPort(int internalPort) {
this.internalPort = internalPort;
return this;
}
/**
* @see NatPortForwardingRule#getProtocol()
*/
public Builder protocol(String protocol) {
this.protocol = protocol;
return this;
}
public NatPortForwardingRule build() {
return new NatPortForwardingRule(externalIpAddress, externalPort, internalIpAddress, internalPort, protocol);
}
public Builder fromNatPortForwardingRule(NatPortForwardingRule in) {
return externalIpAddress(in.getExternalIpAddress())
.externalPort(in.getExternalPort())
.internalIpAddress(in.getInternalIpAddress())
.internalPort(in.getInternalPort())
.protocol(in.getProtocol());
}
}
private NatPortForwardingRule(String externalIpAddress, int externalPort, String internalIpAddress, int internalPort, String protocol) {
this.externalIpAddress = externalIpAddress;
this.externalPort = externalPort;
this.internalIpAddress = internalIpAddress;
this.internalPort = internalPort;
this.protocol = protocol;
}
private NatPortForwardingRule() {
// For JAXB
}
@XmlElement(name = "ExternalIpAddress", required = true)
protected String externalIpAddress;
@XmlElement(name = "ExternalPort")
protected int externalPort;
@XmlElement(name = "InternalIpAddress", required = true)
protected String internalIpAddress;
@XmlElement(name = "InternalPort")
protected int internalPort;
@XmlElement(name = "Protocol", required = true)
protected String protocol;
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the externalPort property.
*/
public int getExternalPort() {
return externalPort;
}
/**
* Gets the value of the internalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getInternalIpAddress() {
return internalIpAddress;
}
/**
* Gets the value of the internalPort property.
*/
public int getInternalPort() {
return internalPort;
}
/**
* Gets the value of the protocol property.
*
* @return possible object is
* {@link String }
*/
public String getProtocol() {
return protocol;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatPortForwardingRule that = NatPortForwardingRule.class.cast(o);
return equal(externalIpAddress, that.externalIpAddress) &&
equal(externalPort, that.externalPort) &&
equal(internalIpAddress, that.internalIpAddress) &&
equal(internalPort, that.internalPort) &&
equal(protocol, that.protocol);
}
@Override
public int hashCode() {
return Objects.hashCode(externalIpAddress,
externalPort,
internalIpAddress,
internalPort,
protocol);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("externalIpAddress", externalIpAddress)
.add("externalPort", externalPort)
.add("internalIpAddress", internalIpAddress)
.add("internalPort", internalPort)
.add("protocol", protocol).toString();
}
}

View File

@ -0,0 +1,242 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents a NAT rule.
* <p/>
* <p/>
* <p>Java class for NatRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;choice>
* &lt;element name="OneToOneBasicRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneBasicRuleType"/>
* &lt;element name="OneToOneVmRule" type="{http://www.vmware.com/vcloud/v1.5}NatOneToOneVmRuleType"/>
* &lt;element name="PortForwardingRule" type="{http://www.vmware.com/vcloud/v1.5}NatPortForwardingRuleType"/>
* &lt;element name="VmRule" type="{http://www.vmware.com/vcloud/v1.5}NatVmRuleType"/>
* &lt;/choice>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "NatRule", propOrder = {
"description",
"oneToOneBasicRule",
"oneToOneVmRule",
"portForwardingRule",
"vmRule"
})
public class NatRule {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNatRule(this);
}
public static class Builder {
private String description;
private NatOneToOneBasicRule oneToOneBasicRule;
private NatOneToOneVmRule oneToOneVmRule;
private NatPortForwardingRule portForwardingRule;
private NatVmRule vmRule;
/**
* @see NatRule#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see NatRule#getOneToOneBasicRule()
*/
public Builder oneToOneBasicRule(NatOneToOneBasicRule oneToOneBasicRule) {
this.oneToOneBasicRule = oneToOneBasicRule;
return this;
}
/**
* @see NatRule#getOneToOneVmRule()
*/
public Builder oneToOneVmRule(NatOneToOneVmRule oneToOneVmRule) {
this.oneToOneVmRule = oneToOneVmRule;
return this;
}
/**
* @see NatRule#getPortForwardingRule()
*/
public Builder portForwardingRule(NatPortForwardingRule portForwardingRule) {
this.portForwardingRule = portForwardingRule;
return this;
}
/**
* @see NatRule#getVmRule()
*/
public Builder vmRule(NatVmRule vmRule) {
this.vmRule = vmRule;
return this;
}
public NatRule build() {
return new NatRule(description, oneToOneBasicRule, oneToOneVmRule, portForwardingRule, vmRule);
}
public Builder fromNatRule(NatRule in) {
return description(in.getDescription())
.oneToOneBasicRule(in.getOneToOneBasicRule())
.oneToOneVmRule(in.getOneToOneVmRule())
.portForwardingRule(in.getPortForwardingRule())
.vmRule(in.getVmRule());
}
}
public NatRule(String description, NatOneToOneBasicRule oneToOneBasicRule, NatOneToOneVmRule oneToOneVmRule,
NatPortForwardingRule portForwardingRule, NatVmRule vmRule) {
this.description = description;
this.oneToOneBasicRule = oneToOneBasicRule;
this.oneToOneVmRule = oneToOneVmRule;
this.portForwardingRule = portForwardingRule;
this.vmRule = vmRule;
}
private NatRule() {
// for JAXB
}
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "OneToOneBasicRule")
protected NatOneToOneBasicRule oneToOneBasicRule;
@XmlElement(name = "OneToOneVmRule")
protected NatOneToOneVmRule oneToOneVmRule;
@XmlElement(name = "PortForwardingRule")
protected NatPortForwardingRule portForwardingRule;
@XmlElement(name = "VmRule")
protected NatVmRule vmRule;
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
}
/**
* Gets the value of the oneToOneBasicRule property.
*
* @return possible object is
* {@link NatOneToOneBasicRule }
*/
public NatOneToOneBasicRule getOneToOneBasicRule() {
return oneToOneBasicRule;
}
/**
* Gets the value of the oneToOneVmRule property.
*
* @return possible object is
* {@link NatOneToOneVmRule }
*/
public NatOneToOneVmRule getOneToOneVmRule() {
return oneToOneVmRule;
}
/**
* Gets the value of the portForwardingRule property.
*
* @return possible object is
* {@link NatPortForwardingRule }
*/
public NatPortForwardingRule getPortForwardingRule() {
return portForwardingRule;
}
/**
* Gets the value of the vmRule property.
*
* @return possible object is
* {@link NatVmRule }
*/
public NatVmRule getVmRule() {
return vmRule;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatRule that = NatRule.class.cast(o);
return equal(description, that.description) &&
equal(oneToOneBasicRule, that.oneToOneBasicRule) &&
equal(oneToOneVmRule, that.oneToOneVmRule) &&
equal(portForwardingRule, that.portForwardingRule) &&
equal(vmRule, that.vmRule);
}
@Override
public int hashCode() {
return Objects.hashCode(description,
oneToOneBasicRule,
oneToOneVmRule,
portForwardingRule,
vmRule);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("description", description)
.add("oneToOneBasicRule", oneToOneBasicRule)
.add("oneToOneVmRule", oneToOneVmRule)
.add("portForwardingRule", portForwardingRule)
.add("vmRule", vmRule).toString();
}
}

View File

@ -0,0 +1,179 @@
/**
* 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.Collection;
import java.util.Collections;
import java.util.List;
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 a NAT network service.
* <p/>
* <p/>
* <p>Java class for NatService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="NatType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Policy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="NatRule" type="{http://www.vmware.com/vcloud/v1.5}NatRuleType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "NatService")
@XmlType(propOrder = {
"natType",
"policy",
"natRules"
})
public class NatService extends NetworkServiceType<NatService> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromNatService(this);
}
public static class Builder extends NetworkServiceType.Builder<NatService> {
private String natType;
private String policy;
private Set<NatRule> natRules = Sets.newLinkedHashSet();
/**
* @see NatService#getNatType()
*/
public Builder natType(String natType) {
this.natType = natType;
return this;
}
/**
* @see NatService#getPolicy()
*/
public Builder policy(String policy) {
this.policy = policy;
return this;
}
/**
* @see NatService#getNatRules()
*/
public Builder natRules(Set<NatRule> natRules) {
this.natRules = checkNotNull(natRules, "natRules");
return this;
}
public NatService build() {
return new NatService(isEnabled, natType, policy, natRules);
}
public Builder fromNatService(NatService in) {
return fromNetworkService(in).natType(in.getNatType()).policy(in.getPolicy())
.natRules(in.getNatRules());
}
public Builder fromNetworkService(NetworkServiceType<NatService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
@Override
public Builder enabled(boolean enabled) {
this.isEnabled = enabled;
return this;
}
}
@XmlElement(name = "NatType")
private String natType;
@XmlElement(name = "Policy")
private String policy;
@XmlElement(name = "NatRule")
private Set<NatRule> natRules = Sets.newLinkedHashSet();
private NatService(boolean enabled, String natType, String policy, Set<NatRule> natRules) {
super(enabled);
this.natType = natType;
this.policy = policy;
this.natRules = ImmutableSet.copyOf(natRules);
}
private NatService() {
// for JAXB
}
public String getNatType() {
return natType;
}
public String getPolicy() {
return policy;
}
public Set<NatRule> getNatRules() {
return Collections.unmodifiableSet(natRules);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatService that = NatService.class.cast(o);
return super.equals(that)
&& equal(natType, that.natType)
&& equal(natRules, that.natRules)
&& equal(policy, that.policy);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), natType, natRules, policy);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("natType", natType).add("natRules", natRules).add("policy", policy);
}
}

View File

@ -0,0 +1,262 @@
/**
* 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 javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents the NAT rule for port forwarding between VM NIC/port
* and external IP/port.
* <p/>
* <p/>
* <p>Java class for NatVmRule complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="NatVmRule">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ExternalIpAddress" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType" minOccurs="0"/>
* &lt;element name="ExternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="VAppScopedVmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="VmNicId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="InternalPort" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="Protocol" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "NatVmRule", propOrder = {
"externalIpAddress",
"externalPort",
"vAppScopedVmId",
"vmNicId",
"internalPort",
"protocol"
})
public class NatVmRule {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNatVmRule(this);
}
public static class Builder {
private String externalIpAddress;
private int externalPort;
private String vAppScopedVmId;
private int vmNicId;
private int internalPort;
private String protocol;
/**
* @see NatVmRule#getExternalIpAddress()
*/
public Builder externalIpAddress(String externalIpAddress) {
this.externalIpAddress = externalIpAddress;
return this;
}
/**
* @see NatVmRule#getExternalPort()
*/
public Builder externalPort(int externalPort) {
this.externalPort = externalPort;
return this;
}
/**
* @see NatVmRule#getVAppScopedVmId()
*/
public Builder vAppScopedVmId(String vAppScopedVmId) {
this.vAppScopedVmId = vAppScopedVmId;
return this;
}
/**
* @see NatVmRule#getVmNicId()
*/
public Builder vmNicId(int vmNicId) {
this.vmNicId = vmNicId;
return this;
}
/**
* @see NatVmRule#getInternalPort()
*/
public Builder internalPort(int internalPort) {
this.internalPort = internalPort;
return this;
}
/**
* @see NatVmRule#getProtocol()
*/
public Builder protocol(String protocol) {
this.protocol = protocol;
return this;
}
public NatVmRule build() {
return new NatVmRule(externalIpAddress, externalPort, vAppScopedVmId, vmNicId, internalPort, protocol);
}
public Builder fromNatVmRule(NatVmRule in) {
return externalIpAddress(in.getExternalIpAddress())
.externalPort(in.getExternalPort())
.vAppScopedVmId(in.getVAppScopedVmId())
.vmNicId(in.getVmNicId())
.internalPort(in.getInternalPort())
.protocol(in.getProtocol());
}
}
private NatVmRule(String externalIpAddress, int externalPort, String vAppScopedVmId, int vmNicId,
int internalPort, String protocol) {
this.externalIpAddress = externalIpAddress;
this.externalPort = externalPort;
this.vAppScopedVmId = vAppScopedVmId;
this.vmNicId = vmNicId;
this.internalPort = internalPort;
this.protocol = protocol;
}
private NatVmRule() {
// for JAXB
}
@XmlElement(name = "ExternalIpAddress")
protected String externalIpAddress;
@XmlElement(name = "ExternalPort")
protected int externalPort;
@XmlElement(name = "VAppScopedVmId", required = true)
protected String vAppScopedVmId;
@XmlElement(name = "VmNicId")
protected int vmNicId;
@XmlElement(name = "InternalPort")
protected int internalPort;
@XmlElement(name = "Protocol", required = true)
protected String protocol;
/**
* Gets the value of the externalIpAddress property.
*
* @return possible object is
* {@link String }
*/
public String getExternalIpAddress() {
return externalIpAddress;
}
/**
* Gets the value of the externalPort property.
*/
public int getExternalPort() {
return externalPort;
}
/**
* Gets the value of the vAppScopedVmId property.
*
* @return possible object is
* {@link String }
*/
public String getVAppScopedVmId() {
return vAppScopedVmId;
}
/**
* Gets the value of the vmNicId property.
*/
public int getVmNicId() {
return vmNicId;
}
/**
* Gets the value of the internalPort property.
*/
public int getInternalPort() {
return internalPort;
}
/**
* Gets the value of the protocol property.
*
* @return possible object is
* {@link String }
*/
public String getProtocol() {
return protocol;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
NatVmRule that = NatVmRule.class.cast(o);
return equal(externalIpAddress, that.externalIpAddress) &&
equal(externalPort, that.externalPort) &&
equal(vAppScopedVmId, that.vAppScopedVmId) &&
equal(vmNicId, that.vmNicId) &&
equal(internalPort, that.internalPort) &&
equal(protocol, that.protocol);
}
@Override
public int hashCode() {
return Objects.hashCode(externalIpAddress,
externalPort,
vAppScopedVmId,
vmNicId,
internalPort,
protocol);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("externalIpAddress", externalIpAddress)
.add("externalPort", externalPort)
.add("vAppScopedVmId", vAppScopedVmId)
.add("vmNicId", vmNicId)
.add("internalPort", internalPort)
.add("protocol", protocol).toString();
}
}

View File

@ -97,7 +97,7 @@ public class NetworkAssignment
}
private NetworkAssignment() {
// For JAXB and builder use
// for JAXB
}

View File

@ -81,7 +81,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static class Builder extends SectionType.Builder<NetworkConfigSection> {
private Set<Link> links = Sets.newLinkedHashSet();
private Set<VAppNetworkConfiguration<?>> networkConfigs = Sets.newLinkedHashSet();
private Set<VAppNetworkConfiguration> networkConfigs = Sets.newLinkedHashSet();
private URI href;
private String type;
@ -96,7 +96,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
/**
* @see NetworkConfigSection#getNetworkConfigs()
*/
public Builder networkConfig(Set<VAppNetworkConfiguration<?>> networkConfigs) {
public Builder networkConfigs(Set<VAppNetworkConfiguration> networkConfigs) {
this.networkConfigs = checkNotNull(networkConfigs, "networkConfigs");
return this;
}
@ -125,7 +125,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public Builder fromNetworkConfigSection(NetworkConfigSection in) {
return fromSection(in)
.links(in.getLinks())
.networkConfig(in.getNetworkConfigs())
.networkConfigs(in.getNetworkConfigs())
.href(in.getHref())
.type(in.getType());
}
@ -157,16 +157,16 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
}
@XmlElement(name = "Link")
protected Set<Link> links;
protected Set<Link> links = Sets.newLinkedHashSet();
@XmlElement(name = "NetworkConfig")
protected Set<VAppNetworkConfiguration<?>> networkConfigs;
protected Set<VAppNetworkConfiguration> networkConfigs = Sets.newLinkedHashSet();
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Set<VAppNetworkConfiguration<?>> networkConfigs,
public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Set<VAppNetworkConfiguration> networkConfigs,
URI href, String type) {
super(info, required);
this.links = ImmutableSet.copyOf(links);
@ -189,7 +189,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
/**
* Gets the value of the networkConfig property.
*/
public Set<VAppNetworkConfiguration<?>> getNetworkConfigs() {
public Set<VAppNetworkConfiguration> getNetworkConfigs() {
return Collections.unmodifiableSet(this.networkConfigs);
}

View File

@ -44,9 +44,9 @@ public class NetworkConfiguration {
public static class Builder {
private IpScope ipScope;
private ReferenceType<?> parentNetwork;
private Reference parentNetwork;
private String fenceMode;
private boolean retainNetInfoAcrossDeployments;
private Boolean retainNetInfoAcrossDeployments;
private NetworkFeatures features;
private SyslogServerSettings syslogServerSettings;
private RouterInfo routerInfo;
@ -62,7 +62,7 @@ public class NetworkConfiguration {
/**
* @see NetworkConfiguration#getParentNetwork()
*/
public Builder parentNetwork(ReferenceType<?> parentNetwork) {
public Builder parentNetwork(Reference parentNetwork) {
this.parentNetwork = parentNetwork;
return this;
}
@ -120,7 +120,7 @@ public class NetworkConfiguration {
}
}
public NetworkConfiguration(IpScope ipScope, ReferenceType<?> parentNetwork, String fenceMode, boolean retainNetInfoAcrossDeployments,
public NetworkConfiguration(IpScope ipScope, Reference parentNetwork, String fenceMode, Boolean retainNetInfoAcrossDeployments,
NetworkFeatures features, SyslogServerSettings syslogServerSettings, RouterInfo routerInfo) {
this.ipScope = ipScope;
this.parentNetwork = parentNetwork;
@ -132,17 +132,17 @@ public class NetworkConfiguration {
}
private NetworkConfiguration() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "IpScope")
private IpScope ipScope;
@XmlElement(name = "ParentNetwork")
private ReferenceType<?> parentNetwork;
private Reference parentNetwork;
@XmlElement(name = "FenceMode")
private String fenceMode;
@XmlElement(name = "RetainNetInfoAcrossDeployments")
private boolean retainNetInfoAcrossDeployments = false;
private Boolean retainNetInfoAcrossDeployments;
@XmlElement(name = "Features")
private NetworkFeatures features;
@XmlElement(name = "SyslogServerSettings")
@ -162,7 +162,7 @@ public class NetworkConfiguration {
/**
* @return reference to parent network.
*/
public ReferenceType<?> getParentNetwork() {
public Reference getParentNetwork() {
return parentNetwork;
}
@ -212,7 +212,8 @@ public class NetworkConfiguration {
if (o == null || getClass() != o.getClass())
return false;
NetworkConfiguration that = NetworkConfiguration.class.cast(o);
return equal(ipScope, that.ipScope) && equal(parentNetwork, that.parentNetwork) &&
return equal(ipScope, that.ipScope) &&
equal(parentNetwork, that.parentNetwork) &&
equal(fenceMode, that.fenceMode) &&
equal(retainNetInfoAcrossDeployments, that.retainNetInfoAcrossDeployments) &&
equal(features, that.features) &&

View File

@ -180,7 +180,7 @@ public class NetworkConnection {
}
private NetworkConnection() {
// For JAXB and builder use
// for JAXB
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -83,7 +84,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public static class Builder extends SectionType.Builder<NetworkConnectionSection> {
private Integer primaryNetworkConnectionIndex;
private Set<NetworkConnection> networkConnection = Sets.newLinkedHashSet();
private Set<NetworkConnection> networkConnections = Sets.newLinkedHashSet();
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
@ -99,8 +100,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
/**
* @see NetworkConnectionSection#getNetworkConnections()
*/
public Builder networkConnection(Set<NetworkConnection> networkConnection) {
this.networkConnection = checkNotNull(networkConnection, "networkConnection");
public Builder networkConnections(Set<NetworkConnection> networkConnections) {
this.networkConnections = checkNotNull(networkConnections, "networkConnection");
return this;
}
@ -130,14 +131,14 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public NetworkConnectionSection build() {
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnection, links, href, type);
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnections, links, href, type);
}
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnection(in.getNetworkConnections())
.networkConnections(in.getNetworkConnections())
.links(in.getLinks())
.href(in.getHref())
.type(in.getType());
@ -212,7 +213,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
* {@link NetworkConnection }
*/
public Set<NetworkConnection> getNetworkConnections() {
return this.networkConnections;
return Collections.unmodifiableSet(this.networkConnections);
}
/**
@ -222,7 +223,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
* {@link Link }
*/
public Set<Link> getLinks() {
return this.links;
return Collections.unmodifiableSet(this.links);
}
/**
@ -259,7 +260,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
@Override
public int hashCode() {
return Objects.hashCode(primaryNetworkConnectionIndex,
return Objects.hashCode(super.hashCode(),
primaryNetworkConnectionIndex,
networkConnections,
links,
href,

View File

@ -21,8 +21,10 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects;
@ -47,12 +49,12 @@ public class NetworkFeatures {
public static class Builder {
private Set<NetworkService> services = Sets.newLinkedHashSet();
private Set<NetworkServiceType<?>> services = Sets.newLinkedHashSet();
/**
* @see NetworkFeatures#getNetworkServices()
*/
public Builder services(Set<NetworkService> services) {
public Builder services(Set<? extends NetworkServiceType<?>> services) {
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
return this;
}
@ -60,7 +62,7 @@ public class NetworkFeatures {
/**
* @see NetworkFeatures#getNetworkServices()
*/
public Builder service(NetworkService service) {
public Builder service(NetworkServiceType<?> service) {
services.add(checkNotNull(service, "service"));
return this;
}
@ -75,22 +77,22 @@ public class NetworkFeatures {
}
private NetworkFeatures() {
// For JAXB and builder use
// for JAXB
}
public NetworkFeatures(Set<NetworkService> services) {
this.services = services;
public NetworkFeatures(Set<? extends NetworkServiceType<?>> services) {
this.services = ImmutableSet.copyOf(services);
}
@XmlElement(name = "NetworkService")
private Set<NetworkService> services = Sets.newLinkedHashSet();
@XmlElementRef
private Set<? extends NetworkServiceType<?>> services = Sets.newLinkedHashSet();
/**
* @return a Network service. May be any of DhcpService, NatService, IpsecVpnService,
* DhcpService, or StaticRoutingService.
*/
public Set<NetworkService> getNetworkServices() {
return ImmutableSet.copyOf(services);
public Set<? extends NetworkServiceType<?>> getNetworkServices() {
return Collections.unmodifiableSet(services);
}
@Override

View File

@ -21,7 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.google.common.base.Objects;
@ -29,45 +29,43 @@ import com.google.common.base.Objects;
* Represents a network service
*
* @author danikov
* @author Adam Lowe
*/
@XmlRootElement(name = "NetworkService")
public class NetworkService {
@XmlSeeAlso({
DhcpService.class,
IpsecVpnService.class,
FirewallService.class,
DhcpService.class,
StaticRoutingService.class,
NatService.class
})
public abstract class NetworkServiceType<T extends NetworkServiceType<T>> {
public abstract Builder<T> toBuilder();
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNetworkService(this);
}
public static class Builder {
private boolean isEnabled;
public static abstract class Builder<T extends NetworkServiceType<T>> {
protected boolean isEnabled;
/**
* @see NetworkService#isEnabled()
* @see NetworkServiceType#isEnabled()
*/
public Builder enabled(boolean isEnabled) {
public Builder<T> enabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
public NetworkService build() {
return new NetworkService(isEnabled);
}
public abstract NetworkServiceType<T> build();
public Builder fromNetworkService(NetworkService in) {
public Builder<T> fromNetworkServiceType(NetworkServiceType<T> in) {
return enabled(in.isEnabled());
}
}
private NetworkService(boolean enabled) {
protected NetworkServiceType(boolean enabled) {
isEnabled = enabled;
}
private NetworkService() {
// For JAXB and builder use
protected NetworkServiceType() {
// for JAXB
}
@XmlElement(name = "IsEnabled")
@ -86,7 +84,7 @@ public class NetworkService {
return true;
if (o == null || getClass() != o.getClass())
return false;
NetworkService that = NetworkService.class.cast(o);
NetworkServiceType that = NetworkServiceType.class.cast(o);
return equal(isEnabled, that.isEnabled);
}
@ -97,6 +95,10 @@ public class NetworkService {
@Override
public String toString() {
return Objects.toStringHelper("").add("isEnabled", isEnabled).toString();
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("isEnabled", isEnabled);
}
}

View File

@ -152,7 +152,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
}
protected NetworkType() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Configuration")

View File

@ -183,7 +183,7 @@ public class Org extends EntityType<Org> {
}
private Org() {
// For JAXB and builder use
// for JAXB
}
public Org(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String fullName, Boolean enabled) {

View File

@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -79,7 +80,7 @@ public class OrgList {
}
private OrgList() {
// For JAXB and builder use
// for JAXB
}
private OrgList(Set<Reference> orgs) {
@ -90,7 +91,7 @@ public class OrgList {
private Set<Reference> orgs = Sets.newLinkedHashSet();
public Set<Reference> getOrgs() {
return ImmutableSet.copyOf(orgs);
return Collections.unmodifiableSet(orgs);
}
@Override

View File

@ -19,18 +19,17 @@
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.Set;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.net.URI;
import java.util.Set;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
/**
@ -56,10 +55,8 @@ import com.google.common.collect.Sets;
*/
@XmlRootElement(name = "Owner")
@XmlType(propOrder = {"user"})
public class Owner
extends ResourceType<Owner>
public class Owner extends ResourceType<Owner> {
{
public static Builder builder() {
return new Builder();
}
@ -136,7 +133,7 @@ public class Owner
@SuppressWarnings("unused")
private Owner() {
// For JAXB and builder use
// for JAXB
}
public Owner(URI href, String type, Set<Link> links, Reference user) {

View File

@ -111,7 +111,7 @@ public class ParamsType<T extends ParamsType<T>> {
}
protected ParamsType() {
// For JAXB and builder use
// for JAXB
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -55,7 +56,7 @@ import com.google.common.collect.Sets;
* </pre>
*/
@XmlType(name = "ProductSectionList", propOrder = {
"productSection"
"productSections"
})
public class ProductSectionList
extends ResourceType<ProductSectionList>
@ -76,9 +77,9 @@ public class ProductSectionList
private Set<ProductSection> productSections = Sets.newLinkedHashSet();
/**
* @see ProductSectionList#getProductSection()
* @see ProductSectionList#getProductSections()
*/
public Builder productSection(Set<ProductSection> productSections) {
public Builder productSections(Set<ProductSection> productSections) {
this.productSections = checkNotNull(productSections, "productSection");
return this;
}
@ -89,7 +90,6 @@ public class ProductSectionList
return productSectionList;
}
/**
* @see ResourceType#getHref()
*/
@ -134,27 +134,27 @@ public class ProductSectionList
public Builder fromProductSectionList(ProductSectionList in) {
return fromResourceType(in)
.productSection(in.getProductSection());
.productSections(in.getProductSections());
}
}
private ProductSectionList() {
// For JAXB and builder use
// for JAXB
}
private ProductSectionList(Set<ProductSection> productSection) {
this.productSection = ImmutableSet.copyOf(productSection);
private ProductSectionList(Set<ProductSection> productSections) {
this.productSections = ImmutableSet.copyOf(productSections);
}
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected Set<ProductSection> productSection = Sets.newLinkedHashSet();
protected Set<ProductSection> productSections = Sets.newLinkedHashSet();
/**
* Gets the value of the productSection property.
*/
public Set<ProductSection> getProductSection() {
return this.productSection;
public Set<ProductSection> getProductSections() {
return Collections.unmodifiableSet(this.productSections);
}
@Override
@ -164,18 +164,18 @@ public class ProductSectionList
if (o == null || getClass() != o.getClass())
return false;
ProductSectionList that = ProductSectionList.class.cast(o);
return equal(productSection, that.productSection);
return equal(productSections, that.productSections);
}
@Override
public int hashCode() {
return Objects.hashCode(productSection);
return Objects.hashCode(productSections);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("productSection", productSection).toString();
.add("productSections", productSections).toString();
}
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
@ -38,6 +39,10 @@ import com.google.common.base.Objects.ToStringHelper;
*
* @author grkvlt@apache.org
*/
@XmlSeeAlso({
CatalogReference.class,
Reference.class
})
public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
public static <T extends ReferenceType<T>> Builder<T> builder() {

View File

@ -19,9 +19,15 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Parameters to be used for vm relocation.
@ -43,13 +49,38 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "RelocateParams", propOrder = {
@XmlRootElement(name = "RelocateParams")
@XmlType(propOrder = {
"datastore"
})
public class RelocateParams {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Reference datastore;
public Builder datastore(Reference dataStore) {
this.datastore = dataStore;
return this;
}
public RelocateParams build() {
return new RelocateParams(datastore);
}
}
@XmlElement(name = "Datastore", required = true)
protected ReferenceType<?> datastore;
private Reference datastore;
private RelocateParams(Reference datastore) {
this.datastore = checkNotNull(datastore);
}
private RelocateParams() {
// for JAXB
}
/**
* Gets the value of the datastore property.
@ -60,4 +91,25 @@ public class RelocateParams {
public ReferenceType<?> getDatastore() {
return datastore;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RelocateParams that = RelocateParams.class.cast(o);
return equal(datastore, that.datastore);
}
@Override
public int hashCode() {
return Objects.hashCode(datastore);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("datastore", datastore).toString();
}
}

View File

@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@ -72,7 +73,7 @@ public class ResourceEntities {
* @see ResourceEntities#getResourceEntities()
*/
public Builder resourceEntities(Set<Reference> resourceEntities) {
this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
this.resourceEntities = ImmutableSet.copyOf(checkNotNull(resourceEntities, "resourceEntities"));
return this;
}
@ -95,7 +96,7 @@ public class ResourceEntities {
}
private ResourceEntities() {
// For JAXB and builder use
// for JAXB
}
private ResourceEntities(Set<Reference> resourceEntity) {
@ -110,7 +111,7 @@ public class ResourceEntities {
* Gets the value of the resourceEntity property.
*/
public Set<Reference> getResourceEntities() {
return this.resourceEntities;
return Collections.unmodifiableSet(this.resourceEntities);
}
@Override

View File

@ -22,12 +22,14 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -100,7 +102,7 @@ public abstract class ResourceType<T extends ResourceType<T>> implements URISupp
protected ResourceType(URI href, String type, Set<Link> links) {
this.href = href;
this.type = type;
this.links = links;
this.links = ImmutableSet.copyOf(links);
}
protected ResourceType() {
@ -148,7 +150,7 @@ public abstract class ResourceType<T extends ResourceType<T>> implements URISupp
* Set of optional links to an entity or operation associated with this object.
*/
public Set<Link> getLinks() {
return links;
return Collections.unmodifiableSet(links);
}
@Override

View File

@ -62,7 +62,7 @@ public class RouterInfo {
}
private RouterInfo() {
// For JAXB and builder use
// for JAXB
}
private RouterInfo(String externalIp) {

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -109,7 +110,7 @@ public class Session {
}
private Session() {
// For JAXB and builder use
// for JAXB
}
private Session(String user, String org, URI href, Set<Link> links) {
@ -129,7 +130,7 @@ public class Session {
private URI href;
public Set<Link> getLinks() {
return ImmutableSet.copyOf(links);
return Collections.unmodifiableSet(links);
}
/**

View File

@ -20,7 +20,9 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -107,7 +109,7 @@ public class SourcedCompositionItemParam {
* @see SourcedCompositionItemParam#getNetworkAssignments()
*/
public Builder networkAssignments(Set<NetworkAssignment> networkAssignments) {
this.networkAssignments = networkAssignments;
this.networkAssignments = ImmutableSet.copyOf(checkNotNull(networkAssignments, "networkAssignments"));
return this;
}
@ -142,7 +144,7 @@ public class SourcedCompositionItemParam {
}
private SourcedCompositionItemParam() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "Source", required = true)
@ -189,26 +191,9 @@ public class SourcedCompositionItemParam {
/**
* Gets the value of the networkAssignment property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkAssignment property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkAssignment().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkAssignment }
*/
public Set<NetworkAssignment> getNetworkAssignments() {
return this.networkAssignments;
return Collections.unmodifiableSet(this.networkAssignments);
}
/**

View File

@ -0,0 +1,211 @@
/**
* 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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* <p>Java class for StaticRoute complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="StaticRoute">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Network" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="NextHopIp" type="{http://www.vmware.com/vcloud/v1.5}IpAddressType"/>
* &lt;element name="Interface" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StaticRoute", propOrder = {
"name",
"network",
"nextHopIp",
"theInterface"
})
public class StaticRoute {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromStaticRoute(this);
}
public static class Builder {
private String name;
private String network;
private String nextHopIp;
private String theInterface;
/**
* @see StaticRoute#getName()
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see StaticRoute#getNetwork()
*/
public Builder network(String network) {
this.network = network;
return this;
}
/**
* @see StaticRoute#getNextHopIp()
*/
public Builder nextHopIp(String nextHopIp) {
this.nextHopIp = nextHopIp;
return this;
}
/**
* @see StaticRoute#getInterface()
*/
public Builder setInterface(String theInterface) {
this.theInterface = theInterface;
return this;
}
public StaticRoute build() {
return new StaticRoute(name, network, nextHopIp, theInterface);
}
public Builder fromStaticRoute(StaticRoute in) {
return name(in.getName())
.network(in.getNetwork())
.nextHopIp(in.getNextHopIp())
.setInterface(in.getInterface());
}
}
private StaticRoute(String name, String network, String nextHopIp, String theInterface) {
this.name = checkNotNull(name, "name");
this.network = checkNotNull(network, "network");
this.nextHopIp = checkNotNull(nextHopIp, "nextHopIp");
this.theInterface = checkNotNull(theInterface, "interface");
}
private StaticRoute() {
// for JAXB
}
@XmlElement(name = "Name", required = true)
protected String name;
@XmlElement(name = "Network", required = true)
protected String network;
@XmlElement(name = "NextHopIp", required = true)
protected String nextHopIp;
@XmlElement(name = "Interface", required = true)
protected String theInterface;
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
/**
* Gets the value of the network property.
*
* @return possible object is
* {@link String }
*/
public String getNetwork() {
return network;
}
/**
* Gets the value of the nextHopIp property.
*
* @return possible object is
* {@link String }
*/
public String getNextHopIp() {
return nextHopIp;
}
/**
* Gets the value of the interface property.
*
* @return possible object is
* {@link String }
*/
public String getInterface() {
return theInterface;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
StaticRoute that = StaticRoute.class.cast(o);
return equal(name, that.name) &&
equal(network, that.network) &&
equal(nextHopIp, that.nextHopIp) &&
equal(theInterface, that.theInterface);
}
@Override
public int hashCode() {
return Objects.hashCode(name,
network,
nextHopIp,
theInterface);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("name", name)
.add("network", network)
.add("nextHopIp", nextHopIp)
.add("interface", theInterface).toString();
}
}

View File

@ -0,0 +1,147 @@
/**
* 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.List;
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.ImmutableList;
import com.google.common.collect.Lists;
/**
* Represents Static Routing network service.
* <p/>
* <p/>
* <p>Java class for StaticRoutingService complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="StaticRoutingService">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}NetworkServiceType">
* &lt;sequence>
* &lt;element name="StaticRoute" type="{http://www.vmware.com/vcloud/v1.5}StaticRouteType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "StaticRoutingService")
@XmlType(propOrder = {
"staticRoutes"
})
public class StaticRoutingService extends NetworkServiceType<StaticRoutingService> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromStaticRoutingService(this);
}
public static class Builder extends NetworkServiceType.Builder<StaticRoutingService> {
private List<StaticRoute> staticRoutes = ImmutableList.of();
/**
* @see StaticRoutingService#getStaticRoutes()
*/
public Builder staticRoutes(List<StaticRoute> staticRoutes) {
this.staticRoutes = ImmutableList.copyOf(checkNotNull(staticRoutes, "staticRoutes"));
return this;
}
public StaticRoutingService build() {
return new StaticRoutingService(isEnabled, staticRoutes);
}
@Override
public Builder fromNetworkServiceType(NetworkServiceType<StaticRoutingService> in) {
return Builder.class.cast(super.fromNetworkServiceType(in));
}
public Builder fromStaticRoutingService(StaticRoutingService in) {
return fromNetworkServiceType(in)
.staticRoutes(in.getStaticRoutes());
}
@Override
public Builder enabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
}
private StaticRoutingService(boolean enabled, List<StaticRoute> staticRoutes) {
super(enabled);
this.staticRoutes = ImmutableList.copyOf(staticRoutes);
}
private StaticRoutingService() {
// for JAXB
}
@XmlElement(name = "StaticRoute")
protected List<StaticRoute> staticRoutes = Lists.newArrayList();
/**
* Gets the value of the staticRoutes property.
*/
public List<StaticRoute> getStaticRoutes() {
return Collections.unmodifiableList(this.staticRoutes);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
StaticRoutingService that = StaticRoutingService.class.cast(o);
return equal(staticRoutes, that.staticRoutes);
}
@Override
public int hashCode() {
return Objects.hashCode(staticRoutes);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("staticRoutes", staticRoutes).toString();
}
}

View File

@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -96,11 +97,11 @@ public class SupportedHardwareVersions {
}
private SupportedHardwareVersions() {
// For JAXB and builder use
// for JAXB
}
private SupportedHardwareVersions(Set<String> supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions;
this.supportedHardwareVersions = ImmutableSet.copyOf(supportedHardwareVersions);
}

View File

@ -76,7 +76,7 @@ public class SyslogServerSettings {
}
private SyslogServerSettings() {
// For JAXB and builder use
// for JAXB
}
@XmlElement(name = "SyslogServerIp1")

View File

@ -295,7 +295,7 @@ public class Task extends EntityType<Task> {
}
private Task() {
// For JAXB and builder use
// for JAXB
}

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -52,7 +53,7 @@ public class TasksInProgress {
* @see TasksInProgress#getTasks()
*/
public Builder tasks(Set<Task> tasks) {
this.tasks = Sets.newLinkedHashSet(checkNotNull(tasks, "tasks"));
this.tasks = ImmutableSet.copyOf(checkNotNull(tasks, "tasks"));
return this;
}
@ -73,11 +74,11 @@ public class TasksInProgress {
}
}
protected TasksInProgress() {
// For JAXB and builder use
private TasksInProgress() {
// for JAXB
}
protected TasksInProgress(Collection<Task> tasks) {
private TasksInProgress(Collection<Task> tasks) {
this.tasks = ImmutableSet.copyOf(tasks);
}
@ -85,7 +86,7 @@ public class TasksInProgress {
private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() {
return ImmutableSet.copyOf(tasks);
return Collections.unmodifiableSet(tasks);
}
@Override

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -160,7 +161,7 @@ public class TasksList extends EntityType<TasksList> {
}
protected TasksList() {
// For JAXB and builder use
// for JAXB
}
public TasksList(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Set<Task> tasks) {
@ -172,7 +173,7 @@ public class TasksList extends EntityType<TasksList> {
private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() {
return ImmutableSet.copyOf(tasks);
return Collections.unmodifiableSet(tasks);
}
@Override

View File

@ -172,7 +172,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
}
protected VAppCreationParamsType() {
// For JAXB and builder use
// for JAXB
}
/**

View File

@ -61,17 +61,17 @@ import com.google.common.collect.Sets;
"configuration",
"isDeployed"
})
public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> extends ResourceType<T> {
public static <T extends VAppNetworkConfiguration<T>> Builder<T> builder() {
return new Builder<T>();
public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfiguration> {
public static <T extends VAppNetworkConfiguration> Builder builder() {
return new Builder();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromVAppNetworkConfiguration(this);
public Builder toBuilder() {
return new Builder().fromVAppNetworkConfiguration(this);
}
public static class Builder<T extends VAppNetworkConfiguration<T>> extends ResourceType.Builder<T> {
public static class Builder extends ResourceType.Builder<VAppNetworkConfiguration> {
private String description;
private NetworkConfiguration configuration;
@ -81,7 +81,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
/**
* @see VAppNetworkConfiguration#getDescription()
*/
public Builder<T> description(String description) {
public Builder description(String description) {
this.description = description;
return this;
}
@ -89,7 +89,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
/**
* @see VAppNetworkConfiguration#getConfiguration()
*/
public Builder<T> configuration(NetworkConfiguration configuration) {
public Builder configuration(NetworkConfiguration configuration) {
this.configuration = configuration;
return this;
}
@ -97,7 +97,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
/**
* @see VAppNetworkConfiguration#isDeployed()
*/
public Builder<T> isDeployed(Boolean isDeployed) {
public Builder isDeployed(Boolean isDeployed) {
this.isDeployed = isDeployed;
return this;
}
@ -105,14 +105,14 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
/**
* @see VAppNetworkConfiguration#getNetworkName()
*/
public Builder<T> networkName(String networkName) {
public Builder networkName(String networkName) {
this.networkName = networkName;
return this;
}
public VAppNetworkConfiguration<T> build() {
return new VAppNetworkConfiguration<T>(href, type, links,
public VAppNetworkConfiguration build() {
return new VAppNetworkConfiguration(href, type, links,
description, configuration, isDeployed, networkName);
}
@ -121,7 +121,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
* @see ResourceType#getHref()
*/
@Override
public Builder<T> href(URI href) {
public Builder href(URI href) {
super.href(href);
return this;
}
@ -130,7 +130,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
* @see ResourceType#getType()
*/
@Override
public Builder<T> type(String type) {
public Builder type(String type) {
super.type(type);
return this;
}
@ -139,7 +139,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
* @see ResourceType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
public Builder links(Set<Link> links) {
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
return this;
}
@ -148,7 +148,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
* @see ResourceType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
public Builder link(Link link) {
super.link(link);
return this;
}
@ -157,11 +157,11 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromResourceType(ResourceType<T> in) {
public Builder fromResourceType(ResourceType<VAppNetworkConfiguration> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) {
public Builder fromVAppNetworkConfiguration(VAppNetworkConfiguration in) {
return fromResourceType(in)
.description(in.getDescription())
.configuration(in.getConfiguration())
@ -238,7 +238,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> ext
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppNetworkConfiguration<?> that = VAppNetworkConfiguration.class.cast(o);
VAppNetworkConfiguration that = VAppNetworkConfiguration.class.cast(o);
return equal(description, that.description) &&
equal(configuration, that.configuration) &&
equal(isDeployed, that.isDeployed) &&

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@ -88,7 +89,7 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
public static class Builder extends ResourceEntityType.Builder<VAppTemplate> {
private Owner owner;
private Set<VAppTemplate> children = Sets.newLinkedHashSet();
private Set<SectionType> sections = Sets.newLinkedHashSet();
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded;
private Boolean goldMaster;
@ -112,8 +113,8 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
/**
* @see VAppTemplate#getSections()
*/
public Builder sections(Set<SectionType> sections) {
this.sections = sections;
public Builder sections(Set<? extends SectionType<?>> sections) {
this.sections = checkNotNull(sections, "sections");
return this;
}
@ -253,12 +254,12 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
}
}
@XmlElementRef
@XmlElement(name = "Owner")
protected Owner owner;
@XmlElementRef
@XmlElement(name = "Children")
protected VAppTemplateChildren children = VAppTemplateChildren.builder().build();
@XmlElementRef
protected Set<SectionType> sections = Sets.newLinkedHashSet();
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlAttribute
@ -267,7 +268,8 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
protected Boolean goldMaster;
private VAppTemplate(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children, Set<SectionType> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children,
Set<? extends SectionType<?>> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
super(href, type, links, description, tasksInProgress, id, name, files, status);
this.owner = owner;
this.children = VAppTemplateChildren.builder().vms(children).build();
@ -305,42 +307,28 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
* Contains ovf sections for vApp template.
* Gets the value of the section property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link 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 >}
* {@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 }
*/
public Set<SectionType> getSections() {
return this.sections;
public Set<? extends SectionType<?>> getSections() {
return Collections.unmodifiableSet(this.sections);
}
/**

View File

@ -22,6 +22,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -103,7 +104,7 @@ public class VAppTemplateChildren {
* Gets the value of the vm property.
*/
public Set<VAppTemplate> getVms() {
return this.vms;
return Collections.unmodifiableSet(this.vms);
}
@Override

View File

@ -20,14 +20,12 @@ package org.jclouds.vcloud.director.v1_5.domain.cim;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.*;
/**
*
@ -238,7 +236,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* @see ResourceAllocationSettingData#getConnections
*/
public Builder connections(List<String> connections) {
this.connections.addAll(checkNotNull(connections, "connections"));
this.connections = Lists.newArrayList(checkNotNull(connections, "connections"));
return this;
}
@ -246,7 +244,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* @see ResourceAllocationSettingData#getHostResources
*/
public Builder hostResources(List<String> hostResources) {
this.hostResources.addAll(checkNotNull(hostResources, "hostResources"));
this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources"));
return this;
}
@ -665,7 +663,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* network or switch port.
*/
public List<String> getConnections() {
return connections;
return Collections.unmodifiableList(connections);
}
/**
@ -687,7 +685,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* based on host resources that are identified by element values.
*/
public List<String> getHostResources() {
return hostResources;
return Collections.unmodifiableList(hostResources);
}
@Override

View File

@ -22,7 +22,8 @@ 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.XmlElementRef;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@ -116,7 +117,7 @@ public class DiskSection extends SectionType<DiskSection> {
}
@XmlElementRef
@XmlElement(name = "Disk")
private Set<Disk> disks;
private DiskSection(@Nullable String info, @Nullable Boolean required, Iterable<Disk> disks) {

View File

@ -89,7 +89,7 @@ public abstract class SectionType<T extends SectionType<T>> {
@XmlElement(name = "Info")
private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private boolean required;
private Boolean required;
protected SectionType(@Nullable String info, @Nullable Boolean required) {
this.info = info;

View File

@ -38,9 +38,6 @@ import com.google.common.collect.Sets;
*/
public abstract class BaseEnvelope<V extends BaseVirtualSystem<V>, E extends BaseEnvelope<V, E>> {
/**
* {@inheritDoc}
*/
public abstract Builder<V, E> toBuilder();
public static abstract class Builder<V extends BaseVirtualSystem<V>, E extends BaseEnvelope<V, E>> {
@ -109,9 +106,6 @@ public abstract class BaseEnvelope<V extends BaseVirtualSystem<V>, E extends Bas
return this;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public abstract E build() ;

View File

@ -77,7 +77,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getName()
* @see CatalogReferences#getName()
*/
@Override
public Builder name(String name) {
@ -86,7 +86,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getPage()
* @see CatalogReferences#getPage()
*/
@Override
public Builder page(Integer page) {
@ -95,7 +95,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getPageSize()
* @see CatalogReferences#getPageSize()
*/
@Override
public Builder pageSize(Integer pageSize) {
@ -104,7 +104,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getTotal()
* @see CatalogReferences#getTotal()
*/
@Override
public Builder total(Long total) {
@ -113,7 +113,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getHref()
* @see CatalogReferences#getHref()
*/
@Override
public Builder href(URI href) {
@ -131,7 +131,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getLinks()
* @see CatalogReferences#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -140,7 +140,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
/**
* @see CatalogReference#getLinks()
* @see CatalogReferences#getLinks()
*/
@Override
public Builder link(Link link) {
@ -163,6 +163,6 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
}
protected CatalogReferences() {
// For JAXB and builder use
// for JAXB
}
}

View File

@ -161,7 +161,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
}
protected ContainerType() {
// For JAXB and builder use
// for JAXB
}
/**

View File

@ -71,7 +71,7 @@ public class QueryList extends ContainerType<QueryList> {
}
private QueryList() {
// For JAXB and builder use
// for JAXB
}
@Override

View File

@ -252,7 +252,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
}
private QueryResultCatalogRecord() {
// For JAXB and builder use
// for JAXB
}

View File

@ -221,7 +221,7 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
}
private QueryResultNetworkRecord() {
// For JAXB and builder use
// Qfor JAXB
}
@XmlAttribute

View File

@ -43,7 +43,10 @@ import com.google.common.collect.Sets;
*
* @author grkvlt@apache.org
*/
@XmlSeeAlso({QueryResultCatalogRecord.class, QueryResultNetworkRecord.class})
@XmlSeeAlso({
QueryResultCatalogRecord.class,
QueryResultNetworkRecord.class}
)
public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
public static <T extends QueryResultRecordType<T>> Builder<T> builder() {

View File

@ -172,13 +172,11 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
}
protected QueryResultReferences() {
// For JAXB and builder use
// for JAXB
}
// NOTE add other types as they are used. probably not the best way to do this.
@XmlElementRefs({
@XmlElementRef(type = CatalogReference.class)
})
@XmlElementRef
private Set<T> references = Sets.newLinkedHashSet();
/**

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@ -36,11 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -58,7 +57,7 @@ public interface CatalogAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Catalog> getCatalog(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef);
ListenableFuture<Catalog> getCatalog(@EndpointParam URI catalogUri);
/**
* Creates a catalog item in a catalog.
@ -69,7 +68,7 @@ public interface CatalogAsyncClient {
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef,
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam URI catalogUri,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
@ -79,7 +78,7 @@ public interface CatalogAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam URI catalogItemUri);
/**
* Modifies a catalog item.
@ -89,7 +88,7 @@ public interface CatalogAsyncClient {
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam URI catalogItemUri,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
@ -99,10 +98,10 @@ public interface CatalogAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> deleteCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
ListenableFuture<Void> deleteCatalogItem(@EndpointParam URI catalogItemUri);
/**
* @return asynchronous access to {@link Metadata.Writeable} features
* @return asynchronous access to {@link Writable} features
*/
@Delegate
MetadataAsyncClient.Writable getMetadataClient();

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
@ -25,7 +26,6 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to {@link Catalog} objects.
@ -43,10 +43,10 @@ public interface CatalogClient {
* GET /catalog/{id}
* </pre>
*
* @param catalogRef the reference for the catalog
* @param catalogUri the reference for the catalog
* @return a catalog
*/
Catalog getCatalog(URISupplier catalogRef);
Catalog getCatalog(URI catalogUri);
/**
* Creates a catalog item in a catalog.
@ -55,11 +55,11 @@ public interface CatalogClient {
* POST /catalog/{id}/catalogItems
* </pre>
*
* @param catalogRef the reference for the catalog
* @param catalogUri the URI of the catalog
* @param item the catalog item to create
* @return the created catalog item
*/
CatalogItem addCatalogItem(URISupplier catalogRef, CatalogItem item);
CatalogItem addCatalogItem(URI catalogUri, CatalogItem item);
/**
* Retrieves a catalog item.
@ -71,7 +71,7 @@ public interface CatalogClient {
* @param catalogItemRef the reference for the catalog item
* @return the catalog item
*/
CatalogItem getCatalogItem(URISupplier catalogItemRef);
CatalogItem getCatalogItem(URI catalogItemRef);
/**
* Modifies a catalog item.
@ -84,7 +84,7 @@ public interface CatalogClient {
* @param catalogItem the catalog item
* @return the updated catalog item
*/
CatalogItem updateCatalogItem(URISupplier catalogItemRef, CatalogItem catalogItem);
CatalogItem updateCatalogItem(URI catalogItemRef, CatalogItem catalogItem);
/**
* Deletes a catalog item.
@ -95,7 +95,7 @@ public interface CatalogClient {
*
* @param catalogItemRef the reference for the catalog item
*/
void deleteCatalogItem(URISupplier catalogItemRef);
void deleteCatalogItem(URI catalogItemRef);
/**
* @return synchronous access to {@link Metadata.Writeable} features

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@ -37,10 +39,8 @@ import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -52,43 +52,42 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface MediaAsyncClient {
/**
* @see MediaClient#getMedia(URISupplier)
* @see MediaClient#getMedia(URI)
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> getMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
ListenableFuture<Media> getMedia(@EndpointParam URI uri);
/**
* @see MediaClient#updateMedia(URISupplier, Media))
* @see MediaClient#updateMedia(URI, Media))
*/
@PUT
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> updateMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef,
@BinderParam(BindToXMLPayload.class) Media media);
ListenableFuture<Task> updateMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media);
/**
* @see MediaClient#deleteMedia(URISupplier))
* @see MediaClient#deleteMedia(URI))
*/
@DELETE
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri);
/**
* @see MediaClient#getOwner(URISupplier)
* @see MediaClient#getOwner(URI)
*/
@GET
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
ListenableFuture<Owner> getOwner(@EndpointParam URI uri);
/**
* @return asynchronous access to {@link Metadata.Writeable} features

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
@ -26,7 +27,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to Media.
@ -44,7 +44,7 @@ public interface MediaClient {
*
* @return the media or null if not found
*/
Media getMedia(URISupplier mediaRef);
Media getMedia(URI mediaUri);
/**
* Updates the name/description of a media.
@ -52,19 +52,19 @@ public interface MediaClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task updateMedia(URISupplier mediaRef, Media media);
Task updateMedia(URI mediaUri, Media media);
/**
* Deletes a media.
*/
Task deleteMedia(URISupplier mediaRef);
Task deleteMedia(URI mediaUri);
/**
* Retrieves an owner.
*
* @return the owner or null if not found
*/
Owner getOwner(URISupplier mediaRef);
Owner getOwner(URI mediaUri);
/**
* @return synchronous access to {@link Metadata.Writeable} features

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@ -40,7 +42,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -60,24 +61,23 @@ public interface MetadataAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef);
ListenableFuture<Metadata> getMetadata(@EndpointParam URI metaDataUri);
/**
* @see MetadataClient.Readable#getMetadataEntry(URISupplier, String)
* @see MetadataClient.Readable#getMetadataValue(URI, String)
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef ,
@PathParam("key") String key);
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam URI metaDataUri, @PathParam("key") String key);
}
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public static interface Writable extends Readable {
/**
* @see MetadataClient.Writable#mergeMetadata(URISupplier, Metadata))
* @see MetadataClient.Writable#mergeMetadata(URI, Metadata))
*/
@POST
@Path("/metadata")
@ -85,12 +85,10 @@ public interface MetadataAsyncClient {
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef,
@BinderParam(BindToXMLPayload.class) Metadata metadata);
ListenableFuture<Task> mergeMetadata(@EndpointParam URI metaDataUri, @BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
* @see MetadataClient.Writable#setMetadata(URISupplier, String, MetadataEntry))
* @see MetadataClient.Writable#setMetadata(URI, String, MetadataEntry))
*/
@PUT
@Path("/metadata/{key}")
@ -98,7 +96,7 @@ public interface MetadataAsyncClient {
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
ListenableFuture<Task> setMetadata(@EndpointParam URI metaDataUri,
@PathParam("key") String key,
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
@ -110,7 +108,6 @@ public interface MetadataAsyncClient {
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
@PathParam("key") String key);
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key);
}
}

View File

@ -18,13 +18,13 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to Upload.
@ -42,14 +42,14 @@ public interface MetadataClient {
*
* @return a list of metadata
*/
Metadata getMetadata(URISupplier parentRef);
Metadata getMetadata(URI uri);
/**
* Retrieves a metadata value
*
* @return the metadata value, or null if not found
*/
MetadataValue getMetadataValue(URISupplier parentRef, String key);
MetadataValue getMetadataValue(URI uri, String key);
}
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
@ -60,7 +60,7 @@ public interface MetadataClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task mergeMetadata(URISupplier parentRef, Metadata metadata);
Task mergeMetadata(URI uri, Metadata metadata);
/**
* Sets the metadata for the particular key for the media to the value provided.
@ -69,7 +69,7 @@ public interface MetadataClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task setMetadata(URISupplier parentRef, String key, MetadataValue metadataValue);
Task setMetadata(URI uri, String key, MetadataValue metadataValue);
/**
* Deletes a metadata entry.
@ -77,6 +77,6 @@ public interface MetadataClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task deleteMetadataEntry(URISupplier parentRef, String key);
Task deleteMetadataEntry(URI uri, String key);
}
}

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@ -28,10 +30,8 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -44,13 +44,13 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface NetworkAsyncClient {
/**
* @see NeworkClient#getNetwork(URISupplier)
* @see NetworkClient#getNetwork(URI)
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier networkRef);
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam URI networkUri);
/**
* @return asynchronous access to {@link Metadata.Readable} features

View File

@ -18,13 +18,13 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to Network.
@ -42,7 +42,7 @@ public interface NetworkClient {
*
* @return the network or null if not found
*/
OrgNetwork getNetwork(URISupplier networkRef);
OrgNetwork getNetwork(URI networkUri);
/**
* @return synchronous access to {@link Metadata.Readable} features

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@ -30,11 +32,8 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,13 +54,13 @@ public interface OrgAsyncClient {
ListenableFuture<OrgList> getOrgList();
/**
* @see OrgClient#getOrg(ReferenceType)
* @see OrgClient#getOrg(URI)
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Org> getOrg(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier orgRef);
ListenableFuture<Org> getOrg(@EndpointParam URI orgUri);
/**
* @return asynchronous access to {@link Metadata.Readable} features

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
@ -25,7 +26,6 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to Org.
@ -57,7 +57,7 @@ public interface OrgClient {
*
* @return the org or null if not found
*/
Org getOrg(URISupplier orgRef);
Org getOrg(URI orgRef);
/**
* @return synchronous access to {@link Metadata.Readable} features

View File

@ -35,7 +35,6 @@ import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
import com.google.common.util.concurrent.ListenableFuture;
@ -53,7 +52,7 @@ public interface TaskAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URISupplier orgRef);
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URI orgURI);
/**
* @see TaskClient#getTask(URI)
@ -62,7 +61,7 @@ public interface TaskAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> getTask(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier taskRef);
ListenableFuture<Task> getTask(@EndpointParam URI taskURI);
/**
* @see TaskClient#cancelTask(URI)
@ -72,5 +71,5 @@ public interface TaskAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Void> cancelTask(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier taskRef);
ListenableFuture<Void> cancelTask(@EndpointParam URI taskURI);
}

View File

@ -18,12 +18,12 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
* Provides synchronous access to {@link Task} objects.
@ -41,10 +41,10 @@ public interface TaskClient {
* GET /tasksList/{id}
* </pre>
*
* @param orgId the unique id for the organization
* @param orgURI the URI of the organization
* @return a list of tasks
*/
TasksList getTaskList(URISupplier orgRef);
TasksList getTaskList(URI orgURI);
/**
* Retrieves a task.
@ -55,7 +55,7 @@ public interface TaskClient {
*
* @return the task or null if not found
*/
Task getTask(URISupplier taskUri);
Task getTask(URI taskUri);
/**
* Cancels a task.
@ -64,5 +64,5 @@ public interface TaskClient {
* POST /task/{id}/action/cancel
* </pre>
*/
void cancelTask(URISupplier taskUri);
void cancelTask(URI taskUri);
}

Some files were not shown because too many files have changed in this diff Show More