Merge pull request #441 from grkvlt/vapp

Issue 830: The VAppClient and VApp domain objects
This commit is contained in:
Adrian Cole 2012-03-14 11:06:28 -07:00
commit 5c3a3572b6
154 changed files with 14341 additions and 1805 deletions

View File

@ -41,6 +41,7 @@ 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.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UserAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
@ -108,15 +109,20 @@ public interface VCloudDirectorAsyncClient {
@Delegate
UploadAsyncClient getUploadClient();
/**
* @return asynchronous access to {@link VApp} features
*/
@Delegate
VAppAsyncClient getVAppClient();
/**
* @return asynchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
* @return asynchronous access to {@link VAppTemplate} features
*/
@Delegate
VAppTemplateAsyncClient getVAppTemplateClient();
/**
* @return asynchronous access to {@link Catalog} features
* @return asynchronous access to {@link Catalog} admin features
*/
@Delegate
AdminCatalogAsyncClient getAdminCatalogClient();

View File

@ -45,6 +45,7 @@ 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.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.UserClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
@ -107,19 +108,25 @@ public interface VCloudDirectorClient {
VdcClient getVdcClient();
/**
* @return synchronous access to {@link Upload} features
* @return synchronous access to upload features
*/
@Delegate
UploadClient getUploadClient();
/**
* @return synchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
* @return synchronous access to {@link VApp} features
*/
@Delegate
VAppClient getVAppClient();
/**
* @return synchronous access to {@link VAppTemplate} features
*/
@Delegate
VAppTemplateClient getVAppTemplateClient();
/**
* @return synchronous access to {@link Catalog} features
* @return synchronous access to {@link Catalog} admin features
*/
@Delegate
AdminCatalogClient getAdminCatalogClient();

View File

@ -18,7 +18,6 @@
*/
package org.jclouds.vcloud.director.v1_5;
/**
* Constants used by VCloudDirector clients
*
@ -31,6 +30,8 @@ public class VCloudDirectorConstants {
public static final String VCLOUD_OVF_NS = "http://schemas.dmtf.org/ovf/envelope/1";
public static final String VCLOUD_OVF_ENV_NS = "http://schemas.dmtf.org/ovf/environment/1";
public static final String VCLOUD_CIM_NS = "http://schemas.dmtf.org/wbem/wscim/1/common";
/** The property used to configure the timeout for task completion. */

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -29,21 +29,31 @@ public class VCloudDirectorException extends RuntimeException {
/** The serialVersionUID. */
private static final long serialVersionUID = -5292516858598372960L;
private static final String MSG_FMT = "%s: %s";
private final Error error;
private final Task task;
public VCloudDirectorException(Error error) {
super("ERR-801: Error: " + error.getMessage());
super(String.format(MSG_FMT, "Error", error.getMessage()));
this.error = error;
this.task = null;
}
public VCloudDirectorException(Task task) {
super("ERR-802: Task error: " + task.getError().getMessage());
super(String.format(MSG_FMT, "Task error", task.getError().getMessage()));
this.error = task.getError();
this.task = task;
}
public Integer getMajorErrorCode() {
return error.getMajorErrorCode();
}
public Error.Code getCode() {
return Error.Code.fromCode(error.getMajorErrorCode());
}
public Error getError() {
return error;
}
@ -55,5 +65,4 @@ public class VCloudDirectorException extends RuntimeException {
public Task getTask() {
return task;
}
}

View File

@ -34,6 +34,10 @@ public class VCloudDirectorMediaType {
public static final String ANY = "*/*";
public static final String ANY_IMAGE = "image/*";
public static final String APPLICATION_XML_1_5 = "application/*+xml;version=1.5";
public static final String SESSION = "application/vnd.vmware.vcloud.session+xml";
public static final String ERROR = "application/vnd.vmware.vcloud.error+xml";
@ -74,30 +78,25 @@ public class VCloudDirectorMediaType {
public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml";
public static final String V_APP = "application/vnd.vmware.vcloud.vApp+xml";
public static final String VAPP = "application/vnd.vmware.vcloud.vApp+xml";
public static final String V_APP_TEMPLATE = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String VAPP_TEMPLATE = "application/vnd.vmware.vcloud.vAppTemplate+xml";
public static final String CAPTURE_VAPP_PARAMS =
"application/vnd.vmware.vcloud.captureVAppParams+xml";
public static final String VM = "application/vnd.vmware.vcloud.vm+xml";
public static final String CLONE_MEDIA_PARAMS =
"application/vnd.vmware.vcloud.cloneMediaParams+xml";
public static final String CAPTURE_VAPP_PARAMS = "application/vnd.vmware.vcloud.captureVAppParams+xml";
public static final String CLONE_V_APP_PARAMS =
"application/vnd.vmware.vcloud.cloneVAppParams+xml";
public static final String CLONE_MEDIA_PARAMS = "application/vnd.vmware.vcloud.cloneMediaParams+xml";
public static final String CLONE_V_APP_TEMPLATE_PARAMS =
"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml";
public static final String CLONE_VAPP_PARAMS = "application/vnd.vmware.vcloud.cloneVAppParams+xml";
public static final String COMPOSE_VAPP_PARAMS =
"application/vnd.vmware.vcloud.composeVAppParams+xml";
public static final String CLONE_VAPP_TEMPLATE_PARAMS = "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml";
public static final String INSTANTIATE_VAPP_TEMPLATE_PARAMS =
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml";
public static final String COMPOSE_VAPP_PARAMS = "application/vnd.vmware.vcloud.composeVAppParams+xml";
public static final String INSTANTIATE_VAPP_TEMPLATE_PARAMS = "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml";
public static final String UPLOAD_VAPP_TEMPLATE_PARAMS =
"application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml";
public static final String UPLOAD_VAPP_TEMPLATE_PARAMS = "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml";
public static final String QUERY_RESULT_RECORDS = "application/vnd.vmware.vcloud.query.records+xml";
@ -107,26 +106,38 @@ 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.customizationSection+xml";
public static final String GUEST_CUSTOMIZATION_SECTION = "application/vnd.vmware.vcloud.guestCustomizationSection+xml";
public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leaseSettingsSection+xml";
public static final String NETWORK_SECTION = "application/vnd.vmware.vcloud.networkSection+xml";
public static final String NETWORK_CONFIG_SECTION = "application/vnd.vmware.vcloud.networkConfigSection+xml";
public static final String NETWORK_CONNECTION_SECTION = "application/vnd.vmware.vcloud.networkConnectionSection+xml";
public static final String PRODUCT_SECTION_LIST = "application/vnd.vmware.vcloud.productSection+xml";
public static final String OPERATING_SYSTEM_SECTION = "application/vnd.vmware.vcloud.operatingSystemSection+xml";
public static final String PRODUCT_SECTION_LIST = "application/vnd.vmware.vcloud.productSections+xml";
public static final String STARTUP_SECTION = "application/vnd.vmware.vcloud.startupSection+xml";
public static final String VIRTUAL_HARDWARE_SECTION = "application/vnd.vmware.vcloud.virtualHardwareSection+xml";
public static final String RELOCATE_TEMPLATE = "application/vnd.vmware.vcloud.relocateTemplate+xml";
public static final String LEASE_SETTINGS_SECTION = "application/vnd.vmware.vcloud.leaseSettingsSection+xml";
public static final String ENVELOPE = "application/vnd.???";
public static final String VM_PENDING_ANSWER = "application/vnd.vmware.vcloud.vmPendingAnswer+xml";
public static final String VM_PENDING_QUESTION = "application/vnd.vmware.vcloud.vmPendingQuestion+xml";
public static final String OVF_RASD_ITEM = "application/vnd.vmware.vcloud.rasdItem+xml";
public static final String OVF_RASD_ITEMS_LIST = "application/vnd.vmware.vcloud.rasdItemsList+xml";
public static final String ADMIN_CATALOG = "application/vnd.vmware.admin.catalog+xml";
public static final String ADMIN_ORG = "application/vnd.vmware.admin.organization+xml";
@ -156,29 +167,55 @@ public class VCloudDirectorMediaType {
public static final String USER = "application/vnd.vmware.admin.user+xml";
public static final String ROLE = "application/vnd.vmware.admin.role+xml";
public static final String DEPLOY_VAPP_PARAMS = "application/vnd.vmware.vcloud.deployVAppParams+xml";
public static final String RECOMPOSE_VAPP_PARAMS = "application/vnd.vmware.vcloud.recomposeVAppParams+xml";
public static final String RELOCATE_VM_PARAMS = "application/vnd.vmware.vcloud.relocateVmParams+xml";
public static final String UNDEPLOY_VAPP_PARAMS = "application/vnd.vmware.vcloud.undeployVAppParams+xml";
public static final String MEDIA_PARAMS = "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml";
public static final String RUNTIME_INFO_SECTION = "application/vnd.vmware.vcloud.runtimeInfoSection+xml";
public static final String SCREEN_TICKET = "application/vnd.vmware.vcloud.screenTicket+xml";
public static final String VAPP_NETWORK = "application/vnd.vmware.vcloud.vAppNetwork+xml";
public static final String ADMIN_VDC = "application/vnd.vmware.admin.vdc+xml";
public static final String OVF_TEXT_XML = "text/xml";
public static final List<String> ALL_OVF = ImmutableList.of(
OVF_TEXT_XML
);
/**
* All acceptable media types.
* All acceptable vcloud-specific media types.
*
* This list must be updated whenever a new media type constant is added.
*/
public static final List<String> ALL = ImmutableList.of(
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY,
METADATA_VALUE, ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK,
CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY,
MEDIA, OWNER, VDC, ADMIN_USER, V_APP, V_APP_TEMPLATE,
CAPTURE_VAPP_PARAMS, CLONE_V_APP_PARAMS, CLONE_V_APP_TEMPLATE_PARAMS,
COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS,
UPLOAD_VAPP_TEMPLATE_PARAMS, ADMIN_CATALOG, ADMIN_ORG,
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,
CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE,
PUBLISH_CATALOG_PARAMS, GROUP, ORG_VAPP_TEMPLATE_LEASE_SETTINGS,
ORG_LEASE_SETTINGS, ORG_PASSWORD_POLICY_SETTINGS, ORG_LDAP_SETTINGS,
ORG_GENERAL_SETTINGS, ORG_EMAIL_SETTINGS, ORG_SETTINGS, ADMIN_NETWORK,
ADMIN_ORG_NETWORK, USER, ROLE, ADMIN_VDC
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY, METADATA_VALUE,
ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK, CATALOG, CATALOG_ITEM,
CATALOG_ITEMS, CATALOGS_LIST, PROPERTY, MEDIA, OWNER, VDC, ADMIN_USER,
VAPP, VAPP_TEMPLATE, VM, CAPTURE_VAPP_PARAMS, CLONE_MEDIA_PARAMS,
CLONE_VAPP_PARAMS, CLONE_VAPP_TEMPLATE_PARAMS, COMPOSE_VAPP_PARAMS,
INSTANTIATE_VAPP_TEMPLATE_PARAMS, UPLOAD_VAPP_TEMPLATE_PARAMS,
QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,
CONTROL_ACCESS, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION,
LEASE_SETTINGS_SECTION, NETWORK_SECTION, NETWORK_CONFIG_SECTION,
NETWORK_CONNECTION_SECTION, OPERATING_SYSTEM_SECTION,
PRODUCT_SECTION_LIST, STARTUP_SECTION, VIRTUAL_HARDWARE_SECTION,
RELOCATE_TEMPLATE, ENVELOPE, VM_PENDING_ANSWER, VM_PENDING_QUESTION,
OVF_RASD_ITEM, OVF_RASD_ITEMS_LIST, ADMIN_CATALOG,
PUBLISH_CATALOG_PARAMS, GROUP, ORG_VAPP_TEMPLATE_LEASE_SETTINGS,
ORG_LEASE_SETTINGS, ORG_PASSWORD_POLICY_SETTINGS, ORG_LDAP_SETTINGS,
ORG_GENERAL_SETTINGS, ORG_EMAIL_SETTINGS, ORG_SETTINGS, ADMIN_NETWORK,
ADMIN_ORG_NETWORK, USER, ROLE, DEPLOY_VAPP_PARAMS, RECOMPOSE_VAPP_PARAMS,
RELOCATE_VM_PARAMS, UNDEPLOY_VAPP_PARAMS, ADMIN_VDC, MEDIA_PARAMS, RUNTIME_INFO_SECTION,
SCREEN_TICKET, VAPP_NETWORK
);
}

View File

@ -41,6 +41,7 @@ public class VCloudDirectorPropertiesBuilder extends PropertiesBuilder {
public Properties defaultProperties() {
Properties properties = super.defaultProperties();
/** FIXME this should not be the default */
properties.setProperty(PROPERTY_ENDPOINT, "https://vcloudbeta.bluelock.com/api");
properties.setProperty(PROPERTY_SESSION_INTERVAL, Integer.toString(30 * 60));
properties.setProperty(PROPERTY_API_VERSION, "1.5");

View File

@ -17,8 +17,8 @@
*/
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 static com.google.common.base.Throwables.*;
import static org.jclouds.rest.config.BinderUtils.*;
import java.net.URI;
import java.util.Map;
@ -66,6 +66,8 @@ import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.UserAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UserClient;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
@ -104,6 +106,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(MediaClient.class, MediaAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class)
.put(VdcClient.class, VdcAsyncClient.class)
.put(VAppClient.class, VAppAsyncClient.class)
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
.put(UploadClient.class, UploadAsyncClient.class)
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
@ -124,6 +127,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
bindClientAndAsyncClient(binder(), OrgClient.class, OrgAsyncClient.class);
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
bindClientAndAsyncClient(binder(), VAppClient.class, VAppAsyncClient.class);
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);

View File

@ -0,0 +1,285 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
* Represents a base type for VAppType and VmType.
*
* <pre>
* &lt;complexType name="AbstractVAppType" &gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "AbstractVAppType")
public abstract class AbstractVAppType<T extends AbstractVAppType<T>> extends ResourceEntityType<T> {
public static abstract class Builder<T extends AbstractVAppType<T>> extends ResourceEntityType.Builder<T> {
protected Boolean deployed;
protected Reference vAppParent;
protected List<SectionType<?>> sections = Lists.newArrayList();
/**
* @see AbstractVAppType#isDeployed()
*/
public Builder<T> isDeployed(Boolean deployed) {
this.deployed = deployed;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
public Builder<T> deployed() {
this.deployed = Boolean.TRUE;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
public Builder<T> notDeployed() {
this.deployed = Boolean.FALSE;
return this;
}
/**
* @see AbstractVAppType#getVAppParent()
*/
public Builder<T> parent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
public Builder<T> sections(List<SectionType<?>> sections) {
if (checkNotNull(sections, "sections").size() > 0)
this.sections = Lists.newArrayList(sections);
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
public Builder<T> section(SectionType<?> section) {
if (this.sections == null)
this.sections = Lists.newArrayList();
this.sections.add(checkNotNull(section, "section"));
return this;
}
/**
* @see ResourceEntityType#getFiles()
*/
@Override
public Builder<T> files(FilesList files) {
this.files = files;
return this;
}
/**
* @see ResourceEntityType#getStatus()
*/
@Override
public Builder<T> status(Integer status) {
this.status = status;
return this;
}
/**
* @see EntityType#getId()
*/
@Override
public Builder<T> id(String id) {
this.id = id;
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder<T> tasks(Set<Task> tasks) {
if (checkNotNull(tasks, "tasks").size() > 0)
this.tasks = Sets.newLinkedHashSet(tasks);
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder<T> task(Task task) {
if (tasks == null)
tasks = Sets.newLinkedHashSet();
this.tasks.add(checkNotNull(task, "task"));
return this;
}
/**
* @see ResourceType#getHref()
*/
@Override
public Builder<T> href(URI href) {
this.href = href;
return this;
}
/**
* @see ResourceType#getType()
*/
@Override
public Builder<T> type(String type) {
this.type = type;
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
return Builder.class.cast(super.link(link));
}
@Override
public Builder<T> fromResourceEntityType(ResourceEntityType<T> in) {
return Builder.class.cast(super.fromResourceEntityType(in));
}
public Builder<T> fromAbstractVAppType(AbstractVAppType<T> in) {
return fromResourceEntityType(in).parent(vAppParent).sections(sections).isDeployed(deployed);
}
}
@XmlElement(name = "VAppParent")
protected Reference vAppParent;
@XmlElementRef(name = "Section", namespace = VCloudDirectorConstants.VCLOUD_OVF_NS)
protected List<SectionType<?>> sections = Lists.newArrayList();
@XmlAttribute
protected Boolean deployed;
protected AbstractVAppType() {
// for JAXB and Builders
}
public AbstractVAppType(URI href, String type, @Nullable Set<Link> links, String description, @Nullable Set<Task> tasks, String id, String name, FilesList files, Integer status, Reference vAppParent,
@Nullable List<SectionType<?>> sections, Boolean deployed) {
super(href, type, links, description, tasks, id, name, files, status);
this.vAppParent = vAppParent;
this.sections = sections;
this.deployed = deployed;
}
/**
* Gets the value of the vAppParent property.
*/
public Reference getVAppParent() {
return vAppParent;
}
/**
* Specific ovf:Section with additional information for the vApp.
*
* Objects of the following type(s) are allowed in the list:
* <ul>
* <li>SectionType
* <li>VirtualHardwareSectionType
* <li>LeaseSettingsSectionType
* <li>EulaSectionType
* <li>RuntimeInfoSectionType
* <li>AnnotationSectionType
* <li>DeploymentOptionSectionType
* <li>StartupSectionType
* <li>ResourceAllocationSectionType
* <li>NetworkConnectionSectionType
* <li>CustomizationSectionType
* <li>ProductSectionType
* <li>GuestCustomizationSectionType
* <li>OperatingSystemSectionType
* <li>NetworkConfigSectionType
* <li>NetworkSectionType
* <li>DiskSectionType
* <li>InstallSectionType
* </ul>
*/
public List<SectionType<?>> getSections() {
return this.sections;
}
/**
* Gets the value of the deployed property.
*/
public Boolean isDeployed() {
return deployed;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
AbstractVAppType<?> that = AbstractVAppType.class.cast(o);
return super.equals(that) &&
equal(this.vAppParent, that.vAppParent) && equal(this.sections, that.sections) && equal(this.deployed, that.deployed);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), vAppParent, sections, deployed);
}
@Override
public ToStringHelper string() {
return super.string().add("vAppParent", vAppParent).add("sections", sections).add("deployed", deployed);
}
}

View File

@ -0,0 +1,131 @@
/*
* 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.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Specifies who can access the resource.
*
* <pre>
* &lt;complexType name="AccessSetting" /&gt;
* </pre>
*
* @since 0.9
*/
@XmlRootElement(name = "AccessSetting")
@XmlType(name = "AccessSettingType")
public class AccessSetting {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromAccessSetting(this);
}
public static class Builder {
private Reference subject;
private String accessLevel;
/**
* @see AccessSetting#getSubject()
*/
public Builder subject(Reference subject) {
this.subject = subject;
return this;
}
/**
* @see AccessSetting#getAccessLevel()
*/
public Builder accessLevel(String accessLevel) {
this.accessLevel = accessLevel;
return this;
}
public AccessSetting build() {
AccessSetting accessSetting = new AccessSetting(subject, accessLevel);
return accessSetting;
}
public Builder fromAccessSetting(AccessSetting in) {
return subject(in.getSubject()).accessLevel(in.getAccessLevel());
}
}
protected AccessSetting() {
// For JAXB and builder use
}
public AccessSetting(Reference subject, String accessLevel) {
this.subject = subject;
this.accessLevel = accessLevel;
}
@XmlElement(name = "Subject", required = true)
protected Reference subject;
@XmlElement(name = "AccessLevel", required = true)
protected String accessLevel;
/**
* Gets the value of the subject property.
*/
public Reference getSubject() {
return subject;
}
/**
* Gets the value of the accessLevel property.
*/
public String getAccessLevel() {
return accessLevel;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
AccessSetting that = AccessSetting.class.cast(o);
return equal(this.subject, that.subject) && equal(this.accessLevel, that.accessLevel);
}
@Override
public int hashCode() {
return Objects.hashCode(subject, accessLevel);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("subject", subject).add("accessLevel", accessLevel).toString();
}
}

View File

@ -0,0 +1,122 @@
/*
* 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.*;
import static com.google.common.base.Preconditions.*;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
/**
* A list of access settings for a resource.
*
* <pre>
* &lt;complexType name="AccessSettings" /&gt;
* </pre>
*
* @since 0.9
*/
@XmlRootElement(name = "AccessSettings")
@XmlType(name = "AccessSettingsType")
public class AccessSettings {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromAccessSettings(this);
}
public static class Builder {
private List<AccessSetting> accessSettings = Lists.newArrayList();
/**
* @see AccessSettings#getAccessSettings()
*/
public Builder accessSettings(List<AccessSetting> accessSettings) {
this.accessSettings = checkNotNull(accessSettings, "accessSettings");
return this;
}
/**
* @see AccessSettings#getAccessSettings()
*/
public Builder accessSetting(AccessSetting accessSetting) {
this.accessSettings.add(checkNotNull(accessSetting, "accessSetting"));
return this;
}
public AccessSettings build() {
return new AccessSettings(accessSettings);
}
public Builder fromAccessSettings(AccessSettings in) {
return accessSettings(in.getAccessSettings());
}
}
protected AccessSettings() {
// For JAXB and builder use
}
public AccessSettings(List<AccessSetting> accessSettings) {
this.accessSettings = accessSettings;
}
@XmlElement(name = "AccessSetting", required = true)
protected List<AccessSetting> accessSettings = Lists.newArrayList();
/**
* Gets the value of the accessSetting property.
*/
public List<AccessSetting> getAccessSettings() {
return accessSettings;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
AccessSettings that = AccessSettings.class.cast(o);
return equal(this.accessSettings, that.accessSettings);
}
@Override
public int hashCode() {
return Objects.hashCode(accessSettings);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("accessSettings", accessSettings).toString();
}
}

View File

@ -22,8 +22,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@ -49,7 +47,6 @@ import javax.xml.bind.annotation.XmlRootElement;
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "AdminCatalog")
public class AdminCatalog extends CatalogType<AdminCatalog> {

View File

@ -29,13 +29,14 @@ 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 org.jclouds.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
@ -84,7 +85,7 @@ public class CaptureVAppParams
public static class Builder extends ParamsType.Builder<CaptureVAppParams> {
private Reference source;
private Set<? extends Section<?>> sections = ImmutableSet.of();
private Set<? extends SectionType<?>> sections = ImmutableSet.of();
/**
* @see CaptureVAppParams#getSource()
@ -97,7 +98,7 @@ public class CaptureVAppParams
/**
* @see CaptureVAppParams#getSections()
*/
public Builder sections(Set<? extends Section<?>> sections) {
public Builder sections(Set<? extends SectionType<?>> sections) {
this.sections = checkNotNull(sections, "sections");
return this;
}
@ -118,7 +119,7 @@ public class CaptureVAppParams
}
}
private CaptureVAppParams(String description, String name, Reference source, Set<? extends Section<?>> sections) {
private CaptureVAppParams(String description, String name, Reference source, Set<? extends SectionType<?>> sections) {
super(description, name);
this.source = source;
this.sections = sections;
@ -128,14 +129,14 @@ public class CaptureVAppParams
// for JAXB
}
private CaptureVAppParams(Set<? extends Section<?>> sections) {
private CaptureVAppParams(Set<? extends SectionType<?>> sections) {
this.sections = ImmutableSet.copyOf(sections);
}
@XmlElement(name = "Source", required = true)
protected Reference source;
@XmlElementRef
protected Set<? extends Section<?>> sections = Sets.newLinkedHashSet();
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
* Gets the value of the source property.
@ -153,7 +154,7 @@ public class CaptureVAppParams
* Gets the value of the section property.
*
* Objects of the following type(s) are allowed in the list
* {@link Section }
* {@link SectionType }
* {@link VirtualHardwareSection }
* {@link LeaseSettingsSection }
* {@link EulaSection }
@ -172,7 +173,7 @@ public class CaptureVAppParams
* {@link DiskSection }
* {@link InstallSection }
*/
public Set<? extends Section<?>> getSections() {
public Set<? extends SectionType<?>> getSections() {
return Collections.unmodifiableSet(this.sections);
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,51 +16,106 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import javax.xml.bind.annotation.XmlType;
/**
* Represents parameters for copying a vApp and optionally deleting the source.
* <p/>
* <p/>
* <p>Java class for CloneVAppParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="CloneVAppParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}InstantiateVAppParamsType">
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="CloneVAppParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "CloneVAppParams")
public class CloneVAppParams
extends InstantiateVAppParamsType<CloneVAppParams> {
public class CloneVAppParams extends InstantiateVAppParamsType<CloneVAppParams> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromCloneVAppParams(this);
}
public static class Builder extends InstantiateVAppParamsType.Builder<CloneVAppParams> {
@Override
public CloneVAppParams build() {
return new CloneVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
return new CloneVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
/**
* @see InstantiateVAppParamsType#getSource()
*/
@Override
public Builder source(ReferenceType<?> source) {
this.source = source;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder isSourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder sourceDelete() {
this.sourceDelete = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder notSourceDelete() {
this.sourceDelete = Boolean.FALSE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder isLinkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder linkedClone() {
this.linkedClone = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder notLinkedClone() {
this.linkedClone = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
super.description(description);
return this;
@ -69,6 +124,7 @@ public class CloneVAppParams
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
super.name(name);
return this;
@ -77,56 +133,72 @@ public class CloneVAppParams
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
super.vAppParent(vAppParent);
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
super.instantiationParams(instantiationParams);
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
this.powerOn = powerOn;
return this;
}
/**
* @see InstantiateVAppParamsType#getSource()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder source(Reference source) {
super.source(source);
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete);
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone);
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
@ -140,12 +212,12 @@ public class CloneVAppParams
}
}
private CloneVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
protected CloneVAppParams() {
// For JAXB and builder use
}
public CloneVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, ReferenceType<?> source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
private CloneVAppParams() {
// For JAXB
}
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,60 +16,36 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/**
* Represents vApp composition parameters.
* <p/>
* <p/>
* <p>Java class for ComposeVAppParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="ComposeVAppParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VAppCreationParamsType">
* &lt;sequence>
* &lt;element name="SourcedItem" type="{http://www.vmware.com/vcloud/v1.5}SourcedCompositionItemParamType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element ref="{http://www.vmware.com/vcloud/v1.5}AllEULAsAccepted" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="linkedClone" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="ComposeVAppParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "ComposeVAppParams", propOrder = {
"sourcedItems",
"allEULAsAccepted"
})
@XmlSeeAlso({
// RecomposeVAppParamsType.class
})
public class ComposeVAppParams
extends VAppCreationParamsType<ComposeVAppParams>
@XmlRootElement(name = "ComposeVAppParams")
@XmlType(name = "ComposeVAppParamsType")
public class ComposeVAppParams extends VAppCreationParamsType<ComposeVAppParams> {
{
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -80,15 +56,23 @@ public class ComposeVAppParams
public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> {
private Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
private Boolean allEULAsAccepted;
private Boolean linkedClone;
protected List<SourcedCompositionItemParam> sourcedItems = Lists.newArrayList();
protected Boolean allEULAsAccepted;
protected Boolean linkedClone;
/**
* @see ComposeVAppParams#getSourcedItems()
*/
public Builder sourcedItems(Set<SourcedCompositionItemParam> sourcedItems) {
this.sourcedItems = checkNotNull(sourcedItems, "sourcedItems");
public Builder sourcedItems(List<SourcedCompositionItemParam> sourcedItems) {
this.sourcedItems = Lists.newArrayList(checkNotNull(sourcedItems, "sourcedItems"));
return this;
}
/**
* @see ComposeVAppParams#getSourcedItem()
*/
public Builder sourcedItem(SourcedCompositionItemParam sourcedItem) {
this.sourcedItems.add(checkNotNull(sourcedItem, "sourcedItem"));
return this;
}
@ -101,19 +85,107 @@ public class ComposeVAppParams
}
/**
* @see ComposeVAppParams#isLinkedClone() ()
* @see ComposeVAppParams#isLinkedClone()
*/
public Builder linkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
@Override
public ComposeVAppParams build() {
return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn,
sourcedItems, allEULAsAccepted, linkedClone);
return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, sourcedItems, allEULAsAccepted, linkedClone);
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
this.powerOn = powerOn;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
this.name = name;
return this;
}
@Override
public Builder fromVAppCreationParamsType(VAppCreationParamsType<ComposeVAppParams> in) {
@ -121,49 +193,41 @@ public class ComposeVAppParams
}
public Builder fromComposeVAppParams(ComposeVAppParams in) {
return fromVAppCreationParamsType(in)
.sourcedItems(in.getSourcedItems())
.allEULAsAccepted(in.isAllEULAsAccepted())
.linkedClone(in.isLinkedClone());
return fromVAppCreationParamsType(in).sourcedItems(in.getSourcedItems()).allEULAsAccepted(in.isAllEULAsAccepted()).linkedClone(in.isLinkedClone());
}
}
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItems, Boolean allEULAsAccepted, Boolean linkedClone) {
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn,
List<SourcedCompositionItemParam> sourcedItems, Boolean allEULAsAccepted, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.sourcedItems = ImmutableSet.copyOf(sourcedItems);
this.sourcedItems = ImmutableList.copyOf(sourcedItems);
this.allEULAsAccepted = allEULAsAccepted;
this.linkedClone = linkedClone;
}
private ComposeVAppParams() {
protected ComposeVAppParams() {
// for JAXB
}
@XmlElement(name = "SourcedItem")
protected Set<SourcedCompositionItemParam> sourcedItems = Sets.newLinkedHashSet();
protected List<SourcedCompositionItemParam> sourcedItems = Lists.newArrayList();
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
protected Boolean linkedClone;
/**
* Gets the value of the sourcedItem property.
* Gets the value of the sourcedItems property.
*/
public Set<SourcedCompositionItemParam> getSourcedItems() {
return Collections.unmodifiableSet(this.sourcedItems);
public List<SourcedCompositionItemParam> getSourcedItems() {
return ImmutableList.copyOf(sourcedItems);
}
/**
* Used to confirm acceptance of all EULAs in a
* vApp template. Instantiation fails if this
* element is missing, empty, or set to false
* and one or more EulaSection elements are
* present.
* Used to confirm acceptance of all EULAs in a vApp template.
*
* @return possible object is
* {@link Boolean }
* Instantiation fails if this element is missing, empty, or set to
* false and one or more EulaSection elements are present.
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
@ -171,9 +235,6 @@ public class ComposeVAppParams
/**
* Gets the value of the linkedClone property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isLinkedClone() {
return linkedClone;
@ -186,24 +247,18 @@ public class ComposeVAppParams
if (o == null || getClass() != o.getClass())
return false;
ComposeVAppParams that = ComposeVAppParams.class.cast(o);
return equal(sourcedItems, that.sourcedItems) &&
equal(allEULAsAccepted, that.allEULAsAccepted) &&
equal(linkedClone, that.linkedClone);
return super.equals(that) &&
equal(this.sourcedItems, that.sourcedItems) && equal(this.allEULAsAccepted, that.allEULAsAccepted) && equal(this.linkedClone, that.linkedClone);
}
@Override
public int hashCode() {
return Objects.hashCode(sourcedItems,
allEULAsAccepted,
linkedClone);
return Objects.hashCode(super.hashCode(), sourcedItems, allEULAsAccepted, linkedClone);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("sourcedItem", sourcedItems)
.add("allEULAsAccepted", allEULAsAccepted)
.add("linkedClone", linkedClone).toString();
public ToStringHelper string() {
return super.string().add("sourcedItems", sourcedItems).add("allEULAsAccepted", allEULAsAccepted).add("linkedClone", linkedClone);
}
}

View File

@ -0,0 +1,169 @@
/*
* 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.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Used to control access to resources.
*
* <pre>
* &lt;complexType name="ControlAccessParams" /&gt;
* </pre>
*
* @since 0.9
*/
@XmlRootElement(name = "ControlAccessParams")
@XmlType(name = "ControlAccessParamsType")
public class ControlAccessParams {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromControlAccessParams(this);
}
public static class Builder {
private Boolean sharedToEveryone = Boolean.FALSE;
private String everyoneAccessLevel;
private AccessSettings accessSettings;
/**
* @see ControlAccessParams#getIsSharedToEveryone()
*/
public Builder isSharedToEveryone(Boolean sharedToEveryone) {
this.sharedToEveryone = sharedToEveryone;
return this;
}
/**
* @see ControlAccessParams#getIsSharedToEveryone()
*/
public Builder sharedToEveryone() {
this.sharedToEveryone = Boolean.TRUE;
return this;
}
/**
* @see ControlAccessParams#getIsSharedToEveryone()
*/
public Builder notSharedToEveryone() {
this.sharedToEveryone = Boolean.FALSE;
return this;
}
/**
* @see ControlAccessParams#getEveryoneAccessLevel()
*/
public Builder everyoneAccessLevel(String everyoneAccessLevel) {
this.everyoneAccessLevel = everyoneAccessLevel;
return this;
}
/**
* @see ControlAccessParams#getAccessSettings()
*/
public Builder accessSettings(AccessSettings accessSettings) {
this.accessSettings = accessSettings;
return this;
}
public ControlAccessParams build() {
ControlAccessParams controlAccessParams = new ControlAccessParams(sharedToEveryone, everyoneAccessLevel, accessSettings);
return controlAccessParams;
}
public Builder fromControlAccessParams(ControlAccessParams in) {
return isSharedToEveryone(in.isSharedToEveryone()).everyoneAccessLevel(in.getEveryoneAccessLevel()).accessSettings(in.getAccessSettings());
}
}
protected ControlAccessParams() {
// For JAXB and builder use
}
public ControlAccessParams(Boolean sharedToEveryone, String everyoneAccessLevel, AccessSettings accessSettings) {
this.sharedToEveryone = sharedToEveryone;
this.everyoneAccessLevel = everyoneAccessLevel;
this.accessSettings = accessSettings;
}
@XmlElement(name = "IsSharedToEveryone", required = true)
protected Boolean sharedToEveryone;
@XmlElement(name = "EveryoneAccessLevel")
protected String everyoneAccessLevel;
@XmlElement(name = "AccessSettings")
protected AccessSettings accessSettings;
/**
* If true, this means that the resource is shared with everyone in the organization.
*
* Defaults to false. Sharing settings must be manipulated through the organization.
*/
public Boolean isSharedToEveryone() {
return sharedToEveryone;
}
/**
* If {@link #isSharedToEveryone()} is true, this element must be present and determines the access level.
*/
public String getEveryoneAccessLevel() {
return everyoneAccessLevel;
}
/**
* The access settings to be applied if {@link #isSharedToEveryone()} is false.
*
* Required on create and modify if {@link #isSharedToEveryone()} is false.
*/
public AccessSettings getAccessSettings() {
return accessSettings;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ControlAccessParams that = ControlAccessParams.class.cast(o);
return equal(this.sharedToEveryone, that.sharedToEveryone) && equal(this.everyoneAccessLevel, that.everyoneAccessLevel) && equal(this.accessSettings, that.accessSettings);
}
@Override
public int hashCode() {
return Objects.hashCode(sharedToEveryone, everyoneAccessLevel, accessSettings);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("sharedToEveryone", sharedToEveryone).add("everyoneAccessLevel", everyoneAccessLevel).add("accessSettings", accessSettings).toString();
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
@ -34,20 +33,15 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
@ -66,15 +60,13 @@ import com.google.common.collect.Sets;
* </pre>
*/
@XmlRootElement(name = "CustomizationSection")
@XmlType(propOrder = {
"customizeOnInstantiate",
"links"
})
public class CustomizationSection extends SectionType<CustomizationSection> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromCustomizationSection(this);
}
@ -118,12 +110,13 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
}
@Override
public CustomizationSection build() {
return new CustomizationSection(info, required, customizeOnInstantiate, links, href, type);
}
public Builder fromCustomizationSection(CustomizationSection in) {
return fromSection(in)
return fromSectionType(in)
.customizeOnInstantiate(in.isCustomizeOnInstantiate())
.links(in.getLinks())
.href(in.getHref())
@ -134,8 +127,8 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<CustomizationSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<CustomizationSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

View File

@ -0,0 +1,190 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents vApp/VM deployment parameters.
*
* <pre>
* &lt;complexType name="DeployVAppParams" /&gt;
* </pre>
*
* @since 0.9
*/
@XmlRootElement(name = "DeployVAppParams")
@XmlType(name = "DeployVAppParamsType")
public class DeployVAppParams {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromDeployVAppParams(this);
}
public static class Builder {
private Boolean powerOn = Boolean.TRUE;
private Integer deploymentLeaseSeconds;
private Boolean forceCustomization = Boolean.FALSE;
/**
* @see DeployVAppParams#isPowerOn()
*/
public Builder powerOn(Boolean powerOn) {
this.powerOn = powerOn;
return this;
}
/**
* @see DeployVAppParams#isPowerOn()
*/
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see DeployVAppParams#isPowerOn()
*/
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
/**
* @see DeployVAppParams#getDeploymentLeaseSeconds()
*/
public Builder deploymentLeaseSeconds(Integer deploymentLeaseSeconds) {
this.deploymentLeaseSeconds = deploymentLeaseSeconds;
return this;
}
/**
* @see DeployVAppParams#isForceCustomization()
*/
public Builder forceCustomization(Boolean forceCustomization) {
this.forceCustomization = forceCustomization;
return this;
}
/**
* @see DeployVAppParams#isForceCustomization()
*/
public Builder forceCustomization() {
this.forceCustomization = Boolean.TRUE;
return this;
}
/**
* @see DeployVAppParams#isForceCustomization()
*/
public Builder notForceCustomization() {
this.forceCustomization = Boolean.FALSE;
return this;
}
public DeployVAppParams build() {
DeployVAppParams deployVAppParams = new DeployVAppParams(powerOn, deploymentLeaseSeconds, forceCustomization);
return deployVAppParams;
}
public Builder fromDeployVAppParams(DeployVAppParams in) {
return powerOn(in.isPowerOn()).deploymentLeaseSeconds(in.getDeploymentLeaseSeconds()).forceCustomization(in.isForceCustomization());
}
}
protected DeployVAppParams() {
// For JAXB and builder use
}
public DeployVAppParams(Boolean powerOn, Integer deploymentLeaseSeconds, Boolean forceCustomization) {
this.powerOn = powerOn;
this.deploymentLeaseSeconds = deploymentLeaseSeconds;
this.forceCustomization = forceCustomization;
}
@XmlAttribute
protected Boolean powerOn;
@XmlAttribute
protected Integer deploymentLeaseSeconds;
@XmlAttribute
protected Boolean forceCustomization;
/**
* Used to specify whether to power on vapp on deployment, if not set default value is true.
*/
public Boolean isPowerOn() {
return powerOn;
}
public void setPowerOn(Boolean value) {
this.powerOn = value;
}
/**
* Lease in seconds for deployment.
*/
public Integer getDeploymentLeaseSeconds() {
return deploymentLeaseSeconds;
}
public void setDeploymentLeaseSeconds(Integer value) {
this.deploymentLeaseSeconds = value;
}
/**
* Used to specify whether to force customization on deployment, if not set default value is false.
*/
public Boolean isForceCustomization() {
return forceCustomization;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
DeployVAppParams that = DeployVAppParams.class.cast(o);
return equal(powerOn, that.powerOn) && equal(deploymentLeaseSeconds, that.deploymentLeaseSeconds) && equal(forceCustomization, that.forceCustomization);
}
@Override
public int hashCode() {
return Objects.hashCode(powerOn, deploymentLeaseSeconds, forceCustomization);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("powerOn", powerOn).add("deploymentLeaseSeconds", deploymentLeaseSeconds).add("forceCustomization", forceCustomization).toString();
}
}

View File

@ -23,6 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.collect.Sets;
/**
@ -31,6 +33,7 @@ import com.google.common.collect.Sets;
* @author grkvlt@apache.org
* @author Adam Lowe
*/
@XmlRootElement(name = "Entity")
public class Entity extends EntityType<Entity> {
public static Builder builder() {

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -28,6 +28,7 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
@ -38,17 +39,18 @@ import com.google.common.collect.Sets;
/**
* Basic entity type in the vCloud object model.
* <p/>
* Includes a name, an optional description, and an optional list of links
* <p/>
*
* Includes the entity name and an optional id, description, and set of running {@link Task}s.
*
* <pre>
* &lt;xs:complexType name="EntityType"&gt;
* &lt;xs:complexType name="EntityType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
* @author Adam Lowe
*/
public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T> {
@XmlType(name = "EntityType")
public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
public static abstract class NewBuilder<T extends NewBuilder<T>> extends ResourceType.NewBuilder<T> {
@ -96,7 +98,12 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
}
}
public static abstract class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromEntityType(this);
}
public static class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
protected String description;
protected Set<Task> tasks;
@ -146,6 +153,11 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
return this;
}
@Override
public EntityType<T> build() {
return new EntityType<T>(href, type, links, description, tasks, id, name);
}
/**
* @see ResourceType#getHref()
*/
@ -167,7 +179,6 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
/**
* @see ResourceType#getLinks()
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> links(Set<Link> links) {
return Builder.class.cast(super.links(links));
@ -176,7 +187,6 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
/**
* @see ResourceType#getLinks()
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> link(Link link) {
return Builder.class.cast(super.link(link));
@ -185,7 +195,6 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in));
@ -228,6 +237,10 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
return description;
}
public void setDescription(String description) {
this.description = description;
}
/**
* A list of queued, running, or recently completed tasks associated with this entity.
*/
@ -237,7 +250,7 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
/**
* The resource identifier, expressed in URN format.
* <p/>
*
* The value of this attribute uniquely identifies the resource, persists for the life of the
* resource, and is never reused.
*/
@ -252,6 +265,10 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -276,11 +293,11 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(description, tasks, id, name);
return Objects.hashCode(super.hashCode(), description, tasks, id, name);
}
@Override
public ToStringHelper string() {
return super.string().add("description", description).add("tasks", tasks).add("id", id).add("name", name);
}
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -21,18 +21,25 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Arrays;
import javax.annotation.Resource;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
/**
* The standard error message type used in the vCloud REST API.
* <p/>
*
* <pre>
* &lt;xs:complexType name="ErrorType"&gt;
* &lt;xs:complexType name="ErrorType" /&gt;
* </pre>
*
* @author grkvlt@apache.org
@ -40,6 +47,52 @@ import com.google.common.base.Objects;
@XmlRootElement(name = "Error")
public class Error {
@Resource
protected static Logger logger = Logger.NULL;
public static enum Code {
OK(200),
CREATED(201),
ACCEPTED(202),
NO_CONTENT(204),
SEE_OTHER(303),
BAD_REQUEST(400),
UNAUTHORIZED(401),
FORBIDDEN(403), // NOTE also means 'not found' for entities
NOT_FOUND(404),
NOT_ALLOWED(405),
INTERNAL_ERROR(500),
NOT_IMPLEMENTED(501),
UNAVAILABLE(503),
UNRECOGNIZED(-1);
private Integer majorErrorCode;
private Code(Integer majorErrorCode) {
this.majorErrorCode = majorErrorCode;
}
public Integer getCode() {
return majorErrorCode;
}
public static Code fromCode(final int majorErrorCode) {
Optional<Code> found = Iterables.tryFind(Arrays.asList(values()), new Predicate<Code>() {
@Override
public boolean apply(Code code) {
return code.getCode().equals(majorErrorCode);
}
});
if (found.isPresent()) {
return found.get();
} else {
logger.warn("Unrecognized major error code '%d'", majorErrorCode);
return UNRECOGNIZED;
}
}
}
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ERROR;
public static Builder builder() {

View File

@ -23,14 +23,15 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.collect.ForwardingSet;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
@ -58,7 +59,10 @@ import com.google.common.collect.Lists;
@XmlType(name = "FilesList", propOrder = {
"files"
})
public class FilesList {
public class FilesList extends ForwardingSet<File> {
// TODO Investigate using the same wrapper (e.g. see Tasks); can we eliminate this class?
public static Builder builder() {
return new Builder();
}
@ -69,13 +73,13 @@ public class FilesList {
public static class Builder {
private List<File> files = Lists.newLinkedList();
private Set<File> files = Sets.newLinkedHashSet();
/**
* @see FilesList#getFiles()
*/
public Builder files(List<File> files) {
this.files = Lists.newLinkedList(checkNotNull(files, "files"));
public Builder files(Iterable<File> files) {
this.files = Sets.newLinkedHashSet(checkNotNull(files, "files"));
return this;
}
@ -97,23 +101,22 @@ public class FilesList {
}
}
@XmlElement(name = "File", required = true)
private Set<File> files = Sets.newLinkedHashSet();
private FilesList() {
// for JAXB
}
private FilesList(List<File> files) {
this.files = ImmutableList.copyOf(files);
private FilesList(Iterable<File> files) {
this.files = ImmutableSet.copyOf(files);
}
@XmlElement(name = "File", required = true)
protected List<File> files = Lists.newLinkedList();
/**
* Gets the value of the file property.
*/
public List<File> getFiles() {
return Collections.unmodifiableList(this.files);
public Set<File> getFiles() {
return Collections.unmodifiableSet(this.files);
}
@Override
@ -137,4 +140,8 @@ public class FilesList {
.add("file", files).toString();
}
@Override
protected Set<File> delegate() {
return getFiles();
}
}

View File

@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
@ -34,20 +33,15 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
@ -97,11 +91,12 @@ import com.google.common.collect.Sets;
"links"
})
public class GuestCustomizationSection extends SectionType<GuestCustomizationSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromGuestCustomizationSection(this);
}
@ -262,6 +257,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
}
@Override
public GuestCustomizationSection build() {
return new GuestCustomizationSection(info, required, enabled, changeSid, virtualMachineId,
joinDomainEnabled, useOrgSettings, domainName, domainUserName,
@ -271,7 +267,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
}
public Builder fromGuestCustomizationSection(GuestCustomizationSection in) {
return fromSection(in)
return fromSectionType(in)
.enabled(in.isEnabled())
.changeSid(in.isChangeSid())
.virtualMachineId(in.getVirtualMachineId())
@ -295,8 +291,8 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<GuestCustomizationSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<GuestCustomizationSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

View File

@ -0,0 +1,246 @@
/*
* 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.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents vApp instantiation from OVF parameters
*
* <pre>
* &lt;complexType name="InstantiateOvfParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateOvfParams")
public class InstantiateOvfParams extends VAppCreationParamsType<InstantiateOvfParams> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromInstantiateOvfParams(this);
}
public static class Builder extends VAppCreationParamsType.Builder<InstantiateOvfParams> {
private Boolean allEULAsAccepted;
private String transferFormat;
/**
* @see InstantiateOvfParams#isAllEULAsAccepted()
*/
public Builder isAllEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted;
return this;
}
/**
* @see InstantiateOvfParams#isAllEULAsAccepted()
*/
public Builder allEULAsAccepted() {
this.allEULAsAccepted = Boolean.TRUE;
return this;
}
/**
* @see InstantiateOvfParams#isAllEULAsAccepted()
*/
public Builder allEULAsNotAccepted() {
this.allEULAsAccepted = Boolean.FALSE;
return this;
}
/**
* @see InstantiateOvfParams#getTransferFormat()
*/
public Builder transferFormat(String transferFormat) {
this.transferFormat = transferFormat;
return this;
}
@Override
public InstantiateOvfParams build() {
InstantiateOvfParams instantiateOvfParams = new InstantiateOvfParams(description, name, vAppParent, instantiationParams, deploy, powerOn, allEULAsAccepted, transferFormat);
return instantiateOvfParams;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
this.powerOn = powerOn;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
this.name = name;
return this;
}
@Override
public Builder fromVAppCreationParamsType(VAppCreationParamsType<InstantiateOvfParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder fromInstantiateOvfParams(InstantiateOvfParams in) {
return fromVAppCreationParamsType(in).isAllEULAsAccepted(in.isAllEULAsAccepted()).transferFormat(in.getTransferFormat());
}
}
protected InstantiateOvfParams() {
// For JAXB and builder use
}
public InstantiateOvfParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn, Boolean allEULAsAccepted,
String transferFormat) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.allEULAsAccepted = allEULAsAccepted;
this.transferFormat = transferFormat;
}
@XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted;
@XmlAttribute
protected String transferFormat;
/**
* Gets the value of the allEULAsAccepted property.
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
}
/**
* Gets the value of the transferFormat property.
*/
public String getTransferFormat() {
return transferFormat;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
InstantiateOvfParams that = InstantiateOvfParams.class.cast(o);
return super.equals(that) && equal(this.allEULAsAccepted, that.allEULAsAccepted) && equal(this.transferFormat, that.transferFormat);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), allEULAsAccepted, transferFormat);
}
@Override
public ToStringHelper string() {
return super.string().add("allEULAsAccepted", allEULAsAccepted).add("transferFormat", transferFormat);
}
}

View File

@ -20,13 +20,13 @@
package org.jclouds.vcloud.director.v1_5.domain;
/**
* Parameters for Instantiating a vApp
*
* @author danikov
*/
public class InstantiateVAppParams
extends InstantiateVAppParamsType<InstantiateVAppParams> {
public class InstantiateVAppParams extends InstantiateVAppParamsType<InstantiateVAppParams> {
@SuppressWarnings("unchecked")
public static Builder builder() {
@ -38,40 +38,81 @@ public class InstantiateVAppParams
return new Builder();
}
public static class Builder
extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> {
public static class Builder extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> {
@Override
public InstantiateVAppParams build() {
return new InstantiateVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
return new InstantiateVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
/**
* @see InstantiateVAppParams#getSource()
* @see InstantiateVAppParamsType#getSource()
*/
public Builder source(Reference source) {
super.source(source);
@Override
public Builder source(ReferenceType<?> source) {
this.source = source;
return this;
}
/**
* @see InstantiateVAppParams#isSourceDelete()
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete);
@Override
public Builder isSourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete;
return this;
}
/**
* @see InstantiateVAppParams#isLinkedClone()
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone);
@Override
public Builder sourceDelete() {
this.sourceDelete = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder notSourceDelete() {
this.sourceDelete = Boolean.FALSE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder isLinkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder linkedClone() {
this.linkedClone = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder notLinkedClone() {
this.linkedClone = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
super.description(description);
return this;
@ -80,40 +121,81 @@ public class InstantiateVAppParams
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
super.name(name);
return this;
}
/**
* @see VAppCreationParamsType#getVAppParent()
* @see VAppCreationParams#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
super.vAppParent(vAppParent);
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
* @see VAppCreationParams#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
super.instantiationParams(instantiationParams);
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
* @see VAppCreationParams#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
* @see VAppCreationParams#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParams#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParams#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
this.powerOn = powerOn;
return this;
}
/**
* @see VAppCreationParams#isPowerOn()
*/
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParams#isPowerOn()
*/
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
@ -121,8 +203,7 @@ public class InstantiateVAppParams
* {@inheritDoc}
*/
@Override
public Builder fromInstantiateVAppParamsType(
InstantiateVAppParamsType<InstantiateVAppParams> in) {
public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<InstantiateVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
@ -131,8 +212,8 @@ public class InstantiateVAppParams
}
}
private InstantiateVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
public InstantiateVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, ReferenceType<?> source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
@ -149,5 +230,4 @@ public class InstantiateVAppParams
InstantiateVAppParams that = InstantiateVAppParams.class.cast(o);
return super.equals(that);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,54 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents vApp instantiation parameters.
* <p/>
* <p/>
* <p>Java class for InstantiateVAppParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="InstantiateVAppParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VAppCreationParamsType">
* &lt;sequence>
* &lt;element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
* &lt;element name="IsSourceDelete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="linkedClone" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="InstantiateVAppParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "InstantiateVAppParams", propOrder = {
"source",
"isSourceDelete"
})
@XmlSeeAlso({
// InstantiateVAppTemplateParamsType.class,
// CloneVAppParamsType.class
})
public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
extends VAppCreationParamsType<T>
@XmlType(name = "InstantiateVAppParams")
public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>> extends VAppCreationParamsType<T> {
{
public static <T extends InstantiateVAppParamsType<T>> Builder<T> builder() {
return new Builder<T>();
}
@ -74,14 +49,14 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
public static class Builder<T extends InstantiateVAppParamsType<T>> extends VAppCreationParamsType.Builder<T> {
protected Reference source;
protected Boolean isSourceDelete;
protected ReferenceType<?> source;
protected Boolean sourceDelete;
protected Boolean linkedClone;
/**
* @see InstantiateVAppParamsType#getSource()
*/
public Builder<T> source(Reference source) {
public Builder<T> source(ReferenceType<?> source) {
this.source = source;
return this;
}
@ -89,26 +64,60 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder<T> isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete;
public Builder<T> isSourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder<T> sourceDelete() {
this.sourceDelete = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
public Builder<T> notSourceDelete() {
this.sourceDelete = Boolean.FALSE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder<T> linkedClone(Boolean linkedClone) {
public Builder<T> isLinkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder<T> linkedClone() {
this.linkedClone = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
public Builder<T> notLinkedClone() {
this.linkedClone = Boolean.FALSE;
return this;
}
@Override
public InstantiateVAppParamsType<T> build() {
return new InstantiateVAppParamsType<T>(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
return new InstantiateVAppParamsType<T>(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder<T> description(String description) {
super.description(description);
return this;
@ -117,6 +126,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
/**
* @see ParamsType#getName()
*/
@Override
public Builder<T> name(String name) {
super.name(name);
return this;
@ -125,40 +135,77 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder<T> vAppParent(Reference vAppParent) {
super.vAppParent(vAppParent);
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder<T> instantiationParams(InstantiationParams instantiationParams) {
super.instantiationParams(instantiationParams);
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder<T> deploy(Boolean deploy) {
super.deploy(deploy);
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder<T> deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder<T> notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder<T> powerOn(Boolean powerOn) {
super.powerOn(powerOn);
this.powerOn = powerOn;
return this;
}
/**
* {@inheritDoc}
* @see VAppCreationParamsType#isPowerOn()
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder<T> notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
@Override
@SuppressWarnings("unchecked")
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
@ -167,55 +214,45 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
return fromVAppCreationParamsType(in)
.source(in.getSource())
.isSourceDelete(in.isSourceDelete())
.linkedClone(in.isLinkedClone());
.isLinkedClone(in.isLinkedClone());
}
}
protected InstantiateVAppParamsType() {
// For JAXB and builder use
}
protected InstantiateVAppParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
public InstantiateVAppParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, ReferenceType<?> source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.source = source;
isSourceDelete = sourceDelete;
this.sourceDelete = sourceDelete;
this.linkedClone = linkedClone;
}
protected InstantiateVAppParamsType() {
// for JAXB
}
@XmlElement(name = "Source", required = true)
private Reference source;
protected ReferenceType<?> source;
@XmlElement(name = "IsSourceDelete")
private Boolean isSourceDelete;
protected Boolean sourceDelete;
@XmlAttribute
private Boolean linkedClone;
protected Boolean linkedClone;
/**
* Gets the value of the source property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getSource() {
public ReferenceType<?> getSource() {
return source;
}
/**
* Gets the value of the isSourceDelete property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isSourceDelete() {
return isSourceDelete;
return sourceDelete;
}
/**
* Gets the value of the linkedClone property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isLinkedClone() {
return linkedClone;
@ -228,24 +265,22 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
if (o == null || getClass() != o.getClass())
return false;
InstantiateVAppParamsType<?> that = InstantiateVAppParamsType.class.cast(o);
return equal(source, that.source) &&
equal(isSourceDelete, that.isSourceDelete) &&
equal(linkedClone, that.linkedClone);
return super.equals(that) &&
equal(this.source, that.source) &&
equal(this.sourceDelete, that.sourceDelete) &&
equal(this.linkedClone, that.linkedClone);
}
@Override
public int hashCode() {
return Objects.hashCode(source,
isSourceDelete,
linkedClone);
return Objects.hashCode(super.hashCode(), source, sourceDelete, linkedClone);
}
@Override
public String toString() {
return Objects.toStringHelper("")
public ToStringHelper string() {
return super.string()
.add("source", source)
.add("isSourceDelete", isSourceDelete)
.add("linkedClone", linkedClone).toString();
.add("isSourceDelete", sourceDelete)
.add("linkedClone", linkedClone);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,49 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents vApp template instantiation parameters.
* <p/>
* <p/>
* <p>Java class for InstantiateVAppTemplateParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="InstantiateVAppTemplateParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}InstantiateVAppParamsType">
* &lt;sequence>
* &lt;element ref="{http://www.vmware.com/vcloud/v1.5}AllEULAsAccepted" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="InstantiateVAppTemplateParams" /&gt;
* </pre>
*/
@XmlType(name = "InstantiateVAppTemplateParams", propOrder = {
"allEULAsAccepted"
})
public class InstantiateVAppTemplateParams
extends InstantiateVAppParamsType<InstantiateVAppTemplateParams> {
@XmlRootElement(name = "InstantiateVAppTemplateParams")
public class InstantiateVAppTemplateParams extends InstantiateVAppParamsType<InstantiateVAppTemplateParams> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromInstantiateVAppTemplateParams(this);
}
@ -75,13 +58,78 @@ public class InstantiateVAppTemplateParams
return this;
}
@Override
public InstantiateVAppTemplateParams build() {
return new InstantiateVAppTemplateParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone, allEULAsAccepted);
return new InstantiateVAppTemplateParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone, allEULAsAccepted);
}
/**
* @see InstantiateVAppParamsType#getSource()
*/
@Override
public Builder source(ReferenceType<?> source) {
this.source = source;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder isSourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder sourceDelete() {
this.sourceDelete = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isSourceDelete()
*/
@Override
public Builder notSourceDelete() {
this.sourceDelete = Boolean.FALSE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder isLinkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder linkedClone() {
this.linkedClone = Boolean.TRUE;
return this;
}
/**
* @see InstantiateVAppParamsType#isLinkedClone()
*/
@Override
public Builder notLinkedClone() {
this.linkedClone = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
super.description(description);
return this;
@ -90,6 +138,7 @@ public class InstantiateVAppTemplateParams
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
super.name(name);
return this;
@ -98,32 +147,72 @@ public class InstantiateVAppTemplateParams
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
super.vAppParent(vAppParent);
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
super.instantiationParams(instantiationParams);
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
super.deploy(deploy);
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn);
this.powerOn = powerOn;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
@ -136,18 +225,17 @@ public class InstantiateVAppTemplateParams
}
public Builder fromInstantiateVAppTemplateParams(InstantiateVAppTemplateParams in) {
return fromInstantiateVAppParamsType(in)
.allEULAsAccepted(in.isAllEULAsAccepted());
return fromInstantiateVAppParamsType(in).allEULAsAccepted(in.isAllEULAsAccepted());
}
}
public InstantiateVAppTemplateParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone, Boolean allEULAsAccepted) {
Boolean deploy, Boolean powerOn, ReferenceType<?> source, Boolean sourceDelete, Boolean linkedClone, Boolean allEULAsAccepted) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
this.allEULAsAccepted = allEULAsAccepted;
}
private InstantiateVAppTemplateParams() {
protected InstantiateVAppTemplateParams() {
// for JAXB
}
@ -161,9 +249,6 @@ public class InstantiateVAppTemplateParams
* element is missing, empty, or set to false
* and one or more EulaSection elements are
* present.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isAllEULAsAccepted() {
return allEULAsAccepted;
@ -176,18 +261,16 @@ public class InstantiateVAppTemplateParams
if (o == null || getClass() != o.getClass())
return false;
InstantiateVAppTemplateParams that = InstantiateVAppTemplateParams.class.cast(o);
return equal(allEULAsAccepted, that.allEULAsAccepted);
return super.equals(that) && equal(this.allEULAsAccepted, that.allEULAsAccepted);
}
@Override
public int hashCode() {
return Objects.hashCode(allEULAsAccepted);
return Objects.hashCode(super.hashCode(), allEULAsAccepted);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("allEULAsAccepted", allEULAsAccepted).toString();
public ToStringHelper string() {
return super.string().add("allEULAsAccepted", allEULAsAccepted);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,54 +16,36 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Objects.*;
import static com.google.common.base.Preconditions.*;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/**
* Represents a list of ovf:Section to configure for instantiating a VApp.
* <p/>
* <p/>
* <p>Java class for InstantiationParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="InstantiationParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="InstantiationParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "InstantiationParams", propOrder = {
"section"
})
@XmlRootElement(name = "InstantiationParams")
@XmlType(name = "InstantiationParamsType")
public class InstantiationParams {
public static Builder builder() {
return new Builder();
}
@ -73,7 +55,7 @@ public class InstantiationParams {
}
public static class Builder {
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
* @see InstantiationParams#getSections()
@ -83,13 +65,11 @@ public class InstantiationParams {
return this;
}
public InstantiationParams build() {
InstantiationParams instantiationParams = new InstantiationParams(sections);
return instantiationParams;
}
public Builder fromInstantiationParams(InstantiationParams in) {
return sections(in.getSections());
}
@ -103,34 +83,33 @@ public class InstantiationParams {
this.sections = sections;
}
@XmlElementRef
protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/**
* An ovf:Section to configure for instantiation.
* <p/>
* Gets the value of the section property.
* <p/>
* An {@code ovf:Section} to configure for instantiation.
*
* Objects of the following type(s) are allowed in the list
* {@link SectionType }
* {@link VirtualHardwareSection }
* {@link LeaseSettingsSection }
* {@link EulaSection }
* {@link RuntimeInfoSection }
* {@link AnnotationSection }
* {@link DeploymentOptionSection }
* {@link StartupSection }
* {@link ResourceAllocationSection }
* {@link NetworkConnectionSection }
* {@link CustomizationSection }
* {@link ProductSection }
* {@link GuestCustomizationSection }
* {@link org.jclouds.ovf.OperatingSystemSection }
* {@link NetworkConfigSection }
* {@link NetworkSection }
* {@link DiskSection }
* {@link InstallSection }
* <ul>
* <li>{@link SectionType}
* <li>{@link VirtualHardwareSection}
* <li>{@link LeaseSettingsSection}
* <li>{@link EulaSection}
* <li>{@link RuntimeInfoSection}
* <li>{@link AnnotationSection}
* <li>{@link DeploymentOptionSection}
* <li>{@link StartupSection}
* <li>{@link ResourceAllocationSection}
* <li>{@link NetworkConnectionSection}
* <li>{@link CustomizationSection}
* <li>{@link ProductSection}
* <li>{@link GuestCustomizationSection}
* <li>{@link OperatingSystemSection}
* <li>{@link NetworkConfigSection}
* <li>{@link NetworkSection}
* <li>{@link DiskSection}
* <li>{@link InstallSection}
* </ul>
*/
public Set<? extends SectionType<?>> getSections() {
return Collections.unmodifiableSet(this.sections);
@ -153,8 +132,6 @@ public class InstantiationParams {
@Override
public String toString() {
return Objects.toStringHelper("")
.add("sections", sections).toString();
return Objects.toStringHelper("").add("sections", sections).toString();
}
}

View File

@ -35,20 +35,15 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
@ -70,18 +65,14 @@ import com.google.common.collect.Sets;
* </pre>
*/
@XmlRootElement(name = "LeaseSettingsSection")
@XmlType(propOrder = {
"links",
"deploymentLeaseInSeconds",
"storageLeaseInSeconds",
"deploymentLeaseExpiration",
"storageLeaseExpiration"
})
@XmlType(name = "LeaseSettingsSection")
public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public static <T extends LeaseSettingsSection> Builder builder() {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromLeaseSettingsSection(this);
}
@ -152,6 +143,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
}
@Override
public LeaseSettingsSection build() {
return new LeaseSettingsSection(info, required, links, deploymentLeaseInSeconds,
storageLeaseInSeconds, deploymentLeaseExpiration,
@ -159,7 +151,7 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
}
public Builder fromLeaseSettingsSection(LeaseSettingsSection in) {
return fromSection(in)
return fromSectionType(in)
.links(in.getLinks())
.deploymentLeaseInSeconds(in.getDeploymentLeaseInSeconds())
.storageLeaseInSeconds(in.getStorageLeaseInSeconds())
@ -173,8 +165,8 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<LeaseSettingsSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<LeaseSettingsSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

View File

@ -45,31 +45,80 @@ import com.google.common.base.Objects.ToStringHelper;
public class Link extends ReferenceType<Link> {
public static final class Rel {
public static final String UP = "up";
public static final String DOWN = "down";
public static final String EDIT = "edit";
public static final String ADD = "add";
public static final String DELETE = "delete";
public static final String REMOVE = "remove";
public static final String CATALOG_ITEM = "catalogItem";
public static final String TASK_CANCEL = "task:cancel";
public static final String ALTERNATE = "alternate";
public static final String NEXT_PAGE = "nextPage";
public static final String PREVIOUS_PAGE = "previousPage";
public static final String LAST_PAGE = "lastPage";
public static final String FIRST_PAGE = "firstPage";
public static final String CATALOG_ITEM = "catalogItem";
public static final String COLLABORATION_ABORT = "collaboration:abort";
public static final String COLLABORATION_FAIL = "collaboration:fail";
public static final String COLLABORATION_RESUME = "collaboration:resume";
public static final String CONSOLIDATE = "consolidate";
public static final String CONTROL_ACCESS = "controlAccess";
public static final String COPY = "copy";
public static final String DEPLOY = "deploy";
public static final String DISABLE = "disable";
public static final String DISCARD_STATE = "discardState";
public static final String DOWN = "down";
public static final String DOWNLOAD_ALTERNATE = "download:alternate";
public static final String DOWNLOAD_DEFAULT = "download:default";
public static final String EDIT = "edit";
public static final String ENABLE = "enable";
public static final String FIRST_PAGE = "firstPage";
public static final String INSTALL_VMWARE_TOOLS = "installVmwareTools";
public static final String LAST_PAGE = "lastPage";
public static final String EJECT_MEDIA = "media:ejectMedia";
public static final String INSERT_MEDIA = "media:insertMedia";
public static final String MOVE = "move";
public static final String NEXT_PAGE = "nextPage";
public static final String OVA = "ova";
public static final String OVF = "ovf";
public static final String POWER_OFF = "power:powerOff";
public static final String POWER_ON = "power:powerOn";
public static final String REBOOT = "power:reboot";
public static final String RESET = "power:reset";
public static final String SHUTDOWN = "power:shutdown";
public static final String SUSPEND = "power:suspend";
public static final String PREVIOUS_PAGE = "previousPage";
public static final String PUBLISH = "publish";
public static final String RECOMPOSE = "recompose";
public static final String RECONNECT = "reconnect";
public static final String REGISTER = "register";
public static final String REJECT = "reject";
public static final String RELOCATE = "relocate";
public static final String REMOVE = "remove";
public static final String REPAIR = "repair";
public static final String SCREEN_ACQUIRE_TICKET = "screen:acquireTicket";
public static final String SCREEN_THUMBNAIL = "screen:thumbnail";
public static final String TASK_CANCEL = "task:cancel";
public static final String BLOCKING_TASK = "blockingTask";
public static final String TASK_OWNER = "taskOwner";
public static final String TASK_PARAMS = "taskParams";
public static final String TASK_REQUEST = "taskRequest";
public static final String UNDEPLOY = "undeploy";
public static final String UNLOCK = "unlock";
public static final String UNREGISTER = "unregister";
public static final String UP = "up";
public static final String UPDATE_PROGRESS = "updateProgress";
public static final String UPGRADE = "upgrade";
public static final String UPLOAD_ALTERNATE = "upload:alternate";
public static final String UPLOAD_DEFAULT = "upload:default";
/**
* All acceptable {@link Link#getRel()} values.
* <p/>
*
* This list must be updated whenever a new relationship is added.
*/
public static final List<String> ALL = Arrays.asList(
UP, DOWN, EDIT, ADD, DELETE, REMOVE, CATALOG_ITEM, TASK_CANCEL,
ALTERNATE, NEXT_PAGE, PREVIOUS_PAGE, LAST_PAGE, FIRST_PAGE,
CONTROL_ACCESS, UPLOAD_DEFAULT
ADD, ALTERNATE, CATALOG_ITEM, COLLABORATION_ABORT,
COLLABORATION_FAIL, COLLABORATION_RESUME, CONSOLIDATE,
CONTROL_ACCESS, COPY, DEPLOY, DISABLE, DISCARD_STATE, DOWN,
DOWNLOAD_ALTERNATE, DOWNLOAD_DEFAULT, EDIT, ENABLE, FIRST_PAGE,
INSTALL_VMWARE_TOOLS, LAST_PAGE, EJECT_MEDIA, INSERT_MEDIA, MOVE,
NEXT_PAGE, OVA, OVF, POWER_OFF, POWER_ON, REBOOT, RESET, SHUTDOWN,
SUSPEND, PREVIOUS_PAGE, PUBLISH, RECOMPOSE, RECONNECT, REGISTER,
REJECT, RELOCATE, REMOVE, REPAIR, SCREEN_ACQUIRE_TICKET,
SCREEN_THUMBNAIL, TASK_CANCEL, BLOCKING_TASK, TASK_OWNER,
TASK_PARAMS, TASK_REQUEST, UNDEPLOY, UNLOCK, UNREGISTER, UP,
UPDATE_PROGRESS, UPGRADE, UPLOAD_ALTERNATE, UPLOAD_DEFAULT
);
}
@ -198,7 +247,7 @@ public class Link extends ReferenceType<Link> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(rel);
return Objects.hashCode(super.hashCode(), rel);
}
@Override

View File

@ -258,7 +258,7 @@ public class Media extends ResourceEntityType<Media> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(owner, imageType, size);
return Objects.hashCode(super.hashCode(), owner, imageType, size);
}
@Override

View File

@ -0,0 +1,109 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents parameters for inserting/ejecting media to VM.
*
* <pre>
* &lt;complexType name="MediaInsertOrEjectParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(name = "MediaInsertOrEjectParams")
@XmlType(name = "MediaInsertOrEjectParamsType")
public class MediaInsertOrEjectParams {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromMediaInsertOrEjectParams(this);
}
public static class Builder {
private Reference media;
/**
* @see MediaInsertOrEjectParams#getMedia()
*/
public Builder media(Reference media) {
this.media = media;
return this;
}
public MediaInsertOrEjectParams build() {
MediaInsertOrEjectParams mediaInsertOrEjectParams = new MediaInsertOrEjectParams(media);
return mediaInsertOrEjectParams;
}
public Builder fromMediaInsertOrEjectParams(MediaInsertOrEjectParams in) {
return media(in.getMedia());
}
}
protected MediaInsertOrEjectParams() {
// For JAXB and builder use
}
public MediaInsertOrEjectParams(Reference media) {
this.media = media;
}
@XmlElement(name = "Media", required = true)
protected Reference media;
/**
* Gets the value of the media property.
*/
public Reference getMedia() {
return media;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MediaInsertOrEjectParams that = MediaInsertOrEjectParams.class.cast(o);
return equal(media, that.media);
}
@Override
public int hashCode() {
return Objects.hashCode(media);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("media", media).toString();
}
}

View File

@ -161,7 +161,7 @@ public class Metadata extends ResourceType<Metadata> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(metadataEntries);
return Objects.hashCode(super.hashCode(), metadataEntries);
}
@Override

View File

@ -181,7 +181,7 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(key, value);
return Objects.hashCode(super.hashCode(), key, value);
}
@Override

View File

@ -153,7 +153,7 @@ public class MetadataValue extends ResourceType<MetadataValue> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(value);
return Objects.hashCode(super.hashCode(), value);
}
@Override

View File

@ -30,51 +30,30 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
* &lt;extension base="{http://schemas.dmtf.org/ovf/envelope/1}Section_Type">
* &lt;sequence>
* &lt;element name="Link" type="{http://www.vmware.com/vcloud/v1.5}LinkType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="NetworkConfig" type="{http://www.vmware.com/vcloud/v1.5}VAppNetworkConfigurationType" 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>
* &lt;complexType name="NetworkConfigSection" /&gt;
* </pre>
*/
@XmlRootElement(name = "NetworkConfigSection")
@XmlType(propOrder = {
"links",
"networkConfigs"
})
public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromNetworkConfigSection(this);
}
@ -119,12 +98,13 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
}
@Override
public NetworkConfigSection build() {
return new NetworkConfigSection(info, required, links, networkConfigs, href, type);
}
public Builder fromNetworkConfigSection(NetworkConfigSection in) {
return fromSection(in)
return fromSectionType(in)
.links(in.getLinks())
.networkConfigs(in.getNetworkConfigs())
.href(in.getHref())
@ -135,8 +115,8 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<NetworkConfigSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<NetworkConfigSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**
@ -176,7 +156,7 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
this.type = type;
}
private NetworkConfigSection() {
protected NetworkConfigSection() {
// For JAXB
}
@ -203,9 +183,6 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;
@ -218,29 +195,17 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
if (o == null || getClass() != o.getClass())
return false;
NetworkConfigSection that = NetworkConfigSection.class.cast(o);
return super.equals(that) &&
equal(links, that.links) &&
equal(networkConfigs, that.networkConfigs) &&
equal(href, that.href) &&
equal(type, that.type);
return super.equals(that) && equal(links, that.links) && equal(networkConfigs, that.networkConfigs) && equal(href, that.href) && equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(),
links,
networkConfigs,
href,
type);
return Objects.hashCode(super.hashCode(), links, networkConfigs, href, type);
}
@Override
public Objects.ToStringHelper string() {
return super.string()
.add("links", links)
.add("networkConfigs", networkConfigs)
.add("href", href)
.add("type", type);
return super.string().add("links", links).add("networkConfigs", networkConfigs).add("href", href).add("type", type);
}
}

View File

@ -20,12 +20,16 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
/**
@ -65,6 +69,34 @@ import com.google.common.base.Objects;
"ipAddressAllocationMode"
})
public class NetworkConnection {
public static enum IpAddressAllocationMode {
POOL("pool"),
DHCP("dhcp"),
MANUAL("manual"),
NONE("none"),
UNRECOGNIZED("unrecognized");
public static final List<IpAddressAllocationMode> ALL = ImmutableList.of(POOL, DHCP, MANUAL, NONE);
private final String label;
private IpAddressAllocationMode(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public static IpAddressAllocationMode fromValue(String value) {
try {
return valueOf(checkNotNull(value, "value").toUpperCase());
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
}
public static Builder builder() {
return new Builder();
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
@ -30,54 +29,30 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
* &lt;extension base="{http://schemas.dmtf.org/ovf/envelope/1}Section_Type">
* &lt;sequence>
* &lt;element name="PrimaryNetworkConnectionIndex" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="NetworkConnection" type="{http://www.vmware.com/vcloud/v1.5}NetworkConnectionType" maxOccurs="unbounded" 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>
* &lt;complexType name="NetworkConnectionSection" /&gt;
* </pre>
*/
@XmlRootElement(name = "NetworkConnectionSection")
@XmlType(propOrder = {
"primaryNetworkConnectionIndex",
"networkConnections",
"links"
})
public class NetworkConnectionSection extends SectionType<NetworkConnectionSection> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromNetworkConnectionSection(this);
}
@ -130,27 +105,23 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return this;
}
@Override
public NetworkConnectionSection build() {
return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnections, links, href, type);
}
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnections(in.getNetworkConnections())
.links(in.getLinks())
.href(in.getHref())
.type(in.getType());
return fromSectionType(in).primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).networkConnections(in.getNetworkConnections()).links(in.getLinks()).href(in.getHref()).type(
in.getType());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<NetworkConnectionSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<NetworkConnectionSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**
@ -171,8 +142,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
}
private NetworkConnectionSection(@Nullable String info, @Nullable Boolean required, Integer primaryNetworkConnectionIndex,
Set<NetworkConnection> networkConnections, Set<Link> links, URI href, String type) {
private NetworkConnectionSection(@Nullable String info, @Nullable Boolean required, Integer primaryNetworkConnectionIndex, Set<NetworkConnection> networkConnections, Set<Link> links, URI href,
String type) {
super(info, required);
this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
this.networkConnections = ImmutableSet.copyOf(networkConnections);
@ -199,9 +170,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
/**
* Gets the value of the primaryNetworkConnectionIndex property.
*
* @return possible object is
* {@link Integer }
*
* @return possible object is {@link Integer }
*/
public Integer getPrimaryNetworkConnectionIndex() {
return primaryNetworkConnectionIndex;
@ -210,8 +180,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
/**
* Gets the value of the networkConnection property.
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link NetworkConnection }
* Objects of the following type(s) are allowed in the list {@link NetworkConnection }
*/
public Set<NetworkConnection> getNetworkConnections() {
return Collections.unmodifiableSet(this.networkConnections);
@ -220,8 +189,7 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
/**
* Gets the value of the link property.
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
* Objects of the following type(s) are allowed in the list {@link Link }
*/
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
@ -236,9 +204,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*
* @return possible object is {@link String }
*/
public String getType() {
return type;
@ -253,30 +220,17 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
NetworkConnectionSection that = NetworkConnectionSection.class.cast(o);
return super.equals(that) &&
equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnections, that.networkConnections) &&
equal(links, that.links) &&
equal(href, that.href) &&
equal(type, that.type);
equal(networkConnections, that.networkConnections) && equal(links, that.links) &&
equal(href, that.href) && equal(type, that.type);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(),
primaryNetworkConnectionIndex,
networkConnections,
links,
href,
type);
return Objects.hashCode(super.hashCode(), primaryNetworkConnectionIndex, networkConnections, links, href, type);
}
@Override
public Objects.ToStringHelper string() {
return super.string()
.add("primaryNetworkConnectionIndex", primaryNetworkConnectionIndex)
.add("networkConnection", networkConnections)
.add("links", links)
.add("href", href)
.add("type", type);
return super.string().add("primaryNetworkConnectionIndex", primaryNetworkConnectionIndex).add("networkConnection", networkConnections).add("links", links).add("href", href).add("type", type);
}
}

View File

@ -174,7 +174,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(networkConfiguration);
return Objects.hashCode(super.hashCode(), networkConfiguration);
}
@Override

View File

@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@ -34,10 +35,10 @@ import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets;
/**
* iRepresents an organization.
* <p/>
* Represents an organization.
*
* Unit of multi-tenancy and a top-level container. Contain vDCs, TasksList, Catalogs and Shared Network entities.
* <p/>
*
* <pre>
* &lt;xs:complexType name="OrgType"&gt;
* </pre>
@ -53,6 +54,7 @@ public class Org extends EntityType<Org> {
return new ConcreteBuilder();
}
@Override
public NewBuilder<?> toNewBuilder() {
return new ConcreteBuilder().fromOrg(this);
}
@ -172,18 +174,30 @@ public class Org extends EntityType<Org> {
this.id = id;
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder tasks(Set<Task> tasks) {
super.tasks(tasks);
if (checkNotNull(tasks, "tasks").size() > 0)
this.tasks = Sets.newLinkedHashSet(tasks);
return this;
}
/**
* @see ReferenceType#getHref()
* @see EntityType#getTasks()
*/
@Override
public Builder task(Task task) {
if (tasks == null)
tasks = Sets.newLinkedHashSet();
this.tasks.add(checkNotNull(task, "task"));
return this;
}
/**
* @see ResourceType#getHref()
*/
@Override
public Builder href(URI href) {
@ -192,7 +206,7 @@ public class Org extends EntityType<Org> {
}
/**
* @see ReferenceType#getType()
* @see ResourceType#getType()
*/
@Override
public Builder type(String type) {
@ -201,19 +215,22 @@ public class Org extends EntityType<Org> {
}
/**
* @see EntityType#getLinks()
* @see ResourceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
if (checkNotNull(links, "links").size() > 0)
this.links = Sets.newLinkedHashSet(links);
return this;
}
/**
* @see EntityType#getLinks()
* @see ResourceType#getLinks()
*/
@Override
public Builder link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return this;
}
@ -232,12 +249,12 @@ public class Org extends EntityType<Org> {
// for JAXB
}
public Org(URI href, String type, Set<Link> links, String description,
Set<Task> tasksInProgress, String id, String name,
public Org(URI href, String type, @Nullable Set<Link> links, String description,
@Nullable Set<Task> tasks, String id, String name,
String fullName, Boolean enabled) {
super(href, type, links, description, tasksInProgress, id, name);
super(href, type, links, description, tasks, id, name);
this.fullName = fullName;
isEnabled = enabled;
this.isEnabled = enabled;
}
@XmlElement(name = "FullName", required = true)
@ -253,7 +270,7 @@ public class Org extends EntityType<Org> {
}
/**
* Full name of the organization.
* Is the organization enabled.
*/
public Boolean isEnabled() {
return isEnabled;
@ -271,7 +288,7 @@ public class Org extends EntityType<Org> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(fullName, isEnabled);
return Objects.hashCode(super.hashCode(), fullName, isEnabled);
}
@Override

View File

@ -72,6 +72,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
/**
* @see NetworkType#getConfiguration()
*/
@Override
public Builder configuration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
return this;
@ -150,12 +151,12 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
}
@Override
public Builder fromEntityType(EntityType<OrgNetwork> in) {
public Builder fromNetworkType(NetworkType<OrgNetwork> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromOrgNetwork(OrgNetwork in) {
return fromEntityType(in).configuration(in.getConfiguration())
return fromNetworkType(in).configuration(in.getConfiguration())
.networkPool(in.getNetworkPool())
.allowedExternalIpAddresses(in.getAllowedExternalIpAddresses());
}
@ -202,7 +203,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(networkPool, allowedExternalIpAddresses);
return Objects.hashCode(super.hashCode(), networkPool, allowedExternalIpAddresses);
}
@Override

View File

@ -35,28 +35,11 @@ import com.google.common.base.Objects.ToStringHelper;
/**
* 1.5
*
* <p>Java class for OrgPasswordPolicySettings complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* Java class for OrgPasswordPolicySettings complex type.
*
* <pre>
* &lt;complexType name="OrgPasswordPolicySettings">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
* &lt;sequence>
* &lt;element name="AccountLockoutEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="InvalidLoginsBeforeLockout" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="AccountLockoutIntervalMinutes" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="OrgPasswordPolicySettings" /&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "OrgPasswordPolicySettings")

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,11 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
@ -30,32 +28,19 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents the owner of this entity.
* <p/>
* <p/>
* <p>Java class for Owner complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="Owner">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
* &lt;sequence>
* &lt;element name="User" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="Owner" /&;
* </pre>
*
* @since 1.5
*/
@XmlRootElement(name = "Owner")
@XmlType(propOrder = {"user"})
@XmlType(name = "OwnerType")
public class Owner extends ResourceType<Owner> {
public static Builder builder() {
@ -69,17 +54,17 @@ public class Owner extends ResourceType<Owner> {
public static class Builder extends ResourceType.Builder<Owner> {
private Reference user;
private ReferenceType<?> user;
/**
* @see Owner#getUser()
*/
public Builder user(Reference user) {
public Builder user(ReferenceType<?> user) {
this.user = user;
return this;
}
@Override
public Owner build() {
return new Owner(href, type, links, user);
}
@ -107,8 +92,7 @@ public class Owner extends ResourceType<Owner> {
*/
@Override
public Builder links(Set<Link> links) {
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
return this;
return Builder.class.cast(super.links(links));
}
/**
@ -116,8 +100,7 @@ public class Owner extends ResourceType<Owner> {
*/
@Override
public Builder link(Link link) {
super.link(link);
return this;
return Builder.class.cast(super.link(link));
}
@ -132,26 +115,22 @@ public class Owner extends ResourceType<Owner> {
}
}
@SuppressWarnings("unused")
private Owner() {
protected Owner() {
// for JAXB
}
public Owner(URI href, String type, Set<Link> links, Reference user) {
public Owner(URI href, String type, Set<Link> links, ReferenceType<?> user) {
super(href, type, links);
this.user = user;
}
@XmlElement(name = "User", required = true)
protected Reference user;
protected ReferenceType<?> user;
/**
* Gets the value of the user property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getUser() {
public ReferenceType<?> getUser() {
return user;
}
@ -162,18 +141,16 @@ public class Owner extends ResourceType<Owner> {
if (o == null || getClass() != o.getClass())
return false;
Owner that = Owner.class.cast(o);
return equal(user, that.user);
return super.equals(that) && equal(this.user, that.user);
}
@Override
public int hashCode() {
return Objects.hashCode(user);
return Objects.hashCode(super.hashCode(), user);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("user", user).toString();
public ToStringHelper string() {
return super.string().add("user", user);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,62 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.*;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* A basic type used to specify parameters for operations.
* <p/>
* <p/>
* <p>Java class for Params complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="Params">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="Params" /&gt;
* </pre>
*/
@XmlType(name = "Params", propOrder = {
"description"
})
@XmlSeeAlso({
// CaptureVAppParams.class, // FIXME!
CloneVAppTemplateParams.class,
CloneMediaParams.class,
UploadVAppTemplateParams.class
//, ImportVmAsVAppTemplateParams.class,
// ImportMediaParams.class,
// UpdateResourcePoolSetParams.class,
// VAppCreationParams.class
})
@XmlType(name = "Params")
public class ParamsType<T extends ParamsType<T>> {
public static <T extends ParamsType<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromParamsType(this);
}
public static class Builder<T extends ParamsType<T>> {
@ -94,7 +58,6 @@ public class ParamsType<T extends ParamsType<T>> {
return this;
}
public ParamsType<T> build() {
return new ParamsType<T>(description, name);
}
@ -105,7 +68,7 @@ public class ParamsType<T extends ParamsType<T>> {
}
}
protected ParamsType(String description, String name) {
public ParamsType(String description, String name) {
this.description = description;
this.name = name;
}
@ -122,9 +85,6 @@ public class ParamsType<T extends ParamsType<T>> {
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
@ -132,9 +92,6 @@ public class ParamsType<T extends ParamsType<T>> {
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
@ -147,21 +104,20 @@ public class ParamsType<T extends ParamsType<T>> {
if (o == null || getClass() != o.getClass())
return false;
ParamsType<?> that = ParamsType.class.cast(o);
return equal(description, that.description) &&
equal(name, that.name);
return equal(this.description, that.description) && equal(this.name, that.name);
}
@Override
public int hashCode() {
return Objects.hashCode(description,
name);
return Objects.hashCode(description, name);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("description", description)
.add("name", name).toString();
return string().toString();
}
public ToStringHelper string() {
return Objects.toStringHelper("").add("description", description).add("name", name);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,33 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import javax.annotation.Nullable;
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.VCloudDirectorConstants;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* Essentially a container with a list of product sections.
* <p/>
* <p>Java class for ProductSectionList complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="ProductSectionList">
* &lt;complexContent>
@ -56,14 +56,10 @@ import com.google.common.collect.Sets;
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "ProductSectionList", propOrder = {
"productSections"
})
public class ProductSectionList
extends ResourceType<ProductSectionList>
{
@SuppressWarnings("unchecked")
@XmlRootElement(name = "ProductSectionList")
@XmlType(name = "ProductSectionListType")
public class ProductSectionList extends ResourceType<ProductSectionList> implements Set<ProductSection> {
public static Builder builder() {
return new Builder();
}
@ -81,13 +77,24 @@ public class ProductSectionList
* @see ProductSectionList#getProductSections()
*/
public Builder productSections(Set<ProductSection> productSections) {
this.productSections = checkNotNull(productSections, "productSection");
if (checkNotNull(productSections, "productSections").size() > 0)
this.productSections = Sets.newLinkedHashSet(productSections);
return this;
}
/**
* @see ProductSectionList#getProductSections()
*/
public Builder productSections(ProductSection productSection) {
if (productSections == null)
productSections = Sets.newLinkedHashSet();
this.productSections.add(checkNotNull(productSection, "productSection"));
return this;
}
@Override
public ProductSectionList build() {
ProductSectionList productSectionList = new ProductSectionList(productSections);
ProductSectionList productSectionList = new ProductSectionList(href, type, links, productSections);
return productSectionList;
}
@ -114,8 +121,7 @@ public class ProductSectionList
*/
@Override
public Builder links(Set<Link> links) {
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
return this;
return Builder.class.cast(super.links(links));
}
/**
@ -123,8 +129,7 @@ public class ProductSectionList
*/
@Override
public Builder link(Link link) {
super.link(link);
return this;
return Builder.class.cast(super.link(link));
}
@ -135,7 +140,7 @@ public class ProductSectionList
public Builder fromProductSectionList(ProductSectionList in) {
return fromResourceType(in)
.productSections(in.getProductSections());
.productSections(ImmutableSet.copyOf(in));
}
}
@ -143,19 +148,20 @@ public class ProductSectionList
// for JAXB
}
private ProductSectionList(Set<ProductSection> productSections) {
this.productSections = ImmutableSet.copyOf(productSections);
private ProductSectionList(URI href, String type, @Nullable Set<Link> links, @Nullable Set<ProductSection> productSections) {
super(href, type, links);
this.productSections = productSections != null && productSections.isEmpty() ? null : productSections;
}
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected Set<ProductSection> productSections = Sets.newLinkedHashSet();
@XmlElement(name = "ProductSection", namespace = VCloudDirectorConstants.VCLOUD_OVF_NS)
protected Set<ProductSection> productSections;
/**
* Gets the value of the productSection property.
*/
public Set<ProductSection> getProductSections() {
return Collections.unmodifiableSet(this.productSections);
return productSections == null ? ImmutableSet.<ProductSection>of() : Collections.unmodifiableSet(productSections);
}
@Override
@ -165,18 +171,92 @@ public class ProductSectionList
if (o == null || getClass() != o.getClass())
return false;
ProductSectionList that = ProductSectionList.class.cast(o);
return equal(productSections, that.productSections);
return super.equals(that) && equal(this.productSections, that.productSections);
}
@Override
public int hashCode() {
return Objects.hashCode(productSections);
return Objects.hashCode(super.hashCode(), productSections);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("productSections", productSections).toString();
public ToStringHelper string() {
return super.string().add("productSections", productSections);
}
/**
* The delegate always returns a {@link Set} even if {@link #productSections} is {@literal null}.
*
* The delegated {@link Set} is used by the methods implementing its interface.
* <p>
* NOTE Annoying lack of multiple inheritance for using ForwardingList!
*/
private Set<ProductSection> delegate() {
return getProductSections();
}
@Override
public boolean add(ProductSection arg0) {
return delegate().add(arg0);
}
@Override
public boolean addAll(Collection<? extends ProductSection> arg0) {
return delegate().addAll(arg0);
}
@Override
public void clear() {
delegate().clear();
}
@Override
public boolean contains(Object arg0) {
return delegate().contains(arg0);
}
@Override
public boolean containsAll(Collection<?> arg0) {
return delegate().containsAll(arg0);
}
@Override
public boolean isEmpty() {
return delegate().isEmpty();
}
@Override
public Iterator<ProductSection> iterator() {
return delegate().iterator();
}
@Override
public boolean remove(Object arg0) {
return delegate().remove(arg0);
}
@Override
public boolean removeAll(Collection<?> arg0) {
return delegate().removeAll(arg0);
}
@Override
public boolean retainAll(Collection<?> arg0) {
return delegate().retainAll(arg0);
}
@Override
public int size() {
return delegate().size();
}
@Override
public Object[] toArray() {
return delegate().toArray();
}
@Override
public <T> T[] toArray(T[] arg0) {
return delegate().toArray(arg0);
}
}

View File

@ -0,0 +1,170 @@
/*
* 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.*;
import static com.google.common.base.Preconditions.*;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
* Represents a list of RASD items.
*
* <pre>
* &lt;complexType name="RasdItemsList" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "RasdItemsList")
public class RasdItemsList extends ResourceType<RasdItemsList> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromRasdItemsList(this);
}
public static class Builder extends ResourceType.Builder<RasdItemsList> {
private List<RASD> items = Lists.newArrayList();
/**
* @see RasdItemsList#getItems()
*/
public Builder items(List<RASD> items) {
this.items = checkNotNull(items, "items");
return this;
}
/**
* @see RasdItemsList#getItems()
*/
public Builder item(RASD item) {
this.items.add(checkNotNull(item, "item"));
return this;
}
@Override
public RasdItemsList build() {
RasdItemsList rasdItemsList = new RasdItemsList(href, type, links, items);
return rasdItemsList;
}
/**
* @see ResourceType#getHref()
*/
@Override
public Builder href(URI href) {
super.href(href);
return this;
}
/**
* @see ResourceType#getType()
*/
@Override
public Builder type(String type) {
super.type(type);
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder link(Link link) {
super.link(link);
return this;
}
@Override
public Builder fromResourceType(ResourceType<RasdItemsList> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromRasdItemsList(RasdItemsList in) {
return fromResourceType(in).items(in.getItems());
}
}
protected RasdItemsList() {
// For JAXB and builder use
}
public RasdItemsList(URI href, String type, Set<Link> links, List<RASD> items) {
super(href, type, links);
this.items = items;
}
@XmlElement(name = "Item")
protected List<RASD> items = Lists.newArrayList();
/**
* A RASD item content.
*/
public List<RASD> getItems() {
return items;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RasdItemsList that = RasdItemsList.class.cast(o);
return super.equals(that) && equal(this.items, that.items);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), items);
}
@Override
public ToStringHelper string() {
return super.string().add("items", items);
}
}

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;
import static com.google.common.base.Objects.equal;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents vApp re-composition parameters.
*
* <pre>
* &lt;complexType name="RecomposeVAppParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ComposeVAppParamsType">
* &lt;sequence>
* &lt;element name="CreateItem" type="{http://www.vmware.com/vcloud/v1.5}VmType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="DeleteItem" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlRootElement(name = "RecomposeVAppParams")
@XmlType(name = "RecomposeVAppParamsType")
public class RecomposeVAppParams extends ComposeVAppParams {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromRecomposeVAppParams(this);
}
public static class Builder extends ComposeVAppParams.Builder {
private List<Vm> createItem;
private List<Reference> deleteItem;
/**
* @see RecomposeVAppParams#getCreateItem()
*/
public Builder createItem(List<Vm> createItem) {
this.createItem = createItem;
return this;
}
/**
* @see RecomposeVAppParams#getDeleteItem()
*/
public Builder deleteItem(List<Reference> deleteItem) {
this.deleteItem = deleteItem;
return this;
}
@Override
public RecomposeVAppParams build() {
return new RecomposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, sourcedItems, allEULAsAccepted, linkedClone, createItem, deleteItem);
}
@Override
public Builder fromComposeVAppParams(ComposeVAppParams in) {
return Builder.class.cast(super.fromComposeVAppParams(in));
}
public Builder fromRecomposeVAppParams(RecomposeVAppParams in) {
return fromComposeVAppParams(in).createItem(in.getCreateItem()).deleteItem(in.getDeleteItem());
}
}
private RecomposeVAppParams() {
// For JAXB and builder use
}
private RecomposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn,
List<SourcedCompositionItemParam> sourcedItems, Boolean allEULAsAccepted, Boolean linkedClone, List<Vm> createItem, List<Reference> deleteItem) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, sourcedItems, allEULAsAccepted, linkedClone);
this.createItem = createItem;
this.deleteItem = deleteItem;
}
@XmlElement(name = "CreateItem")
protected List<Vm> createItem;
@XmlElement(name = "DeleteItem")
protected List<Reference> deleteItem;
/**
* Gets the value of the createItem property.
*/
public List<Vm> getCreateItem() {
if (createItem == null) {
createItem = new ArrayList<Vm>();
}
return this.createItem;
}
/**
* Gets the value of the deleteItem property.
*/
public List<Reference> getDeleteItem() {
if (deleteItem == null) {
deleteItem = new ArrayList<Reference>();
}
return this.deleteItem;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RecomposeVAppParams that = RecomposeVAppParams.class.cast(o);
return super.equals(that) &&
equal(this.createItem, that.createItem) && equal(this.deleteItem, that.deleteItem);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), createItem, deleteItem);
}
@Override
public ToStringHelper string() {
return super.string().add("createItem", createItem).add("deleteItem", deleteItem);
}
}

View File

@ -23,29 +23,32 @@ import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.jclouds.logging.Logger;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* A reference to a resource.
* <p/>
*
* Contains an href attribute and optional name and type attributes.
* <p/>
* <p>
* <pre>
* &lt;xs:complexType name="ReferenceType"&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlSeeAlso({
CatalogReference.class,
Reference.class
})
@XmlAccessorType(XmlAccessType.FIELD)
public class ReferenceType<T extends ReferenceType<T>> {
@javax.annotation.Resource
protected static Logger logger = Logger.NULL;
public static <T extends ReferenceType<T>> Builder<T> builder() {
return new Builder<T>();
}

View File

@ -18,18 +18,17 @@
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import com.google.common.collect.Sets;
import javax.xml.bind.annotation.XmlRootElement;
/**
* A resource.
*
* @author grkvlt@apache.org
*/
@XmlRootElement(name = "Resource")
public class Resource extends ResourceType<Resource> {
public static Builder builder() {
@ -71,8 +70,7 @@ public class Resource extends ResourceType<Resource> {
*/
@Override
public Builder links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
return this;
return Builder.class.cast(super.links(links));
}
/**
@ -80,8 +78,7 @@ public class Resource extends ResourceType<Resource> {
*/
@Override
public Builder link(Link link) {
this.links.add(checkNotNull(link, "link"));
return this;
return Builder.class.cast(super.link(link));
}
@Override

View File

@ -35,29 +35,16 @@ import com.google.common.collect.Sets;
/**
* Represents a list of references to resource entities.
* <p/>
* <p/>
* <p>Java class for ResourceEntities complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="ResourceEntities">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ResourceEntity" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="ResourceEntities" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "ResourceEntities", propOrder = {
"resourceEntities"
})
@XmlType(name = "ResourceEntities")
public class ResourceEntities {
public static Builder builder() {
return new Builder();
}

View File

@ -20,28 +20,110 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Arrays;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
/**
* Base type that represents a resource entity such as a vApp template or virtual media.
* <p/>
*
* <pre>
* &lt;complexType name="ResourceEntity" &gt;
* &lt;complexType name="ResourceEntity" /&gt;
* </pre>
*
* @author danikov
* @author Adam Lowe
* @author grkvlt@apache.org
*/
@XmlType(name = "ResourceEntityType")
public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> {
public static enum Status {
FAILED_CREATION(-1, "The object could not be created.", true, true, true),
UNRESOLVED(0, "The object is unresolved.", true, true, true),
RESOLVED(1, "The object is resolved.", true, true, true),
DEPLOYED(2, "The object is deployed.", false, false, false),
SUSPENDED(3, "The object is suspended.", false, true, true),
POWERED_ON(4, "The object is powered on.", false, true, true),
WAITING_FOR_INPUT(5, "The object is waiting for user input.", false, true, true),
UNKNOWN(6, "The object is in an unknown state.", true, true, true),
UNRECOGNIZED(7, "The object is in an unrecognized state.", true, true, true),
POWERED_OFF(8, "The object is powered off.", true, true, true),
INCONSISTENT_STATE(9, "The object is in an inconsistent state.", false, true, true),
MIXED(10, "Children do not all have the same status.", true, true, false),
UPLOAD_OVF_PENDING(11, "Upload initiated, OVF descriptor pending.", true, false, false),
UPLOAD_COPYING(12, "Upload initiated, copying contents.", true, false, false),
UPLOAD_DISK_PENDING(13, "Upload initiated , disk contents pending.", true, false, false),
UPLOAD_QUARANTINED(14, "Upload has been quarantined.", true, false, false),
UPLOAD_QUARANTINE_EXPIRED(15, "Upload quarantine period has expired.", true, false, false),
// Convention is "UNRECOGNIZED", but that is already a valid state name! so using UNRECOGNIZED_VALUE
UNRECOGNIZED_VALUE(404, "Unrecognized", false, false, false);
private Integer value;
private String description;
private boolean vAppTemplate;
private boolean vApp;
private boolean vm;
private Status(int value, String description, boolean vAppTemplate, boolean vApp, boolean vm) {
this.value = value;
this.description = description;
this.vAppTemplate = vAppTemplate;
this.vApp = vApp;
this.vm = vm;
}
public Integer getValue() {
return value;
}
public String getDescription() {
return description;
}
public boolean isVAppTemplate() {
return vAppTemplate;
}
public boolean isVApp() {
return vApp;
}
public boolean isVm() {
return vm;
}
public static Status fromValue(final int value) {
Optional<Status> found = Iterables.tryFind(Arrays.asList(values()), new Predicate<Status>() {
@Override
public boolean apply(Status status) {
return status.getValue() == value;
}
});
if (found.isPresent()) {
return found.get();
} else {
logger.warn("Illegal status value '%d'", value);
return UNRECOGNIZED_VALUE;
}
}
}
public static abstract class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
protected FilesList files;
protected Integer status;
@ -99,29 +181,33 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
}
/**
* @see ResourceEntityType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> links(Set<Link> links) {
super.links(links);
if (checkNotNull(links, "links").size() > 0)
this.links = Sets.newLinkedHashSet(links);
return this;
}
/**
* @see ResourceEntityType#getLinks()
* @see EntityType#getLinks()
*/
@Override
public Builder<T> link(Link link) {
super.link(link);
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return this;
}
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in));
public Builder<T> fromEntityType(EntityType<T> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder<T> fromResourceEntityType(ResourceEntityType<T> in) {
return fromResourceType(in).files(in.getFiles()).status(in.getStatus());
return fromEntityType(in).files(in.getFiles()).status(in.getStatus());
}
}
@ -177,7 +263,7 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(files, status);
return Objects.hashCode(super.hashCode(), files, status);
}
@Override

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -27,8 +27,10 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.logging.Logger;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
@ -37,16 +39,22 @@ import com.google.common.collect.Sets;
/**
* The base type for all objects in the vCloud model.
* <p/>
*
* Has an optional list of links and href and type attributes.
* <p/>
*
* <pre>
* &lt;xs:complexType name="ResourceType"&gt;
* &lt;xs:complexType name="ResourceType" /&gt;
* </pre>
*
* @author Adrian Cole
*
* @since 0.9
*/
public abstract class ResourceType<T extends ResourceType<T>> {
@XmlType(name = "ResourceType")
public class ResourceType<T extends ResourceType<T>> {
@javax.annotation.Resource
protected static Logger logger = Logger.NULL;
public NewBuilder<?> toNewBuilder() {
throw new UnsupportedOperationException("New builder not yet implemented for this class");
@ -99,10 +107,12 @@ public abstract class ResourceType<T extends ResourceType<T>> {
return href(in.getHref()).type(in.getType()).links(in.getLinks());
}
}
public abstract Builder<T> toBuilder();
public static abstract class Builder<T extends ResourceType<T>> {
public Builder<T> toBuilder() {
return new Builder<T>().fromResourceType(this);
}
public static class Builder<T extends ResourceType<T>> {
protected URI href;
protected String type;
@ -128,7 +138,8 @@ public abstract class ResourceType<T extends ResourceType<T>> {
* @see ResourceType#getLinks()
*/
public Builder<T> links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
if (checkNotNull(links, "links").size() > 0)
this.links = Sets.newLinkedHashSet(links);
return this;
}
@ -142,7 +153,9 @@ public abstract class ResourceType<T extends ResourceType<T>> {
return this;
}
public abstract ResourceType<T> build();
public ResourceType<T> build() {
return new ResourceType<T>(href, type, links);
}
protected Builder<T> fromResourceType(ResourceType<T> in) {
return href(in.getHref()).type(in.getType()).links(in.getLinks());
@ -156,11 +169,11 @@ public abstract class ResourceType<T extends ResourceType<T>> {
@XmlElement(name = "Link")
private Set<Link> links;
protected ResourceType(URI href, String type, @Nullable Set<Link> links) {
public ResourceType(URI href, String type, @Nullable Set<Link> links) {
this.href = href;
this.type = type;
// nullable so that jaxb wont persist empty collections
this.links = links != null && links.size() == 0 ? null : links;
this.links = links != null && links.isEmpty() ? null : links;
}
protected ResourceType() {
@ -169,7 +182,7 @@ public abstract class ResourceType<T extends ResourceType<T>> {
/**
* Contains the URI to the entity.
* <p/>
*
* An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of
* the object, and is never reused. The value of the href attribute is a reference to a view of
@ -186,7 +199,7 @@ public abstract class ResourceType<T extends ResourceType<T>> {
/**
* Contains the type of the the entity.
* <p/>
*
* The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions.
*

View File

@ -0,0 +1,148 @@
/*
* 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.*;
import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType.Builder;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
/**
* Runtime information for a specific vm
*
* <pre>
* &lt;complexType name="RuntimeInfoSection" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "RuntimeInfoSection")
public class RuntimeInfoSection extends SectionType<RuntimeInfoSection> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromRuntimeInfoSection(this);
}
public static class Builder extends SectionType.Builder<RuntimeInfoSection> {
private VMWareTools vmWareTools;
private List<Object> any = Lists.newArrayList();
/**
* @see RuntimeInfoSection#getVmWareTools()
*/
public Builder vmWareTools(VMWareTools vmWareTools) {
this.vmWareTools = vmWareTools;
return this;
}
/**
* @see RuntimeInfoSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this;
}
@Override
public RuntimeInfoSection build() {
RuntimeInfoSection runtimeInfoSection = new RuntimeInfoSection(info, required, vmWareTools, any);
return runtimeInfoSection;
}
@Override
public Builder fromSectionType(SectionType<RuntimeInfoSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
public Builder fromRuntimeInfoSection(RuntimeInfoSection in) {
return fromSectionType(in)
.vmWareTools(in.getVMWareTools())
.any(in.getAny());
}
}
protected RuntimeInfoSection() {
// For JAXB and builder use
}
public RuntimeInfoSection(@Nullable String info, @Nullable Boolean required, VMWareTools vmWareTools, List<Object> any) {
super(info, required);
this.vmWareTools = vmWareTools;
this.any = any;
}
@XmlElement(name = "VMWareTools")
private VMWareTools vmWareTools;
@XmlAnyElement(lax = true)
private List<Object> any = Lists.newArrayList();
/**
* Gets the value of the vmWareTools property.
*/
public VMWareTools getVMWareTools() {
return vmWareTools;
}
/**
* Gets the value of the any property.
*/
public List<Object> getAny() {
return this.any;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RuntimeInfoSection that = RuntimeInfoSection.class.cast(o);
return super.equals(that) &&
equal(vmWareTools, that.vmWareTools) && equal(any, that.any);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), vmWareTools, any);
}
@Override
public ToStringHelper string() {
return super.string().add("vmWareTools", vmWareTools).add("any", any);
}
}

View File

@ -0,0 +1,107 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import com.google.common.base.Objects;
/**
* The ticket for accessing the console of a VM.
*
* <pre>
* &lt;complexType name="ScreenTicket" /&gt;
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ScreenTicket")
public class ScreenTicket {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().fromScreenTicket(this);
}
public static class Builder {
private String value;
/**
* @see VmQuestionAnswer#getChoiceId()
*/
public Builder value(String value) {
this.value = value;
return this;
}
public ScreenTicket build() {
return new ScreenTicket(value);
}
public Builder fromScreenTicket(ScreenTicket in) {
return value(in.getValue());
}
}
protected ScreenTicket() {
// For JAXB
}
public ScreenTicket(String value) {
this.value = value;
}
@XmlValue
private String value;
/**
* Gets the value of the value property.
*/
public String getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ScreenTicket that = ScreenTicket.class.cast(o);
return equal(this.value, that.value);
}
@Override
public int hashCode() {
return Objects.hashCode(value);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("value", value).toString();
}
}

View File

@ -270,8 +270,18 @@ public class Task extends EntityType<Task> {
public Builder fromTask(Task in) {
return fromEntityType(in)
.error(in.getError()).org(in.getOrg()).progress(in.getProgress()).status(in.getStatus())
.operation(in.getOperation()).operationName(in.getOperationName());
.error(in.getError())
.org(in.getOrg())
.progress(in.getProgress())
.owner(in.getOwner())
.user(in.getUser())
.params(in.getParams())
.status(in.getStatus())
.operation(in.getOperation())
.operationName(in.getOperationName())
.startTime(in.getStartTime())
.endTime(in.getEndTime())
.expiryTime(in.getExpiryTime());
}
}
@ -294,11 +304,10 @@ public class Task extends EntityType<Task> {
this.expiryTime = expiryTime;
}
private Task() {
protected Task() {
// for JAXB
}
@XmlElement(name = "Error")
private Error error;
@XmlElement(name = "Organization")
@ -371,7 +380,7 @@ public class Task extends EntityType<Task> {
/**
* The execution status of the task.
* <p/>
*
* One of:
* <ul>
* <li>queued - The task has been queued for execution.
@ -383,7 +392,6 @@ public class Task extends EntityType<Task> {
* <li>aborted - The task was aborted by an administrative action.
* </ul>
*/
// TODO: enum!!!
public String getStatus() {
return status;
}
@ -446,7 +454,7 @@ public class Task extends EntityType<Task> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(error, org, progress, status, operation, operationName,
return Objects.hashCode(super.hashCode(), error, org, progress, status, operation, operationName,
startTime, endTime, expiryTime);
}

View File

@ -170,11 +170,7 @@ public class TasksList extends ResourceType<TasksList> implements Set<Task> {
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(delegate(), name);
}
private Set<Task> delegate() {
return tasks == null ? ImmutableSet.<Task>of() : Collections.unmodifiableSet(tasks);
return Objects.hashCode(super.hashCode(), delegate(), name);
}
@Override
@ -187,6 +183,15 @@ public class TasksList extends ResourceType<TasksList> implements Set<Task> {
return new Builder().fromTasksList(this);
}
/*
* Methods below are for implementing Set; annoying lack of multiple inheritance for using ForwardingSet!
*/
private Set<Task> delegate() {
return tasks == null ? ImmutableSet.<Task>of() : Collections.unmodifiableSet(tasks);
}
@Override
public Iterator<Task> iterator() {
return delegate().iterator();
@ -252,4 +257,4 @@ public class TasksList extends ResourceType<TasksList> implements Set<Task> {
return delegate().toArray(array);
}
}
}

View File

@ -0,0 +1,116 @@
/**
* 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.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* Represents vApp/VM undeployment parameters.
*
* <pre>
* &lt;complexType name="UndeployVAppParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="UndeployPowerAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UndeployVAppParams")
public class UndeployVAppParams {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromUndeployVAppParams(this);
}
public static class Builder {
private String undeployPowerAction;
/**
* @see UndeployVAppParams#getUndeployPowerAction()
*/
public Builder undeployPowerAction(String undeployPowerAction) {
this.undeployPowerAction = undeployPowerAction;
return this;
}
public UndeployVAppParams build() {
UndeployVAppParams undeployVAppParams = new UndeployVAppParams();
undeployVAppParams.undeployPowerAction = undeployPowerAction;
return undeployVAppParams;
}
public Builder fromUndeployVAppParams(UndeployVAppParams in) {
return undeployPowerAction(in.getUndeployPowerAction());
}
}
private UndeployVAppParams() {
// For JAXB and builder use
}
@XmlElement(name = "UndeployPowerAction")
protected String undeployPowerAction;
/**
* Gets the value of the undeployPowerAction property.
*/
public String getUndeployPowerAction() {
return undeployPowerAction;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
UndeployVAppParams that = UndeployVAppParams.class.cast(o);
return equal(undeployPowerAction, that.undeployPowerAction);
}
@Override
public int hashCode() {
return Objects.hashCode(undeployPowerAction);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("undeployPowerAction", undeployPowerAction).toString();
}
}

View File

@ -94,10 +94,8 @@ import com.google.common.collect.Sets;
"password",
"groups"
})
public class User
extends EntityType<User>
public class User extends EntityType<User> {
{
public static Builder builder() {
return new Builder();
}

View File

@ -1,5 +1,388 @@
/*
* 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;
public class VApp {
// Placeholder for merge
import static com.google.common.base.Objects.*;
import static com.google.common.base.Preconditions.*;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.EntityType.Builder;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
* Represents a vApp.
*
* <pre>
* &lt;complexType name="VApp" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlRootElement(name = "VApp")
@XmlType(name = "VAppType")
public class VApp extends AbstractVAppType<VApp> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVApp(this);
}
public static class Builder extends AbstractVAppType.Builder<VApp> {
private Owner owner;
private Boolean inMaintenanceMode;
private VAppChildren children;
private Boolean ovfDescriptorUploaded;
/**
* @see VApp#getOwner()
*/
public Builder owner(Owner owner) {
this.owner = owner;
return this;
}
/**
* @see VApp#isInMaintenanceMode()
*/
public Builder isInMaintenanceMode(Boolean inMaintenanceMode) {
this.inMaintenanceMode = inMaintenanceMode;
return this;
}
/**
* @see VApp#isInMaintenanceMode()
*/
public Builder inMaintenanceMode() {
this.inMaintenanceMode = Boolean.TRUE;
return this;
}
/**
* @see VApp#isInMaintenanceMode()
*/
public Builder notInMaintenanceMode() {
this.inMaintenanceMode = Boolean.FALSE;
return this;
}
/**
* @see VApp#getChildren()
*/
public Builder children(VAppChildren children) {
this.children = children;
return this;
}
/**
* @see VApp#isOvfDescriptorUploaded()
*/
public Builder isOvfDescriptorUploaded(Boolean ovfDescriptorUploaded) {
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
return this;
}
/**
* @see VApp#isOvfDescriptorUploaded()
*/
public Builder ovfDescriptorUploaded() {
this.ovfDescriptorUploaded = Boolean.TRUE;
return this;
}
/**
* @see VApp#isOvfDescriptorUploaded()
*/
public Builder ovfDescriptorNotUploaded() {
this.ovfDescriptorUploaded = Boolean.FALSE;
return this;
}
@Override
public VApp build() {
VApp vApp = new VApp(href, type, links, description, tasks, id, name, files, status, vAppParent, sections, inMaintenanceMode,
owner, inMaintenanceMode, children, ovfDescriptorUploaded);
return vApp;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder isDeployed(Boolean deployed) {
this.deployed = deployed;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder deployed() {
this.deployed = Boolean.TRUE;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder notDeployed() {
this.deployed = Boolean.FALSE;
return this;
}
/**
* @see AbstractVAppType#getVAppParent()
*/
@Override
public Builder parent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
@Override
public Builder sections(List<SectionType<?>> sections) {
if (checkNotNull(sections, "sections").size() > 0)
this.sections = Lists.newArrayList(sections);
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
@Override
public Builder section(SectionType<?> section) {
if (this.sections == null)
this.sections = Lists.newArrayList();
this.sections.add(checkNotNull(section, "section"));
return this;
}
/**
* @see ResourceEntityType#getFiles()
*/
@Override
public Builder files(FilesList files) {
this.files = files;
return this;
}
/**
* @see ResourceEntityType#getStatus()
*/
@Override
public Builder status(Integer status) {
this.status = status;
return this;
}
/**
* @see EntityType#getName()
*/
@Override
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see EntityType#getDescription()
*/
@Override
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see EntityType#getId()
*/
@Override
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder tasks(Set<Task> tasks) {
if (checkNotNull(tasks, "tasks").size() > 0)
this.tasks = Sets.newLinkedHashSet(tasks);
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder task(Task task) {
if (tasks == null)
tasks = Sets.newLinkedHashSet();
this.tasks.add(checkNotNull(task, "task"));
return this;
}
/**
* @see ReferenceType#getHref()
*/
@Override
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see ReferenceType#getType()
*/
@Override
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see EntityType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
if (checkNotNull(links, "links").size() > 0)
this.links = Sets.newLinkedHashSet(links);
return this;
}
/**
* @see EntityType#getLinks()
*/
@Override
public Builder link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return this;
}
@Override
public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) {
return Builder.class.cast(super.fromAbstractVAppType(in));
}
public Builder fromVApp(VApp in) {
return fromAbstractVAppType(in)
.owner(in.getOwner()).isInMaintenanceMode(in.isInMaintenanceMode())
.children(in.getChildren()).isOvfDescriptorUploaded(in.isOvfDescriptorUploaded());
}
}
protected VApp() {
// For JAXB and builder use
}
public VApp(URI href, String type, @Nullable Set<Link> links, String description, @Nullable Set<Task> tasks, String id, String name, FilesList files, Integer status, Reference vAppParent,
@Nullable List<SectionType<?>> sections, Boolean deployed, Owner owner, Boolean inMaintenanceMode, VAppChildren children, Boolean ovfDescriptorUploaded) {
super(href, type, links, description, tasks, id, name, files, status, vAppParent, sections, deployed);
this.owner = owner;
this.inMaintenanceMode = inMaintenanceMode;
this.children = children;
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
}
@XmlElement(name = "Owner")
protected Owner owner;
@XmlElement(name = "InMaintenanceMode")
protected Boolean inMaintenanceMode;
@XmlElement(name = "Children")
protected VAppChildren children;
@XmlAttribute
protected Boolean ovfDescriptorUploaded;
/**
* Gets the value of the owner property.
*/
public Owner getOwner() {
return owner;
}
/**
* Gets the value of the inMaintenanceMode property.
*/
public Boolean isInMaintenanceMode() {
return inMaintenanceMode;
}
/**
* Gets the value of the children property.
*/
public VAppChildren getChildren() {
return children;
}
/**
* Gets the value of the ovfDescriptorUploaded property.
*/
public Boolean isOvfDescriptorUploaded() {
return ovfDescriptorUploaded;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VApp that = VApp.class.cast(o);
return super.equals(that) &&
equal(this.owner, that.owner) && equal(this.inMaintenanceMode, that.inMaintenanceMode) &&
equal(this.children, that.children) && equal(this.ovfDescriptorUploaded, that.ovfDescriptorUploaded);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), owner, inMaintenanceMode, children, ovfDescriptorUploaded);
}
@Override
public ToStringHelper string() {
return super.string().add("owner", owner).add("inMaintenanceMode", inMaintenanceMode)
.add("children", children).add("ovfDescriptorUploaded", ovfDescriptorUploaded);
}
}

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.Objects.*;
import static com.google.common.base.Preconditions.*;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
/**
* Represents vApp children.
*
* <pre>
* &lt;complexType name="VAppChildren" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppChildren")
public class VAppChildren {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVAppChildren(this);
}
public static class Builder {
private List<VApp> vApps = Lists.newArrayList();
private List<Vm> vms = Lists.newArrayList();
/**
* @see VAppChildren#getVApps()
*/
public Builder vApps(List<VApp> vApps) {
this.vApps = checkNotNull(vApps, "vApps");
return this;
}
/**
* @see VAppChildren#getVApps()
*/
public Builder vApp(VApp vApp) {
this.vApps.add(checkNotNull(vApp, "vApp"));
return this;
}
/**
* @see VAppChildren#getVms()
*/
public Builder vms(List<Vm> vms) {
this.vms = checkNotNull(vms, "vms");
return this;
}
/**
* @see VAppChildren#getVms()
*/
public Builder vm(Vm vm) {
this.vms.add(checkNotNull(vm, "vm"));
return this;
}
public VAppChildren build() {
VAppChildren vAppChildren = new VAppChildren(vApps, vms);
return vAppChildren;
}
public Builder fromVAppChildren(VAppChildren in) {
return vApps(in.getVApps()).vms(in.getVms());
}
}
private VAppChildren() {
// For JAXB and builder use
}
private VAppChildren(List<VApp> vApps, List<Vm> vms) {
this.vApps = vApps;
this.vms = vms;
}
@XmlElement(name = "VApp")
protected List<VApp> vApps = Lists.newArrayList();
@XmlElement(name = "Vm")
protected List<Vm> vms = Lists.newArrayList();
/**
* Reserved.
*
* Unimplemented.
*/
public List<VApp> getVApps() {
return vApps;
}
/**
* Child VMs.
*/
public List<Vm> getVms() {
return vms;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppChildren that = VAppChildren.class.cast(o);
return equal(this.vApps, that.vApps) && equal(this.vms, that.vms);
}
@Override
public int hashCode() {
return Objects.hashCode(vApps, vms);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("vApps", vApps).add("vms", vms).toString();
}
}

View File

@ -0,0 +1,169 @@
/*
* 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.XmlType;
/**
* Represents vApp creation parameters.
*
* <pre>
* &lt;complexType name="VAppCreationParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "VAppCreationParams")
public class VAppCreationParams extends VAppCreationParamsType<VAppCreationParams> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVAppCreationParams(this);
}
public static class Builder extends VAppCreationParamsType.Builder<VAppCreationParams> {
@Override
public VAppCreationParams build() {
VAppCreationParams vAppCreationParams = new VAppCreationParams(description, name, vAppParent, instantiationParams, deploy, powerOn);
return vAppCreationParams;
}
/**
* @see VAppCreationParamsType#getVAppParent()
*/
@Override
public Builder vAppParent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see VAppCreationParamsType#getInstantiationParams()
*/
@Override
public Builder instantiationParams(InstantiationParams instantiationParams) {
this.instantiationParams = instantiationParams;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy(Boolean deploy) {
this.deploy = deploy;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
@Override
public Builder notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn(Boolean powerOn) {
this.powerOn = powerOn;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@Override
public Builder notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see ParamsType#getName()
*/
@Override
public Builder name(String name) {
this.name = name;
return this;
}
@Override
public Builder fromVAppCreationParamsType(VAppCreationParamsType<VAppCreationParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in));
}
public Builder fromVAppCreationParams(VAppCreationParams in) {
return fromVAppCreationParamsType(in);
}
}
protected VAppCreationParams() {
// For JAXB and builder use
}
public VAppCreationParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppCreationParams that = VAppCreationParams.class.cast(o);
return super.equals(that);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,64 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.*;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents vApp creation parameters.
* <p/>
* <p/>
* <p>Java class for VAppCreationParams complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="VAppCreationParams">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
* &lt;sequence>
* &lt;element name="VAppParent" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
* &lt;element name="InstantiationParams" type="{http://www.vmware.com/vcloud/v1.5}InstantiationParamsType" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="deploy" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* &lt;attribute name="powerOn" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="VAppCreationParams" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "VAppCreationParams", propOrder = {
"vAppParent",
"instantiationParams"
})
@XmlSeeAlso({
// InstantiateOvfParamsType.class,
// ComposeVAppParamsType.class,
// InstantiateVAppParamsType.class,
// ImportVmAsVAppParamsType.class
})
public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
extends ParamsType<T>
{
public static <T extends VAppCreationParamsType<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromVAppCreationParamsType(this);
}
@XmlType(name = "VAppCreationParamsType")
public class VAppCreationParamsType<T extends VAppCreationParamsType<T>> extends ParamsType<T> {
public static class Builder<T extends VAppCreationParamsType<T>> extends ParamsType.Builder<T> {
@ -106,6 +71,22 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
public Builder<T> deploy() {
this.deploy = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isDeploy()
*/
public Builder<T> notDeploy() {
this.deploy = Boolean.FALSE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
@ -114,45 +95,68 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder<T> powerOn() {
this.powerOn = Boolean.TRUE;
return this;
}
/**
* @see VAppCreationParamsType#isPowerOn()
*/
public Builder<T> notPowerOn() {
this.powerOn = Boolean.FALSE;
return this;
}
@Override
public VAppCreationParamsType<T> build() {
return new VAppCreationParamsType<T>(description, name, vAppParent, instantiationParams,deploy, powerOn);
VAppCreationParamsType<T> vAppCreationParams = new VAppCreationParamsType<T>(description, name, vAppParent, instantiationParams, deploy, powerOn);
return vAppCreationParams;
}
/**
* @see ParamsType#getDescription()
*/
@Override
public Builder<T> description(String description) {
super.description(description);
this.description = description;
return this;
}
/**
* @see ParamsType#getName()
*/
@Override
public Builder<T> name(String name) {
super.name(name);
this.name = name;
return this;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder<T> fromParamsType(ParamsType<T> in) {
return Builder.class.cast(super.fromParamsType(in));
}
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return fromParamsType(in)
.vAppParent(in.getVAppParent())
.instantiationParams(in.getInstantiationParams())
.deploy(in.isDeploy())
.powerOn(in.isPowerOn());
return fromParamsType(in).vAppParent(in.getVAppParent()).instantiationParams(in.getInstantiationParams()).deploy(in.isDeploy()).powerOn(in.isPowerOn());
}
}
protected VAppCreationParamsType() {
// For JAXB and builder use
}
public VAppCreationParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn) {
super(description, name);
this.vAppParent = vAppParent;
this.instantiationParams = instantiationParams;
this.deploy = deploy;
this.powerOn = powerOn;
}
@XmlElement(name = "VAppParent")
protected Reference vAppParent;
@XmlElement(name = "InstantiationParams")
@ -162,24 +166,8 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
@XmlAttribute
protected Boolean powerOn;
public VAppCreationParamsType(String description, String name, Reference vAppParent,
InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn) {
super(description, name);
this.vAppParent = vAppParent;
this.instantiationParams = instantiationParams;
this.deploy = deploy;
this.powerOn = powerOn;
}
protected VAppCreationParamsType() {
// for JAXB
}
/**
* Gets the value of the vAppParent property.
*
* @return possible object is
* {@link Reference }
*/
public Reference getVAppParent() {
return vAppParent;
@ -187,9 +175,6 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
/**
* Gets the value of the instantiationParams property.
*
* @return possible object is
* {@link InstantiationParams }
*/
public InstantiationParams getInstantiationParams() {
return instantiationParams;
@ -197,9 +182,6 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
/**
* Gets the value of the deploy property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isDeploy() {
return deploy;
@ -207,9 +189,6 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
/**
* Gets the value of the powerOn property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isPowerOn() {
return powerOn;
@ -222,7 +201,8 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
if (o == null || getClass() != o.getClass())
return false;
VAppCreationParamsType<?> that = VAppCreationParamsType.class.cast(o);
return equal(vAppParent, that.vAppParent) &&
return super.equals(that) &&
equal(vAppParent, that.vAppParent) &&
equal(instantiationParams, that.instantiationParams) &&
equal(deploy, that.deploy) &&
equal(powerOn, that.powerOn);
@ -230,19 +210,15 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
@Override
public int hashCode() {
return Objects.hashCode(vAppParent,
instantiationParams,
deploy,
powerOn);
return Objects.hashCode(super.hashCode(), vAppParent, instantiationParams, deploy, powerOn);
}
@Override
public String toString() {
public ToStringHelper string() {
return Objects.toStringHelper("")
.add("vAppParent", vAppParent)
.add("instantiationParams", instantiationParams)
.add("deploy", deploy)
.add("powerOn", powerOn).toString();
.add("powerOn", powerOn);
}
}

View File

@ -0,0 +1,235 @@
/**
* 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.*;
import static com.google.common.base.Preconditions.*;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets;
/**
* Represents a vApp network.
*
* <pre>
* &lt;complexType name="VAppNetwork" /&gt;
* </pre>
*/
@XmlType(name = "VAppNetwork")
public class VAppNetwork extends NetworkType<VAppNetwork> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVAppNetwork(this);
}
public static class Builder extends NetworkType.Builder<VAppNetwork> {
private Boolean deployed;
/**
* @see VAppNetwork#isDeployed()
*/
public Builder isDeployed(Boolean deployed) {
this.deployed = deployed;
return this;
}
/**
* @see VAppNetwork#isDeployed()
*/
public Builder deployed() {
this.deployed = Boolean.TRUE;
return this;
}
/**
* @see VAppNetwork#isDeployed()
*/
public Builder notDeployed() {
this.deployed = Boolean.FALSE;
return this;
}
@Override
public VAppNetwork build() {
VAppNetwork vAppNetwork = new VAppNetwork(href, type, links, description, tasks, id, name, networkConfiguration);
vAppNetwork.deployed = deployed;
return vAppNetwork;
}
/**
* @see NetworkType#getConfiguration()
*/
@Override
public Builder configuration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
return this;
}
/**
* @see EntityType#getName()
*/
@Override
public Builder name(String name) {
this.name = name;
return this;
}
/**
* @see EntityType#getDescription()
*/
@Override
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see EntityType#getId()
*/
@Override
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder tasks(Set<Task> tasks) {
if (checkNotNull(tasks, "tasks").size() > 0)
this.tasks = Sets.newLinkedHashSet(tasks);
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder task(Task task) {
if (tasks == null)
tasks = Sets.newLinkedHashSet();
this.tasks.add(checkNotNull(task, "task"));
return this;
}
/**
* @see ResourceType#getHref()
*/
@Override
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see ResourceType#getType()
*/
@Override
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
if (checkNotNull(links, "links").size() > 0)
this.links = Sets.newLinkedHashSet(links);
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return this;
}
@Override
public Builder fromNetworkType(NetworkType<VAppNetwork> in) {
return Builder.class.cast(super.fromNetworkType(in));
}
public Builder fromVAppNetwork(VAppNetwork in) {
return fromNetworkType(in).isDeployed(in.isDeployed());
}
}
protected VAppNetwork() {
// For JAXB and builder use
}
public VAppNetwork(URI href, String type, @Nullable Set<Link> links, String description, @Nullable Set<Task> tasks, String id, String name, NetworkConfiguration networkConfiguration) {
super(href, type, links, description, tasks, id, name, networkConfiguration);
}
@XmlAttribute
protected Boolean deployed;
/**
* Gets the value of the deployed property.
*/
public Boolean isDeployed() {
return deployed;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VAppNetwork that = VAppNetwork.class.cast(o);
return super.equals(that) && equal(this.deployed, that.deployed);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), deployed);
}
@Override
public ToStringHelper string() {
return super.string().add("deployed", deployed);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,54 +16,35 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Objects.*;
import static com.google.common.base.Preconditions.*;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets;
/**
* Represents a VApp network configuration.
* <p/>
* <p/>
* <p>Java class for VAppNetworkConfiguration complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="VAppNetworkConfiguration">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
* &lt;sequence>
* &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="Configuration" type="{http://www.vmware.com/vcloud/v1.5}NetworkConfigurationType"/>
* &lt;element name="IsDeployed" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="networkName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="VAppNetworkConfiguration" /&gt;
* </pre>
*/
@XmlType(name = "VAppNetworkConfiguration", propOrder = {
"description",
"configuration",
"isDeployed"
})
@XmlRootElement(name = "NetworkConfiguration")
@XmlType(name = "VAppNetworkConfiguration")
public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfiguration> {
public static <T extends VAppNetworkConfiguration> Builder builder() {
public static Builder builder() {
return new Builder();
}
@ -76,7 +57,7 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
private String description;
private NetworkConfiguration configuration;
private Boolean isDeployed;
private Boolean deployed;
private String networkName;
/**
@ -98,8 +79,8 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
/**
* @see VAppNetworkConfiguration#isDeployed()
*/
public Builder isDeployed(Boolean isDeployed) {
this.isDeployed = isDeployed;
public Builder isDeployed(Boolean deployed) {
this.deployed = deployed;
return this;
}
@ -111,13 +92,11 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
return this;
}
@Override
public VAppNetworkConfiguration build() {
return new VAppNetworkConfiguration(href, type, links,
description, configuration, isDeployed, networkName);
return new VAppNetworkConfiguration(href, type, links, description, configuration, deployed, networkName);
}
/**
* @see ResourceType#getHref()
*/
@ -157,7 +136,7 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder fromResourceType(ResourceType<VAppNetworkConfiguration> in) {
return Builder.class.cast(super.fromResourceType(in));
}
@ -176,7 +155,7 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
@XmlElement(name = "Configuration", required = true)
protected NetworkConfiguration configuration;
@XmlElement(name = "IsDeployed")
protected Boolean isDeployed;
protected Boolean deployed;
@XmlAttribute(required = true)
protected String networkName;
@ -185,19 +164,16 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
super(href, type, links);
this.description = description;
this.configuration = configuration;
isDeployed = deployed;
this.deployed = deployed;
this.networkName = networkName;
}
private VAppNetworkConfiguration() {
protected VAppNetworkConfiguration() {
// For JAXB
}
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
@ -205,29 +181,20 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
/**
* Gets the value of the configuration property.
*
* @return possible object is
* {@link NetworkConfiguration }
*/
public NetworkConfiguration getConfiguration() {
return configuration;
}
/**
* Gets the value of the isDeployed property.
*
* @return possible object is
* {@link Boolean }
* Gets the value of the deployed property.
*/
public Boolean isDeployed() {
return isDeployed;
return deployed;
}
/**
* Gets the value of the networkName property.
*
* @return possible object is
* {@link String }
*/
public String getNetworkName() {
return networkName;
@ -240,27 +207,24 @@ public class VAppNetworkConfiguration extends ResourceType<VAppNetworkConfigurat
if (o == null || getClass() != o.getClass())
return false;
VAppNetworkConfiguration that = VAppNetworkConfiguration.class.cast(o);
return equal(description, that.description) &&
equal(configuration, that.configuration) &&
equal(isDeployed, that.isDeployed) &&
equal(networkName, that.networkName);
return super.equals(that) &&
equal(this.description, that.description) &&
equal(this.configuration, that.configuration) &&
equal(this.deployed, that.deployed) &&
equal(this.networkName, that.networkName);
}
@Override
public int hashCode() {
return Objects.hashCode(description,
configuration,
isDeployed,
networkName);
return Objects.hashCode(super.hashCode(), description, configuration, deployed, networkName);
}
@Override
public String toString() {
public ToStringHelper string() {
return Objects.toStringHelper("")
.add("description", description)
.add("configuration", configuration)
.add("isDeployed", isDeployed)
.add("networkName", networkName).toString();
.add("deployed", deployed)
.add("networkName", networkName);
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Objects.*;
import static com.google.common.base.Preconditions.*;
import java.net.URI;
import java.util.Collections;
@ -30,54 +29,23 @@ 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.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/**
* 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>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType">
* &lt;sequence>
* &lt;element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
* &lt;element name="Children" type="{http://www.vmware.com/vcloud/v1.5}VAppTemplateChildrenType" minOccurs="0"/>
* &lt;element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="VAppScopedLocalId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="ovfDescriptorUploaded" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* &lt;attribute name="goldMaster" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="VAppTemplate" /&gt;
* </pre>
*/
@XmlRootElement(name = "VAppTemplate")
@XmlType(propOrder = {
"owner",
"children",
"sections",
"vAppScopedLocalId"
})
public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
public static Builder builder() {
return new Builder();
}

View File

@ -0,0 +1,105 @@
/*
* 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.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VMWareTools")
public class VMWareTools {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromVMWareTools(this);
}
public static class Builder {
private String version;
/**
* @see VMWareTools#getVersion()
*/
public Builder version(String version) {
this.version = version;
return this;
}
public VMWareTools build() {
VMWareTools vmWareTools = new VMWareTools(version);
return vmWareTools;
}
public Builder fromVMWareTools(VMWareTools in) {
return version(in.getVersion());
}
}
@XmlAttribute(required = true)
protected String version;
protected VMWareTools() {
// For JAXB and builder use
}
public VMWareTools(String version) {
this.version = version;
}
/**
* Gets the value of the version property.
*/
public String getVersion() {
return version;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VMWareTools that = VMWareTools.class.cast(o);
return equal(this.version, that.version);
}
@Override
public int hashCode() {
return Objects.hashCode(version);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("version", version).toString();
}
}

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
@ -24,61 +23,22 @@ import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents a virtual data center (vDC).
* <p/>
* <p/>
* <p>Java class for Vdc complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
*
* <pre>
* &lt;complexType name="Vdc">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
* &lt;sequence>
* &lt;element name="AllocationModel" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="StorageCapacity" type="{http://www.vmware.com/vcloud/v1.5}CapacityWithUsageType"/>
* &lt;element name="ComputeCapacity" type="{http://www.vmware.com/vcloud/v1.5}ComputeCapacityType"/>
* &lt;element name="ResourceEntities" type="{http://www.vmware.com/vcloud/v1.5}ResourceEntitiesType" minOccurs="0"/>
* &lt;element name="AvailableNetworks" type="{http://www.vmware.com/vcloud/v1.5}AvailableNetworksType" minOccurs="0"/>
* &lt;element name="Capabilities" type="{http://www.vmware.com/vcloud/v1.5}CapabilitiesType" minOccurs="0"/>
* &lt;element name="NicQuota" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="NetworkQuota" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="VmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* &lt;element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;complexType name="Vdc" /&gt;
* </pre>
*/
@XmlRootElement(name = "Vdc")
@XmlType(propOrder = {
"allocationModel",
"storageCapacity",
"computeCapacity",
"resourceEntities",
"availableNetworks",
"capabilities",
"nicQuota",
"networkQuota",
"vmQuota",
"isEnabled"
})
@XmlSeeAlso({
AdminVdc.class
})
@XmlType(name = "VdcType")
public class Vdc extends EntityType<Vdc> {
public static Builder<?> builder() {
return new ConcreteBuilder();
}
@ -89,7 +49,7 @@ public class Vdc extends EntityType<Vdc> {
}
@Override
public ResourceType.Builder<Vdc> toBuilder() {
public EntityType.Builder<Vdc> toBuilder() {
throw new UnsupportedOperationException("Use new builder");
}
@ -100,8 +60,8 @@ public class Vdc extends EntityType<Vdc> {
private ResourceEntities resourceEntities;
private AvailableNetworks availableNetworks;
private Capabilities capabilities;
private int nicQuota;
private int networkQuota;
private Integer nicQuota;
private Integer networkQuota;
private Integer vmQuota;
private Boolean isEnabled;
private Integer status;
@ -157,7 +117,7 @@ public class Vdc extends EntityType<Vdc> {
/**
* @see Vdc#getNicQuota()
*/
public T nicQuota(int nicQuota) {
public T nicQuota(Integer nicQuota) {
this.nicQuota = nicQuota;
return self();
}
@ -165,7 +125,7 @@ public class Vdc extends EntityType<Vdc> {
/**
* @see Vdc#getNetworkQuota()
*/
public T networkQuota(int networkQuota) {
public T networkQuota(Integer networkQuota) {
this.networkQuota = networkQuota;
return self();
}
@ -194,6 +154,7 @@ public class Vdc extends EntityType<Vdc> {
return self();
}
@Override
public Vdc build() {
return new Vdc(this);
}
@ -235,7 +196,7 @@ public class Vdc extends EntityType<Vdc> {
this.nicQuota = b.nicQuota;
this.networkQuota = b.networkQuota;
this.vmQuota = b.vmQuota;
isEnabled = b.isEnabled;
this.isEnabled = b.isEnabled;
this.status = b.status;
}
@ -252,9 +213,9 @@ public class Vdc extends EntityType<Vdc> {
@XmlElement(name = "Capabilities")
protected Capabilities capabilities;
@XmlElement(name = "NicQuota")
protected int nicQuota;
protected Integer nicQuota;
@XmlElement(name = "NetworkQuota")
protected int networkQuota;
protected Integer networkQuota;
@XmlElement(name = "VmQuota")
protected Integer vmQuota;
@XmlElement(name = "IsEnabled")
@ -264,9 +225,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the allocationModel property.
*
* @return possible object is
* {@link String }
*/
public String getAllocationModel() {
return allocationModel;
@ -274,9 +232,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the storageCapacity property.
*
* @return possible object is
* {@link CapacityWithUsage }
*/
public CapacityWithUsage getStorageCapacity() {
return storageCapacity;
@ -284,9 +239,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the computeCapacity property.
*
* @return possible object is
* {@link ComputeCapacity }
*/
public ComputeCapacity getComputeCapacity() {
return computeCapacity;
@ -294,9 +246,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the resourceEntities property.
*
* @return possible object is
* {@link ResourceEntities }
*/
public ResourceEntities getResourceEntities() {
return resourceEntities;
@ -304,9 +253,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the availableNetworks property.
*
* @return possible object is
* {@link AvailableNetworks }
*/
public AvailableNetworks getAvailableNetworks() {
return availableNetworks;
@ -314,9 +260,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the capabilities property.
*
* @return possible object is
* {@link Capabilities }
*/
public Capabilities getCapabilities() {
return capabilities;
@ -325,22 +268,19 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the nicQuota property.
*/
public int getNicQuota() {
public Integer getNicQuota() {
return nicQuota;
}
/**
* Gets the value of the networkQuota property.
*/
public int getNetworkQuota() {
public Integer getNetworkQuota() {
return networkQuota;
}
/**
* Gets the value of the vmQuota property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getVmQuota() {
return vmQuota;
@ -348,9 +288,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the isEnabled property.
*
* @return possible object is
* {@link Boolean }
*/
public Boolean isEnabled() {
return isEnabled;
@ -358,9 +295,6 @@ public class Vdc extends EntityType<Vdc> {
/**
* Gets the value of the status property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getStatus() {
return status;
@ -374,33 +308,23 @@ public class Vdc extends EntityType<Vdc> {
return false;
Vdc that = Vdc.class.cast(o);
return super.equals(that) &&
equal(allocationModel, that.allocationModel) &&
equal(storageCapacity, that.storageCapacity) &&
equal(computeCapacity, that.computeCapacity) &&
equal(resourceEntities, that.resourceEntities) &&
equal(availableNetworks, that.availableNetworks) &&
equal(capabilities, that.capabilities) &&
equal(nicQuota, that.nicQuota) &&
equal(networkQuota, that.networkQuota) &&
equal(vmQuota, that.vmQuota) &&
equal(isEnabled, that.isEnabled) &&
equal(status, that.status);
equal(this.allocationModel, that.allocationModel) &&
equal(this.storageCapacity, that.storageCapacity) &&
equal(this.computeCapacity, that.computeCapacity) &&
equal(this.resourceEntities, that.resourceEntities) &&
equal(this.availableNetworks, that.availableNetworks) &&
equal(this.capabilities, that.capabilities) &&
equal(this.nicQuota, that.nicQuota) &&
equal(this.networkQuota, that.networkQuota) &&
equal(this.vmQuota, that.vmQuota) &&
equal(this.isEnabled, that.isEnabled) &&
equal(this.status, that.status);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(),
allocationModel,
storageCapacity,
computeCapacity,
resourceEntities,
availableNetworks,
capabilities,
nicQuota,
networkQuota,
vmQuota,
isEnabled,
status);
return Objects.hashCode(super.hashCode(), allocationModel, storageCapacity, computeCapacity, resourceEntities, availableNetworks,
capabilities, nicQuota, networkQuota, vmQuota, isEnabled, status);
}
@Override

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 static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
* Represents a VM.
*
* <pre>
* &lt;complexType name="Vm" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "Vm")
public class Vm extends AbstractVAppType<Vm> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVm(this);
}
public static class Builder extends AbstractVAppType.Builder<Vm> {
private String vAppScopedLocalId;
private EnvironmentType environment;
private Boolean needsCustomization;
/**
* @see Vm#getVAppScopedLocalId()
*/
public Builder vAppScopedLocalId(String vAppScopedLocalId) {
this.vAppScopedLocalId = vAppScopedLocalId;
return this;
}
/**
* @see Vm#getEnvironment()
*/
public Builder environment(EnvironmentType environment) {
this.environment = environment;
return this;
}
/**
* @see Vm#getNeedsCustomization()
*/
public Builder isNeedsCustomization(Boolean needsCustomization) {
this.needsCustomization = needsCustomization;
return this;
}
/**
* @see Vm#getNeedsCustomization()
*/
public Builder needsCustomization() {
this.needsCustomization = Boolean.TRUE;
return this;
}
/**
* @see Vm#getNeedsCustomization()
*/
public Builder notNeedsCustomization() {
this.needsCustomization = Boolean.FALSE;
return this;
}
@Override
public Vm build() {
Vm vm = new Vm(href, type, links, description, tasks, id, name, files, status, vAppParent, sections, deployed, vAppScopedLocalId, environment, needsCustomization);
return vm;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder isDeployed(Boolean deployed) {
this.deployed = deployed;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder deployed() {
this.deployed = Boolean.TRUE;
return this;
}
/**
* @see AbstractVAppType#isDeployed()
*/
@Override
public Builder notDeployed() {
this.deployed = Boolean.FALSE;
return this;
}
/**
* @see AbstractVAppType#getVAppParent()
*/
@Override
public Builder parent(Reference vAppParent) {
this.vAppParent = vAppParent;
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
@Override
public Builder sections(List<SectionType<?>> sections) {
if (checkNotNull(sections, "sections").size() > 0)
this.sections = Lists.newArrayList(sections);
return this;
}
/**
* @see AbstractVAppType#getSections()
*/
@Override
public Builder section(SectionType<?> section) {
if (this.sections == null)
this.sections = Lists.newArrayList();
this.sections.add(checkNotNull(section, "section"));
return this;
}
/**
* @see ResourceEntityType#getFiles()
*/
@Override
public Builder files(FilesList files) {
this.files = files;
return this;
}
/**
* @see ResourceEntityType#getStatus()
*/
@Override
public Builder status(Integer status) {
this.status = status;
return this;
}
/**
* @see EntityType#getId()
*/
@Override
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder tasks(Set<Task> tasks) {
if (checkNotNull(tasks, "tasks").size() > 0)
this.tasks = Sets.newLinkedHashSet(tasks);
return this;
}
/**
* @see EntityType#getTasks()
*/
@Override
public Builder task(Task task) {
if (tasks == null)
tasks = Sets.newLinkedHashSet();
this.tasks.add(checkNotNull(task, "task"));
return this;
}
/**
* @see ReferenceType#getHref()
*/
@Override
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see ReferenceType#getType()
*/
@Override
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder link(Link link) {
return Builder.class.cast(super.link(link));
}
@Override
public Builder fromAbstractVAppType(AbstractVAppType<Vm> in) {
return Builder.class.cast(super.fromAbstractVAppType(in));
}
public Builder fromVm(Vm in) {
return fromAbstractVAppType(in).vAppScopedLocalId(in.getVAppScopedLocalId()).environment(in.getEnvironment()).isNeedsCustomization(in.isNeedsCustomization());
}
}
protected Vm() {
// for JAXB and Builders
}
public Vm(URI href, String type, @Nullable Set<Link> links, String description, @Nullable Set<Task> tasks, String id, String name, FilesList files, Integer status, Reference vAppParent,
@Nullable List<SectionType<?>> sections, Boolean deployed, String vAppScopedlocalId, EnvironmentType environment, Boolean needsCustomization) {
super(href, type, links, description, tasks, id, name, files, status, vAppParent, sections, deployed);
this.vAppScopedLocalId = vAppScopedlocalId;
this.environment = environment;
this.needsCustomization = needsCustomization;
}
@XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId;
@XmlElement(name = "Environment", namespace = "http://schemas.dmtf.org/ovf/environment/1")
protected EnvironmentType environment;
@XmlAttribute
protected Boolean needsCustomization;
/**
* Gets the value of the vAppScopedLocalId property.
*
* @return possible object is {@link String }
*/
public String getVAppScopedLocalId() {
return vAppScopedLocalId;
}
/**
* OVF environment section
*
* @return possible object is {@link Environment }
*/
public EnvironmentType getEnvironment() {
return environment;
}
/**
* Gets the value of the needsCustomization property.
*
* @return possible object is {@link Boolean }
*/
public Boolean isNeedsCustomization() {
return needsCustomization;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Vm that = Vm.class.cast(o);
return super.equals(that) &&
equal(this.vAppScopedLocalId, that.vAppScopedLocalId) && equal(this.environment, that.environment) && equal(this.needsCustomization, that.needsCustomization);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), vAppScopedLocalId, environment, needsCustomization);
}
@Override
public ToStringHelper string() {
return super.string().add("vAppScopedLocalId", vAppScopedLocalId).add("environment", environment).add("needsCustomization", needsCustomization);
}
}

View File

@ -0,0 +1,195 @@
/*
* 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.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Represents a question which vSphere issued for a VM in a stuck state(WAITING_FOR_INPUT). It has a question element, a question ID
* element, and a list of choices with at least one element.
*
* <pre>
* &lt;complexType name="VmPendingQuestion" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "VmPendingQuestion")
public class VmPendingQuestion extends ResourceType<VmPendingQuestion> {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return new Builder().fromVmPendingQuestion(this);
}
public static class Builder extends ResourceType.Builder<VmPendingQuestion> {
private String question;
private String questionId;
private List<VmQuestionAnswerChoice> choices;
/**
* @see VmPendingQuestion#getQuestion()
*/
public Builder question(String question) {
this.question = question;
return this;
}
/**
* @see VmPendingQuestion#getQuestionId()
*/
public Builder questionId(String questionId) {
this.questionId = questionId;
return this;
}
/**
* @see VmPendingQuestion#getChoices()
*/
public Builder choices(List<VmQuestionAnswerChoice> choices) {
this.choices = choices;
return this;
}
@Override
public VmPendingQuestion build() {
VmPendingQuestion vmPendingQuestion = new VmPendingQuestion(href, type, links, question, questionId, choices);
return vmPendingQuestion;
}
/**
* @see ResourceType#getHref()
*/
@Override
public Builder href(URI href) {
super.href(href);
return this;
}
/**
* @see ResourceType#getType()
*/
@Override
public Builder type(String type) {
super.type(type);
return this;
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* @see ResourceType#getLinks()
*/
@Override
public Builder link(Link link) {
return Builder.class.cast(super.link(link));
}
@Override
public Builder fromResourceType(ResourceType<VmPendingQuestion> in) {
return Builder.class.cast(super.fromResourceType(in));
}
public Builder fromVmPendingQuestion(VmPendingQuestion in) {
return fromResourceType(in).question(in.getQuestion()).questionId(in.getQuestionId()).choices(in.getChoices());
}
}
protected VmPendingQuestion() {
// For JAXB and builder use
}
public VmPendingQuestion(URI href, String type, Set<Link> links, String question, String questionId, List<VmQuestionAnswerChoice> choices) {
super(href, type, links);
this.question = question;
this.questionId = questionId;
this.choices = choices;
}
@XmlElement(name = "Question", required = true)
protected String question;
@XmlElement(name = "QuestionId", required = true)
protected String questionId;
@XmlElement(name = "Choices", required = true)
protected List<VmQuestionAnswerChoice> choices;
/**
* Gets the value of the question property.
*/
public String getQuestion() {
return question;
}
/**
* Gets the value of the questionId property.
*/
public String getQuestionId() {
return questionId;
}
/**
* Gets the value of the choices property.
*/
public List<VmQuestionAnswerChoice> getChoices() {
return choices;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VmPendingQuestion that = VmPendingQuestion.class.cast(o);
return super.equals(that) &&
equal(this.question, that.question) && equal(this.questionId, that.questionId) && equal(this.choices, that.choices);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), question, questionId, choices);
}
@Override
public ToStringHelper string() {
return super.string().add("question", question).add("questionId", questionId).add("choices", choices);
}
}

View File

@ -0,0 +1,154 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
*
* Represents a VM answer to a question when the VM is in a stuck
* (WAITING_FOR_INPUT) state.
*
*
* <p>Java class for VmQuestionAnswer complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="VmQuestionAnswer">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="ChoiceId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="QuestionId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VmQuestionAnswer", propOrder = {
"choiceId",
"questionId"
})
public class VmQuestionAnswer {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().fromVmQuestionAnswer(this);
}
public static class Builder {
private int choiceId;
private String questionId;
/**
* @see VmQuestionAnswer#getChoiceId()
*/
public Builder choiceId(int choiceId) {
this.choiceId = choiceId;
return this;
}
/**
* @see VmQuestionAnswer#getQuestionId()
*/
public Builder questionId(String questionId) {
this.questionId = questionId;
return this;
}
public VmQuestionAnswer build() {
return new VmQuestionAnswer(choiceId, questionId);
}
public Builder fromVmQuestionAnswer(VmQuestionAnswer in) {
return choiceId(in.getChoiceId()).questionId(in.getQuestionId());
}
}
@XmlElement(name = "ChoiceId")
private int choiceId;
@XmlElement(name = "QuestionId", required = true)
private String questionId;
protected VmQuestionAnswer() {
// For JAXB
}
public VmQuestionAnswer(int choiceId, String questionId) {
this.choiceId = choiceId;
this.questionId = questionId;
}
/**
* Gets the value of the choiceId property.
*
*/
public int getChoiceId() {
return choiceId;
}
/**
* Gets the value of the questionId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getQuestionId() {
return questionId;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VmQuestionAnswer that = VmQuestionAnswer.class.cast(o);
return equal(this.choiceId, that.choiceId) && equal(this.questionId, that.questionId);
}
@Override
public int hashCode() {
return Objects.hashCode(choiceId, questionId);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("choiceId", choiceId).add("questionId", questionId).toString();
}
}

View File

@ -0,0 +1,154 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
*
* Represents a pair of ID and text of an answer choice of a VM question.
*
*
* <p>Java class for VmQuestionAnswerChoice complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="VmQuestionAnswerChoice">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="Text" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VmQuestionAnswerChoice", propOrder = {
"id",
"text"
})
public class VmQuestionAnswerChoice {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().fromVmQuestionAnswerChoice(this);
}
public static class Builder {
private int id;
private String text;
/**
* @see VmQuestionAnswer#getChoiceId()
*/
public Builder id(int id) {
this.id = id;
return this;
}
/**
* @see VmQuestionAnswer#getQuestionId()
*/
public Builder text(String text) {
this.text = text;
return this;
}
public VmQuestionAnswerChoice build() {
return new VmQuestionAnswerChoice(id, text);
}
public Builder fromVmQuestionAnswerChoice(VmQuestionAnswerChoice in) {
return id(in.getId()).text(in.getText());
}
}
protected VmQuestionAnswerChoice() {
// For JAXB
}
public VmQuestionAnswerChoice(int id, String text) {
this.id = id;
this.text = text;
}
@XmlElement(name = "Id")
private int id;
@XmlElement(name = "Text")
private String text;
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Gets the value of the text property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getText() {
return text;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
VmQuestionAnswerChoice that = VmQuestionAnswerChoice.class.cast(o);
return equal(this.id, that.id) && equal(this.text, that.text);
}
@Override
public int hashCode() {
return Objects.hashCode(id, text);
}
@Override
public String toString() {
return Objects.toStringHelper("").add("id", id).add("text", text).toString();
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class AutomaticRecoveryAction extends CimAnySimpleType {
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class AutomaticShutdownAction extends CimAnySimpleType {
}

View File

@ -0,0 +1,32 @@
/*
* 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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class AutomaticStartupAction extends CimAnySimpleType {
}

View File

@ -0,0 +1,70 @@
/*
* 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 org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
/**
* <p>Java class for cimAnySimpleType complex type.
*
* <pre>
* &lt;complexType name="cimAnySimpleType" /&gt;
* </pre>
*/
@XmlType(name = "cimAnySimpleType", namespace = VCLOUD_CIM_NS)
public class CimAnySimpleType {
@XmlValue
@XmlJavaTypeAdapter(CimAnySimpleTypeAdapter.class)
@XmlSchemaType(name = "anySimpleType")
protected String value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,38 @@
/*
* 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 javax.xml.bind.annotation.adapters.XmlAdapter;
public class CimAnySimpleTypeAdapter extends XmlAdapter<String, String> {
@Override
public String unmarshal(String value) {
return (javax.xml.bind.DatatypeConverter.parseAnySimpleType(value));
}
@Override
public String marshal(String value) {
if (value == null) {
return null;
}
return (javax.xml.bind.DatatypeConverter.printAnySimpleType(value));
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* Java class for cimBoolean complex type.
*
* <pre>
* &lt;complexType name="cimBoolean" /&gt;
* </pre>
*/
@XmlType(name = "cimBoolean", namespace = VCLOUD_CIM_NS)
public class CimBoolean {
@XmlValue
protected boolean value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*
*/
public boolean isValue() {
return value;
}
/**
* Sets the value of the value property.
*
*/
public void setValue(boolean value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,96 @@
/*
* 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 org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* Java class for cimReference complex type.
*
* <pre>
* &lt;complexType name="cimReference" /&gt;
* </pre>
*/
@XmlType(name = "cimReference", namespace = VCLOUD_CIM_NS)
public class CimReference {
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* 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 a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,67 @@
/*
* 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 java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* Java class for cimString complex type.
*
* <pre>
* &lt;complexType name="cimString" /&gt;
* </pre>
*/
@XmlType(name = "cimString", namespace = "http://schemas.dmtf.org/wbem/wscim/1/common")
public class CimString {
@XmlValue
protected String value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,82 @@
/*
* 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 java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* Java class for cimUnsignedInt complex type.
*
* <pre>
* &lt;complexType name="cimUnsignedInt" /&gt;
* </pre>
*/
@XmlType(name = "cimUnsignedInt", namespace = "http://schemas.dmtf.org/wbem/wscim/1/common")
public class CimUnsignedInt {
@XmlValue
@XmlSchemaType(name = "unsignedInt")
protected long value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*
*/
public long getValue() {
return value;
}
/**
* Sets the value of the value property.
*
*/
public void setValue(long value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,90 @@
/*
* 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 java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* Java class for cimUnsignedLong complex type.
*
* <pre>
* &lt;complexType name="cimUnsignedLong" /&gt;
* </pre>
*/
@XmlType(name = "cimUnsignedLong", namespace = "http://schemas.dmtf.org/wbem/wscim/1/common")
public class CimUnsignedLong {
@XmlValue
@XmlSchemaType(name = "unsignedLong")
protected BigInteger value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setValue(BigInteger value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,78 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.cim;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* <p>Java class for cimUnsignedShort complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="cimUnsignedShort">
* &lt;simpleContent>
* &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>unsignedShort">
* &lt;anyAttribute processContents='lax'/>
* &lt;/extension>
* &lt;/simpleContent>
* &lt;/complexType>
* </pre>
*/
@XmlType(name = "cimUnsignedShort", namespace = "http://schemas.dmtf.org/wbem/wscim/1/common")
public class CimUnsignedShort {
@XmlValue
@XmlSchemaType(name = "unsignedShort")
protected int value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*
*/
public int getValue() {
return value;
}
/**
* Sets the value of the value property.
*
*/
public void setValue(int value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class ConsumerVisibility extends CimAnySimpleType {
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class MappingBehavior extends CimAnySimpleType {
}

View File

@ -0,0 +1,28 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.cim;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
public class ResourceAllocationCaption
extends JAXBElement<ResourceAllocationCaptionType>
{
protected final static QName NAME = new QName("http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData", "Caption");
public ResourceAllocationCaption(ResourceAllocationCaptionType value) {
super(NAME, ((Class) ResourceAllocationCaptionType.class), null, value);
}
public ResourceAllocationCaption() {
super(NAME, ((Class) ResourceAllocationCaptionType.class), null, null);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class ResourceAllocationCaptionType extends CimString {
}

View File

@ -0,0 +1,28 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.cim;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
public class ResourceAllocationChangeableType
extends JAXBElement<ResourceAllocationChangeableTypeType>
{
protected final static QName NAME = new QName("http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData", "ChangeableType");
public ResourceAllocationChangeableType(ResourceAllocationChangeableTypeType value) {
super(NAME, ((Class) ResourceAllocationChangeableTypeType.class), null, value);
}
public ResourceAllocationChangeableType() {
super(NAME, ((Class) ResourceAllocationChangeableTypeType.class), null, null);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class ResourceAllocationChangeableTypeType extends CimUnsignedShort {
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class ResourceType extends CimAnySimpleType {
}

View File

@ -0,0 +1,28 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.cim;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
public class VirtualSystemCaption
extends JAXBElement<VirtualSystemCaptionType>
{
protected final static QName NAME = new QName("http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData", "Caption");
public VirtualSystemCaption(VirtualSystemCaptionType value) {
super(NAME, ((Class) VirtualSystemCaptionType.class), null, value);
}
public VirtualSystemCaption() {
super(NAME, ((Class) VirtualSystemCaptionType.class), null, null);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*/
@XmlType(name = "")
public class VirtualSystemCaptionType extends CimString {
}

View File

@ -0,0 +1,28 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.cim;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
public class VirtualSystemChangeableType
extends JAXBElement<VirtualSystemChangeableTypeType>
{
protected final static QName NAME = new QName("http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData", "ChangeableType");
public VirtualSystemChangeableType(VirtualSystemChangeableTypeType value) {
super(NAME, ((Class) VirtualSystemChangeableTypeType.class), null, value);
}
public VirtualSystemChangeableType() {
super(NAME, ((Class) VirtualSystemChangeableTypeType.class), null, null);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*/
@XmlType(name = "")
public class VirtualSystemChangeableTypeType extends CimUnsignedShort {
}

View File

@ -17,10 +17,13 @@
* under the License.
*/
@XmlSchema(namespace = VCLOUD_CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED)
@XmlAccessorType(XmlAccessType.FIELD)
package org.jclouds.vcloud.director.v1_5.domain.cim;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

View File

@ -39,10 +39,10 @@ public class Configuration {
}
public static class Builder {
protected String id;
protected boolean isDefault;
protected String label;
protected String description;
private String id;
private boolean isDefault;
private String label;
private String description;
/**
* @see Configuration#getId

View File

@ -45,7 +45,6 @@ import com.google.common.collect.Sets;
@XmlRootElement(name = "DeploymentOptionSection")
public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -93,8 +92,8 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<DeploymentOptionSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<DeploymentOptionSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set;
@ -41,7 +40,7 @@ import com.google.common.collect.Sets;
* @author Adrian Cole
* @author Adam Lowe
*/
@XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS)
@XmlRootElement(name = "DiskSection")
@XmlType(propOrder = {
"disks"
})
@ -61,7 +60,7 @@ public class DiskSection extends SectionType<DiskSection> {
}
public static class Builder extends SectionType.Builder<DiskSection> {
protected Set<Disk> disks = Sets.newLinkedHashSet();
private Set<Disk> disks = Sets.newLinkedHashSet();
/**
* @see DiskSection#getDisks
@ -95,8 +94,8 @@ public class DiskSection extends SectionType<DiskSection> {
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<DiskSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<DiskSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -18,13 +18,14 @@
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseEnvelope;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableSet;
/**
* @author Adrian Cole
@ -33,7 +34,6 @@ import com.google.common.collect.Multimap;
@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS)
public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -41,6 +41,7 @@ public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return new Builder().fromEnvelope(this);
}
@ -50,6 +51,7 @@ public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
/**
* {@inheritDoc}
*/
@Override
public Envelope build() {
return new Envelope(diskSections, networkSections, additionalSections, virtualSystem);
}
@ -57,19 +59,19 @@ public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSection(String name, SectionType additionalSection) {
return Builder.class.cast(super.additionalSection(name, additionalSection));
public Builder additionalSection(SectionType<?> additionalSection) {
this.additionalSections.add(checkNotNull(additionalSection, "additionalSection"));
return this;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Builder additionalSections(Multimap<String, SectionType> additionalSections) {
return Builder.class.cast(super.additionalSections(additionalSections));
public Builder additionalSections(Iterable<? extends SectionType<?>> additionalSections) {
this.additionalSections = ImmutableSet.<SectionType<?>> copyOf(checkNotNull(additionalSections, "additionalSections"));
return this;
}
/**
@ -122,9 +124,8 @@ public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
}
@SuppressWarnings("unchecked")
private Envelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections,
Multimap<String, SectionType> additionalSections, VirtualSystem virtualSystem) {
Iterable<? extends SectionType<?>> additionalSections, VirtualSystem virtualSystem) {
super(diskSections, networkSections, additionalSections, virtualSystem);
}

View File

@ -0,0 +1,271 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.08 at 02:47:44 PM GMT
//
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="order" use="required" type="{http://www.w3.org/2001/XMLSchema}unsignedShort" />
* &lt;attribute name="startDelay" type="{http://www.w3.org/2001/XMLSchema}unsignedShort" default="0" />
* &lt;attribute name="waitingForGuest" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;attribute name="stopDelay" type="{http://www.w3.org/2001/XMLSchema}unsignedShort" default="0" />
* &lt;attribute name="startAction" type="{http://www.w3.org/2001/XMLSchema}string" default="powerOn" />
* &lt;attribute name="stopAction" type="{http://www.w3.org/2001/XMLSchema}string" default="powerOff" />
* &lt;anyAttribute processContents='lax'/>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlType(name = "")
@XmlSeeAlso({
StartupSectionItem.class
})
public class Item {
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1", required = true)
protected String id;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1", required = true)
@XmlSchemaType(name = "unsignedShort")
protected int order;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1")
@XmlSchemaType(name = "unsignedShort")
protected Integer startDelay;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected Boolean waitingForGuest;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1")
@XmlSchemaType(name = "unsignedShort")
protected Integer stopDelay;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected String startAction;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected String stopAction;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the order property.
*
*/
public int getOrder() {
return order;
}
/**
* Sets the value of the order property.
*
*/
public void setOrder(int value) {
this.order = value;
}
/**
* Gets the value of the startDelay property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getStartDelay() {
if (startDelay == null) {
return 0;
} else {
return startDelay;
}
}
/**
* Sets the value of the startDelay property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStartDelay(Integer value) {
this.startDelay = value;
}
/**
* Gets the value of the waitingForGuest property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isWaitingForGuest() {
if (waitingForGuest == null) {
return false;
} else {
return waitingForGuest;
}
}
/**
* Sets the value of the waitingForGuest property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setWaitingForGuest(Boolean value) {
this.waitingForGuest = value;
}
/**
* Gets the value of the stopDelay property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getStopDelay() {
if (stopDelay == null) {
return 0;
} else {
return stopDelay;
}
}
/**
* Sets the value of the stopDelay property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStopDelay(Integer value) {
this.stopDelay = value;
}
/**
* Gets the value of the startAction property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStartAction() {
if (startAction == null) {
return "powerOn";
} else {
return startAction;
}
}
/**
* Sets the value of the startAction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStartAction(String value) {
this.startAction = value;
}
/**
* Gets the value of the stopAction property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStopAction() {
if (stopAction == null) {
return "powerOff";
} else {
return stopAction;
}
}
/**
* Sets the value of the stopAction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStopAction(String value) {
this.stopAction = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}

View File

@ -39,7 +39,6 @@ import com.google.common.collect.Sets;
@XmlRootElement(name = "NetworkSection")
public class NetworkSection extends SectionType<NetworkSection> {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
@ -87,8 +86,8 @@ public class NetworkSection extends SectionType<NetworkSection> {
* {@inheritDoc}
*/
@Override
public Builder fromSection(SectionType<NetworkSection> in) {
return Builder.class.cast(super.fromSection(in));
public Builder fromSectionType(SectionType<NetworkSection> in) {
return Builder.class.cast(super.fromSectionType(in));
}
/**

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