VCloud Director 1.5: adding VAppTemplate and friends - including JAXB compatible OVF and CIM objects

This commit is contained in:
Adam Lowe 2012-02-27 13:05:39 +00:00
parent 9b4e9e24c7
commit 2d54717f08
43 changed files with 7318 additions and 1429 deletions

View File

@ -18,24 +18,11 @@
*/
package org.jclouds.vcloud.director.v1_5;
import org.jclouds.ovf.Network;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import com.google.inject.Provides;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.*;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.*;
/**
* Provides asynchronous access to VCloudDirector via their REST API.
@ -92,4 +79,11 @@ public interface VCloudDirectorAsyncClient {
*/
@Delegate
VdcAsyncClient getVdcClient();
/**
* @return asynchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
*/
@Delegate
VAppTemplateAsyncClient getVAppTemplateClient();
}

View File

@ -18,27 +18,14 @@
*/
package org.jclouds.vcloud.director.v1_5;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.ovf.Network;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Org;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import com.google.inject.Provides;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.*;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.*;
import java.util.concurrent.TimeUnit;
/**
* Provides synchronous access to VCloudDirector.
@ -95,4 +82,11 @@ public interface VCloudDirectorClient {
*/
@Delegate
VdcClient getVdcClient();
/*
* @return synchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
*/
@Delegate
VAppTemplateClient getVAppTemplateClient();
}

View File

@ -29,6 +29,8 @@ public class VCloudDirectorConstants {
/** The XML namespace used by the clients. */
public static final String VCLOUD_1_5_NS = "http://www.vmware.com/vcloud/v1.5";
public static final String VCLOUD_OVF_NS = "http://schemas.dmtf.org/ovf/envelope/1";
/** The property used to configure the timeout for task completion. */
public static final String PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud-director.timeout.task-complete";
@ -51,7 +53,7 @@ public class VCloudDirectorConstants {
/** TODO javadoc */
public static final String PROPERTY_VCLOUD_DIRECTOR_XML_NAMESPACE = "jclouds.vcloud-director.xml.ns";
/** TODO javadoc */
public static final String PROPERTY_VCLOUD_DIRECTOR_XML_SCHEMA = "jclouds.vcloud-director.xml.schema";

View File

@ -107,6 +107,20 @@ public class VCloudDirectorMediaType {
public static final String CONTROL_ACCESS = "application/vnd.vmware.vcloud.controlAccess+xml";
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 GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_CONFIG_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String NETWORK_CONNECTION_SECTION = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String PRODUCT_SECTION_LIST = "application/vnd.vmware.vcloud.vAppTemplate+xml";
/**
* All acceptable media types.
*
@ -121,6 +135,7 @@ public class VCloudDirectorMediaType {
COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS,
UPLOAD_VAPP_TEMPLATE_PARAMS,
QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,
CONTROL_ACCESS
VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION, NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION,
CONTROL_ACCESS
);
}

View File

@ -17,14 +17,16 @@
*/
package org.jclouds.vcloud.director.v1_5.config;
import static com.google.common.base.Throwables.propagate;
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import org.jclouds.Constants;
import org.jclouds.concurrent.RetryOnTimeOutExceptionFunction;
import org.jclouds.domain.Credentials;
@ -42,36 +44,20 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.annotations.Login;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MediaAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.*;
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose;
import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
import org.jclouds.vcloud.director.v1_5.login.SessionAsyncClient;
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Throwables.propagate;
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
/**
* Configures the VCloudDirector connection.
@ -90,6 +76,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(MediaClient.class, MediaAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class)
.put(VdcClient.class, VdcAsyncClient.class)
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
.build();
public VCloudDirectorRestClientModule() {

View File

@ -31,7 +31,12 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.DeploymentOptionSection;
import org.jclouds.ovf.DiskSection;
import org.jclouds.ovf.OperatingSystemSection;
import org.jclouds.ovf.ProductSection;
import org.jclouds.ovf.Section;
import org.jclouds.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
@ -93,7 +98,7 @@ public class CaptureVAppParams
}
/**
* @see CaptureVAppParams#getExtend()
* @see CaptureVAppParams#getSections()
*/
public Builder sections(List<JAXBElement<? extends Section<?>>> sections) {
this.sections = sections;
@ -177,24 +182,24 @@ public class CaptureVAppParams
*
* <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 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 >}
*
*
*/

View File

@ -0,0 +1,329 @@
/**
* 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 java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
/**
* Represents a vApp template customization settings section.
* <p/>
* <p/>
* <p>Java class for CustomizationSection complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="CustomizationSection">
* &lt;complexContent>
* &lt;extension base="{http://schemas.dmtf.org/ovf/envelope/1}Section_Type">
* &lt;sequence>
* &lt;element name="CustomizeOnInstantiate" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="Link" type="{http://www.vmware.com/vcloud/v1.5}LinkType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="href" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
* &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;anyAttribute processContents='lax'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "CustomizationSection")
@XmlType(propOrder = {
"customizeOnInstantiate",
"link",
"any"
})
public class CustomizationSection extends SectionType<CustomizationSection> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromCustomizationSection(this);
}
public static class Builder extends SectionType.Builder<CustomizationSection> {
private boolean customizeOnInstantiate;
private List<Link> link;
private List<Object> any;
private URI href;
private String type;
/**
* @see CustomizationSection#isCustomizeOnInstantiate()
*/
public Builder customizeOnInstantiate(boolean customizeOnInstantiate) {
this.customizeOnInstantiate = customizeOnInstantiate;
return this;
}
/**
* @see CustomizationSection#getLink()
*/
public Builder link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see CustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this;
}
/**
* @see CustomizationSection#getHref()
*/
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see CustomizationSection#getType()
*/
public Builder type(String type) {
this.type = type;
return this;
}
public CustomizationSection build() {
CustomizationSection customizationSection = new CustomizationSection(info, link, any);
customizationSection.setCustomizeOnInstantiate(customizeOnInstantiate);
customizationSection.setHref(href);
customizationSection.setType(type);
return customizationSection;
}
public Builder fromCustomizationSection(CustomizationSection in) {
return fromSection(in)
.customizeOnInstantiate(in.isCustomizeOnInstantiate())
.link(in.getLink())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<CustomizationSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private CustomizationSection(String info, List<Link> link, List<Object> any) {
super(info);
this.link = link;
this.any = any;
}
private CustomizationSection() {
// For JAXB
}
@XmlElement(name = "CustomizeOnInstantiate")
protected boolean customizeOnInstantiate;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
/**
* Gets the value of the customizeOnInstantiate property.
*/
public boolean isCustomizeOnInstantiate() {
return customizeOnInstantiate;
}
/**
* Sets the value of the customizeOnInstantiate property.
*/
public void setCustomizeOnInstantiate(boolean value) {
this.customizeOnInstantiate = value;
}
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the href property.
*
* @return possible object is
* {@link String }
*/
public URI getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value allowed object is
* {@link String }
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
CustomizationSection that = CustomizationSection.class.cast(o);
return equal(customizeOnInstantiate, that.customizeOnInstantiate) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(customizeOnInstantiate,
link,
any,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("customizeOnInstantiate", customizeOnInstantiate)
.add("link", link)
.add("any", any)
.add("href", href)
.add("type", type).toString();
}
}

View File

@ -1,350 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.Section;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
/**
*
* Represents a vApp template customization settings section.
*
*
* <p>Java class for CustomizationSection complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CustomizationSection">
* &lt;complexContent>
* &lt;extension base="{http://schemas.dmtf.org/ovf/envelope/1}Section_Type">
* &lt;sequence>
* &lt;element name="CustomizeOnInstantiate" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="Link" type="{http://www.vmware.com/vcloud/v1.5}LinkType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="href" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
* &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;anyAttribute processContents='lax'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CustomizationSection", propOrder = {
"customizeOnInstantiate",
"link",
"any"
})
public class CustomizationSectionType<T extends CustomizationSectionType<T>>
extends Section<T>
{
public static <T extends CustomizationSectionType<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromCustomizationSectionType(this);
}
public static class Builder<T extends CustomizationSectionType<T>> extends Section.Builder<T> {
private boolean customizeOnInstantiate;
private List<Link> link;
private List<Object> any;
private String href;
private String type;
/**
* @see CustomizationSectionType#getCustomizeOnInstantiate()
*/
public Builder<T> customizeOnInstantiate(boolean customizeOnInstantiate) {
this.customizeOnInstantiate = customizeOnInstantiate;
return this;
}
/**
* @see CustomizationSectionType#getLink()
*/
public Builder<T> link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see CustomizationSectionType#getAny()
*/
public Builder<T> any(List<Object> any) {
this.any = any;
return this;
}
/**
* @see CustomizationSectionType#getHref()
*/
public Builder<T> href(String href) {
this.href = href;
return this;
}
/**
* @see CustomizationSectionType#getType()
*/
public Builder<T> type(String type) {
this.type = type;
return this;
}
public CustomizationSectionType<T> build() {
CustomizationSectionType<T> customizationSection = new CustomizationSectionType<T>(info, link, any);
customizationSection.setCustomizeOnInstantiate(customizeOnInstantiate);
customizationSection.setHref(href);
customizationSection.setType(type);
return customizationSection;
}
/**
* @see Section#getInfo
*/
public Builder<T> info(String info) {
this.info = info;
return this;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromSection(Section<T> in) {
return Builder.class.cast(super.fromSection(in));
}
public Builder<T> fromCustomizationSectionType(CustomizationSectionType<T> in) {
return fromSection(in)
.customizeOnInstantiate(in.isCustomizeOnInstantiate())
.link(in.getLink())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
}
private CustomizationSectionType() {
// For JAXB and builder use
}
private CustomizationSectionType(String info, List<Link> link, List<Object> any) {
super(info);
this.link = link;
this.any = any;
}
@XmlElement(name = "CustomizeOnInstantiate")
protected boolean customizeOnInstantiate;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAttribute
protected String type;
/**
* Gets the value of the customizeOnInstantiate property.
*
*/
public boolean isCustomizeOnInstantiate() {
return customizeOnInstantiate;
}
/**
* Sets the value of the customizeOnInstantiate property.
*
*/
public void setCustomizeOnInstantiate(boolean value) {
this.customizeOnInstantiate = value;
}
/**
* Gets the value of the link property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LinkType }
*
*
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
CustomizationSectionType<?> that = CustomizationSectionType.class.cast(o);
return equal(customizeOnInstantiate, that.customizeOnInstantiate) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(customizeOnInstantiate,
link,
any,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("customizeOnInstantiate", customizeOnInstantiate)
.add("link", link)
.add("any", any)
.add("href", href)
.add("type", type).toString();
}
}

View File

@ -0,0 +1,151 @@
/**
* 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.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Configuration;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* The DeploymentOptionSection specifies a discrete set of intended resource configurations. The
* author of an OVF package can include sizing metadata for different configurations. A consumer of
* the OVF shall select a configuration, for example, by prompting the user. The selected
* configuration is visible in the OVF environment, enabling guest software to adapt to the selected
* configuration.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "DeploymentOptionSection", namespace = VCLOUD_OVF_NS)
public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromDeploymentOptionSection(this);
}
public static class Builder extends SectionType.Builder<DeploymentOptionSection> {
protected Set<Configuration> configurations = Sets.newLinkedHashSet();
/**
* @see DeploymentOptionSection#getConfigurations
*/
public Builder configuration(Configuration configuration) {
this.configurations.add(checkNotNull(configuration, "configuration"));
return this;
}
/**
* @see DeploymentOptionSection#getConfigurations
*/
public Builder configurations(Iterable<Configuration> configurations) {
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DeploymentOptionSection build() {
return new DeploymentOptionSection(info, configurations);
}
public Builder fromDeploymentOptionSection(DeploymentOptionSection in) {
return info(in.getInfo()).configurations(in.getConfigurations());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<DeploymentOptionSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
@XmlElement(name = "Configuration")
protected Set<Configuration> configurations;
private DeploymentOptionSection(String info, Iterable<Configuration> configurations) {
super(info);
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations"));
}
private DeploymentOptionSection() {
// For JAXB
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), configurations);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false;
DeploymentOptionSection other = (DeploymentOptionSection) obj;
return super.equals(other) && Objects.equal(configurations, other.configurations);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("configurations", configurations);
}
public Set<Configuration> getConfigurations() {
return configurations;
}
}

View File

@ -0,0 +1,155 @@
/**
* 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.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Disk;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* A DiskSection describes meta-information about virtual disks in the OVF package. Virtual disks
* and their metadata are described outside the virtual hardware to facilitate sharing between
* virtual machines within an OVF package.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS)
@XmlType(propOrder = {
"disks"
})
public class DiskSection extends SectionType<DiskSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromDiskSection(this);
}
public static class Builder extends SectionType.Builder<DiskSection> {
protected Set<Disk> disks = Sets.newLinkedHashSet();
/**
* @see DiskSection#getDisks
*/
public Builder disk(Disk disk) {
this.disks.add(checkNotNull(disk, "disk"));
return this;
}
/**
* @see DiskSection#getDisks
*/
public Builder disks(Iterable<Disk> disks) {
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DiskSection build() {
return new DiskSection(info, disks);
}
public Builder fromDiskSection(DiskSection in) {
return disks(in.getDisks()).info(in.getInfo());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<DiskSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private Set<Disk> disks;
private DiskSection(String info, Iterable<Disk> disks) {
super(info);
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
}
private DiskSection() {
// for JAXB
}
/**
* All disks referred to from Connection elements in all {@link VirtualHardwareSection} elements
* shall be defined in the DiskSection.
*
* @return
*/
public Set<Disk> getDisks() {
return disks;
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), disks);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
DiskSection other = (DiskSection) obj;
return super.equals(other) && Objects.equal(disks, other.disks);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("disks", disks);
}
}

View File

@ -0,0 +1,829 @@
/**
* 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 java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
/**
* Represents a guest customization settings.
* <p/>
* <p/>
* <p>Java class for GuestCustomizationSection complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* &lt;complexType name="GuestCustomizationSection">
* &lt;complexContent>
* &lt;extension base="{http://schemas.dmtf.org/ovf/envelope/1}Section_Type">
* &lt;sequence>
* &lt;element name="Enabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="ChangeSid" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="VirtualMachineId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="JoinDomainEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="UseOrgSettings" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="DomainName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="DomainUserName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="DomainUserPassword" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="AdminPasswordEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="AdminPasswordAuto" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="AdminPassword" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="ResetPasswordRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="CustomizationScript" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="ComputerName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Link" type="{http://www.vmware.com/vcloud/v1.5}LinkType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="href" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
* &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;anyAttribute processContents='lax'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "GuestCustomizationSection")
@XmlType(propOrder = {
"enabled",
"changeSid",
"virtualMachineId",
"joinDomainEnabled",
"useOrgSettings",
"domainName",
"domainUserName",
"domainUserPassword",
"adminPasswordEnabled",
"adminPasswordAuto",
"adminPassword",
"resetPasswordRequired",
"customizationScript",
"computerName",
"link",
"any"
})
public class GuestCustomizationSection extends SectionType<GuestCustomizationSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromGuestCustomizationSection(this);
}
public static class Builder extends SectionType.Builder<GuestCustomizationSection> {
private Boolean enabled;
private Boolean changeSid;
private String virtualMachineId;
private Boolean joinDomainEnabled;
private Boolean useOrgSettings;
private String domainName;
private String domainUserName;
private String domainUserPassword;
private Boolean adminPasswordEnabled;
private Boolean adminPasswordAuto;
private String adminPassword;
private Boolean resetPasswordRequired;
private String customizationScript;
private String computerName;
private List<Link> link;
private List<Object> any;
private URI href;
private String type;
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isEnabled()
*/
public Builder enabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isChangeSid()
*/
public Builder changeSid(Boolean changeSid) {
this.changeSid = changeSid;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getVirtualMachineId()
*/
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isJoinDomainEnabled()
*/
public Builder joinDomainEnabled(Boolean joinDomainEnabled) {
this.joinDomainEnabled = joinDomainEnabled;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isUseOrgSettings()
*/
public Builder useOrgSettings(Boolean useOrgSettings) {
this.useOrgSettings = useOrgSettings;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getDomainName()
*/
public Builder domainName(String domainName) {
this.domainName = domainName;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getDomainUserName()
*/
public Builder domainUserName(String domainUserName) {
this.domainUserName = domainUserName;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getDomainUserPassword()
*/
public Builder domainUserPassword(String domainUserPassword) {
this.domainUserPassword = domainUserPassword;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isAdminPasswordEnabled()
*/
public Builder adminPasswordEnabled(Boolean adminPasswordEnabled) {
this.adminPasswordEnabled = adminPasswordEnabled;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isAdminPasswordAuto()
*/
public Builder adminPasswordAuto(Boolean adminPasswordAuto) {
this.adminPasswordAuto = adminPasswordAuto;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getAdminPassword()
*/
public Builder adminPassword(String adminPassword) {
this.adminPassword = adminPassword;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#isResetPasswordRequired()
*/
public Builder resetPasswordRequired(Boolean resetPasswordRequired) {
this.resetPasswordRequired = resetPasswordRequired;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getCustomizationScript()
*/
public Builder customizationScript(String customizationScript) {
this.customizationScript = customizationScript;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getComputerName()
*/
public Builder computerName(String computerName) {
this.computerName = computerName;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink()
*/
public Builder link(List<Link> link) {
this.link = link;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getHref()
*/
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getType()
*/
public Builder type(String type) {
this.type = type;
return this;
}
public GuestCustomizationSection build() {
GuestCustomizationSection guestCustomizationSection = new GuestCustomizationSection(info, resetPasswordRequired, link, any);
guestCustomizationSection.setEnabled(enabled);
guestCustomizationSection.setChangeSid(changeSid);
guestCustomizationSection.setVirtualMachineId(virtualMachineId);
guestCustomizationSection.setJoinDomainEnabled(joinDomainEnabled);
guestCustomizationSection.setUseOrgSettings(useOrgSettings);
guestCustomizationSection.setDomainName(domainName);
guestCustomizationSection.setDomainUserName(domainUserName);
guestCustomizationSection.setDomainUserPassword(domainUserPassword);
guestCustomizationSection.setAdminPasswordEnabled(adminPasswordEnabled);
guestCustomizationSection.setAdminPasswordAuto(adminPasswordAuto);
guestCustomizationSection.setAdminPassword(adminPassword);
guestCustomizationSection.setCustomizationScript(customizationScript);
guestCustomizationSection.setComputerName(computerName);
guestCustomizationSection.setHref(href);
guestCustomizationSection.setType(type);
return guestCustomizationSection;
}
public Builder fromGuestCustomizationSection(GuestCustomizationSection in) {
return fromSection(in)
.enabled(in.isEnabled())
.changeSid(in.isChangeSid())
.virtualMachineId(in.getVirtualMachineId())
.joinDomainEnabled(in.isJoinDomainEnabled())
.useOrgSettings(in.isUseOrgSettings())
.domainName(in.getDomainName())
.domainUserName(in.getDomainUserName())
.domainUserPassword(in.getDomainUserPassword())
.adminPasswordEnabled(in.isAdminPasswordEnabled())
.adminPasswordAuto(in.isAdminPasswordAuto())
.adminPassword(in.getAdminPassword())
.resetPasswordRequired(in.isResetPasswordRequired())
.customizationScript(in.getCustomizationScript())
.computerName(in.getComputerName())
.link(in.getLink())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<GuestCustomizationSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private GuestCustomizationSection() {
// For JAXB and builder use
super(null);
}
private GuestCustomizationSection(@Nullable String info, Boolean resetPasswordRequired, List<Link> link, List<Object> any) {
super(info);
this.resetPasswordRequired = resetPasswordRequired;
this.link = link;
this.any = any;
}
@XmlElement(name = "Enabled")
protected Boolean enabled;
@XmlElement(name = "ChangeSid")
protected Boolean changeSid;
@XmlElement(name = "VirtualMachineId")
protected String virtualMachineId;
@XmlElement(name = "JoinDomainEnabled")
protected Boolean joinDomainEnabled;
@XmlElement(name = "UseOrgSettings")
protected Boolean useOrgSettings;
@XmlElement(name = "DomainName")
protected String domainName;
@XmlElement(name = "DomainUserName")
protected String domainUserName;
@XmlElement(name = "DomainUserPassword")
protected String domainUserPassword;
@XmlElement(name = "AdminPasswordEnabled")
protected Boolean adminPasswordEnabled;
@XmlElement(name = "AdminPasswordAuto")
protected Boolean adminPasswordAuto;
@XmlElement(name = "AdminPassword")
protected String adminPassword;
@XmlElement(name = "ResetPasswordRequired")
protected Boolean resetPasswordRequired;
@XmlElement(name = "CustomizationScript")
protected String customizationScript;
@XmlElement(name = "ComputerName")
protected String computerName;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
/**
* Gets the value of the enabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isEnabled() {
return enabled;
}
/**
* Sets the value of the enabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setEnabled(Boolean value) {
this.enabled = value;
}
/**
* Gets the value of the changeSid property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isChangeSid() {
return changeSid;
}
/**
* Sets the value of the changeSid property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setChangeSid(Boolean value) {
this.changeSid = value;
}
/**
* Gets the value of the virtualMachineId property.
*
* @return possible object is
* {@link String }
*/
public String getVirtualMachineId() {
return virtualMachineId;
}
/**
* Sets the value of the virtualMachineId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVirtualMachineId(String value) {
this.virtualMachineId = value;
}
/**
* Gets the value of the joinDomainEnabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isJoinDomainEnabled() {
return joinDomainEnabled;
}
/**
* Sets the value of the joinDomainEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setJoinDomainEnabled(Boolean value) {
this.joinDomainEnabled = value;
}
/**
* Gets the value of the useOrgSettings property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isUseOrgSettings() {
return useOrgSettings;
}
/**
* Sets the value of the useOrgSettings property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setUseOrgSettings(Boolean value) {
this.useOrgSettings = value;
}
/**
* Gets the value of the domainName property.
*
* @return possible object is
* {@link String }
*/
public String getDomainName() {
return domainName;
}
/**
* Sets the value of the domainName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainName(String value) {
this.domainName = value;
}
/**
* Gets the value of the domainUserName property.
*
* @return possible object is
* {@link String }
*/
public String getDomainUserName() {
return domainUserName;
}
/**
* Sets the value of the domainUserName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserName(String value) {
this.domainUserName = value;
}
/**
* Gets the value of the domainUserPassword property.
*
* @return possible object is
* {@link String }
*/
public String getDomainUserPassword() {
return domainUserPassword;
}
/**
* Sets the value of the domainUserPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserPassword(String value) {
this.domainUserPassword = value;
}
/**
* Gets the value of the adminPasswordEnabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isAdminPasswordEnabled() {
return adminPasswordEnabled;
}
/**
* Sets the value of the adminPasswordEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordEnabled(Boolean value) {
this.adminPasswordEnabled = value;
}
/**
* Gets the value of the adminPasswordAuto property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isAdminPasswordAuto() {
return adminPasswordAuto;
}
/**
* Sets the value of the adminPasswordAuto property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordAuto(Boolean value) {
this.adminPasswordAuto = value;
}
/**
* Gets the value of the adminPassword property.
*
* @return possible object is
* {@link String }
*/
public String getAdminPassword() {
return adminPassword;
}
/**
* Sets the value of the adminPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setAdminPassword(String value) {
this.adminPassword = value;
}
/**
* Gets the value of the resetPasswordRequired property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isResetPasswordRequired() {
return resetPasswordRequired;
}
/**
* Sets the value of the resetPasswordRequired property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setResetPasswordRequired(Boolean value) {
this.resetPasswordRequired = value;
}
/**
* Gets the value of the customizationScript property.
*
* @return possible object is
* {@link String }
*/
public String getCustomizationScript() {
return customizationScript;
}
/**
* Sets the value of the customizationScript property.
*
* @param value allowed object is
* {@link String }
*/
public void setCustomizationScript(String value) {
this.customizationScript = value;
}
/**
* Gets the value of the computerName property.
*
* @return possible object is
* {@link String }
*/
public String getComputerName() {
return computerName;
}
/**
* Sets the value of the computerName property.
*
* @param value allowed object is
* {@link String }
*/
public void setComputerName(String value) {
this.computerName = value;
}
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link org.w3c.dom.Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the href property.
*/
public URI getHref() {
return href;
}
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GuestCustomizationSection that = GuestCustomizationSection.class.cast(o);
return equal(enabled, that.enabled) &&
equal(changeSid, that.changeSid) &&
equal(virtualMachineId, that.virtualMachineId) &&
equal(joinDomainEnabled, that.joinDomainEnabled) &&
equal(useOrgSettings, that.useOrgSettings) &&
equal(domainName, that.domainName) &&
equal(domainUserName, that.domainUserName) &&
equal(domainUserPassword, that.domainUserPassword) &&
equal(adminPasswordEnabled, that.adminPasswordEnabled) &&
equal(adminPasswordAuto, that.adminPasswordAuto) &&
equal(adminPassword, that.adminPassword) &&
equal(resetPasswordRequired, that.resetPasswordRequired) &&
equal(customizationScript, that.customizationScript) &&
equal(computerName, that.computerName) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(enabled,
changeSid,
virtualMachineId,
joinDomainEnabled,
useOrgSettings,
domainName,
domainUserName,
domainUserPassword,
adminPasswordEnabled,
adminPasswordAuto,
adminPassword,
resetPasswordRequired,
customizationScript,
computerName,
link,
any,
href,
type);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("enabled", enabled)
.add("changeSid", changeSid)
.add("virtualMachineId", virtualMachineId)
.add("joinDomainEnabled", joinDomainEnabled)
.add("useOrgSettings", useOrgSettings)
.add("domainName", domainName)
.add("domainUserName", domainUserName)
.add("domainUserPassword", domainUserPassword)
.add("adminPasswordEnabled", adminPasswordEnabled)
.add("adminPasswordAuto", adminPasswordAuto)
.add("adminPassword", adminPassword)
.add("resetPasswordRequired", resetPasswordRequired)
.add("customizationScript", customizationScript)
.add("computerName", computerName)
.add("link", link)
.add("any", any)
.add("href", href)
.add("type", type).toString();
}
}

View File

@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.Section;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
@ -74,12 +74,12 @@ public class InstantiationParams {
public static class Builder {
private List<JAXBElement<? extends Section<?>>> sections;
private List<JAXBElement<? extends SectionType<?>>> sections;
/**
* @see InstantiationParams#getExtend()
* @see InstantiationParams#getSections()
*/
public Builder sections(List<JAXBElement<? extends Section<?>>> sections) {
public Builder sections(List<JAXBElement<? extends SectionType<?>>> sections) {
this.sections = sections;
return this;
}
@ -100,18 +100,19 @@ public class InstantiationParams {
// For JAXB and builder use
}
private InstantiationParams(List<JAXBElement<? extends Section<?>>> sections) {
private InstantiationParams(List<JAXBElement<? extends SectionType<?>>> sections) {
this.sections = sections;
}
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected List<JAXBElement<? extends Section<?>>> sections;
protected List<JAXBElement<? extends SectionType<?>>> sections;
/**
*
* An ovf:Section to configure for instantiation.
* Gets the value of the section property.
* An ovf:Section to configure for instantiation.
*
* Gets the value of the section property.
*
* <p>
* This accessor method returns a reference to the live list,
@ -129,29 +130,29 @@ public class InstantiationParams {
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSection }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSection }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSection }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSection }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSection }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSection }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSection }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSection }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSection }{@code >}
* {@link JAXBElement }{@code <}{@link org.jclouds.ovf.OperatingSystemSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSection }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkSection }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*
*
*/
public List<JAXBElement<? extends Section<?>>> getSections() {
public List<JAXBElement<? extends SectionType<?>>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends Section<?>>>();
sections = new ArrayList<JAXBElement<? extends SectionType<?>>>();
}
return this.sections;
}

View File

@ -20,34 +20,35 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
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.ovf.Section;
import org.jclouds.javax.annotation.Nullable;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
/**
*
* Represents the lease settings section for a vApp.
*
*
* Represents the lease settings section for a vApp.
* <p/>
* <p/>
* <p>Java class for LeaseSettingsSection complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="LeaseSettingsSection">
* &lt;complexContent>
@ -67,53 +68,48 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LeaseSettingsSection", propOrder = {
"link",
"deploymentLeaseInSeconds",
"storageLeaseInSeconds",
"deploymentLeaseExpiration",
"storageLeaseExpiration",
"any"
@XmlRootElement(name = "LeaseSettingsSection", namespace = VCLOUD_1_5_NS)
@XmlType(propOrder = {
"link",
"deploymentLeaseInSeconds",
"storageLeaseInSeconds",
"deploymentLeaseExpiration",
"storageLeaseExpiration",
"any"
})
public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
extends Section<T>
{
public static <T extends LeaseSettingsSection<T>> Builder<T> builder() {
return new Builder<T>();
public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public static <T extends LeaseSettingsSection> Builder builder() {
return new Builder();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromLeaseSettingsSection(this);
public Builder toBuilder() {
return new Builder().fromLeaseSettingsSection(this);
}
public static class Builder<T extends LeaseSettingsSection<T>> extends Section.Builder<T> {
private List<Link> link;
public static class Builder extends SectionType.Builder<LeaseSettingsSection> {
private List<Link> links;
private Integer deploymentLeaseInSeconds;
private Integer storageLeaseInSeconds;
private XMLGregorianCalendar deploymentLeaseExpiration;
private XMLGregorianCalendar storageLeaseExpiration;
private List<Object> any;
private String href;
private URI href;
private String type;
/**
* @see LeaseSettingsSection#getLink()
* @see LeaseSettingsSection#getLinks()
*/
public Builder<T> link(List<Link> link) {
this.link = link;
public Builder links(List<Link> links) {
this.links = links;
return this;
}
/**
* @see LeaseSettingsSection#getDeploymentLeaseInSeconds()
*/
public Builder<T> deploymentLeaseInSeconds(Integer deploymentLeaseInSeconds) {
public Builder deploymentLeaseInSeconds(Integer deploymentLeaseInSeconds) {
this.deploymentLeaseInSeconds = deploymentLeaseInSeconds;
return this;
}
@ -121,7 +117,7 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getStorageLeaseInSeconds()
*/
public Builder<T> storageLeaseInSeconds(Integer storageLeaseInSeconds) {
public Builder storageLeaseInSeconds(Integer storageLeaseInSeconds) {
this.storageLeaseInSeconds = storageLeaseInSeconds;
return this;
}
@ -129,7 +125,7 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getDeploymentLeaseExpiration()
*/
public Builder<T> deploymentLeaseExpiration(XMLGregorianCalendar deploymentLeaseExpiration) {
public Builder deploymentLeaseExpiration(XMLGregorianCalendar deploymentLeaseExpiration) {
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
return this;
}
@ -137,7 +133,7 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getStorageLeaseExpiration()
*/
public Builder<T> storageLeaseExpiration(XMLGregorianCalendar storageLeaseExpiration) {
public Builder storageLeaseExpiration(XMLGregorianCalendar storageLeaseExpiration) {
this.storageLeaseExpiration = storageLeaseExpiration;
return this;
}
@ -145,7 +141,7 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getAny()
*/
public Builder<T> any(List<Object> any) {
public Builder any(List<Object> any) {
this.any = any;
return this;
}
@ -153,7 +149,7 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getHref()
*/
public Builder<T> href(String href) {
public Builder href(URI href) {
this.href = href;
return this;
}
@ -161,14 +157,14 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
/**
* @see LeaseSettingsSection#getType()
*/
public Builder<T> type(String type) {
public Builder type(String type) {
this.type = type;
return this;
}
public LeaseSettingsSection<T> build() {
LeaseSettingsSection<T> leaseSettingsSection = new LeaseSettingsSection<T>(link, any);
public LeaseSettingsSection build() {
LeaseSettingsSection leaseSettingsSection = new LeaseSettingsSection(info, links, any);
leaseSettingsSection.setDeploymentLeaseInSeconds(deploymentLeaseInSeconds);
leaseSettingsSection.setStorageLeaseInSeconds(storageLeaseInSeconds);
leaseSettingsSection.setDeploymentLeaseExpiration(deploymentLeaseExpiration);
@ -178,287 +174,263 @@ public class LeaseSettingsSection<T extends LeaseSettingsSection<T>>
return leaseSettingsSection;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromSection(Section<T> in) {
return Builder.class.cast(super.fromSection(in));
}
public Builder<T> fromLeaseSettingsSection(LeaseSettingsSection<T> in) {
public Builder fromLeaseSettingsSection(LeaseSettingsSection in) {
return fromSection(in)
.link(in.getLink())
.deploymentLeaseInSeconds(in.getDeploymentLeaseInSeconds())
.storageLeaseInSeconds(in.getStorageLeaseInSeconds())
.deploymentLeaseExpiration(in.getDeploymentLeaseExpiration())
.storageLeaseExpiration(in.getStorageLeaseExpiration())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
.links(in.getLinks())
.deploymentLeaseInSeconds(in.getDeploymentLeaseInSeconds())
.storageLeaseInSeconds(in.getStorageLeaseInSeconds())
.deploymentLeaseExpiration(in.getDeploymentLeaseExpiration())
.storageLeaseExpiration(in.getStorageLeaseExpiration())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<LeaseSettingsSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private LeaseSettingsSection() {
// For JAXB and builder use
}
@XmlElement(name = "Link")
protected List<Link> link;
@XmlElement(name = "DeploymentLeaseInSeconds")
protected Integer deploymentLeaseInSeconds;
@XmlElement(name = "StorageLeaseInSeconds")
protected Integer storageLeaseInSeconds;
@XmlElement(name = "DeploymentLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar deploymentLeaseExpiration;
@XmlElement(name = "StorageLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar storageLeaseExpiration;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
private LeaseSettingsSection(List<Link> link, List<Object> any) {
private LeaseSettingsSection(@Nullable String info, List<Link> link, List<Object> any) {
super(info);
this.link = link;
this.any = any;
}
private LeaseSettingsSection() {
// For JAXB
}
@XmlElement(name = "Link")
protected List<Link> link;
@XmlElement(name = "DeploymentLeaseInSeconds")
protected Integer deploymentLeaseInSeconds;
@XmlElement(name = "StorageLeaseInSeconds")
protected Integer storageLeaseInSeconds;
@XmlElement(name = "DeploymentLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar deploymentLeaseExpiration;
@XmlElement(name = "StorageLeaseExpiration")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar storageLeaseExpiration;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAttribute
protected String type;
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLinks() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the link property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LinkType }
*
*
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the deploymentLeaseInSeconds property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getDeploymentLeaseInSeconds() {
return deploymentLeaseInSeconds;
}
/**
* Gets the value of the deploymentLeaseInSeconds property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getDeploymentLeaseInSeconds() {
return deploymentLeaseInSeconds;
}
/**
* Sets the value of the deploymentLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setDeploymentLeaseInSeconds(Integer value) {
this.deploymentLeaseInSeconds = value;
}
/**
* Sets the value of the deploymentLeaseInSeconds property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setDeploymentLeaseInSeconds(Integer value) {
this.deploymentLeaseInSeconds = value;
}
/**
* Gets the value of the storageLeaseInSeconds property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getStorageLeaseInSeconds() {
return storageLeaseInSeconds;
}
/**
* Gets the value of the storageLeaseInSeconds property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getStorageLeaseInSeconds() {
return storageLeaseInSeconds;
}
/**
* Sets the value of the storageLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setStorageLeaseInSeconds(Integer value) {
this.storageLeaseInSeconds = value;
}
/**
* Sets the value of the storageLeaseInSeconds property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStorageLeaseInSeconds(Integer value) {
this.storageLeaseInSeconds = value;
}
/**
* Gets the value of the deploymentLeaseExpiration property.
*
* @return possible object is
* {@link XMLGregorianCalendar }
*/
public XMLGregorianCalendar getDeploymentLeaseExpiration() {
return deploymentLeaseExpiration;
}
/**
* Gets the value of the deploymentLeaseExpiration property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDeploymentLeaseExpiration() {
return deploymentLeaseExpiration;
}
/**
* Sets the value of the deploymentLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setDeploymentLeaseExpiration(XMLGregorianCalendar value) {
this.deploymentLeaseExpiration = value;
}
/**
* Sets the value of the deploymentLeaseExpiration property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDeploymentLeaseExpiration(XMLGregorianCalendar value) {
this.deploymentLeaseExpiration = value;
}
/**
* Gets the value of the storageLeaseExpiration property.
*
* @return possible object is
* {@link XMLGregorianCalendar }
*/
public XMLGregorianCalendar getStorageLeaseExpiration() {
return storageLeaseExpiration;
}
/**
* Gets the value of the storageLeaseExpiration property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getStorageLeaseExpiration() {
return storageLeaseExpiration;
}
/**
* Sets the value of the storageLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setStorageLeaseExpiration(XMLGregorianCalendar value) {
this.storageLeaseExpiration = value;
}
/**
* Sets the value of the storageLeaseExpiration property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setStorageLeaseExpiration(XMLGregorianCalendar value) {
this.storageLeaseExpiration = value;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* @return the value of the href property.
*/
public URI getHref() {
return href;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
LeaseSettingsSection<?> that = LeaseSettingsSection.class.cast(o);
return equal(link, that.link) &&
equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
equal(storageLeaseInSeconds, that.storageLeaseInSeconds) &&
equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
equal(storageLeaseExpiration, that.storageLeaseExpiration) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
LeaseSettingsSection that = LeaseSettingsSection.class.cast(o);
return equal(link, that.link) &&
equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
equal(storageLeaseInSeconds, that.storageLeaseInSeconds) &&
equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
equal(storageLeaseExpiration, that.storageLeaseExpiration) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(link,
deploymentLeaseInSeconds,
storageLeaseInSeconds,
deploymentLeaseExpiration,
storageLeaseExpiration,
any,
href,
type);
return Objects.hashCode(link,
deploymentLeaseInSeconds,
storageLeaseInSeconds,
deploymentLeaseExpiration,
storageLeaseExpiration,
any,
href,
type);
}
@Override

View File

@ -20,33 +20,34 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.Section;
import org.jclouds.javax.annotation.Nullable;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
/**
*
* Represents the network config section of a vApp.
*
*
* Represents the network config section of a vApp.
* <p/>
* <p/>
* <p>Java class for NetworkConfigSection complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="NetworkConfigSection">
* &lt;complexContent>
@ -63,39 +64,35 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkConfigSection", propOrder = {
"link",
"networkConfig",
"any"
@XmlRootElement(name="NetworkConfigSection", namespace = VCLOUD_1_5_NS)
@XmlType( propOrder = {
"link",
"networkConfig",
"any"
})
public class NetworkConfigSection<T extends NetworkConfigSection<T>>
extends Section<T>
{
public static <T extends NetworkConfigSection<T>> Builder<T> builder() {
return new Builder<T>();
public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static Builder builder() {
return new Builder();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromNetworkConfigSection(this);
public Builder toBuilder() {
return new Builder().fromNetworkConfigSection(this);
}
public static class Builder<T extends NetworkConfigSection<T>> extends Section.Builder<T> {
public static class Builder extends SectionType.Builder<NetworkConfigSection> {
private List<Link> link;
private List<VAppNetworkConfiguration<?>> networkConfig;
private List<Object> any;
private String href;
private URI href;
private String type;
/**
* @see NetworkConfigSection#getLink()
*/
public Builder<T> link(List<Link> link) {
public Builder link(List<Link> link) {
this.link = link;
return this;
}
@ -103,7 +100,7 @@ public class NetworkConfigSection<T extends NetworkConfigSection<T>>
/**
* @see NetworkConfigSection#getNetworkConfig()
*/
public Builder<T> networkConfig(List<VAppNetworkConfiguration<?>> networkConfig) {
public Builder networkConfig(List<VAppNetworkConfiguration<?>> networkConfig) {
this.networkConfig = networkConfig;
return this;
}
@ -111,7 +108,7 @@ public class NetworkConfigSection<T extends NetworkConfigSection<T>>
/**
* @see NetworkConfigSection#getAny()
*/
public Builder<T> any(List<Object> any) {
public Builder any(List<Object> any) {
this.any = any;
return this;
}
@ -119,7 +116,7 @@ public class NetworkConfigSection<T extends NetworkConfigSection<T>>
/**
* @see NetworkConfigSection#getHref()
*/
public Builder<T> href(String href) {
public Builder href(URI href) {
this.href = href;
return this;
}
@ -127,216 +124,206 @@ public class NetworkConfigSection<T extends NetworkConfigSection<T>>
/**
* @see NetworkConfigSection#getType()
*/
public Builder<T> type(String type) {
public Builder type(String type) {
this.type = type;
return this;
}
public NetworkConfigSection<T> build() {
NetworkConfigSection<T> networkConfigSection = new NetworkConfigSection<T>(link, networkConfig, any);
public NetworkConfigSection build() {
NetworkConfigSection networkConfigSection = new NetworkConfigSection(info, link, networkConfig, any);
networkConfigSection.setHref(href);
networkConfigSection.setType(type);
return networkConfigSection;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromSection(Section<T> in) {
return Builder.class.cast(super.fromSection(in));
}
public Builder<T> fromNetworkConfigSection(NetworkConfigSection<T> in) {
public Builder fromNetworkConfigSection(NetworkConfigSection in) {
return fromSection(in)
.link(in.getLink())
.networkConfig(in.getNetworkConfig())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
.link(in.getLink())
.networkConfig(in.getNetworkConfig())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<NetworkConfigSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private NetworkConfigSection() {
// For JAXB and builder use
}
private NetworkConfigSection(List<Link> link, List<VAppNetworkConfiguration<?>> networkConfig, List<Object> any) {
@XmlElement(name = "Link")
protected List<Link> link;
@XmlElement(name = "NetworkConfig")
protected List<VAppNetworkConfiguration<?>> networkConfig;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
private NetworkConfigSection(@Nullable String info, List<Link> link, List<VAppNetworkConfiguration<?>> networkConfig, List<Object> any) {
super(info);
this.link = link;
this.networkConfig = networkConfig;
this.any = any;
}
private NetworkConfigSection() {
// For JAXB
}
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
@XmlElement(name = "Link")
protected List<Link> link;
@XmlElement(name = "NetworkConfig")
protected List<VAppNetworkConfiguration<?>> networkConfig;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAttribute
protected String type;
/**
* Gets the value of the networkConfig property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConfig property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConfig().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link VAppNetworkConfiguration }
*/
public List<VAppNetworkConfiguration<?>> getNetworkConfig() {
if (networkConfig == null) {
networkConfig = new ArrayList<VAppNetworkConfiguration<?>>();
}
return this.networkConfig;
}
/**
* Gets the value of the link property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LinkType }
*
*
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the networkConfig property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConfig property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConfig().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VAppNetworkConfigurationType }
*
*
*/
public List<VAppNetworkConfiguration<?>> getNetworkConfig() {
if (networkConfig == null) {
networkConfig = new ArrayList<VAppNetworkConfiguration<?>>();
}
return this.networkConfig;
}
/**
* Gets the value of the href property.
*/
public URI getHref() {
return href;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
NetworkConfigSection<?> that = NetworkConfigSection.class.cast(o);
return equal(link, that.link) &&
equal(networkConfig, that.networkConfig) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
NetworkConfigSection that = NetworkConfigSection.class.cast(o);
return equal(link, that.link) &&
equal(networkConfig, that.networkConfig) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(link,
networkConfig,
any,
href,
type);
return Objects.hashCode(link,
networkConfig,
any,
href,
type);
}
@Override

View File

@ -20,7 +20,9 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@ -29,24 +31,26 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.Section;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects;
/**
*
* Represents a list of network cards existing in a VM.
*
*
* Represents a list of network cards existing in a VM.
* <p/>
* <p/>
* <p>Java class for NetworkConnectionSection complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="NetworkConnectionSection">
* &lt;complexContent>
@ -64,41 +68,38 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkConnectionSection", propOrder = {
"primaryNetworkConnectionIndex",
"networkConnection",
"link",
"any"
@XmlRootElement(name="NetworkConnectionSection", namespace = VCLOUD_1_5_NS)
@XmlType(propOrder = {
"primaryNetworkConnectionIndex",
"networkConnection",
"link",
"any"
})
public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
extends Section<T>
public class NetworkConnectionSection extends SectionType<NetworkConnectionSection> {
{
public static <T extends NetworkConnectionSection<T>> Builder<T> builder() {
return new Builder<T>();
public static Builder builder() {
return new Builder();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromNetworkConnectionSection(this);
public Builder toBuilder() {
return new Builder().fromNetworkConnectionSection(this);
}
public static class Builder<T extends NetworkConnectionSection<T>> extends Section.Builder<T> {
public static class Builder extends SectionType.Builder<NetworkConnectionSection> {
private Integer primaryNetworkConnectionIndex;
private List<NetworkConnection> networkConnection;
private List<Link> link;
private List<Object> any;
private String href;
private URI href;
private String type;
/**
* @see NetworkConnectionSection#getPrimaryNetworkConnectionIndex()
*/
public Builder<T> primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) {
public Builder primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) {
this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
return this;
}
@ -106,7 +107,7 @@ public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
/**
* @see NetworkConnectionSection#getNetworkConnection()
*/
public Builder<T> networkConnection(List<NetworkConnection> networkConnection) {
public Builder networkConnection(List<NetworkConnection> networkConnection) {
this.networkConnection = networkConnection;
return this;
}
@ -114,7 +115,7 @@ public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
/**
* @see NetworkConnectionSection#getLink()
*/
public Builder<T> link(List<Link> link) {
public Builder link(List<Link> link) {
this.link = link;
return this;
}
@ -122,7 +123,7 @@ public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
/**
* @see NetworkConnectionSection#getAny()
*/
public Builder<T> any(List<Object> any) {
public Builder any(List<Object> any) {
this.any = any;
return this;
}
@ -130,7 +131,7 @@ public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
/**
* @see NetworkConnectionSection#getHref()
*/
public Builder<T> href(String href) {
public Builder href(URI href) {
this.href = href;
return this;
}
@ -138,247 +139,233 @@ public class NetworkConnectionSection<T extends NetworkConnectionSection<T>>
/**
* @see NetworkConnectionSection#getType()
*/
public Builder<T> type(String type) {
public Builder type(String type) {
this.type = type;
return this;
}
public NetworkConnectionSection<T> build() {
NetworkConnectionSection<T> networkConnectionSection = new NetworkConnectionSection<T>(networkConnection, link, any);
public NetworkConnectionSection build() {
NetworkConnectionSection networkConnectionSection = new NetworkConnectionSection(info, networkConnection, link, any);
networkConnectionSection.setPrimaryNetworkConnectionIndex(primaryNetworkConnectionIndex);
networkConnectionSection.setHref(href);
networkConnectionSection.setType(type);
return networkConnectionSection;
}
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnection(in.getNetworkConnection())
.link(in.getLink())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromSection(Section<T> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSection(SectionType<NetworkConnectionSection> in) {
return Builder.class.cast(super.fromSection(in));
}
public Builder<T> fromNetworkConnectionSection(NetworkConnectionSection<T> in) {
return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnection(in.getNetworkConnection())
.link(in.getLink())
.any(in.getAny())
.href(in.getHref())
.type(in.getType());
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private NetworkConnectionSection() {
// For JAXB and builder use
}
private NetworkConnectionSection(List<NetworkConnection> networkConnection, List<Link> link, List<Object> any) {
private NetworkConnectionSection(@Nullable String info, List<NetworkConnection> networkConnection, List<Link> link, List<Object> any) {
super(info);
this.networkConnection = networkConnection;
this.link = link;
this.any = any;
}
private NetworkConnectionSection() {
// For JAXB
}
@XmlElement(name = "PrimaryNetworkConnectionIndex")
protected Integer primaryNetworkConnectionIndex;
@XmlElement(name = "NetworkConnection")
protected List<NetworkConnection> networkConnection;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAttribute
protected String type;
@XmlElement(name = "PrimaryNetworkConnectionIndex")
protected Integer primaryNetworkConnectionIndex;
@XmlElement(name = "NetworkConnection")
protected List<NetworkConnection> networkConnection;
@XmlElement(name = "Link")
protected List<Link> link;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute
protected String type;
/**
* Gets the value of the primaryNetworkConnectionIndex property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getPrimaryNetworkConnectionIndex() {
return primaryNetworkConnectionIndex;
}
/**
* Gets the value of the primaryNetworkConnectionIndex property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getPrimaryNetworkConnectionIndex() {
return primaryNetworkConnectionIndex;
}
/**
* Sets the value of the primaryNetworkConnectionIndex property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setPrimaryNetworkConnectionIndex(Integer value) {
this.primaryNetworkConnectionIndex = value;
}
/**
* Sets the value of the primaryNetworkConnectionIndex property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setPrimaryNetworkConnectionIndex(Integer value) {
this.primaryNetworkConnectionIndex = value;
}
/**
* Gets the value of the networkConnection property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConnection property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConnection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link NetworkConnectionType }
*
*
*/
public List<NetworkConnection> getNetworkConnection() {
if (networkConnection == null) {
networkConnection = new ArrayList<NetworkConnection>();
}
return this.networkConnection;
}
/**
* Gets the value of the networkConnection property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConnection property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConnection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkConnection }
*/
public List<NetworkConnection> getNetworkConnection() {
if (networkConnection == null) {
networkConnection = new ArrayList<NetworkConnection>();
}
return this.networkConnection;
}
/**
* Gets the value of the link property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LinkType }
*
*
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* @return the value of the href property.
*/
public URI getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
NetworkConnectionSection<?> that = NetworkConnectionSection.class.cast(o);
return equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnection, that.networkConnection) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
NetworkConnectionSection that = NetworkConnectionSection.class.cast(o);
return equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnection, that.networkConnection) &&
equal(link, that.link) &&
equal(any, that.any) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(primaryNetworkConnectionIndex,
networkConnection,
link,
any,
href,
type);
return Objects.hashCode(primaryNetworkConnectionIndex,
networkConnection,
link,
any,
href,
type);
}
@Override

View File

@ -0,0 +1,152 @@
/**
* 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.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* The NetworkSection element shall list all logical networks used in the OVF package.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "NetworkSection", namespace = VCLOUD_OVF_NS)
public class NetworkSection extends SectionType<NetworkSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromNetworkSection(this);
}
public static class Builder extends SectionType.Builder<NetworkSection> {
protected Set<Network> networks = Sets.newLinkedHashSet();
/**
* @see NetworkSection#getNetworks
*/
public Builder network(Network network) {
this.networks.add(checkNotNull(network, "network"));
return this;
}
/**
* @see NetworkSection#getNetworks
*/
public Builder networks(Iterable<Network> networks) {
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public NetworkSection build() {
return new NetworkSection(info, networks);
}
public Builder fromNetworkSection(NetworkSection in) {
return networks(in.getNetworks()).info(in.getInfo());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<NetworkSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private Set<Network> networks;
private NetworkSection(String info, Iterable<Network> networks) {
super(info);
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
}
private NetworkSection() {
// for JAXB
}
/**
* All networks referred to from Connection elements in all {@link VirtualHardwareSection}
* elements shall be defined in the NetworkSection.
*
* @return
*/
public Set<Network> getNetworks() {
return networks;
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), networks);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NetworkSection other = (NetworkSection) obj;
return super.equals(other) && Objects.equal(networks, other.networks);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("networks", networks);
}
}

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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
/**
* An OperatingSystemSection specifies the operating system installed on a virtual machine.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection")
public class OperatingSystemSection extends SectionType<OperatingSystemSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromOperatingSystemSection(this);
}
public static class Builder extends SectionType.Builder<OperatingSystemSection> {
private Integer id;
private String description;
private String version;
/**
* @see OperatingSystemSection#getId()
*/
public Builder id(Integer id) {
this.id = id;
return this;
}
/**
* @see OperatingSystemSection#getVersion()
*/
public Builder version(String version) {
this.version = version;
return this;
}
/**
* @see OperatingSystemSection#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public OperatingSystemSection build() {
return new OperatingSystemSection(info, id, version, description);
}
public Builder fromOperatingSystemSection(OperatingSystemSection in) {
return id(in.getId()).info(in.getInfo()).description(in.getDescription());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<OperatingSystemSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
@XmlAttribute
protected Integer id;
@XmlAttribute
protected String version;
@XmlElement
protected String description;
public OperatingSystemSection(@Nullable String info, @Nullable Integer id, @Nullable String version, @Nullable String description) {
super(info);
this.id = id;
this.description = description;
this.version = version;
}
protected OperatingSystemSection() {
// For Builders and JAXB
}
/**
*
* @return ovf id
* @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode()
*/
public Integer getId() {
return id;
}
public String getVersion() {
return version;
}
/**
*
* @return description or null
*/
public String getDescription() {
return description;
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), description);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
OperatingSystemSection other = (OperatingSystemSection) obj;
return super.equals(other) && Objects.equal(description, other.description);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("description", description);
}
}

View File

@ -0,0 +1,140 @@
/**
* 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.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* The ProductSection element specifies product-information for an appliance, such as product name,
* version, and vendor.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ProductSection", namespace = VCLOUD_OVF_NS)
public class ProductSection extends SectionType<ProductSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromDeploymentOptionSection(this);
}
public static class Builder extends SectionType.Builder<ProductSection> {
protected Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties = Sets.newLinkedHashSet();
/**
* @see ProductSection#getProperties
*/
public Builder property(org.jclouds.vcloud.director.v1_5.domain.ovf.Property property) {
this.properties.add(checkNotNull(property, "property"));
return this;
}
/**
* @see ProductSection#getProperties
*/
public Builder properties(Iterable<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties) {
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> copyOf(checkNotNull(properties, "properties"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ProductSection build() {
return new ProductSection(info, properties);
}
public Builder fromDeploymentOptionSection(ProductSection in) {
return info(in.getInfo()).properties(in.getProperties());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<ProductSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
protected Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties;
private ProductSection(String info, Iterable<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties) {
super(info);
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> copyOf(checkNotNull(properties, "properties"));
}
private ProductSection() {
// For JAXB
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), properties);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false;
ProductSection other = (ProductSection) obj;
return super.equals(other) && Objects.equal(properties, other.properties);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("properties", properties);
}
public Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> getProperties() {
return properties;
}
}

View File

@ -32,17 +32,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.ProductSection;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/**
*
* Essentially a container
* with a list of product sections.
*
* Essentially a container with a list of product sections.
*
* <p>Java class for ProductSectionList complex type.
*
@ -176,9 +172,7 @@ public class ProductSectionList
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ProductSectionType }
*
*
* {@link ProductSection }
*/
public List<ProductSection> getProductSection() {
if (productSection == null) {

View File

@ -0,0 +1,123 @@
/**
* 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 org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
/**
* Metadata about a virtual machine or grouping of them.
* <p/>
* Base type for Sections, subclassing this is the most common form of extensibility. Subtypes define more specific
* elements.
*
* @author Adrian Cole
* @author Adam Lowe
*/
// TODO why do I have to declare these?
@XmlSeeAlso(
{CustomizationSection.class,
DeploymentOptionSection.class,
DiskSection.class,
LeaseSettingsSection.class,
GuestCustomizationSection.class,
NetworkSection.class,
NetworkConfigSection.class,
NetworkConnectionSection.class,
ProductSection.class,
VirtualHardwareSection.class,
VirtualSystem.class })
public abstract class SectionType<T extends SectionType<T>> {
public abstract Builder<T> toBuilder();
public static abstract class Builder<T extends SectionType<T>> {
protected String info;
public abstract SectionType<T> build();
/**
* @see SectionType#getInfo
*/
public Builder<T> info(String info) {
this.info = info;
return this;
}
public Builder<T> fromSection(SectionType<T> in) {
return info(in.getInfo());
}
}
@XmlElement(name = "Info", namespace = VCLOUD_OVF_NS)
protected String info;
public SectionType(@Nullable String info) {
this.info = info;
}
protected SectionType() {
// For Builders and JAXB
}
/**
* Info element describes the meaning of the Section, this is typically shown if the Section is not understood by an
* application
*
* @return ovf info
*/
public String getInfo() {
return info;
}
@Override
public int hashCode() {
return Objects.hashCode(info);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SectionType<?> other = (SectionType<?>) obj;
return Objects.equal(info, other.info);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("info", info);
}
}

View File

@ -21,31 +21,31 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.ovf.Section;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
/**
*
* Represents a vApp template.
*
*
* Represents a vApp template.
* <p/>
* <p/>
* <p>Java class for VAppTemplate complex type.
*
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <p/>
* <pre>
* &lt;complexType name="VAppTemplate">
* &lt;complexContent>
@ -63,18 +63,17 @@ import com.google.common.base.Objects;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppTemplate", propOrder = {
"owner",
"children",
"section",
"vAppScopedLocalId"
@XmlRootElement(name = "VAppTemplate")
@XmlType(propOrder = {
"owner",
"children",
"sections",
"vAppScopedLocalId"
})
public class VAppTemplate
extends ResourceEntityType<VAppTemplate>
extends ResourceEntityType<VAppTemplate>
{
@SuppressWarnings("unchecked")
@ -87,10 +86,9 @@ public class VAppTemplate
}
public static class Builder extends ResourceEntityType.Builder<VAppTemplate> {
private Owner owner;
private VAppTemplateChildren children;
private List<JAXBElement<? extends Section<?>>> sections;
private List<SectionType> sections;
private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded;
private Boolean goldMaster;
@ -112,9 +110,9 @@ public class VAppTemplate
}
/**
* @see VAppTemplate#getExtend()
* @see VAppTemplate#getSections()
*/
public Builder extend(List<JAXBElement<? extends Section<?>>> sections) {
public Builder sections(List<SectionType> sections) {
this.sections = sections;
return this;
}
@ -128,7 +126,7 @@ public class VAppTemplate
}
/**
* @see VAppTemplate#getOvfDescriptorUploaded()
* @see VAppTemplate#isOvfDescriptorUploaded()
*/
public Builder ovfDescriptorUploaded(Boolean ovfDescriptorUploaded) {
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
@ -136,262 +134,342 @@ public class VAppTemplate
}
/**
* @see VAppTemplate#getGoldMaster()
* @see VAppTemplate#isGoldMaster()
*/
public Builder goldMaster(Boolean goldMaster) {
this.goldMaster = goldMaster;
return this;
}
@Override
public VAppTemplate build() {
VAppTemplate vAppTemplate = new VAppTemplate(sections);
vAppTemplate.setOwner(owner);
vAppTemplate.setChildren(children);
vAppTemplate.setVAppScopedLocalId(vAppScopedLocalId);
vAppTemplate.setOvfDescriptorUploaded(ovfDescriptorUploaded);
vAppTemplate.setGoldMaster(goldMaster);
return vAppTemplate;
VAppTemplate result = new VAppTemplate(href, name, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
result.setFiles(files);
result.setStatus(status);
result.setDescription(description);
result.setTasksInProgress(tasksInProgress);
result.setId(id);
result.setType(type);
result.setLinks(links);
return result;
}
@Override
public Builder fromResourceEntityType(ResourceEntityType<VAppTemplate> in) {
return Builder.class.cast(super.fromResourceEntityType(in));
return Builder.class.cast(super.fromResourceEntityType(in));
}
public Builder fromVAppTemplate(VAppTemplate in) {
return fromResourceEntityType(in)
.owner(in.getOwner())
.children(in.getChildren())
.extend(in.getSections())
.vAppScopedLocalId(in.getVAppScopedLocalId())
.ovfDescriptorUploaded(in.isOvfDescriptorUploaded())
.goldMaster(in.isGoldMaster());
.owner(in.getOwner())
.children(in.getChildren())
.sections(in.getSections())
.vAppScopedLocalId(in.getVAppScopedLocalId())
.ovfDescriptorUploaded(in.isOvfDescriptorUploaded())
.goldMaster(in.isGoldMaster());
}
/**
* @see ResourceEntityType#getFiles()
*/
@Override
public Builder files(FilesList files) {
super.files(files);
return this;
}
/**
* @see ResourceEntityType#getStatus()
*/
@Override
public Builder status(Integer status) {
super.status(status);
return this;
}
/**
* @see EntityType#getName()
*/
@Override
public Builder name(String name) {
super.name(name);
return this;
}
/**
* @see EntityType#getDescription()
*/
@Override
public Builder description(String description) {
super.description(description);
return this;
}
/**
* @see EntityType#getId()
*/
@Override
public Builder id(String id) {
super.id(id);
return this;
}
/**
* @see EntityType#getTasksInProgress()
*/
@Override
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
super.tasksInProgress(tasksInProgress);
return this;
}
/**
* @see ReferenceType#getHref()
*/
@Override
public Builder href(URI href) {
super.href(href);
return this;
}
/**
* @see ReferenceType#getType()
*/
@Override
public Builder type(String type) {
super.type(type);
return this;
}
/**
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
super.links(links);
return this;
}
/**
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
super.link(link);
return this;
}
}
@XmlElementRef
protected Owner owner;
@XmlElement(name = "Children")
protected VAppTemplateChildren children;
@XmlElementRef
protected List<SectionType> sections;
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlAttribute
protected Boolean ovfDescriptorUploaded;
@XmlAttribute
protected Boolean goldMaster;
private VAppTemplate(URI href, String name, @Nullable Owner owner, @Nullable VAppTemplateChildren children,
List<SectionType> sections, @Nullable String vAppScopedLocalId,
@Nullable Boolean ovfDescriptorUploaded, @Nullable Boolean goldMaster) {
super(href, name);
this.sections = sections;
this.owner = owner;
this.children = children;
this.vAppScopedLocalId = vAppScopedLocalId;
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
this.goldMaster = goldMaster;
}
private VAppTemplate() {
// For JAXB and builder use
}
private VAppTemplate(List<JAXBElement<? extends Section<?>>> sections) {
this.sections = sections;
/**
* Gets the value of the owner property.
*
* @return possible object is
* {@link Owner }
*/
public Owner getOwner() {
return owner;
}
/**
* Sets the value of the owner property.
*
* @param value allowed object is
* {@link Owner }
*/
public void setOwner(Owner value) {
this.owner = value;
}
@XmlElement(name = "Owner")
protected Owner owner;
@XmlElement(name = "Children")
protected VAppTemplateChildren children;
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected List<JAXBElement<? extends Section<?>>> sections;
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlAttribute
protected Boolean ovfDescriptorUploaded;
@XmlAttribute
protected Boolean goldMaster;
/**
* Gets the value of the children property.
*
* @return possible object is
* {@link VAppTemplateChildren }
*/
public VAppTemplateChildren getChildren() {
return children;
}
/**
* Gets the value of the owner property.
*
* @return
* possible object is
* {@link Owner }
*
*/
public Owner getOwner() {
return owner;
}
/**
* Sets the value of the children property.
*
* @param value allowed object is
* {@link VAppTemplateChildren }
*/
public void setChildren(VAppTemplateChildren value) {
this.children = value;
}
/**
* Sets the value of the owner property.
*
* @param value
* allowed object is
* {@link Owner }
*
*/
public void setOwner(Owner value) {
this.owner = value;
}
/**
* 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 >}
*/
public List<SectionType> getSections() {
if (sections == null) {
sections = new ArrayList<SectionType>();
}
return this.sections;
}
/**
* Gets the value of the children property.
*
* @return
* possible object is
* {@link VAppTemplateChildren }
*
*/
public VAppTemplateChildren getChildren() {
return children;
}
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return possible object is
* {@link String }
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
}
/**
* Sets the value of the children property.
*
* @param value
* allowed object is
* {@link VAppTemplateChildren }
*
*/
public void setChildren(VAppTemplateChildren value) {
this.children = value;
}
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/**
*
* Contains ovf sections for vApp template.
* Gets the value of the section property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >}
*
*
*/
public List<JAXBElement<? extends Section<?>>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends Section<?>>>();
}
return this.sections;
}
/**
* Gets the value of the ovfDescriptorUploaded property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isOvfDescriptorUploaded() {
return ovfDescriptorUploaded;
}
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
}
/**
* Sets the value of the ovfDescriptorUploaded property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setOvfDescriptorUploaded(Boolean value) {
this.ovfDescriptorUploaded = value;
}
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/**
* Gets the value of the goldMaster property.
*
* @return possible object is
* {@link Boolean }
*/
public boolean isGoldMaster() {
if (goldMaster == null) {
return false;
} else {
return goldMaster;
}
}
/**
* Gets the value of the ovfDescriptorUploaded property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isOvfDescriptorUploaded() {
return ovfDescriptorUploaded;
}
/**
* Sets the value of the ovfDescriptorUploaded property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setOvfDescriptorUploaded(Boolean value) {
this.ovfDescriptorUploaded = value;
}
/**
* Gets the value of the goldMaster property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isGoldMaster() {
if (goldMaster == null) {
return false;
} else {
return goldMaster;
}
}
/**
* Sets the value of the goldMaster property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setGoldMaster(Boolean value) {
this.goldMaster = value;
}
/**
* Sets the value of the goldMaster property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setGoldMaster(Boolean value) {
this.goldMaster = value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppTemplate that = VAppTemplate.class.cast(o);
return equal(owner, that.owner) &&
equal(children, that.children) &&
equal(sections, that.sections) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(ovfDescriptorUploaded, that.ovfDescriptorUploaded) &&
equal(goldMaster, that.goldMaster);
return super.equals(that) &&
equal(owner, that.owner) &&
equal(children, that.children) &&
equal(sections, that.sections) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(ovfDescriptorUploaded, that.ovfDescriptorUploaded) &&
equal(goldMaster, that.goldMaster);
}
@Override
public int hashCode() {
return Objects.hashCode(owner,
children,
sections,
vAppScopedLocalId,
ovfDescriptorUploaded,
goldMaster);
return Objects.hashCode(super.hashCode(),
owner,
children,
sections,
vAppScopedLocalId,
ovfDescriptorUploaded,
goldMaster);
}
@Override
public String toString() {
return Objects.toStringHelper("")
return Objects.toStringHelper(super.toString())
.add("owner", owner)
.add("children", children)
.add("sections", sections)

View File

@ -123,7 +123,7 @@ public class VAppTemplateChildren {
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VAppTemplateType }
* {@link VAppTemplate }
*
*
*/

View File

@ -273,7 +273,7 @@ public class Vdc
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
@ -282,7 +282,7 @@ public class Vdc
}
/**
* @see ReferenceType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {

View File

@ -0,0 +1,207 @@
/**
* 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.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* The virtual hardware required by a virtual machine is specified in VirtualHardwareSection.
* <p/>
* This specification supports abstract or incomplete hardware descriptions in which only the major
* devices are described. The hypervisor is allowed to create additional virtual hardware
* controllers and devices, as long as the required devices listed in the descriptor are realized.
*
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_OVF_NS)
public class VirtualHardwareSection extends SectionType<VirtualHardwareSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVirtualHardwareSection(this);
}
public static class Builder extends SectionType.Builder<VirtualHardwareSection> {
protected VirtualSystemSettingData virtualSystem;
protected Set<String> transports = Sets.newLinkedHashSet();
protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
/**
* @see VirtualHardwareSection#getSystem
*/
public Builder system(VirtualSystemSettingData virtualSystem) {
this.virtualSystem = virtualSystem;
return this;
}
/**
* @see VirtualHardwareSection#getTransports
*/
public Builder transport(String transport) {
this.transports.add(checkNotNull(transport, "transport"));
return this;
}
/**
* @see VirtualHardwareSection#getTransports
*/
public Builder transports(Iterable<String> transports) {
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
return this;
}
/**
* @see VirtualHardwareSection#getItems
*/
public Builder item(ResourceAllocationSettingData item) {
this.items.add(checkNotNull(item, "item"));
return this;
}
/**
* @see VirtualHardwareSection#getItems
*/
public Builder items(Iterable<? extends ResourceAllocationSettingData> items) {
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(
items, "items"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public VirtualHardwareSection build() {
return new VirtualHardwareSection(info, transports, virtualSystem, items);
}
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
return fromSection(in).items(in.getItems()).transports(in.getTransports()).system(
in.getSystem()).info(in.getInfo());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<VirtualHardwareSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
private VirtualSystemSettingData virtualSystem;
private Set<String> transports;
private Set<ResourceAllocationSettingData> items;
private VirtualHardwareSection(String info, Iterable<String> transports, VirtualSystemSettingData virtualSystem,
Iterable<? extends ResourceAllocationSettingData> items) {
super(info);
this.virtualSystem = virtualSystem;
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(items, "items"));
}
private VirtualHardwareSection() {
// For JAXB
}
/**
* transport types define methods by which the environment document is communicated from the
* deployment platform to the guest software.
* <p/>
* To enable interoperability, this specification defines an "iso" transport type which all
* implementations that support CD-ROM devices are required to support. The iso transport
* communicates the environment 1346 document by making a dynamically generated ISO image
* available to the guest software. To support the iso transport type, prior to booting a virtual
* machine, an implementation shall make an ISO 9660 read-only disk image available as backing
* for a disconnected CD-ROM. If the iso transport is selected for a VirtualHardwareSection, at
* least one disconnected CD-ROM device shall be present in this section.
* <p/>
* Support for the "iso" transport type is not a requirement for virtual hardware architectures
* or guest 1351 operating systems which do not have CD-ROM device support.
*
* @return
*/
public Set<String> getTransports() {
return transports;
}
public VirtualSystemSettingData getSystem() {
return virtualSystem;
}
public Set<? extends ResourceAllocationSettingData> getItems() {
return items;
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), transports, virtualSystem, items);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
VirtualHardwareSection other = (VirtualHardwareSection) obj;
return super.equals(other) && Objects.equal(transports, other.transports)
&& Objects.equal(virtualSystem, other.virtualSystem)
&& Objects.equal(items, other.items);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("transports", transports).add("virtualSystem", virtualSystem).add("items", items);
}
}

View File

@ -0,0 +1,167 @@
/**
* 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 org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseVirtualSystem;
import com.google.common.collect.Multimap;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlRootElement(name = "VirtualSystem", namespace = VCLOUD_OVF_NS)
public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
public static Builder builder() {
return new Builder();
}
@Override
public SectionType.Builder<VirtualSystem> toBuilder() {
return new Builder().fromVirtualSystem(this);
}
public static class Builder extends BaseVirtualSystem.Builder<VirtualSystem> {
/**
* {@inheritDoc}
*/
@Override
public VirtualSystem build() {
return new VirtualSystem(id, info, name, operatingSystem, virtualHardwareSections, productSections,
additionalSections);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSection(String name, SectionType additionalSection) {
return Builder.class.cast(super.additionalSection(name, additionalSection));
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSections(Multimap<String, SectionType> additionalSections) {
return Builder.class.cast(super.additionalSections(additionalSections));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<VirtualSystem> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromVirtualSystem(BaseVirtualSystem<VirtualSystem> in) {
return Builder.class.cast(super.fromVirtualSystem(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) {
return Builder.class.cast(super.virtualHardwareSection(virtualHardwareSection));
}
/**
* {@inheritDoc}
*/
@Override
public Builder virtualHardwareSections(Iterable<? extends VirtualHardwareSection> virtualHardwareSections) {
return Builder.class.cast(super.virtualHardwareSections(virtualHardwareSections));
}
/**
* {@inheritDoc}
*/
@Override
public Builder id(String id) {
return Builder.class.cast(super.id(id));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder operatingSystemSection(OperatingSystemSection operatingSystem) {
return Builder.class.cast(super.operatingSystemSection(operatingSystem));
}
/**
* {@inheritDoc}
*/
@Override
public Builder productSection(ProductSection productSection) {
return Builder.class.cast(super.productSection(productSection));
}
/**
* {@inheritDoc}
*/
@Override
public Builder productSections(Iterable<? extends ProductSection> productSections) {
return Builder.class.cast(super.productSections(productSections));
}
}
@SuppressWarnings("unchecked")
private VirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(id, info, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
}
private VirtualSystem() {
// for JAXB
}
}

View File

@ -0,0 +1,128 @@
/**
* 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.cim;
/**
*
* ManagedElement is an abstract class that provides a common superclass (or top of the inheritance
* tree) for the non-association classes in the CIM Schema.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public abstract class ManagedElement extends SettingData {
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromManagedElement(this);
}
public static class Builder extends SettingData.Builder {
protected String caption;
protected String description;
/**
* @see ManagedElement#getCaption
*/
public Builder caption(String caption) {
this.caption = caption;
return this;
}
/**
* @see ManagedElement#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
public Builder fromManagedElement(ManagedElement in) {
return caption(in.getCaption()).description(in.getDescription()).fromSettingData(in);
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSettingData(SettingData in) {
return Builder.class.cast(super.fromSettingData(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
}
}
protected String caption;
protected String description;
protected ManagedElement(String elementName, String instanceID, String caption, String description) {
super(elementName, instanceID);
this.caption = caption;
this.description = description;
}
protected ManagedElement() {
// for JAXB
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public String getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public String getDescription() {
return description;
}
@Override
public String toString() {
return String.format("[elementName=%s, instanceID=%s, caption=%s, description=%s]", elementName, instanceID,
caption, description);
}
}

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.cim;
import org.jclouds.compute.domain.OsFamily;
/**
* Operating system based on DMTF CIM model.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*/
public enum OSType {
/**
* Other
*/
OTHER(1, "Other", OsFamily.UNRECOGNIZED, false),
/**
* MACOS
*/
MACOS(2, "MACOS", OsFamily.DARWIN, false),
/**
* Solaris
*/
SOLARIS(29, "Solaris", OsFamily.SOLARIS, false),
/**
* LINUX
*/
LINUX(36, "LINUX", OsFamily.LINUX, false),
/**
* FreeBSD
*/
FREEBSD(42, "FreeBSD", OsFamily.FREEBSD, false),
/**
* NetBSD
*/
NETBSD(43, "NetBSD", OsFamily.NETBSD, false),
/**
* OpenBSD
*/
OPENBSD(65, "OpenBSD", OsFamily.OPENBSD, false),
/**
* Not Applicable
*/
NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false),
/**
* Microsoft Windows Server 2003
*/
WINDOWS_SERVER_2003(69, "Microsoft Windows Server 2003", OsFamily.WINDOWS, false),
/**
* Microsoft Windows Server 2003 64-Bit
*/
WINDOWS_SERVER_2003_64(70, "Microsoft Windows Server 2003 64-Bit", OsFamily.WINDOWS, true),
/**
* Microsoft Windows Server 2008
*/
WINDOWS_SERVER_2008(76, "Microsoft Windows Server 2008", OsFamily.WINDOWS, false),
/**
* Microsoft Windows Server 2008 64-Bit
*/
WINDOWS_SERVER_2008_64(77, "Microsoft Windows Server 2008 64-Bit", OsFamily.WINDOWS, true),
/**
* FreeBSD 64-Bit
*/
FREEBSD_64(78, "FreeBSD 64-Bit", OsFamily.FREEBSD, true),
/**
* RedHat Enterprise Linux
*/
RHEL(79, "RedHat Enterprise Linux", OsFamily.RHEL, false),
/**
* RedHat Enterprise Linux 64-Bit
*/
RHEL_64(80, "RedHat Enterprise Linux 64-Bit", OsFamily.RHEL, true),
/**
* Solaris 64-Bit
*/
SOLARIS_64(81, "Solaris 64-Bit", OsFamily.SOLARIS, true),
/**
* SUSE
*/
SUSE(82, "SUSE", OsFamily.SUSE, false),
/**
* SUSE 64-Bit
*/
SUSE_64(83, "SUSE 64-Bit", OsFamily.SUSE, true),
/**
* SLES
*/
SLES(84, "SLES", OsFamily.SUSE, false),
/**
* SLES 64-Bit
*/
SLES_64(85, "SLES 64-Bit", OsFamily.SUSE, true),
/**
* Novell OES
*/
NOVELL_OES(86, "Novell OES", OsFamily.SUSE, true),
/**
* Mandriva
*/
MANDRIVA(89, "Mandriva", OsFamily.MANDRIVA, false),
/**
* Mandriva 64-Bit
*/
MANDRIVA_64(90, "Mandriva 64-Bit", OsFamily.MANDRIVA, true),
/**
* TurboLinux
*/
TURBOLINUX(91, "TurboLinux", OsFamily.TURBOLINUX, false),
/**
* TurboLinux 64-Bit
*/
TURBOLINUX_64(92, "TurboLinux 64-Bit", OsFamily.TURBOLINUX, true),
/**
* Ubuntu
*/
UBUNTU(93, "Ubuntu", OsFamily.UBUNTU, false),
/**
* Ubuntu 64-Bit
*/
UBUNTU_64(94, "Ubuntu 64-Bit", OsFamily.UBUNTU, true),
/**
* Debian
*/
DEBIAN(95, "Debian", OsFamily.DEBIAN, false),
/**
* Debian 64-Bit
*/
DEBIAN_64(96, "Debian 64-Bit", OsFamily.DEBIAN, false),
/**
* Linux 2.4.x
*/
LINUX_2_4(97, "Linux 2.4.x", OsFamily.LINUX, false),
/**
* Linux 2.4.x 64-Bi
*/
LINUX_2_4_64(98, "Linux 2.4.x 64-Bit", OsFamily.LINUX, true),
/**
* Linux 2.6.x
*/
LINUX_2_6(99, "Linux 2.6.x", OsFamily.LINUX, false),
/**
* Linux 2.6.x 64-Bit
*/
LINUX_2_6_64(100, "Linux 2.6.x 64-Bit", OsFamily.LINUX, true),
/**
* Linux 64-Bit
*/
LINUX_64(101, "Linux 64-Bit", OsFamily.LINUX, true),
/**
* Other 64-Bit
*/
OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true),
/**
* Microsoft Windows Server 2008 R2
*/
WINDOWS_SERVER_2008_R2(103, "Microsoft Windows Server 2008 R2", OsFamily.WINDOWS, true),
/**
* VMware ESXi
*/
ESXI(104, "VMware ESXi", OsFamily.ESX, true),
/**
* Microsoft Windows 7
*/
WINDOWS_7(105, "Microsoft Windows 7", OsFamily.WINDOWS, false),
/**
* CentOS 32-bit
*/
CENTOS(106, "CentOS 32-bit", OsFamily.CENTOS, false),
/**
* CentOS 64-bit
*/
CENTOS_64(107, "CentOS 64-bit", OsFamily.CENTOS, true),
/**
* Oracle Enterprise Linux 32-bit
*/
ORACLE_ENTERPRISE_LINUX(108, "Oracle Enterprise Linux 32-bit", OsFamily.OEL, false),
/**
* Oracle Enterprise Linux 64-bit
*/
ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true),
/**
* eComStation 32-bitx
*/
ECOMSTATION_32(109, "eComStation 32-bitx", OsFamily.UNRECOGNIZED, false), UNRECOGNIZED(Integer.MAX_VALUE,
"UNRECOGNIZED", null, true);
private final int code;
public int getCode() {
return code;
}
public String getValue() {
return value;
}
public OsFamily getFamily() {
return family;
}
public boolean is64Bit() {
return is64Bit;
}
private final String value;
private final OsFamily family;
private final boolean is64Bit;
OSType(int code, String value, OsFamily family, boolean is64Bit) {
this.code = code;
this.value = value;
this.family = family;
this.is64Bit = is64Bit;
}
public static OSType fromValue(int code) {
for (OSType type : values()) {
if (type.code == code)
return type;
}
return UNRECOGNIZED;
}
}

View File

@ -0,0 +1,747 @@
/**
* 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.cim;
import static com.google.common.base.Preconditions.checkNotNull;
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;
/**
*
* The ResourceAllocationSettingData class represents settings specifically
* related to an allocated resource that are outside the scope of the CIM class
* typically used to represent the resource itself. These settings include
* information specific to the allocation that may not be visible to the
* consumer of the resource itself. For example, a virtual processor may look
* like a 2 ghz processor to the consumer (virtual computer system), however the
* virtualization system may use time-slicing to schedule the the virtual
* processor to only allow it to use 1 ghz.
*
* @author Adrian Cole
* @see <a href=
* "http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public class ResourceAllocationSettingData extends ManagedElement {
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromResourceAllocationSettingData(this);
}
public static class Builder extends ManagedElement.Builder {
protected String address;
protected String addressOnParent;
protected String allocationUnits;
protected Boolean automaticAllocation;
protected Boolean automaticDeallocation;
protected ConsumerVisibility consumerVisibility;
protected Long limit;
protected MappingBehavior mappingBehavior;
protected String otherResourceType;
protected String parent;
protected String poolID;
protected Long reservation;
protected String resourceSubType;
protected ResourceType resourceType;
protected Long virtualQuantity;
protected String virtualQuantityUnits;
protected Integer weight;
protected List<String> connections = Lists.newArrayList();
protected List<String> hostResources = Lists.newArrayList();
/**
* @see ResourceAllocationSettingData#getAddress
*/
public Builder address(String address) {
this.address = address;
return this;
}
/**
* @see ResourceAllocationSettingData#getAddressOnParent
*/
public Builder addressOnParent(String addressOnParent) {
this.addressOnParent = addressOnParent;
return this;
}
/**
* @see ResourceAllocationSettingData#getAllocationUnits
*/
public Builder allocationUnits(String allocationUnits) {
this.allocationUnits = allocationUnits;
return this;
}
/**
* @see ResourceAllocationSettingData#isAutomaticAllocation()
*/
public Builder automaticAllocation(Boolean automaticAllocation) {
this.automaticAllocation = automaticAllocation;
return this;
}
/**
* @see ResourceAllocationSettingData#isAutomaticDeallocation()
*/
public Builder automaticDeallocation(Boolean automaticDeallocation) {
this.automaticDeallocation = automaticDeallocation;
return this;
}
/**
* @see ResourceAllocationSettingData#getConsumerVisibility
*/
public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
this.consumerVisibility = consumerVisibility;
return this;
}
/**
* @see ResourceAllocationSettingData#getLimit
*/
public Builder limit(Long limit) {
this.limit = limit;
return this;
}
/**
* @see ResourceAllocationSettingData#getMappingBehavior
*/
public Builder mappingBehavior(MappingBehavior mappingBehavior) {
this.mappingBehavior = mappingBehavior;
return this;
}
/**
* @see ResourceAllocationSettingData#getOtherResourceType
*/
public Builder otherResourceType(String otherResourceType) {
this.otherResourceType = otherResourceType;
return this;
}
/**
* @see ResourceAllocationSettingData#getParent
*/
public Builder parent(String parent) {
this.parent = parent;
return this;
}
/**
* @see ResourceAllocationSettingData#getPoolID
*/
public Builder poolID(String poolID) {
this.poolID = poolID;
return this;
}
/**
* @see ResourceAllocationSettingData#getReservation
*/
public Builder reservation(Long reservation) {
this.reservation = reservation;
return this;
}
/**
* @see ResourceAllocationSettingData#getResourceSubType
*/
public Builder resourceSubType(String resourceSubType) {
this.resourceSubType = resourceSubType;
return this;
}
/**
* @see ResourceAllocationSettingData#getResourceType
*/
public Builder resourceType(ResourceType resourceType) {
this.resourceType = resourceType;
return this;
}
/**
* @see ResourceAllocationSettingData#getVirtualQuantity
*/
public Builder virtualQuantity(Long virtualQuantity) {
this.virtualQuantity = virtualQuantity;
return this;
}
/**
* @see ResourceAllocationSettingData#getVirtualQuantityUnits
*/
public Builder virtualQuantityUnits(String virtualQuantityUnits) {
this.virtualQuantityUnits = virtualQuantityUnits;
return this;
}
/**
* @see ResourceAllocationSettingData#getWeight
*/
public Builder weight(Integer weight) {
this.weight = weight;
return this;
}
/**
* @see ResourceAllocationSettingData#getConnections()
*/
public Builder connection(String connection) {
this.connections.add(checkNotNull(connection, "connection"));
return this;
}
/**
* @see ResourceAllocationSettingData#getHostResources()
*/
public Builder hostResource(String hostResource) {
this.hostResources.add(checkNotNull(hostResource, "hostResource"));
return this;
}
/**
* @see ResourceAllocationSettingData#getConnections
*/
public Builder connections(List<String> connections) {
this.connections.addAll(checkNotNull(connections, "connections"));
return this;
}
/**
* @see ResourceAllocationSettingData#getHostResources
*/
public Builder hostResources(List<String> hostResources) {
this.hostResources.addAll(checkNotNull(hostResources, "hostResources"));
return this;
}
public ResourceAllocationSettingData build() {
return new ResourceAllocationSettingData(elementName, instanceID, caption, description, address,
addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
virtualQuantity, virtualQuantityUnits, weight, connections, hostResources);
}
public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
return fromManagedElement(in).address(in.getAddress()).addressOnParent(in.getAddressOnParent())
.allocationUnits(in.getAllocationUnits()).automaticAllocation(in.isAutomaticAllocation())
.automaticDeallocation(in.isAutomaticDeallocation()).consumerVisibility(in.getConsumerVisibility())
.limit(in.getLimit()).mappingBehavior(in.getMappingBehavior())
.otherResourceType(in.getOtherResourceType()).parent(in.getParent()).poolID(in.getPoolID())
.reservation(in.getReservation()).resourceSubType(in.getResourceSubType())
.resourceType(in.getResourceType()).virtualQuantity(in.getVirtualQuantity())
.virtualQuantityUnits(in.getVirtualQuantityUnits()).weight(in.getWeight())
.connections(in.getConnections()).hostResources(in.getHostResources());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromManagedElement(ManagedElement in) {
return Builder.class.cast(super.fromManagedElement(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder caption(String caption) {
return Builder.class.cast(super.caption(caption));
}
/**
* {@inheritDoc}
*/
@Override
public Builder description(String description) {
return Builder.class.cast(super.description(description));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
}
}
/**
* The type of resource this allocation setting represents.
*/
public static enum ResourceType {
OTHER(1), COMPUTER_SYSTEM(2), PROCESSOR(3), MEMORY(4), IDE_CONTROLLER(5), PARALLEL_SCSI_HBA(6), FC_HBA(7), ISCSI_HBA(
8), IB_HCA(9), ETHERNET_ADAPTER(10), OTHER_NETWORK_ADAPTER(11), IO_SLOT(12), IO_DEVICE(13), FLOPPY_DRIVE(14), CD_DRIVE(
15), DVD_DRIVE(16), DISK_DRIVE(17), TAPE_DRIVE(18), STORAGE_EXTENT(19), OTHER_STORAGE_DEVICE(20), SERIAL_PORT(
21), PARALLEL_PORT(22), USB_CONTROLLER(23), GRAPHICS_CONTROLLER(24), IEEE_1394_CONTROLLER(25), PARTITIONABLE_UNIT(
26), BASE_PARTITIONABLE_UNIT(27), POWER(28), COOLING_CAPACITY(29), ETHERNET_SWITCH_PORT(30), LOGICAL_DISK(
31), STORAGE_VOLUME(32), ETHERNET_CONNECTION(33), DMTF_RESERVED(Integer.valueOf("8000", 16)), VENDOR_RESERVED(
Integer.valueOf("FFFF", 16));
protected final int code;
ResourceType(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, ResourceType> RESOURCE_TYPE_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(ResourceType.values()), new Function<ResourceType, Integer>() {
@Override
public Integer apply(ResourceType input) {
return input.code;
}
});
public static ResourceType fromValue(String type) {
return RESOURCE_TYPE_BY_ID.get(new Integer(checkNotNull(type, "type")));
}
}
/**
* Describes the consumers visibility to the allocated resource.
*/
public static enum ConsumerVisibility {
UNKNOWN(0),
/**
* indicates the underlying or host resource is utilized and passed
* through to the consumer, possibly using partitioning. At least one item
* shall be present in the HostResource property.
*/
PASSED_THROUGH(2),
/**
* indicates the resource is virtualized and may not map directly to an
* underlying/host resource. Some implementations may support specific
* assignment for virtualized resources, in which case the host
* resource(s) are exposed using the HostResource property.
*/
VIRTUALIZED(3),
/**
* indicates a representation of the resource does not exist within the
* context of the resource consumer.
*/
NOT_REPRESENTED(4), DMTF_RESERVED(32767), VENDOR_RESERVED(65535);
protected final int code;
ConsumerVisibility(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, ConsumerVisibility> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(ConsumerVisibility.values()), new Function<ConsumerVisibility, Integer>() {
@Override
public Integer apply(ConsumerVisibility input) {
return input.code;
}
});
public static ConsumerVisibility fromValue(String behavior) {
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior")));
}
}
/**
* Specifies how this resource maps to underlying resourcesIf the
* HostResource array contains any entries, this property reflects how the
* resource maps to those specific resources.
*/
public static enum MappingBehavior {
UNKNOWN(0), NOT_SUPPORTED(2), DEDICATED(3), SOFT_AFFINITY(4), HARD_AFFINITY(5), DMTF_RESERVED(32767), VENDOR_RESERVED(
65535);
protected final int code;
MappingBehavior(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, MappingBehavior> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(MappingBehavior.values()), new Function<MappingBehavior, Integer>() {
@Override
public Integer apply(MappingBehavior input) {
return input.code;
}
});
public static MappingBehavior fromValue(String behavior) {
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior")));
}
}
protected String address;
protected String addressOnParent;
protected String allocationUnits;
protected Boolean automaticAllocation;
protected Boolean automaticDeallocation;
protected ConsumerVisibility consumerVisibility;
protected Long limit;
protected MappingBehavior mappingBehavior;
protected String otherResourceType;
protected String parent;
protected String poolID;
protected Long reservation;
protected String resourceSubType;
protected ResourceType resourceType;
protected Long virtualQuantity;
protected String virtualQuantityUnits;
protected Integer weight;
protected List<String> connections;
protected List<String> hostResources;
private ResourceAllocationSettingData(String elementName, String instanceID, String caption, String description,
String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation,
Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
String resourceSubType, ResourceType resourceType, Long virtualQuantity, String virtualQuantityUnits,
Integer weight, List<String> connections, List<String> hostResources) {
super(elementName, instanceID, caption, description);
this.address = address;
this.addressOnParent = addressOnParent;
this.allocationUnits = allocationUnits;
this.automaticAllocation = automaticAllocation;
this.automaticDeallocation = automaticDeallocation;
this.consumerVisibility = consumerVisibility;
this.limit = limit;
this.mappingBehavior = mappingBehavior;
this.otherResourceType = otherResourceType;
this.parent = parent;
this.poolID = poolID;
this.reservation = reservation;
this.resourceSubType = resourceSubType;
this.resourceType = resourceType;
this.virtualQuantity = virtualQuantity;
this.virtualQuantityUnits = virtualQuantityUnits;
this.weight = weight;
this.connections = ImmutableList.copyOf(connections);
this.hostResources = ImmutableList.copyOf(hostResources);
}
private ResourceAllocationSettingData() {
// for JAXB
}
/**
* The address of the resource. For example, the MAC address of a Ethernet
* port.
*/
public String getAddress() {
return address;
}
/**
* Describes the address of this resource in the context of the Parent. The
* Parent/AddressOnParent properties are used to describe the controller
* relationship as well the ordering of devices on a controller.For example,
* if the parent is a PCI Controller, this property would specify the PCI
* slot of this child device.
*/
public String getAddressOnParent() {
return addressOnParent;
}
/**
* This property specifies the units of allocation used by the Reservation
* and Limit properties. For example, when ResourceType=Processor,
* AllocationUnits may be set to hertz*10^6 or percent. When
* ResourceType=Memory, AllocationUnits may be set to bytes*10^3. It is
* expected that profiles constrain the units that apply in context of
* particular resource types. The value of this property shall be a legal
* value of the Programmatic Units qualifier as defined in Annex C.1 of
* DSP0004 V2.5 or later.
*/
public String getAllocationUnits() {
return allocationUnits;
}
/**
* This property specifies if the resource will be automatically allocated.
* For example when set to true, when the consuming virtual computer system
* is powered on, this resource would be allocated. A value of false
* indicates the resource must be explicitly allocated. For example, the
* setting may represent removable media (cdrom, floppy, etc.) where at power
* on time, the media is not present. An explicit operation is required to
* allocate the resource.
*/
public Boolean isAutomaticAllocation() {
return automaticAllocation;
}
/**
* This property specifies if the resource will be automatically
* de-allocated. For example, when set to true, when the consuming virtual
* computer system is powered off, this resource would be de-allocated. When
* set to false, the resource will remain allocated and must be explicitly
* de-allocated.
*/
public Boolean isAutomaticDeallocation() {
return automaticDeallocation;
}
/**
* Describes the consumers visibility to the allocated resource.
*/
public ConsumerVisibility getConsumerVisibility() {
return consumerVisibility;
}
/**
* This property specifies the upper bound, or maximum amount of resource
* that will be granted for this allocation. For example, a system which
* supports memory paging may support setting the Limit of a Memory
* allocation below that of the VirtualQuantity, thus forcing paging to occur
* for this allocation. The value of the Limit property is expressed in the
* unit specified by the value of the AllocationUnits property.
*/
public Long getLimit() {
return limit;
}
/**
* Specifies how this resource maps to underlying resourcesIf the
* HostResource array contains any entries, this property reflects how the
* resource maps to those specific resources.
*/
public MappingBehavior getMappingBehavior() {
return mappingBehavior;
}
/**
* A string that describes the resource type when a well defined value is not
* available and ResourceType has the value "Other".
*/
public String getOtherResourceType() {
return otherResourceType;
}
/**
* The Parent of the resource. For example, a controller for the current
* allocation
*/
public String getParent() {
return parent;
}
/**
* This property specifies which ResourcePool the resource is currently
* allocated from, or which ResourcePool the resource will be allocated from
* when the allocation occurs.
*/
public String getPoolID() {
return poolID;
}
/**
* This property specifies the amount of resource guaranteed to be available
* for this allocation. On system which support over-commitment of resources,
* this value is typically used for admission control to prevent an an
* allocation from being accepted thus preventing starvation. The value of
* the Reservation property is expressed in the unit specified by the value
* of the AllocationUnits property.
*/
public Long getReservation() {
return reservation;
}
/**
* A string describing an implementation specific sub-type for this resource.
* F
*/
public String getResourceSubType() {
return resourceSubType;
}
/**
* The type of resource this allocation setting represents.
*/
public ResourceType getResourceType() {
return resourceType;
}
/**
* This property specifies the quantity of resources presented to the
* consumer. For example, when ResourceType=Processor, this property would
* reflect the number of discrete Processors presented to the virtual
* computer system. When ResourceType=Memory, this property could reflect the
* number of MB reported to the virtual computer system. The value of the
* VirtualQuantity property should be expressed in units as defined by the
* value of the VirtualQuantityUnits property.
*/
public Long getVirtualQuantity() {
return virtualQuantity;
}
/**
* This property specifies the units used by the VirtualQuantity property.
* For example - if ResourceType=Processor, the value of the
* VirtualQuantityUnits property may be set to "count", indicating that the
* value of the VirtualQuantity property is expressed as a count. - if
* ResourceType=Memory, the value of the VirtualQuantityUnits property may be
* set to "bytes*10^3", indicating that the value of the VirtualQuantity
* property is expressed in kilobyte. It is expected that profiles constrain
* the units that apply in context of particular resource types. The value of
* this property shall be a legal value of the Programmatic Units qualifier
* as defined in Annex C.1 of DSP0004 V2.5 or later.
*/
public String getVirtualQuantityUnits() {
return virtualQuantityUnits;
}
/**
* This property specifies a relative priority for this allocation in
* relation to other allocations from the same ResourcePool. This property
* has no unit of measure, and is only relevant when compared to other
* allocations vying for the same host resources.
*/
public Integer getWeight() {
return weight;
}
/**
* The thing to which this resource is connected. For example, a named
* network or switch port.
*/
public List<String> getConnections() {
return connections;
}
/**
* This property exposes specific assignment of resources. Each non-null
* value of the HostResource property shall be formated as a URI per RFC3986.
* If this resource is modeled then a value should be a WBEM URI (DSP0207).
* If the resource is not modeled then see the appropriate profile. Profiles
* may further constrain the type of URI. A NULL value or empty array
* requests the implementation decide the kind of host resource. If the
* virtual resource is mapped to more than oneunderlying resource, this
* property may be left NULL. If NULL, the DeviceAllocatedFromPool or
* ResourceAllocationFromPool associations may be used to determine the pool
* of host resources this virtual resource may use. If specific assignment is
* utilized, all underlying resources used by this virtual resource should be
* listed.The kind of dependency is specified by the ConsumerVisibility and
* the MappingBehavior properties. Typically the array contains one item,
* however multiple host resources may be specified. A client may set the
* value(s) to indicate that the requested virtual resource allocation be
* based on host resources that are identified by element values.
*/
public List<String> getHostResources() {
return hostResources;
}
@Override
public String toString() {
return String
.format(
"[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s]",
elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
virtualQuantity, virtualQuantityUnits, weight);
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((addressOnParent == null) ? 0 : addressOnParent.hashCode());
result = prime * result + ((resourceSubType == null) ? 0 : resourceSubType.hashCode());
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
ResourceAllocationSettingData other = (ResourceAllocationSettingData) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (addressOnParent == null) {
if (other.addressOnParent != null)
return false;
} else if (!addressOnParent.equals(other.addressOnParent))
return false;
if (resourceSubType == null) {
if (other.resourceSubType != null)
return false;
} else if (!resourceSubType.equals(other.resourceSubType))
return false;
if (resourceType == null) {
if (other.resourceType != null)
return false;
} else if (!resourceType.equals(other.resourceType))
return false;
return true;
}
}

View File

@ -0,0 +1,143 @@
/**
* 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.cim;
import static com.google.common.base.Preconditions.checkNotNull;
/**
*
* The type of resource this allocation setting represents.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public abstract class SettingData implements Comparable<SettingData> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().fromSettingData(this);
}
public static class Builder {
protected String elementName;
protected String instanceID;
/**
* @see SettingData#getElementName
*/
public Builder elementName(String elementName) {
this.elementName = checkNotNull(elementName, "elementName");
return this;
}
/**
* @see SettingData#getInstanceID
*/
public Builder instanceID(String instanceID) {
this.instanceID = checkNotNull(instanceID, "instanceID");
return this;
}
public Builder fromSettingData(SettingData in) {
return elementName(in.getElementName()).instanceID(in.getInstanceID());
}
}
protected String elementName;
protected String instanceID;
public SettingData(String elementName, String instanceID) {
this.elementName = checkNotNull(elementName, "elementName");
this.instanceID = checkNotNull(instanceID, "instanceID");
}
protected SettingData() {
// for JAXB
}
/**
* The user-friendly name for this instance of SettingData. In addition, the user-friendly name
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public String getElementName() {
return elementName;
}
/**
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public String getInstanceID() {
return instanceID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((elementName == null) ? 0 : elementName.hashCode());
result = prime * result + ((instanceID == null) ? 0 : instanceID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SettingData other = (SettingData) obj;
if (elementName == null) {
if (other.elementName != null)
return false;
} else if (!elementName.equals(other.elementName))
return false;
if (instanceID == null) {
if (other.instanceID != null)
return false;
} else if (!instanceID.equals(other.instanceID))
return false;
return true;
}
@Override
public String toString() {
return String.format("[elementName=%s, instanceID=%s]", elementName, instanceID);
}
/**
* {@inheritDoc}
*/
@Override
public int compareTo(SettingData o) {
if (instanceID == null)
return -1;
return (this == o) ? 0 : instanceID.compareTo(o.instanceID);
}
}

View File

@ -0,0 +1,582 @@
/**
* 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.cim;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
*
* CIM_VirtualSystemSettingData defines the virtual aspects of a virtual system through a set of
* virtualization specific properties. CIM_VirtualSystemSettingData is also used as the top level
* class of virtual system configurations. Virtual system configurations model configuration
* information about virtual systems and their components. A virtual system configuration consists
* of one top-level instance of class CIM_VirtualSystemSettingData that aggregates a number of
* instances of class CIM_ResourceAllocationSettingData, using association CIM_ConcreteComponent.
* Virtual system configurations may for example be used to reflect configurations of - virtual
* systems that are defined at a virtualization platform, - virtual systems that are currently
* active, - input requests to create new virtual systems, - input requests to modify existing
* virtual systems, or - snapshots of virtual systems.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public class VirtualSystemSettingData extends ManagedElement {
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVirtualSystemSettingData(this);
}
public static class Builder extends ManagedElement.Builder {
private AutomaticRecoveryAction automaticRecoveryAction;
private AutomaticShutdownAction automaticShutdownAction;
private AutomaticStartupAction automaticStartupAction;
private Long automaticStartupActionDelay;
private Integer automaticStartupActionSequenceNumber;
private URI configurationDataRoot;
private URI configurationFile;
private String configurationID;
private Date creationTime;
private URI logDataRoot;
private URI recoveryFile;
private URI snapshotDataRoot;
private URI suspendDataRoot;
private URI swapFileDataRoot;
private String virtualSystemIdentifier;
private Set<String> virtualSystemTypes = Sets.newLinkedHashSet();
private String notes;
public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) {
this.automaticRecoveryAction = automaticRecoveryAction;
return this;
}
public Builder automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) {
this.automaticShutdownAction = automaticShutdownAction;
return this;
}
public Builder automaticStartupAction(AutomaticStartupAction automaticStartupAction) {
this.automaticStartupAction = automaticStartupAction;
return this;
}
public Builder automaticStartupActionDelay(Long automaticStartupActionDelay) {
this.automaticStartupActionDelay = automaticStartupActionDelay;
return this;
}
public Builder automaticStartupActionSequenceNumber(Integer automaticStartupActionSequenceNumber) {
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
return this;
}
public Builder configurationDataRoot(URI configurationDataRoot) {
this.configurationDataRoot = configurationDataRoot;
return this;
}
public Builder configurationFile(URI configurationFile) {
this.configurationFile = configurationFile;
return this;
}
public Builder configurationID(String configurationID) {
this.configurationID = configurationID;
return this;
}
public Builder creationTime(Date creationTime) {
this.creationTime = creationTime;
return this;
}
public Builder logDataRoot(URI logDataRoot) {
this.logDataRoot = logDataRoot;
return this;
}
public Builder recoveryFile(URI recoveryFile) {
this.recoveryFile = recoveryFile;
return this;
}
public Builder snapshotDataRoot(URI snapshotDataRoot) {
this.snapshotDataRoot = snapshotDataRoot;
return this;
}
public Builder suspendDataRoot(URI suspendDataRoot) {
this.suspendDataRoot = suspendDataRoot;
return this;
}
public Builder swapFileDataRoot(URI swapFileDataRoot) {
this.swapFileDataRoot = swapFileDataRoot;
return this;
}
public Builder virtualSystemIdentifier(String virtualSystemIdentifier) {
this.virtualSystemIdentifier = virtualSystemIdentifier;
return this;
}
public Builder virtualSystemTypes(Iterable<String> virtualSystemTypes) {
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes"));
return this;
}
public Builder virtualSystemType(String virtualSystemType) {
this.virtualSystemTypes.add(checkNotNull(virtualSystemType, "virtualSystemType"));
return this;
}
public Builder notes(String notes) {
this.notes = notes;
return this;
}
public VirtualSystemSettingData build() {
return new VirtualSystemSettingData(elementName, instanceID, caption, description, automaticRecoveryAction,
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID,
creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot,
virtualSystemIdentifier, virtualSystemTypes, notes);
}
public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) {
return fromManagedElement(in).automaticRecoveryAction(in.getAutomaticRecoveryAction())
.automaticShutdownAction(in.getAutomaticShutdownAction()).automaticStartupAction(
in.getAutomaticStartupAction()).automaticStartupActionDelay(
in.getAutomaticStartupActionDelay()).automaticStartupActionSequenceNumber(
in.getAutomaticStartupActionSequenceNumber()).configurationDataRoot(
in.getConfigurationDataRoot()).configurationFile(in.getConfigurationFile()).configurationID(
in.getConfigurationID()).creationTime(in.getCreationTime()).logDataRoot(in.getLogDataRoot())
.recoveryFile(in.getRecoveryFile()).snapshotDataRoot(in.getSnapshotDataRoot()).suspendDataRoot(
in.getSuspendDataRoot()).swapFileDataRoot(in.getSwapFileDataRoot()).virtualSystemIdentifier(
in.getVirtualSystemIdentifier()).virtualSystemTypes(in.getVirtualSystemTypes()).notes(
in.getNotes());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromManagedElement(ManagedElement in) {
return Builder.class.cast(super.fromManagedElement(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder caption(String caption) {
return Builder.class.cast(super.caption(caption));
}
/**
* {@inheritDoc}
*/
@Override
public Builder description(String description) {
return Builder.class.cast(super.description(description));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
}
}
/**
* Action to take for the virtual system when the software executed by the virtual system fails.
* Failures in this case means a failure that is detectable by the host platform, such as a
* non-interuptable wait state condition.
*/
public static enum AutomaticRecoveryAction {
NONE(2),
RESTART(3),
REVERT_TO_SNAPSHOT(4);
protected final int code;
AutomaticRecoveryAction(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, AutomaticRecoveryAction> AUTOMATIC_RECOVERY_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticRecoveryAction.values()), new Function<AutomaticRecoveryAction, Integer>() {
@Override
public Integer apply(AutomaticRecoveryAction input) {
return input.code;
}
});
public static AutomaticRecoveryAction fromValue(String automaticRecoveryAction) {
return AUTOMATIC_RECOVERY_ACTION_BY_ID.get(new Integer(checkNotNull(automaticRecoveryAction,
"automaticRecoveryAction")));
}
}
/**
* Action to take for the virtual system when the host is shut down.
*/
public static enum AutomaticShutdownAction {
TURN_OFF(2),
SAVE_STATE(3),
SHUTDOWN(4);
protected final int code;
AutomaticShutdownAction(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, AutomaticShutdownAction> AUTOMATIC_SHUTDOWN_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticShutdownAction.values()), new Function<AutomaticShutdownAction, Integer>() {
@Override
public Integer apply(AutomaticShutdownAction input) {
return input.code;
}
});
public static AutomaticShutdownAction fromValue(String automaticShutdownAction) {
return AUTOMATIC_SHUTDOWN_ACTION_BY_ID.get(new Integer(checkNotNull(automaticShutdownAction,
"automaticShutdownAction")));
}
}
/**
* Action to take for the virtual system when the host is started.
*/
public static enum AutomaticStartupAction {
NONE(2),
RESTART_IF_PREVIOUSLY_ACTIVE(3),
ALWAYS_STARTUP(4);
protected final int code;
AutomaticStartupAction(int code) {
this.code = code;
}
public String value() {
return code + "";
}
protected final static Map<Integer, AutomaticStartupAction> AUTOMATIC_STARTUP_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticStartupAction.values()), new Function<AutomaticStartupAction, Integer>() {
@Override
public Integer apply(AutomaticStartupAction input) {
return input.code;
}
});
public static AutomaticStartupAction fromValue(String automaticStartupAction) {
return AUTOMATIC_STARTUP_ACTION_BY_ID.get(new Integer(checkNotNull(automaticStartupAction,
"automaticStartupAction")));
}
}
private AutomaticRecoveryAction automaticRecoveryAction;
private AutomaticShutdownAction automaticShutdownAction;
private AutomaticStartupAction automaticStartupAction;
private Long automaticStartupActionDelay;
private Integer automaticStartupActionSequenceNumber;
private URI configurationDataRoot;
private URI configurationFile;
private String configurationID;
private Date creationTime;
private URI logDataRoot;
private URI recoveryFile;
private URI snapshotDataRoot;
private URI suspendDataRoot;
private URI swapFileDataRoot;
private String virtualSystemIdentifier;
private Set<String> virtualSystemTypes;
private String notes;
private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description,
AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction,
AutomaticStartupAction automaticStartupAction, Long automaticStartupActionDelay,
Integer automaticStartupActionSequenceNumber, URI configurationDataRoot, URI configurationFile,
String configurationID, Date creationTime, URI logDataRoot, URI recoveryFile, URI snapshotDataRoot,
URI suspendDataRoot, URI swapFileDataRoot, String virtualSystemIdentifier,
Iterable<String> virtualSystemTypes, String notes) {
super(elementName, instanceID, caption, description);
this.automaticRecoveryAction = automaticRecoveryAction;
this.automaticShutdownAction = automaticShutdownAction;
this.automaticStartupAction = automaticStartupAction;
this.automaticStartupActionDelay = automaticStartupActionDelay;
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
this.configurationDataRoot = configurationDataRoot;
this.configurationFile = configurationFile;
this.configurationID = configurationID;
this.creationTime = creationTime;
this.logDataRoot = logDataRoot;
this.recoveryFile = recoveryFile;
this.snapshotDataRoot = snapshotDataRoot;
this.suspendDataRoot = suspendDataRoot;
this.swapFileDataRoot = swapFileDataRoot;
this.virtualSystemIdentifier = virtualSystemIdentifier;
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes"));
this.notes = notes;
}
private VirtualSystemSettingData() {
// for JAXB
}
/**
* Action to take for the virtual system when the software executed by the virtual system fails.
* Failures in this case means a failure that is detectable by the host platform, such as a
* non-interuptable wait state condition.
*/
public AutomaticRecoveryAction getAutomaticRecoveryAction() {
return automaticRecoveryAction;
}
/**
* Action to take for the virtual system when the host is shut down.
*/
public AutomaticShutdownAction getAutomaticShutdownAction() {
return automaticShutdownAction;
}
/**
* Action to take for the virtual system when the host is started.
*/
public AutomaticStartupAction getAutomaticStartupAction() {
return automaticStartupAction;
}
/**
* Delay applicable to startup action. The value shall be in the interval variant of the datetime
* datatype.
*/
public Long getAutomaticStartupActionDelay() {
return automaticStartupActionDelay;
}
/**
* Number indicating the relative sequence of virtual system activation when the host system is
* started. A lower number indicates earlier activation. If one or more configurations show the
* same value, the sequence is implementation dependent. A value of 0 indicates that the sequence
* is implementation dependent.
*/
public Integer getAutomaticStartupActionSequenceNumber() {
return automaticStartupActionSequenceNumber;
}
/**
* Filepath of a directory where information about the virtual system configuration is
* stored.Format shall be URI based on RFC 2079.
*/
public URI getConfigurationDataRoot() {
return configurationDataRoot;
}
/**
* Filepath of a file where information about the virtual system configuration is stored. A
* relative path appends to the value of the ConfigurationDataRoot property.Format shall be URI
* based on RFC 2079.
*/
public URI getConfigurationFile() {
return configurationFile;
}
/**
* Unique id of the virtual system configuration. Note that the ConfigurationID is different from
* the InstanceID as it is assigned by the implementation to a virtual system or a virtual system
* configuration. It is not a key, and the same value may occur within more than one instance.
*/
public String getConfigurationID() {
return configurationID;
}
/**
* Time when the virtual system configuration was created.
*/
public Date getCreationTime() {
return creationTime;
}
/**
* Filepath of a directory where log information about the virtual system is stored. A relative
* path appends to the value of the ConfigurationDataRoot property.Format shall be URI based on
* RFC 2079.
*/
public URI getLogDataRoot() {
return logDataRoot;
}
/**
* Filepath of a file where recovery relateded information of the virtual system is stored.Format
* shall be URI based on RFC 2079.
*/
public URI getRecoveryFile() {
return recoveryFile;
}
/**
* Filepath of a directory where information about virtual system snapshots is stored. A relative
* path appends to the value of the ConfigurationDataRoot property.Format shall be URI based on
* RFC 2079.
*/
public URI getSnapshotDataRoot() {
return snapshotDataRoot;
}
/**
* Filepath of a directory where suspend related information about the virtual system is stored.
* A relative path appends to the value of the ConfigurationDataRoot property.Format shall be URI
* based on RFC 2079.
*/
public URI getSuspendDataRoot() {
return suspendDataRoot;
}
/**
* Filepath of a directory where swapfiles of the virtual system are stored. A relative path
* appends to the value of the ConfigurationDataRoot property.Format shall be URI based on RFC
* 2079.
*/
public URI getSwapFileDataRoot() {
return swapFileDataRoot;
}
/**
* VirtualSystemIdentifier shall reflect a unique name for the system as it is used within the
* virtualization platform. Note that the VirtualSystemIdentifier is not the hostname assigned to
* the operating system instance running within the virtual system, nor is it an IP address or
* MAC address assigned to any of its network ports. On create requests VirtualSystemIdentifier
* may contain implementation specific rules (like simple patterns or regular expresssion) that
* may be interpreted by the implementation when assigning a VirtualSystemIdentifier.
*/
public String getVirtualSystemIdentifier() {
return virtualSystemIdentifier;
}
/**
* VirtualSystemType shall reflect a particular type of virtual system.
*/
public Set<String> getVirtualSystemTypes() {
return virtualSystemTypes;
}
/**
* End-user supplied notes that are related to the virtual system.
*/
public String getNotes() {
return notes;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((virtualSystemIdentifier == null) ? 0 : virtualSystemIdentifier.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
VirtualSystemSettingData other = (VirtualSystemSettingData) obj;
if (virtualSystemIdentifier == null) {
if (other.virtualSystemIdentifier != null)
return false;
} else if (!virtualSystemIdentifier.equals(other.virtualSystemIdentifier))
return false;
return true;
}
@Override
public String toString() {
return String
.format(
"[elementName=%s, instanceID=%s, caption=%s, description=%s, automaticRecoveryAction=%s, automaticShutdownAction=%s, automaticStartupAction=%s, automaticStartupActionDelay=%s, automaticStartupActionSequenceNumber=%s, configurationDataRoot=%s, configurationFile=%s, configurationID=%s, creationTime=%s, logDataRoot=%s, notes=%s, recoveryFile=%s, snapshotDataRoot=%s, suspendDataRoot=%s, swapFileDataRoot=%s, virtualSystemIdentifier=%s, virtualSystemTypes=%s]",
elementName, instanceID, caption, description, automaticRecoveryAction,
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile,
configurationID, creationTime, logDataRoot, notes, recoveryFile, snapshotDataRoot,
suspendDataRoot, swapFileDataRoot, virtualSystemIdentifier, virtualSystemTypes);
}
}

View File

@ -0,0 +1,156 @@
/**
* 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.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = {
"label", "description"
})
public class Configuration {
public static Builder builder() {
return new Builder();
}
public static class Builder {
protected String id;
protected boolean isDefault;
protected String label;
protected String description;
/**
* @see Configuration#getId
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see Configuration#getLabel
*/
public Builder label(String label) {
this.label = label;
return this;
}
/**
* @see Configuration#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see Configuration#isDefault
*/
public Builder isDefault(boolean isDefault) {
this.isDefault = isDefault;
return this;
}
public Configuration build() {
return new Configuration(id, isDefault, label, description);
}
public Builder fromConfiguration(Configuration in) {
return id(in.getId()).description(in.getDescription()).label(in.getLabel());
}
}
@XmlAttribute
private String id;
@XmlAttribute(name = "default")
private boolean isDefault;
@XmlElement(name = "Label")
private String label;
@XmlElement(name = "Description")
private String description;
public Configuration(String id, boolean isDefault, String label, String description) {
this.id = id;
this.label = label;
this.description = description;
this.isDefault = isDefault;
}
public Configuration() {
// for JAXB
}
@Override
public int hashCode() {
return Objects.hashCode(id, label, description);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Configuration other = (Configuration) obj;
return Objects.equal(id, other.id)
&& Objects.equal(label, other.label)
&& Objects.equal(description, other.description);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("id", id).add("default", isDefault).add("label", label).add("description", description);
}
public String getId() {
return id;
}
public String getDescription() {
return description;
}
public String getLabel() {
return label;
}
public boolean isDefault() {
return isDefault;
}
}

View File

@ -0,0 +1,249 @@
/**
* 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.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.net.URI;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.DiskSection;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Disk", namespace = VCLOUD_OVF_NS)
public class Disk implements Comparable<Disk>{
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String id;
private Long capacity;
private String parentRef;
private String fileRef;
private URI format;
private Long populatedSize;
private String capacityAllocationUnits;
/**
* @see Disk#getId
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see Disk#getCapacity
*/
public Builder capacity(Long capacity) {
this.capacity = capacity;
return this;
}
/**
* @see Disk#getParentRef
*/
public Builder parentRef(String parentRef) {
this.parentRef = parentRef;
return this;
}
/**
* @see Disk#getFileRef
*/
public Builder fileRef(String fileRef) {
this.fileRef = fileRef;
return this;
}
/**
* @see Disk#getFormat
*/
public Builder format(URI format) {
this.format = format;
return this;
}
/**
* @see Disk#getPopulatedSize
*/
public Builder populatedSize(Long populatedSize) {
this.populatedSize = populatedSize;
return this;
}
/**
* @see Disk#getCapacityAllocationUnits
*/
public Builder capacityAllocationUnits(String capacityAllocationUnits) {
this.capacityAllocationUnits = capacityAllocationUnits;
return this;
}
public Disk build() {
return new Disk(id, capacity, parentRef, fileRef, format, populatedSize, capacityAllocationUnits);
}
public Builder fromDisk(Disk in) {
return id(in.getId()).capacity(in.getCapacity()).parentRef(in.getParentRef()).fileRef(in.getFileRef()).format(
in.getFormat()).populatedSize(in.getPopulatedSize()).capacityAllocationUnits(
in.getCapacityAllocationUnits());
}
}
private String id;
private Long capacity;
private String parentRef;
private String fileRef;
private URI format;
private Long populatedSize;
private String capacityAllocationUnits;
private Disk(String id, Long capacity, String parentRef, String fileRef, URI format, Long populatedSize,
String capacityAllocationUnits) {
this.id = id;
this.capacity = capacity;
this.parentRef = parentRef;
this.fileRef = fileRef;
this.format = format;
this.populatedSize = populatedSize;
this.capacityAllocationUnits = capacityAllocationUnits;
}
private Disk() {
// For Jaxb
}
/**
* Each virtual disk is represented by a Disk element that shall be given a identifier using the
* {@code id} attribute, the identifier shall be unique within the {@link DiskSection}.
*/
public String getId() {
return id;
}
/**
* The capacity of a virtual disk shall be specified by the {@code capacity} attribute with an
* xs:long integer value. The default unit of allocation shall be bytes.
*/
public Long getCapacity() {
return capacity;
}
/**
* OVF allows a disk image to be represented as a set of modified blocks in comparison to a
* parent image. The use of parent disks can often significantly reduce the size of an OVF
* package, if it contains multiple disks with similar content. For a Disk element, a parent disk
* may optionally be specified using the {@code parentRef} attribute, which shall contain a valid
* ovf:id reference to a different Disk element. If a disk block does not exist locally, lookup
* for that disk block then occurs in the parent disk. In {@link DiskSection}, parent Disk
* elements shall occur before child Disk elements that refer to them.
*/
public String getParentRef() {
return parentRef;
}
/**
* The ovf:fileRef attribute denotes the virtual disk content by identifying an existing File
* element in the References element, the File element is identified by matching its {@code id}
* attribute value with the {@code fileRef} attribute value. Omitting the {@code fileRef}
* attribute shall indicate an empty disk. In this case, the disk shall be created and the entire
* disk content zeroed at installation time. The guest software will typically format empty disks
* in some file system format.
*/
public String getFileRef() {
return fileRef;
}
/**
* The format URI of a non-empty virtual disk shall be specified by the {@code format} attribute.
*/
public URI getFormat() {
return format;
}
/**
* For non-empty disks, the actual used size of the disk may optionally be specified using the
* {@code populatedSize} attribute. The unit of this attribute is always bytes. {@code
* populatedSize} is allowed to be an estimate of used disk size but shall not be larger than
* {@code capacity}.
*/
public Long getPopulatedSize() {
return populatedSize;
}
/**
* The optional string attribute {@code ovf:capacityAllocationUnits} may be used to specify a
* particular unit of allocation. Values for {@code ovf:capacityAllocationUnits} shall match the
* format for programmatic units defined in DSP0004.
*/
public String getCapacityAllocationUnits() {
return capacityAllocationUnits;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Disk other = (Disk) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public String toString() {
return String
.format(
"[id=%s, capacity=%s, capacityAllocationUnits=%s, fileRef=%s, format=%s, parentRef=%s, populatedSize=%s]",
id, capacity, capacityAllocationUnits, fileRef, format, parentRef, populatedSize);
}
/**
* {@inheritDoc}
*/
@Override
public int compareTo(Disk o) {
if (id == null)
return -1;
return (this == o) ? 0 : id.compareTo(o.id);
}
}

View File

@ -0,0 +1,142 @@
/**
* 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.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.VirtualSystem;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseEnvelope;
import com.google.common.collect.Multimap;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS)
public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
public Builder toBuilder() {
return new Builder().fromEnvelope(this);
}
public static class Builder extends BaseEnvelope.Builder<VirtualSystem, Envelope> {
/**
* {@inheritDoc}
*/
public Envelope build() {
return new Envelope(diskSections, networkSections, additionalSections, virtualSystem);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSection(String name, SectionType additionalSection) {
return Builder.class.cast(super.additionalSection(name, additionalSection));
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSections(Multimap<String, SectionType> additionalSections) {
return Builder.class.cast(super.additionalSections(additionalSections));
}
/**
* {@inheritDoc}
*/
@Override
public Builder diskSection(DiskSection diskSection) {
return Builder.class.cast(super.diskSection(diskSection));
}
/**
* {@inheritDoc}
*/
@Override
public Builder diskSections(Iterable<? extends DiskSection> diskSections) {
return Builder.class.cast(super.diskSections(diskSections));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromEnvelope(BaseEnvelope<VirtualSystem, Envelope> in) {
return Builder.class.cast(super.fromEnvelope(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder networkSection(NetworkSection networkSection) {
return Builder.class.cast(super.networkSection(networkSection));
}
/**
* {@inheritDoc}
*/
@Override
public Builder networkSections(Iterable<? extends NetworkSection> networkSections) {
return Builder.class.cast(super.networkSections(networkSections));
}
/**
* {@inheritDoc}
*/
@Override
public Builder virtualSystem(VirtualSystem virtualSystem) {
return Builder.class.cast(super.virtualSystem(virtualSystem));
}
}
@SuppressWarnings("unchecked")
private Envelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections,
Multimap<String, SectionType> additionalSections, VirtualSystem virtualSystem) {
super(diskSections, networkSections, additionalSections, virtualSystem);
}
private Envelope() {
// For JaxB
}
}

View File

@ -0,0 +1,123 @@
/**
* 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.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Network", namespace = VCLOUD_OVF_NS)
public class Network {
public static Builder builder() {
return new Builder();
}
public static class Builder {
protected String name;
protected String description;
/**
* @see Network#getName
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see Network#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
public Network build() {
return new Network(name, description);
}
public Builder fromNetwork(Network in) {
return name(in.getName()).description(in.getDescription());
}
}
private String name;
private String description;
protected Network(String name, String description) {
this.name = name;
this.description = description;
}
protected Network() {
// for JAXB
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Network other = (Network) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return "[name=" + name + ", description=" + description + "]";
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
}

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.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Property", namespace = VCLOUD_OVF_NS)
public class Property {
public static Builder builder() {
return new Builder();
}
public static class Builder {
protected String key;
protected String value;
protected String label;
protected String description;
/**
* @see Property#getKey
*/
public Builder key(String key) {
this.key = key;
return this;
}
/**
* @see Property#getValue
*/
public Builder value(String value) {
this.value = value;
return this;
}
/**
* @see Property#getLabel
*/
public Builder label(String label) {
this.label = label;
return this;
}
/**
* @see Property#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
public Property build() {
return new Property(key, value, label, description);
}
public Builder fromProperty(Property in) {
return key(in.getKey()).value(in.getValue()).description(in.getDescription()).label(in.getLabel());
}
}
private String key;
private String value;
private String label;
private String description;
private Property(String key, String value, String label, String description) {
this.key = key;
this.value = value;
this.label = label;
this.description = description;
}
private Property() {
// for JAXB
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Property other = (Property) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
return true;
}
@Override
public String toString() {
return String.format("[key=%s, value=%s, label=%s, description=%s]", key, value, label, description);
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
public String getLabel() {
return label;
}
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,189 @@
/**
* 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.ovf.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set;
import org.jclouds.vcloud.director.v1_5.domain.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
/**
* @author Adrian Cole
*/
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>> {
protected Set<DiskSection> diskSections = Sets.newLinkedHashSet();
protected Set<NetworkSection> networkSections = Sets.newLinkedHashSet();
@SuppressWarnings("unchecked")
protected Multimap<String, SectionType> additionalSections = LinkedHashMultimap.create();
protected V virtualSystem;
/**
* @see BaseEnvelope#getDiskSections
*/
public Builder<V, E> diskSection(DiskSection diskSection) {
this.diskSections.add(checkNotNull(diskSection, "diskSection"));
return this;
}
/**
* @see BaseEnvelope#getDiskSections
*/
public Builder<V, E> diskSections(Iterable<? extends DiskSection> diskSections) {
this.diskSections = ImmutableSet.<DiskSection> copyOf(checkNotNull(diskSections, "diskSections"));
return this;
}
/**
* @see BaseEnvelope#getNetworkSections
*/
public Builder<V, E> networkSection(NetworkSection networkSection) {
this.networkSections.add(checkNotNull(networkSection, "networkSection"));
return this;
}
/**
* @see BaseEnvelope#getNetworkSections
*/
public Builder<V, E> networkSections(Iterable<? extends NetworkSection> networkSections) {
this.networkSections = ImmutableSet.<NetworkSection> copyOf(checkNotNull(networkSections, "networkSections"));
return this;
}
/**
* @see BaseEnvelope#getAdditionalSections
*/
@SuppressWarnings("unchecked")
public Builder<V, E> additionalSection(String name, SectionType additionalSection) {
this.additionalSections.put(checkNotNull(name, "name"), checkNotNull(additionalSection, "additionalSection"));
return this;
}
/**
* @see BaseEnvelope#getAdditionalSections
*/
@SuppressWarnings("unchecked")
public Builder<V, E> additionalSections(Multimap<String, SectionType> additionalSections) {
this.additionalSections = ImmutableMultimap.<String, SectionType> copyOf(checkNotNull(additionalSections,
"additionalSections"));
return this;
}
/**
* @see BaseEnvelope#getVirtualSystem
*/
public Builder<V, E> virtualSystem(V virtualSystem) {
this.virtualSystem = virtualSystem;
return this;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public abstract E build() ;
public Builder<V, E> fromEnvelope(BaseEnvelope<V, E> in) {
return virtualSystem(in.getVirtualSystem()).diskSections(in.getDiskSections())
.networkSections(networkSections).additionalSections(in.getAdditionalSections());
}
}
private Set<DiskSection> diskSections;
private Set<NetworkSection> networkSections;
@SuppressWarnings("unchecked")
private Multimap<String, SectionType> additionalSections;
private V virtualSystem;
@SuppressWarnings("unchecked")
protected BaseEnvelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections,
Multimap<String, SectionType> additionalSections, V virtualSystem) {
this.diskSections = ImmutableSet.copyOf(checkNotNull(diskSections, "diskSections"));
this.networkSections = ImmutableSet.copyOf(checkNotNull(networkSections, "networkSections"));
this.additionalSections = ImmutableMultimap.copyOf(checkNotNull(additionalSections, "additionalSections"));
this.virtualSystem = checkNotNull(virtualSystem, "virtualSystem");
}
protected BaseEnvelope() {
// for JAXB
}
public V getVirtualSystem() {
return virtualSystem;
}
public Set<? extends DiskSection> getDiskSections() {
return diskSections;
}
@SuppressWarnings("unchecked")
public Multimap<String, SectionType> getAdditionalSections() {
return additionalSections;
}
@Override
public int hashCode() {
return Objects.hashCode(additionalSections, diskSections, networkSections, virtualSystem);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
BaseEnvelope<?, ?> other = (BaseEnvelope<?, ?>) obj;
return Objects.equal(additionalSections, other.additionalSections)
&& Objects.equal(diskSections, other.diskSections)
&& Objects.equal(networkSections, other.networkSections)
&& Objects.equal(virtualSystem, other.virtualSystem);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("diskSections", diskSections).add("networkSections", networkSections)
.add("additionalSections", additionalSections).add("virtualSystem", virtualSystem);
}
public Set<NetworkSection> getNetworkSections() {
return networkSections;
}
}

View File

@ -0,0 +1,250 @@
/**
* 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.ovf.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set;
import org.jclouds.vcloud.director.v1_5.domain.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.domain.SectionType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
/**
* @author Adrian Cole
*/
public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends SectionType<T> {
public static abstract class Builder<T extends BaseVirtualSystem<T>> extends SectionType.Builder<T> {
protected String id;
protected String name;
protected OperatingSystemSection operatingSystem;
protected Set<VirtualHardwareSection> virtualHardwareSections = Sets.newLinkedHashSet();
protected Set<ProductSection> productSections = Sets.newLinkedHashSet();
@SuppressWarnings("unchecked")
protected Multimap<String, SectionType> additionalSections = LinkedHashMultimap.create();
/**
* @see BaseVirtualSystem#getName
*/
public Builder<T> name(String name) {
this.name = name;
return this;
}
/**
* @see BaseVirtualSystem#getId
*/
public Builder<T> id(String id) {
this.id = id;
return this;
}
/**
* @see BaseVirtualSystem#getOperatingSystemSection
*/
public Builder<T> operatingSystemSection(OperatingSystemSection operatingSystem) {
this.operatingSystem = operatingSystem;
return this;
}
/**
* @see BaseVirtualSystem#getVirtualHardwareSections
*/
public Builder<T> virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) {
this.virtualHardwareSections.add(checkNotNull(virtualHardwareSection, "virtualHardwareSection"));
return this;
}
/**
* @see BaseVirtualSystem#getVirtualHardwareSections
*/
public Builder<T> virtualHardwareSections(Iterable<? extends VirtualHardwareSection> virtualHardwareSections) {
this.virtualHardwareSections = ImmutableSet.<VirtualHardwareSection> copyOf(checkNotNull(virtualHardwareSections,
"virtualHardwareSections"));
return this;
}
/**
* @see BaseVirtualSystem#getProductSections
*/
public Builder<T> productSection(ProductSection productSection) {
this.productSections.add(checkNotNull(productSection, "productSection"));
return this;
}
/**
* @see BaseVirtualSystem#getProductSections
*/
public Builder<T> productSections(Iterable<? extends ProductSection> productSections) {
this.productSections = ImmutableSet.<ProductSection> copyOf(checkNotNull(productSections, "productSections"));
return this;
}
/**
* @see BaseVirtualSystem#getAdditionalSections
*/
@SuppressWarnings("unchecked")
public Builder<T> additionalSection(String name, SectionType additionalSection) {
this.additionalSections.put(checkNotNull(name, "name"), checkNotNull(additionalSection, "additionalSection"));
return this;
}
/**
* @see BaseVirtualSystem#getAdditionalSections
*/
@SuppressWarnings("unchecked")
public Builder<T> additionalSections(Multimap<String, SectionType> additionalSections) {
this.additionalSections = ImmutableMultimap.<String, SectionType> copyOf(checkNotNull(additionalSections,
"additionalSections"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public abstract BaseVirtualSystem<T> build();
public Builder<T> fromVirtualSystem(BaseVirtualSystem<T> in) {
return fromSection(in).id(in.getId()).name(in.getName())
.operatingSystemSection(in.getOperatingSystemSection()).virtualHardwareSections(
in.getVirtualHardwareSections()).productSections(in.getProductSections())
.additionalSections(in.getAdditionalSections());
}
/**
* {@inheritDoc}
*/
@Override
public Builder<T> fromSection(SectionType<T> in) {
return (Builder<T>) super.fromSection(in);
}
/**
* {@inheritDoc}
*/
@Override
public Builder<T> info(String info) {
return (Builder<T>) super.info(info);
}
}
private String id;
private String name;
private OperatingSystemSection operatingSystem;
private Set<VirtualHardwareSection> virtualHardwareSections;
private Set<ProductSection> productSections;
@SuppressWarnings("unchecked")
private Multimap<String, SectionType> additionalSections;
@SuppressWarnings("unchecked")
protected BaseVirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(info);
this.id = id;
this.name = name;
this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
this.virtualHardwareSections = ImmutableSet.copyOf(checkNotNull(virtualHardwareSections, "virtualHardwareSections"));
this.productSections = ImmutableSet.copyOf(checkNotNull(productSections, "productSections"));
this.additionalSections = ImmutableMultimap.copyOf(checkNotNull(additionalSections, "additionalSections"));
}
protected BaseVirtualSystem() {
// For JAXB
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public OperatingSystemSection getOperatingSystemSection() {
return operatingSystem;
}
/**
* Each VirtualSystem element may contain one or more VirtualHardwareSection elements, each of
* which describes the virtual virtualHardwareSections required by the virtual system.
*/
public Set<? extends VirtualHardwareSection> getVirtualHardwareSections() {
return virtualHardwareSections;
}
/**
* Specifies product-information for a package, such as product name and version, along with a
* set of properties that can be configured
*/
public Set<? extends ProductSection> getProductSections() {
return productSections;
}
@SuppressWarnings("unchecked")
public Multimap<String, SectionType> getAdditionalSections() {
return additionalSections;
}
@Override
public int hashCode() {
return Objects.hashCode(id, name, info, operatingSystem, virtualHardwareSections, productSections, additionalSections);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
BaseVirtualSystem<?> other = (BaseVirtualSystem<?>) obj;
return Objects.equal(id, other.id)
&& Objects.equal(name, other.name)
&& Objects.equal(info, other.info)
&& Objects.equal(operatingSystem, other.operatingSystem)
&& Objects.equal(virtualHardwareSections, other.virtualHardwareSections)
&& Objects.equal(productSections, other.productSections)
&& Objects.equal(additionalSections, other.additionalSections);
}
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("id", id).add("name", name).add("info", info)
.add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections)
.add("productSections", productSections).add("additionalSections", additionalSections)
.add("additionalSections", additionalSections);
}
}

View File

@ -0,0 +1,292 @@
/**
* 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.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.ovf.Envelope;
import org.jclouds.ovf.NetworkSection;
import org.jclouds.rest.annotations.*;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.domain.*;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import javax.ws.rs.*;
/**
* @author Adam Lowe
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VAppTemplateAsyncClient {
/**
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#getVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(VAPP_TEMPLATE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier reference);
/**
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#editVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.VAppTemplate)
*/
@PUT
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> editVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier reference,
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
/**
* @see VAppTemplateClient#deleteVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@DELETE
@Consumes(TASK)
@JAXBResponseParser
ListenableFuture<Task> deleteVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#consolidateVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@POST
@Consumes(TASK)
@Path("/consolidate")
@JAXBResponseParser
ListenableFuture<Task> consolidateVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#disableDownloadVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@POST
@Consumes(TASK)
@Path("/action/disableDownload")
@JAXBResponseParser
ListenableFuture<Task> disableDownloadVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#enableDownloadVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@POST
@Consumes(TASK)
@Path("/action/enableDownload")
@JAXBResponseParser
ListenableFuture<Task> enableDownloadVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#relocateVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.RelocateParams)
*/
@POST
@Consumes(TASK)
@Path("/action/relocate")
@JAXBResponseParser
ListenableFuture<Task> relocateVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) RelocateParams params);
/**
* @see VAppTemplateClient#getVAppTemplateCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(CUSTOMIZATION_SECTION)
@Path("/customizationSection")
@JAXBResponseParser
CustomizationSection getVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editVAppTemplateCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.CustomizationSection)
*/
@PUT
@Path("/customizationSection")
@JAXBResponseParser
ListenableFuture<Task> editVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) CustomizationSection sectionType);
/**
* @see VAppTemplateClient#getVAppTemplateGuestCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(GUEST_CUSTOMIZATION_SECTION)
@Path("/guestCustomizationSection")
@JAXBResponseParser
GuestCustomizationSection getVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editVAppTemplateGuestCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
*/
@PUT
@Consumes(TASK)
@Path("/guestCustomizationSection")
@JAXBResponseParser
Task editVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/**
* @see VAppTemplateClient#getVappTemplateLeaseSettingsSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Path("/leaseSettingsSection")
@JAXBResponseParser
LeaseSettingsSection getVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editVappTemplateLeaseSettingsSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection)
*/
@PUT
@Consumes(TASK)
@Path("/leaseSettingsSection")
@JAXBResponseParser
ListenableFuture<Task> editVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
/**
* @see VAppTemplateClient#getMetadataForVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(METADATA)
@Path("/metadata")
@JAXBResponseParser
ListenableFuture<Metadata> getMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@PUT
@Consumes(TASK)
@Path("/metadata")
@JAXBResponseParser
ListenableFuture<Task> editMetadataForVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
* @see VAppTemplateClient#editMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataEntry)
*/
@GET
@Consumes(METADATA_ENTRY)
@Path("/metadata/{key}")
ListenableFuture<MetadataEntry> getMetadataEntryForVAppTemplateAndKey(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@PathParam("key") String key);
/**
* @see VAppTemplateClient#editMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataEntry)
*/
@PUT
@Consumes(TASK)
@Path("/metadata/{key}")
ListenableFuture<Task> editMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@PathParam("key") String key,
@BinderParam(BindToXMLPayload.class) MetadataEntry entry);
/**
* @see VAppTemplateClient#deleteMetadataEntryForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String)
*/
@DELETE
@Produces()
@Consumes(TASK)
@Path("/metadata/{key}")
ListenableFuture<Task> deleteMetadataEntryForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@PathParam("key") String key);
/**
* @see VAppTemplateClient#getNetworkConfigSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(NETWORK_CONFIG_SECTION)
@Path("/networkConfigSection")
ListenableFuture<NetworkConfigSection> getNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editNetworkConfigSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection)
*/
@PUT
@Produces(NETWORK_CONFIG_SECTION)
@Consumes(TASK)
@Path("/networkConfigSection")
ListenableFuture<Task> editNetworkConfigSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/**
* @see VAppTemplateClient#getNetworkConnectionSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(NETWORK_CONNECTION_SECTION)
@Path("/networkConnectionSection")
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editNetworkConnectionSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection)
*/
@PUT
@Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK)
@Path("/networkConnectionSection")
ListenableFuture<Task> editNetworkConnectionSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
* @see VAppTemplateClient#getNetworkSectionForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(NETWORK_SECTION)
@Path("/networkSection")
ListenableFuture<NetworkSection> getNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
@PUT
@Produces(NETWORK_SECTION)
@Consumes(TASK)
@Path("/networkSection")
ListenableFuture<Task> editNetworkSectionForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) NetworkSection section);
/**
* @see VAppTemplateClient#getOvfForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Path("/ovf")
ListenableFuture<Envelope> getOvfForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#getOwnerOfVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(OWNER)
@Path("/owner")
ListenableFuture<Owner> getOwnerOfVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#getProductSectionsForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
*/
@GET
@Consumes(PRODUCT_SECTION_LIST)
@Path("/productSections")
ListenableFuture<ProductSectionList> getProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
/**
* @see VAppTemplateClient#editProductSectionsForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.ProductSectionList)
*/
@PUT
@Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK)
@Path("/productSections")
ListenableFuture<Task> editProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
// TODO shadowVms ?
}

View File

@ -0,0 +1,264 @@
/**
* 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.features;
import org.jclouds.concurrent.Timeout;
import org.jclouds.ovf.Envelope;
import org.jclouds.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.*;
import java.net.URI;
import java.util.concurrent.TimeUnit;
/**
* Provides synchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} objects.
*
* @author Adam Lowe
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VAppTemplateClient {
/**
* Retrieves a vApp template (can be used also to retrieve a VM from a vApp Template).
*
* @param templateReference the reference to the template
* @return the requested template
*/
VAppTemplate getVAppTemplate(URISupplier templateReference);
/**
* Modifies only the name/description of a vApp template.
*
* @param templateReference the reference to the template
* @param template the template containing the new name and/or description
* @return the task performing the action
*/
Task editVAppTemplate(URISupplier templateReference, VAppTemplate template);
/**
* Deletes a vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task deleteVappTemplate(URISupplier templateReference);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task consolidateVappTemplate(URISupplier templateReference);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task disableDownloadVappTemplate(URISupplier templateReference);
/**
* Consolidates a VM,
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task enableDownloadVappTemplate(URISupplier templateReference);
/**
* Relocates a virtual machine in a vApp template to a different datastore. *
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task relocateVappTemplate(URISupplier templateReference, RelocateParams params);
/**
* Retrieves the customization section of a vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
CustomizationSection getVAppTemplateCustomizationSection(URISupplier templateReference);
/**
* Modifies the vApp template customization information.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editVAppTemplateCustomizationSection(URISupplier templateReference, CustomizationSection sectionType);
/**
* Retrieves the Guest Customization Section of a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
GuestCustomizationSection getVAppTemplateGuestCustomizationSection(URISupplier templateReference);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editVAppTemplateGuestCustomizationSection(URISupplier templateReference, GuestCustomizationSection sectionType);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
LeaseSettingsSection getVappTemplateLeaseSettingsSection(URISupplier templateReference);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editVappTemplateLeaseSettingsSection(URISupplier templateReference, LeaseSettingsSection settingsSection);
/**
* Retrieves the metadata associated with a vApp Template.
*
* @param templateReference the reference to the template
* @return the requested metadata
*/
Metadata getMetadataForVappTemplate(URISupplier templateReference);
/**
* Merges the metadata for a vApp Template with the information provided.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editMetadataForVappTemplate(URISupplier templateReference, Metadata metadata);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
MetadataEntry getMetadataEntryForVAppTemplateAndKey(URISupplier templateReference, String key);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editMetadataEntryForVAppTemplate(URISupplier templateReference, String key, MetadataEntry entry);
/**
* Consolidates a VM
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task deleteMetadataEntryForVAppTemplate(URISupplier templateReference, String key);
/**
* Retrieves the network config section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the network config section requested
*/
NetworkConfigSection getNetworkConfigSectionForVAppTemplate(URISupplier templateReference);
/**
* Modifies the network config section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editNetworkConfigSectionForVAppTemplate(URISupplier templateReference, NetworkConfigSection section);
/**
* Retrieves the network connection section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the network connection section requested
*/
NetworkConnectionSection getNetworkConnectionSectionForVAppTemplate(URISupplier templateReference);
/**
* Modifies the network connection section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editNetworkConnectionSectionForVAppTemplate(URISupplier templateReference, NetworkConnectionSection section);
/**
* Retrieves the network section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the network section requested
*/
NetworkSection getNetworkSectionForVAppTemplate(URISupplier templateReference);
/**
* Modifies the network section of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editNetworkSectionForVAppTemplate(URISupplier templateReference, NetworkSection section);
/**
* Retrieves an OVF descriptor of a vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Envelope getOvfForVAppTemplate(URISupplier templateReference);
/**
* Retrieves vApp template owner.
*
* @param templateReference the reference to the template
* @return the owner of the vApp template
*/
Owner getOwnerOfVAppTemplate(URISupplier templateReference);
/**
* Retrieves VAppTemplate/VM product sections
*
* @param templateReference the reference to the template
* @return the product sections
*/
ProductSectionList getProductSectionsForVAppTemplate(URISupplier templateReference);
/**
* Modifies the product sections of a vApp or vApp template.
*
* @param templateReference the reference to the template
* @return the task performing the action
*/
Task editProductSectionsForVAppTemplate(URISupplier templateReference, ProductSectionList sections);
// TODO ShadowVms???
}

View File

@ -24,6 +24,7 @@ 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;
/**
* @author grkvlt@apache.org
@ -33,8 +34,8 @@ public class ReferenceToEndpoint implements Function<Object, URI> {
@Override
public URI apply(Object input) {
Preconditions.checkNotNull(input);
Preconditions.checkArgument(input instanceof ReferenceType<?>);
ReferenceType<?> reference = (ReferenceType<?>) input;
Preconditions.checkArgument(input instanceof URISupplier);
URISupplier reference = (URISupplier) input;
return reference.getURI();
};
}

View File

@ -0,0 +1,100 @@
/*
* 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.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.*;
import org.jclouds.vcloud.director.v1_5.domain.Error;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test;
import java.net.URI;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;
/**
* Tests the request/response behavior of {@link org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient}
*
* @author Adam Lowe
*/
@Test(groups = {"unit", "user"}, singleThreaded = true, testName = "VAppTemplateClientExpectTest")
public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
public void testGetVAppTemplate() {
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-xxxx-xxxx-xxxx-xxx";
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId).acceptMedia(VAPP_TEMPLATE).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).httpResponseBuilder().build()
).getVAppTemplateClient();
assertNotNull(client);
VAppTemplate template = client.getVAppTemplate(vappTemplateRef);
assertEquals(template, exampleTemplate());
}
private VAppTemplate exampleTemplate() {
Link aLink = Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07"))
.type("application/vnd.vmware.vcloud.vdc+xml").rel("up").build();
Link bLink = Link.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
.rel("remove").build();
Owner owner = Owner.builder().user(Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69")).name("x@jclouds.org").type("application/vnd.vmware.admin.user+xml").build()).build();
LeaseSettingsSection leaseSettings = LeaseSettingsSection.builder().type("application/vnd.vmware.vcloud.leaseSettingsSection+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/leaseSettingsSection/"))
.info("Lease settings section")
.links(ImmutableList.of(Link.builder().rel("edit").type("application/vnd.vmware.vcloud.leaseSettingsSection+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/leaseSettingsSection/")).build()))
.storageLeaseInSeconds(0)
.build();
CustomizationSection customization = CustomizationSection.builder()
.type("application/vnd.vmware.vcloud.customizationSection+xml")
.customizeOnInstantiate(true)
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/"))
.build();
return VAppTemplate.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
.links(ImmutableSet.of(aLink, bLink))
.children(VAppTemplateChildren.builder().build())
.type("application/vnd.vmware.vcloud.vAppTemplate+xml")
.description("For testing")
.id("urn:vcloud:vapptemplate:ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")
.name("ubuntu10")
.sections(ImmutableList.<SectionType>of(leaseSettings, customization))
.status(-1)
.owner(owner)
.ovfDescriptorUploaded(true)
.goldMaster(false)
.build();
}
}

View File

@ -22,7 +22,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull;
import java.net.URI;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.date.DateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
@ -57,6 +59,13 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
assertNotNull(dateService);
}
@Override
public Properties setupProperties() {
Properties props = new Properties();
props.put(Constants.PROPERTY_MAX_RETRIES, 1);
return props;
}
protected HttpRequest loginRequest = HttpRequest.builder()
.method("POST")
.endpoint(URI.create(endpoint + "/sessions"))

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
ovfDescriptorUploaded="true" goldMaster="false" status="-1" name="ubuntu10"
id="urn:vcloud:vapptemplate:ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"
type="application/vnd.vmware.vcloud.vAppTemplate+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
href="https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07"/>
<Link rel="remove"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
<Description>For testing</Description>
<Owner type="application/vnd.vmware.vcloud.owner+xml">
<User type="application/vnd.vmware.admin.user+xml" name="x@jclouds.org"
href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
</Owner>
<Children/>
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/leaseSettingsSection/"
ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/leaseSettingsSection/"/>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml"
href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9/customizationSection/"
ovf:required="false">
<ovf:Info>VApp template customization section</ovf:Info>
<CustomizeOnInstantiate>true</CustomizeOnInstantiate>
</CustomizationSection>
</VAppTemplate>