diff --git a/labs/dmtf/pom.xml b/labs/dmtf/pom.xml new file mode 100644 index 0000000000..28ad055190 --- /dev/null +++ b/labs/dmtf/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.5.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + dmtf + jclouds dmtf domain objects + jclouds implementation of DMTF OVF and CIM domain objects + bundle + + + + + + + org.jclouds + jclouds-compute + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-log4j + ${project.version} + test + + + + + + + org.apache.felix + maven-bundle-plugin + + + ${project.artifactId} + org.jclouds.dmtf.*;version="${project.version}" + + org.jclouds*;version="${project.version}", + * + + + + + + + diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/DMTFConstants.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/DMTFConstants.java new file mode 100644 index 0000000000..decf84dbb6 --- /dev/null +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/DMTFConstants.java @@ -0,0 +1,37 @@ +/* + * 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.dmtf; + +/** + * Constants used by DMTF. + * + * @author grkvlt@apache.org + */ +public class DMTFConstants { + + public static final String OVF_NS = "http://schemas.dmtf.org/ovf/envelope/1"; + + public static final String OVF_ENV_NS = "http://schemas.dmtf.org/ovf/environment/1"; + + public static final String CIM_NS = "http://schemas.dmtf.org/wbem/wscim/1/common"; + + public static final String CIM_VSSD_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; + + public static final String CIM_RASD_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleType.java similarity index 90% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleType.java index d527e3e76e..943a919bde 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleType.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; import java.util.HashMap; import java.util.Map; @@ -37,7 +37,7 @@ import javax.xml.namespace.QName; * <complexType name="cimAnySimpleType" /> * */ -@XmlType(name = "cimAnySimpleType", namespace = VCLOUD_CIM_NS) +@XmlType(name = "cimAnySimpleType", namespace = CIM_NS) public class CimAnySimpleType { @XmlValue diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleTypeAdapter.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleTypeAdapter.java similarity index 95% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleTypeAdapter.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleTypeAdapter.java index 8eff91d360..4c3238624d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimAnySimpleTypeAdapter.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimAnySimpleTypeAdapter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import javax.xml.bind.annotation.adapters.XmlAdapter; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimBoolean.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimBoolean.java similarity index 91% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimBoolean.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimBoolean.java index 7ca5cceb1a..ea185d0c28 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimBoolean.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimBoolean.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; import java.util.HashMap; import java.util.Map; @@ -35,7 +35,7 @@ import javax.xml.namespace.QName; * <complexType name="cimBoolean" /> * */ -@XmlType(name = "cimBoolean", namespace = VCLOUD_CIM_NS) +@XmlType(name = "cimBoolean", namespace = CIM_NS) public class CimBoolean { @XmlValue diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimReference.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java similarity index 93% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimReference.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java index 8c90b242e9..9276c89c53 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimReference.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimReference.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +37,7 @@ import javax.xml.namespace.QName; * <complexType name="cimReference" /> * */ -@XmlType(name = "cimReference", namespace = VCLOUD_CIM_NS) +@XmlType(name = "cimReference", namespace = CIM_NS) public class CimReference { @XmlAnyElement(lax = true) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimString.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimString.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimString.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimString.java index 08c9f20323..e0706e03e0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimString.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimString.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import static com.google.common.base.Objects.equal; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedInt.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedInt.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedInt.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedInt.java index e78d7f1c88..07f2bd902f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedInt.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedInt.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import java.util.HashMap; import java.util.Map; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedLong.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedLong.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedLong.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedLong.java index d920852b6e..1102d82135 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedLong.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedLong.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import java.math.BigInteger; import java.util.HashMap; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedShort.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedShort.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedShort.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedShort.java index 24114eac2b..47e420fbb1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/CimUnsignedShort.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/CimUnsignedShort.java @@ -6,7 +6,7 @@ // -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import java.util.HashMap; import java.util.Map; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/OSType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/OSType.java similarity index 99% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/OSType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/OSType.java index 7e4b9a4289..006776e78c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/OSType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/OSType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import org.jclouds.compute.domain.OsFamily; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationCaption.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationCaption.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationCaption.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationCaption.java index fdbba4e431..c2067437ee 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationCaption.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationCaption.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationChangeableType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationChangeableType.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationChangeableType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationChangeableType.java index 5a79ee798d..787313a9e6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationChangeableType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationChangeableType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationSettingData.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationSettingData.java similarity index 72% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationSettingData.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationSettingData.java index 67dbd71f64..33e0fbf7f7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/ResourceAllocationSettingData.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/ResourceAllocationSettingData.java @@ -16,35 +16,27 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_RASD_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import java.math.BigInteger; -import java.net.URI; import java.util.Collections; -import java.util.List; import java.util.Map; import java.util.Set; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.Link; - import com.google.common.base.Function; import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; +import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -61,10 +53,9 @@ import com.google.common.collect.Sets; * * @author Adrian Cole * @author grkvlt@apache.org - * @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd + * @see CIM_ResourceAllocationSettingData */ -@XmlRootElement(name = "Item", namespace = VCLOUD_1_5_NS) -@XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = VCLOUD_OVF_NS, +@XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = OVF_NS, propOrder = { "address", "addressOnParent", @@ -88,21 +79,23 @@ import com.google.common.collect.Sets; "resourceType", "virtualQuantity", "virtualQuantityUnits", - "weight", - "links" + "weight" } ) public class ResourceAllocationSettingData { - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new ConcreteBuilder(); } - public Builder toBuilder() { + public Builder toBuilder() { return builder().fromResourceAllocationSettingData(this); } - public static class Builder { + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> { private String elementName; private String instanceID; @@ -125,254 +118,219 @@ public class ResourceAllocationSettingData { private BigInteger virtualQuantity; private String virtualQuantityUnits; private Long weight; - private List connections = Lists.newArrayList(); - private List hostResources = Lists.newArrayList(); - private URI href; - private String type; - private Set links = Sets.newLinkedHashSet(); + private Set connections = Sets.newLinkedHashSet(); + private Set hostResources = Sets.newLinkedHashSet(); + + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } /** * @see ResourceAllocationSettingData#getElementName() */ - public Builder elementName(String elementName) { + public B elementName(String elementName) { this.elementName = elementName; - return this; + return self(); } /** *@see ResourceAllocationSettingData#getInstanceId() */ - public Builder instanceID(String instanceID) { + public B instanceID(String instanceID) { this.instanceID = instanceID; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getCaption() */ - public Builder caption(String caption) { + public B caption(String caption) { this.caption = caption; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getDescription() */ - public Builder description(String description) { + public B description(String description) { this.description = description; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getAddress */ - public Builder address(String address) { + public B address(String address) { this.address = address; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getAddressOnParent */ - public Builder addressOnParent(String addressOnParent) { + public B addressOnParent(String addressOnParent) { this.addressOnParent = addressOnParent; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getAllocationUnits */ - public Builder allocationUnits(String allocationUnits) { + public B allocationUnits(String allocationUnits) { this.allocationUnits = allocationUnits; - return this; + return self(); } /** * @see ResourceAllocationSettingData#isAutomaticAllocation() */ - public Builder automaticAllocation(Boolean automaticAllocation) { + public B automaticAllocation(Boolean automaticAllocation) { this.automaticAllocation = automaticAllocation; - return this; + return self(); } /** * @see ResourceAllocationSettingData#isAutomaticDeallocation() */ - public Builder automaticDeallocation(Boolean automaticDeallocation) { + public B automaticDeallocation(Boolean automaticDeallocation) { this.automaticDeallocation = automaticDeallocation; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getConsumerVisibility */ - public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { + public B consumerVisibility(ConsumerVisibility consumerVisibility) { this.consumerVisibility = consumerVisibility; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getLimit */ - public Builder limit(BigInteger limit) { + public B limit(BigInteger limit) { this.limit = limit; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getMappingBehavior */ - public Builder mappingBehavior(MappingBehavior mappingBehavior) { + public B mappingBehavior(MappingBehavior mappingBehavior) { this.mappingBehavior = mappingBehavior; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getOtherResourceType */ - public Builder otherResourceType(String otherResourceType) { + public B otherResourceType(String otherResourceType) { this.otherResourceType = otherResourceType; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getParent */ - public Builder parent(String parent) { + public B parent(String parent) { this.parent = parent; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getPoolID */ - public Builder poolID(String poolID) { + public B poolID(String poolID) { this.poolID = poolID; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getReservation */ - public Builder reservation(BigInteger reservation) { + public B reservation(BigInteger reservation) { this.reservation = reservation; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getResourceSubType */ - public Builder resourceSubType(String resourceSubType) { + public B resourceSubType(String resourceSubType) { this.resourceSubType = resourceSubType; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getResourceType */ - public Builder resourceType(ResourceType resourceType) { + public B resourceType(ResourceType resourceType) { this.resourceType = resourceType; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getVirtualQuantity */ - public Builder virtualQuantity(BigInteger virtualQuantity) { + public B virtualQuantity(BigInteger virtualQuantity) { this.virtualQuantity = virtualQuantity; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getVirtualQuantityUnits */ - public Builder virtualQuantityUnits(String virtualQuantityUnits) { + public B virtualQuantityUnits(String virtualQuantityUnits) { this.virtualQuantityUnits = virtualQuantityUnits; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getWeight */ - public Builder weight(Long weight) { + public B weight(Long weight) { this.weight = weight; - return this; + return self(); } /** * @see ResourceAllocationSettingData#getConnections() */ - public Builder connection(CimString connection) { + public B connection(CimString connection) { this.connections.add(checkNotNull(connection, "connection")); - return this; + return self(); } /** * @see ResourceAllocationSettingData#getConnections */ - public Builder connections(List connections) { - this.connections = Lists.newArrayList(checkNotNull(connections, "connections")); - return this; + public B connections(Iterable connections) { + this.connections = Sets.newLinkedHashSet(checkNotNull(connections, "connections")); + return self(); } /** * @see ResourceAllocationSettingData#getHostResources() */ - public Builder hostResource(CimString hostResource) { + public B hostResource(CimString hostResource) { this.hostResources.add(checkNotNull(hostResource, "hostResource")); - return this; + return self(); } /** * @see ResourceAllocationSettingData#getHostResources */ - public Builder hostResources(List hostResources) { - this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources")); - return this; - } - - /** - * @see ResourceAllocationSettingData#getType() - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * @see ResourceAllocationSettingData#getHref() - */ - public Builder href(URI href) { - this.href = href; - return this; - } - - /** - * @see ResourceAllocationSettingData#getLinks() - */ - public Builder links(Set links) { - this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); - return this; - } - - /** - * @see ResourceAllocationSettingData#getLinks() - */ - public Builder link(Link link) { - if (links == null) - links = Sets.newLinkedHashSet(); - this.links.add(checkNotNull(link, "link")); - return this; + public B hostResources(Iterable hostResources) { + this.hostResources = Sets.newLinkedHashSet(checkNotNull(hostResources, "hostResources")); + return self(); } public ResourceAllocationSettingData build() { - return new ResourceAllocationSettingData(elementName, instanceID, caption, description, address, - addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, - mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, - virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, type, href, links); + return new ResourceAllocationSettingData(this); } - public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { + public B fromResourceAllocationSettingData(ResourceAllocationSettingData in) { return elementName(in.getElementName()) .instanceID(in.getInstanceID()) .caption(in.getCaption()) @@ -395,10 +353,7 @@ public class ResourceAllocationSettingData { .virtualQuantityUnits(in.getVirtualQuantityUnits()) .weight(in.getWeight()) .connections(in.getConnections()) - .hostResources(in.getHostResources()) - .type(in.getType()) - .href(in.getHref()) - .links(Sets.newLinkedHashSet(in.getLinks())); + .hostResources(in.getHostResources()); } } @@ -560,96 +515,80 @@ public class ResourceAllocationSettingData { } } - // foo - - @XmlElement(name = "ElementName", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "ElementName", namespace = CIM_RASD_NS) private String elementName; - @XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "InstanceID", namespace = CIM_RASD_NS) private String instanceID; - @XmlElement(name = "Caption", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Caption", namespace = CIM_RASD_NS) private String caption; - @XmlElement(name = "Description", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Description", namespace = CIM_RASD_NS) private String description; - @XmlElement(name = "Address", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Address", namespace = CIM_RASD_NS) private String address; - @XmlElement(name = "AddressOnParent", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "AddressOnParent", namespace = CIM_RASD_NS) private String addressOnParent; - @XmlElement(name = "AllocationUnits", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "AllocationUnits", namespace = CIM_RASD_NS) private String allocationUnits; - @XmlElement(name = "AutomaticAllocation", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "AutomaticAllocation", namespace = CIM_RASD_NS) private Boolean automaticAllocation; - @XmlElement(name = "AutomaticDeallocation", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "AutomaticDeallocation", namespace = CIM_RASD_NS) private Boolean automaticDeallocation; - @XmlElement(name = "ConsumerVisibility", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "ConsumerVisibility", namespace = CIM_RASD_NS) private ConsumerVisibility consumerVisibility; - @XmlElement(name = "Limit", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Limit", namespace = CIM_RASD_NS) private BigInteger limit; - @XmlElement(name = "MappingBehavior", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "MappingBehavior", namespace = CIM_RASD_NS) private MappingBehavior mappingBehavior; - @XmlElement(name = "OtherResourceType", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "OtherResourceType", namespace = CIM_RASD_NS) private String otherResourceType; - @XmlElement(name = "Parent", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Parent", namespace = CIM_RASD_NS) private String parent; - @XmlElement(name = "PoolID", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "PoolID", namespace = CIM_RASD_NS) private String poolID; - @XmlElement(name = "Reservation", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Reservation", namespace = CIM_RASD_NS) private BigInteger reservation; - @XmlElement(name = "ResourceSubType", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "ResourceSubType", namespace = CIM_RASD_NS) private String resourceSubType; - @XmlElement(name = "ResourceType", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "ResourceType", namespace = CIM_RASD_NS) private ResourceType resourceType; - @XmlElement(name = "VirtualQuantity", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "VirtualQuantity", namespace = CIM_RASD_NS) private BigInteger virtualQuantity; - @XmlElement(name = "VirtualQuantityUnits", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "VirtualQuantityUnits", namespace = CIM_RASD_NS) private String virtualQuantityUnits; - @XmlElement(name = "Weight", namespace = VCLOUD_CIM_RASD_NS) + @XmlElement(name = "Weight", namespace = CIM_RASD_NS) private Long weight; - @XmlElement(name = "Connection", namespace = VCLOUD_CIM_RASD_NS) - private List connections = Lists.newArrayList(); - @XmlElement(name = "HostResource", namespace = VCLOUD_CIM_RASD_NS) - private List hostResources = Lists.newArrayList(); - @XmlAttribute(name = "type", namespace = VCLOUD_1_5_NS) - private String type; - @XmlAttribute(name = "href", namespace = VCLOUD_1_5_NS) - private URI href; - @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) - private Set links = Sets.newLinkedHashSet(); + @XmlElement(name = "Connection", namespace = CIM_RASD_NS) + private Set connections = Sets.newLinkedHashSet(); + @XmlElement(name = "HostResource", namespace = CIM_RASD_NS) + private Set hostResources = Sets.newLinkedHashSet(); - private ResourceAllocationSettingData(String elementName, String instanceID, String caption, String description, - String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation, - Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, BigInteger limit, - MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, BigInteger reservation, - String resourceSubType, ResourceType resourceType, BigInteger virtualQuantity, String virtualQuantityUnits, - Long weight, List connections, List hostResources, String type, URI href, Set links) { - this.elementName = elementName; - this.instanceID = instanceID; - this.caption = caption; - this.description = description; - this.address = address; - this.addressOnParent = addressOnParent; - this.allocationUnits = allocationUnits; - this.automaticAllocation = automaticAllocation; - this.automaticDeallocation = automaticDeallocation; - this.consumerVisibility = consumerVisibility; - this.limit = limit; - this.mappingBehavior = mappingBehavior; - this.otherResourceType = otherResourceType; - this.parent = parent; - this.poolID = poolID; - this.reservation = reservation; - this.resourceSubType = resourceSubType; - this.resourceType = resourceType; - this.virtualQuantity = virtualQuantity; - this.virtualQuantityUnits = virtualQuantityUnits; - this.weight = weight; - this.connections = ImmutableList.copyOf(connections); - this.hostResources = ImmutableList.copyOf(hostResources); - this.type = type; - this.href = href; - this.links = links != null ? ImmutableSet.copyOf(links) : Collections.emptySet(); + protected ResourceAllocationSettingData(Builder builder) { + this.elementName = builder.elementName; + this.instanceID = builder.instanceID; + this.caption = builder.caption; + this.description = builder.description; + this.address = builder.address; + this.addressOnParent = builder.addressOnParent; + this.allocationUnits = builder.allocationUnits; + this.automaticAllocation = builder.automaticAllocation; + this.automaticDeallocation = builder.automaticDeallocation; + this.consumerVisibility = builder.consumerVisibility; + this.limit = builder.limit; + this.mappingBehavior = builder.mappingBehavior; + this.otherResourceType = builder.otherResourceType; + this.parent = builder.parent; + this.poolID = builder.poolID; + this.reservation = builder.reservation; + this.resourceSubType = builder.resourceSubType; + this.resourceType = builder.resourceType; + this.virtualQuantity = builder.virtualQuantity; + this.virtualQuantityUnits = builder.virtualQuantityUnits; + this.weight = builder.weight; + this.connections = builder.connections != null ? ImmutableSet.copyOf(builder.connections) : Collections.emptySet(); + this.hostResources = builder.hostResources != null ? ImmutableSet.copyOf(builder.hostResources) : Collections.emptySet(); } - private ResourceAllocationSettingData() { + protected ResourceAllocationSettingData() { // for JAXB } @@ -808,7 +747,6 @@ public class ResourceAllocationSettingData { /** * A string describing an implementation specific sub-type for this resource. - * F */ public String getResourceSubType() { return resourceSubType; @@ -864,8 +802,8 @@ public class ResourceAllocationSettingData { * The thing to which this resource is connected. For example, a named * network or switch port. */ - public List getConnections() { - return Collections.unmodifiableList(connections); + public Set getConnections() { + return ImmutableSet.copyOf(connections); } /** @@ -886,30 +824,19 @@ public class ResourceAllocationSettingData { * value(s) to indicate that the requested virtual resource allocation be * based on host resources that are identified by element values. */ - public List getHostResources() { - return Collections.unmodifiableList(hostResources); - } - - public String getType() { - return type; - } - - public URI getHref() { - return href; - } - - /** - * Set of optional links to an entity or operation associated with this object. - */ - public Set getLinks() { - return links != null ? ImmutableSet.copyOf(links) : Collections.emptySet(); + public Set getHostResources() { + return ImmutableSet.copyOf(hostResources); } @Override public String toString() { + return string().toString(); + } + + public ToStringHelper string() { return Objects.toStringHelper("") - .add("elementname", elementName) - .add("instanceId", instanceID) + .add("elementName", elementName) + .add("instanceID", instanceID) .add("caption", caption) .add("description", description) .add("address", address) @@ -930,11 +857,7 @@ public class ResourceAllocationSettingData { .add("resourceType", resourceType) .add("virtualQuantity", virtualQuantity) .add("virtualQuantityUnits", virtualQuantityUnits) - .add("weight", weight) - .add("type", type) - .add("href", href) - .add("links", links) - .toString(); + .add("weight", weight); } @Override @@ -944,7 +867,7 @@ public class ResourceAllocationSettingData { automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, - resourceType, virtualQuantity, virtualQuantityUnits, weight, type, href, links); + resourceType, virtualQuantity, virtualQuantityUnits, weight); } @Override @@ -978,10 +901,7 @@ public class ResourceAllocationSettingData { equal(this.resourceType, that.resourceType) && equal(this.virtualQuantity, that.virtualQuantity) && equal(this.virtualQuantityUnits, that.virtualQuantityUnits) && - equal(this.weight, that.weight) && - equal(this.type, that.type) && - equal(this.href, that.href) && - equal(this.links, that.links); + equal(this.weight, that.weight); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemCaption.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemCaption.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemCaption.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemCaption.java index 26defdac88..3a469d780c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemCaption.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemCaption.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemChangeableType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemChangeableType.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemChangeableType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemChangeableType.java index 38847d644a..b5fd366e1b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemChangeableType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemChangeableType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemSettingData.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemSettingData.java similarity index 76% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemSettingData.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemSettingData.java index 062368073c..0402a6b842 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/VirtualSystemSettingData.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/VirtualSystemSettingData.java @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.cim; +package org.jclouds.dmtf.cim; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_VSSD_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import java.math.BigInteger; import java.util.Date; @@ -58,9 +58,9 @@ import com.google.common.collect.Maps; * * @author Adrian Cole * @author grkvlt@apache.org - * @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd + * @see CIM_VirtualSystemSettingData */ -@XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = VCLOUD_OVF_NS, +@XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = OVF_NS, propOrder = { "automaticRecoveryAction", "automaticShutdownAction", @@ -87,15 +87,18 @@ import com.google.common.collect.Maps; ) public class VirtualSystemSettingData { - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new ConcreteBuilder(); } - public Builder toBuilder() { + public Builder toBuilder() { return builder().fromVirtualSystemSettingData(this); } - public static class Builder { + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> { private String elementName; private String instanceID; @@ -119,120 +122,121 @@ public class VirtualSystemSettingData { private String virtualSystemType; private String notes; - public Builder elementName(String elementName) { + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } + + public B elementName(String elementName) { this.elementName = elementName; - return this; + return self(); } - public Builder instanceID(String instanceID) { + public B instanceID(String instanceID) { this.instanceID = instanceID; - return this; + return self(); } - public Builder caption(String caption) { + public B caption(String caption) { this.caption = caption; - return this; + return self(); } - public Builder description(String description) { + public B description(String description) { this.description = description; - return this; + return self(); } - public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) { + public B automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) { this.automaticRecoveryAction = automaticRecoveryAction; - return this; + return self(); } - public Builder automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) { + public B automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) { this.automaticShutdownAction = automaticShutdownAction; - return this; + return self(); } - public Builder automaticStartupAction(AutomaticStartupAction automaticStartupAction) { + public B automaticStartupAction(AutomaticStartupAction automaticStartupAction) { this.automaticStartupAction = automaticStartupAction; - return this; + return self(); } - public Builder automaticStartupActionDelay(BigInteger automaticStartupActionDelay) { + public B automaticStartupActionDelay(BigInteger automaticStartupActionDelay) { this.automaticStartupActionDelay = automaticStartupActionDelay; - return this; + return self(); } - public Builder automaticStartupActionSequenceNumber(Long automaticStartupActionSequenceNumber) { + public B automaticStartupActionSequenceNumber(Long automaticStartupActionSequenceNumber) { this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber; - return this; + return self(); } - public Builder configurationDataRoot(String configurationDataRoot) { + public B configurationDataRoot(String configurationDataRoot) { this.configurationDataRoot = configurationDataRoot; - return this; + return self(); } - public Builder configurationFile(String configurationFile) { + public B configurationFile(String configurationFile) { this.configurationFile = configurationFile; - return this; + return self(); } - public Builder configurationID(String configurationID) { + public B configurationID(String configurationID) { this.configurationID = configurationID; - return this; + return self(); } - public Builder creationTime(Date creationTime) { + public B creationTime(Date creationTime) { this.creationTime = creationTime; - return this; + return self(); } - public Builder logDataRoot(String logDataRoot) { + public B logDataRoot(String logDataRoot) { this.logDataRoot = logDataRoot; - return this; + return self(); } - public Builder recoveryFile(String recoveryFile) { + public B recoveryFile(String recoveryFile) { this.recoveryFile = recoveryFile; - return this; + return self(); } - public Builder snapshotDataRoot(String snapshotDataRoot) { + public B snapshotDataRoot(String snapshotDataRoot) { this.snapshotDataRoot = snapshotDataRoot; - return this; + return self(); } - public Builder suspendDataRoot(String suspendDataRoot) { + public B suspendDataRoot(String suspendDataRoot) { this.suspendDataRoot = suspendDataRoot; - return this; + return self(); } - public Builder swapFileDataRoot(String swapFileDataRoot) { + public B swapFileDataRoot(String swapFileDataRoot) { this.swapFileDataRoot = swapFileDataRoot; - return this; + return self(); } - public Builder virtualSystemIdentifier(String virtualSystemIdentifier) { + public B virtualSystemIdentifier(String virtualSystemIdentifier) { this.virtualSystemIdentifier = virtualSystemIdentifier; - return this; + return self(); } - public Builder virtualSystemType(String virtualSystemType) { + public B virtualSystemType(String virtualSystemType) { this.virtualSystemType = virtualSystemType; - return this; + return self(); } - public Builder notes(String notes) { + public B notes(String notes) { this.notes = notes; - return this; + return self(); } public VirtualSystemSettingData build() { - return new VirtualSystemSettingData(elementName, instanceID, caption, description, automaticRecoveryAction, - automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay, - automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID, - creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot, - virtualSystemIdentifier, virtualSystemType, notes); + return new VirtualSystemSettingData(this); } - public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) { + public B fromVirtualSystemSettingData(VirtualSystemSettingData in) { return elementName(in.getElementName()) .instanceID(in.getInstanceID()) .caption(in.getCaption()) @@ -363,49 +367,73 @@ public class VirtualSystemSettingData { } } - @XmlElement(name = "ElementName", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "ElementName", namespace = CIM_VSSD_NS) private String elementName; - @XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "InstanceID", namespace = CIM_VSSD_NS) private String instanceID; - @XmlElement(name = "Caption", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "Caption", namespace = CIM_VSSD_NS) private String caption; - @XmlElement(name = "Description", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "Description", namespace = CIM_VSSD_NS) private String description; - @XmlElement(name = "VirtualSystemIdentifier", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "VirtualSystemIdentifier", namespace = CIM_VSSD_NS) private String virtualSystemIdentifier; - @XmlElement(name = "VirtualSystemType", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "VirtualSystemType", namespace = CIM_VSSD_NS) private String virtualSystemType; - @XmlElement(name = "AutomaticRecoveryAction", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "AutomaticRecoveryAction", namespace = CIM_VSSD_NS) private AutomaticRecoveryAction automaticRecoveryAction; - @XmlElement(name = "AutomaticShutdownAction", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "AutomaticShutdownAction", namespace = CIM_VSSD_NS) private AutomaticShutdownAction automaticShutdownAction; - @XmlElement(name = "AutomaticStartupAction", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "AutomaticStartupAction", namespace = CIM_VSSD_NS) private AutomaticStartupAction automaticStartupAction; - @XmlElement(name = "AutomaticStartupActionDelay", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "AutomaticStartupActionDelay", namespace = CIM_VSSD_NS) private BigInteger automaticStartupActionDelay; - @XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = CIM_VSSD_NS) private Long automaticStartupActionSequenceNumber; - @XmlElement(name = "ConfigurationDataRoot", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "ConfigurationDataRoot", namespace = CIM_VSSD_NS) private String configurationDataRoot; - @XmlElement(name = "ConfigurationFile", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "ConfigurationFile", namespace = CIM_VSSD_NS) private String configurationFile; - @XmlElement(name = "ConfigurationID", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "ConfigurationID", namespace = CIM_VSSD_NS) private String configurationID; - @XmlElement(name = "CreationTime", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "CreationTime", namespace = CIM_VSSD_NS) private Date creationTime; - @XmlElement(name = "LogDataRoot", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "LogDataRoot", namespace = CIM_VSSD_NS) private String logDataRoot; - @XmlElement(name = "RecoveryFile", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "RecoveryFile", namespace = CIM_VSSD_NS) private String recoveryFile; - @XmlElement(name = "SnapshotDataRoot", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "SnapshotDataRoot", namespace = CIM_VSSD_NS) private String snapshotDataRoot; - @XmlElement(name = "SuspendDataRoot", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "SuspendDataRoot", namespace = CIM_VSSD_NS) private String suspendDataRoot; - @XmlElement(name = "SwapFileDataRoot", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "SwapFileDataRoot", namespace = CIM_VSSD_NS) private String swapFileDataRoot; - @XmlElement(name = "Notes", namespace = VCLOUD_CIM_VSSD_NS) + @XmlElement(name = "Notes", namespace = CIM_VSSD_NS) private String notes; + private VirtualSystemSettingData(Builder builder) { + this.elementName = builder.elementName; + this.instanceID = builder.instanceID; + this.caption = builder.caption; + this.description = builder.description; + this.automaticRecoveryAction = builder.automaticRecoveryAction; + this.automaticShutdownAction = builder.automaticShutdownAction; + this.automaticStartupAction = builder.automaticStartupAction; + this.automaticStartupActionDelay = builder.automaticStartupActionDelay; + this.automaticStartupActionSequenceNumber = builder.automaticStartupActionSequenceNumber; + this.configurationDataRoot = builder.configurationDataRoot; + this.configurationFile = builder.configurationFile; + this.configurationID = builder.configurationID; + this.creationTime = builder.creationTime; + this.logDataRoot = builder.logDataRoot; + this.recoveryFile = builder.recoveryFile; + this.snapshotDataRoot = builder.snapshotDataRoot; + this.suspendDataRoot = builder.suspendDataRoot; + this.swapFileDataRoot = builder.swapFileDataRoot; + this.virtualSystemIdentifier = builder.virtualSystemIdentifier; + this.virtualSystemType = builder.virtualSystemType; + this.notes = builder.notes; + } + private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description, AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction, AutomaticStartupAction automaticStartupAction, BigInteger automaticStartupActionDelay, @@ -644,26 +672,26 @@ public class VirtualSystemSettingData { if (getClass() != obj.getClass()) return false; VirtualSystemSettingData that = VirtualSystemSettingData.class.cast(obj); - return equal(this.elementName, that.elementName) && - equal(this.instanceID, that.instanceID) && - equal(this.caption, that.caption) && - equal(this.description, that.description) && - equal(this.automaticRecoveryAction, that.automaticRecoveryAction) && - equal(this.automaticShutdownAction, that.automaticShutdownAction) && - equal(this.automaticStartupAction, that.automaticStartupAction) && - equal(this.automaticStartupActionDelay, that.automaticStartupActionDelay) && - equal(this.automaticStartupActionSequenceNumber, that.automaticStartupActionSequenceNumber) && - equal(this.configurationDataRoot, that.configurationDataRoot) && - equal(this.configurationFile, that.configurationFile) && - equal(this.configurationID, that.configurationID) && - equal(this.creationTime, that.creationTime) && - equal(this.logDataRoot, that.logDataRoot) && - equal(this.recoveryFile, that.recoveryFile) && - equal(this.snapshotDataRoot, that.snapshotDataRoot) && - equal(this.suspendDataRoot, that.suspendDataRoot) && - equal(this.swapFileDataRoot, that.swapFileDataRoot) && - equal(this.virtualSystemIdentifier, that.virtualSystemIdentifier) && - equal(this.virtualSystemType, that.virtualSystemType); + return equal(this.elementName, that.elementName) + && equal(this.instanceID, that.instanceID) + && equal(this.caption, that.caption) + && equal(this.description, that.description) + && equal(this.automaticRecoveryAction, that.automaticRecoveryAction) + && equal(this.automaticShutdownAction, that.automaticShutdownAction) + && equal(this.automaticStartupAction, that.automaticStartupAction) + && equal(this.automaticStartupActionDelay, that.automaticStartupActionDelay) + && equal(this.automaticStartupActionSequenceNumber, that.automaticStartupActionSequenceNumber) + && equal(this.configurationDataRoot, that.configurationDataRoot) + && equal(this.configurationFile, that.configurationFile) + && equal(this.configurationID, that.configurationID) + && equal(this.creationTime, that.creationTime) + && equal(this.logDataRoot, that.logDataRoot) + && equal(this.recoveryFile, that.recoveryFile) + && equal(this.snapshotDataRoot, that.snapshotDataRoot) + && equal(this.suspendDataRoot, that.suspendDataRoot) + && equal(this.swapFileDataRoot, that.swapFileDataRoot) + && equal(this.virtualSystemIdentifier, that.virtualSystemIdentifier) + && equal(this.virtualSystemType, that.virtualSystemType); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/package-info.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/package-info.java similarity index 54% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/package-info.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/cim/package-info.java index eab73abaf2..99b3064a1c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/cim/package-info.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/cim/package-info.java @@ -16,22 +16,21 @@ * specific language governing permissions and limitations * under the License. */ -@XmlSchema(namespace = VCLOUD_CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED, +@XmlSchema(namespace = CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), - @XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS), - @XmlNs(prefix = "vssd", namespaceURI = VCLOUD_CIM_VSSD_NS), - @XmlNs(prefix = "rasd", namespaceURI = VCLOUD_CIM_RASD_NS), - @XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS) + @XmlNs(prefix = "cim", namespaceURI = CIM_NS), + @XmlNs(prefix = "ovf", namespaceURI = OVF_NS), + @XmlNs(prefix = "vssd", namespaceURI = CIM_VSSD_NS), + @XmlNs(prefix = "rasd", namespaceURI = CIM_RASD_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) -package org.jclouds.vcloud.director.v1_5.domain.cim; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +package org.jclouds.dmtf.cim; + +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_RASD_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_VSSD_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Configuration.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Configuration.java index dcc7c2d3aa..a35cc7afbf 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Configuration.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Configuration.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; @@ -30,7 +30,7 @@ import com.google.common.base.Objects; * @author Adrian Cole * @author Adam Lowe */ -@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = { +@XmlType(name = "Configuration", namespace = OVF_NS, propOrder = { "label", "description" }) public class Configuration { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DeploymentOptionSection.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DeploymentOptionSection.java index a9fb6707c1..8cb3161d47 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DeploymentOptionSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DeploymentOptionSection.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Disk.java similarity index 99% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Disk.java index e869d5e9f8..0227061cfa 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Disk.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Disk.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import java.net.URI; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DiskSection.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DiskSection.java index a697545f6b..69567fbde0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/DiskSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/DiskSection.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Item.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java similarity index 99% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Item.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java index 8f35ce8487..ae3e15e13e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Item.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Item.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/MsgType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/MsgType.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/MsgType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/MsgType.java index e0695793c5..cb18197068 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/MsgType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/MsgType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Network.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Network.java index d58df57f62..14850834c3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Network.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import javax.xml.bind.annotation.XmlRootElement; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/NetworkSection.java similarity index 91% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/NetworkSection.java index 06c4ff6f3e..c165436a1a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/NetworkSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/NetworkSection.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Preconditions.checkNotNull; @@ -84,7 +84,7 @@ public class NetworkSection extends SectionType { private NetworkSection(Builder builder) { super(builder); - this.networks = ImmutableSet. copyOf(checkNotNull(networks, "networks")); + this.networks = ImmutableSet.copyOf(checkNotNull(networks, "networks")); } private NetworkSection() { @@ -94,8 +94,6 @@ public class NetworkSection extends SectionType { /** * All networks referred to from Connection elements in all {@link VirtualHardwareSection} * elements shall be defined in the NetworkSection. - * - * @return */ public Set getNetworks() { return networks; @@ -115,12 +113,14 @@ public class NetworkSection extends SectionType { if (getClass() != obj.getClass()) return false; NetworkSection other = (NetworkSection) obj; - return super.equals(other) && Objects.equal(networks, other.networks); + return super.equals(other) + && Objects.equal(networks, other.networks); } @Override protected Objects.ToStringHelper string() { - return super.string().add("networks", networks); + return super.string() + .add("networks", networks); } } \ No newline at end of file diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/OperatingSystemSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/OperatingSystemSection.java new file mode 100644 index 0000000000..14e8dd6a5b --- /dev/null +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/OperatingSystemSection.java @@ -0,0 +1,164 @@ +/* + * 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.dmtf.ovf; + +import static com.google.common.base.Objects.equal; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; + +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; + +/** + * An OperatingSystemSection specifies the operating system installed on a virtual machine. + * + * @author Adrian Cole + * @author Adam Lowe + */ +@XmlRootElement(name = "OperatingSystemSection") +@XmlType(name = "OperatingSystemSection_Type") +public class OperatingSystemSection extends SectionType { + + public static Builder builder() { + return new ConcreteBuilder(); + } + + public Builder toBuilder() { + return builder().fromOperatingSystemSection(this); + } + + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> extends SectionType.Builder { + + private int id; + private String description; + private String version; + + /** + * @see OperatingSystemSection#getId() + */ + public B id(int id) { + this.id = id; + return self(); + } + + /** + * @see OperatingSystemSection#getVersion() + */ + public B version(String version) { + this.version = version; + return self(); + } + + /** + * @see OperatingSystemSection#getDescription + */ + public B description(String description) { + this.description = description; + return self(); + } + + /** + * {@inheritDoc} + */ + @Override + public OperatingSystemSection build() { + return new OperatingSystemSection(this); + } + + public B fromOperatingSystemSection(OperatingSystemSection in) { + return fromSectionType(in) + .id(in.getId()) + .version(in.getVersion()) + .description(in.getDescription()); + } + } + + @XmlAttribute(namespace = OVF_NS, required = true) + protected int id; + @XmlAttribute(namespace = OVF_NS) + protected String version; + @XmlElement(name = "Description") + protected String description; + + public OperatingSystemSection(Builder builder) { + super(builder); + this.id = builder.id; + this.description = builder.description; + this.version = builder.version; + } + + protected OperatingSystemSection() { + // For Builders and JAXB + } + + /** + * Gets the OVF id + * + * @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode() + */ + public int getId() { + return id; + } + + /** + * Gets the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the description or null + */ + public String getDescription() { + return description; + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), id, version, description); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + OperatingSystemSection that = (OperatingSystemSection) obj; + return super.equals(that) + && equal(this.id, that.id) + && equal(this.version, that.version) + && equal(this.description, that.description); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string() + .add("id", id) + .add("version", version) + .add("description", description); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSection.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSection.java index 4f384910ce..f75f8db476 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSection.java @@ -16,11 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; import java.util.Collections; import java.util.Set; @@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimString; +import org.jclouds.dmtf.cim.CimString; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; @@ -69,6 +69,12 @@ public class ProductSection extends SectionType { private CimString appUrl; protected Set properties = Sets.newLinkedHashSet(); + @Override + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } + /** * @see ProductSection#getProduct() */ @@ -190,15 +196,15 @@ public class ProductSection extends SectionType { private MsgType product; @XmlElement(name = "Vendor") private MsgType vendor; - @XmlElement(name = "Version", namespace = VCLOUD_CIM_NS) + @XmlElement(name = "Version", namespace = CIM_NS) private CimString version; - @XmlElement(name = "FullVersion", namespace = VCLOUD_CIM_NS) + @XmlElement(name = "FullVersion", namespace = CIM_NS) private CimString fullVersion; - @XmlElement(name = "ProductUrl", namespace = VCLOUD_CIM_NS) + @XmlElement(name = "ProductUrl", namespace = CIM_NS) private CimString productUrl; - @XmlElement(name = "VendorUrl", namespace = VCLOUD_CIM_NS) + @XmlElement(name = "VendorUrl", namespace = CIM_NS) private CimString vendorUrl; - @XmlElement(name = "AppUrl", namespace = VCLOUD_CIM_NS) + @XmlElement(name = "AppUrl", namespace = CIM_NS) private CimString appUrl; @XmlElement(name = "Property") private Set properties = Sets.newLinkedHashSet(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSectionProperty.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSectionProperty.java similarity index 95% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSectionProperty.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSectionProperty.java index 235e1dbd27..22f04cbcfa 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/ProductSectionProperty.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/ProductSectionProperty.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Property.java similarity index 99% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Property.java index 0cbc300b75..4a8ba382e1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Property.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/Property.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/PropertyConfigurationValueType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/PropertyConfigurationValueType.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/PropertyConfigurationValueType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/PropertyConfigurationValueType.java index 210594fc88..19d1bbe924 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/PropertyConfigurationValueType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/PropertyConfigurationValueType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/SectionType.java similarity index 78% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/SectionType.java index ed058d489c..7b03911274 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/SectionType.java @@ -16,23 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; 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 org.jclouds.vcloud.director.v1_5.domain.CustomizationSection; -import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection; -import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; -import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; -import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; -import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection; - import com.google.common.base.Objects; /** @@ -45,21 +38,6 @@ import com.google.common.base.Objects; * @author grkvlt@apache.org */ @XmlType(name = "Section_Type") -@XmlSeeAlso({ - CustomizationSection.class, - DeploymentOptionSection.class, - DiskSection.class, - LeaseSettingsSection.class, - GuestCustomizationSection.class, - NetworkSection.class, - NetworkConfigSection.class, - NetworkConnectionSection.class, - OperatingSystemSection.class, - ProductSection.class, - RuntimeInfoSection.class, - StartupSection.class, - VirtualHardwareSection.class, - VirtualSystem.class }) public abstract class SectionType { public static abstract class Builder> { @@ -112,7 +90,7 @@ public abstract class SectionType { @XmlElement(name = "Info", required = true) private String info; - @XmlAttribute(namespace = VCLOUD_OVF_NS) + @XmlAttribute(namespace = OVF_NS) private Boolean required; protected SectionType(Builder builder) { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSection.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSection.java index 991acfe6bb..7fd5071789 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSection.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSectionItem.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSectionItem.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSectionItem.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSectionItem.java index 3b5beec298..ca2c716ab1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSectionItem.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/StartupSectionItem.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/VirtualHardwareSection.java similarity index 66% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/VirtualHardwareSection.java index 3332b28d58..ed3c2c1806 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualHardwareSection.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/VirtualHardwareSection.java @@ -16,24 +16,20 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import java.net.URI; import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.Link; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData; +import org.jclouds.dmtf.cim.ResourceAllocationSettingData; +import org.jclouds.dmtf.cim.VirtualSystemSettingData; import com.google.common.base.Joiner; import com.google.common.base.Objects; @@ -71,12 +67,9 @@ public class VirtualHardwareSection extends SectionType { private VirtualSystemSettingData virtualSystem; private String transport; private Set items = Sets.newLinkedHashSet(); - private Set links = Sets.newLinkedHashSet(); - private URI href; - private String type; /** - * @see VirtualHardwareSection#getSystem + * @see VirtualHardwareSection#getSystem() */ public B system(VirtualSystemSettingData virtualSystem) { this.virtualSystem = virtualSystem; @@ -123,38 +116,6 @@ public class VirtualHardwareSection extends SectionType { return self(); } - /** - * @see VirtualHardwareSection#getLinks() - */ - public B links(Set links) { - this.links = checkNotNull(links, "links"); - return self(); - } - - /** - * @see VirtualHardwareSection#getLinks() - */ - public B link(Link link) { - this.links.add(checkNotNull(link, "link")); - return self(); - } - - /** - * @see VirtualHardwareSection#getHref() - */ - public B href(URI href) { - this.href = href; - return self(); - } - - /** - * @see VirtualHardwareSection#getType() - */ - public B type(String type) { - this.type = type; - return self(); - } - /** * {@inheritDoc} */ @@ -167,38 +128,25 @@ public class VirtualHardwareSection extends SectionType { return fromSectionType(in) .items(in.getItems()) .transport(in.getTransport()) - .system(in.getSystem()) - .links(Sets.newLinkedHashSet(in.getLinks())) - .href(in.getHref()) - .type(in.getType()); + .system(in.getSystem()); } } @XmlElement(name = "System") - private VirtualSystemSettingData virtualSystem; + protected VirtualSystemSettingData virtualSystem; @XmlAttribute(name = "transport") - private String transport; + protected String transport; @XmlElement(name = "Item") - private Set items = Sets.newLinkedHashSet(); - @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) - protected Set links = Sets.newLinkedHashSet(); - @XmlAttribute(namespace = VCLOUD_1_5_NS) - @XmlSchemaType(name = "anyURI") - protected URI href; - @XmlAttribute(namespace = VCLOUD_1_5_NS) - protected String type; + protected Set items = Sets.newLinkedHashSet(); - private VirtualHardwareSection(Builder builder) { + protected VirtualHardwareSection(Builder builder) { super(builder); this.virtualSystem = builder.virtualSystem; this.transport = builder.transport; this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Sets.newLinkedHashSet(); - this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Sets.newLinkedHashSet(); - this.href = builder.href; - this.type = builder.type; } - private VirtualHardwareSection() { + protected VirtualHardwareSection() { // For JAXB } @@ -229,36 +177,13 @@ public class VirtualHardwareSection extends SectionType { return virtualSystem; } - public Set getItems() { + public Set getItems() { return ImmutableSet.copyOf(items); } - /** - * Gets the value of the link property. - */ - public Set getLinks() { - return ImmutableSet.copyOf(links); - } - - /** - * @return the value of the href property. - */ - public URI getHref() { - return href; - } - - /** - * Gets the value of the type property. - * - * @return possible object is {@link String } - */ - public String getType() { - return type; - } - @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), transport, virtualSystem, items, links, href, type); + return Objects.hashCode(super.hashCode(), transport, virtualSystem, items); } @Override @@ -267,17 +192,17 @@ public class VirtualHardwareSection extends SectionType { if (obj == null) return false; if (getClass() != obj.getClass()) return false; VirtualHardwareSection that = VirtualHardwareSection.class.cast(obj); - return super.equals(that) && - equal(this.transport, that.transport) && - equal(this.virtualSystem, that.virtualSystem) && - equal(this.items, that.items) && - equal(this.links, that.links) && - equal(this.href, that.href) && - equal(this.type, that.type); + return super.equals(that) + && equal(this.transport, that.transport) + && equal(this.virtualSystem, that.virtualSystem) + && equal(this.items, that.items); } @Override protected Objects.ToStringHelper string() { - return super.string().add("transport", transport).add("virtualSystem", virtualSystem).add("items", items).add("links", links).add("href", href).add("type", type); + return super.string() + .add("transport", transport) + .add("virtualSystem", virtualSystem) + .add("items", items); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EntityType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EntityType.java similarity index 90% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EntityType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EntityType.java index 41e67ec2bc..57d38e238a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EntityType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EntityType.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS; import java.util.Map; import java.util.Set; @@ -54,11 +54,11 @@ import com.google.common.collect.Sets; @XmlType(name = "Entity_Type") public class EntityType { - @XmlElementRef(name = "Section", namespace = VCLOUD_OVF_ENV_NS) + @XmlElementRef(name = "Section", namespace = OVF_ENV_NS) protected Set> sections = Sets.newLinkedHashSet(); @XmlAnyElement(lax = true) protected Set any = Sets.newLinkedHashSet(); - @XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) + @XmlAttribute(namespace = OVF_ENV_NS, required = true) protected String id; @XmlAnyAttribute private Map otherAttributes = Maps.newLinkedHashMap(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EnvironmentType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EnvironmentType.java similarity index 92% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EnvironmentType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EnvironmentType.java index d7356beea4..75127666a9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/EnvironmentType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/EnvironmentType.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS; import java.util.Map; import java.util.Set; @@ -56,13 +56,13 @@ import com.google.common.collect.Sets; @XmlType(name = "Environment_Type") public class EnvironmentType { - @XmlElementRef(name = "Section", namespace = VCLOUD_OVF_ENV_NS) + @XmlElementRef(name = "Section", namespace = OVF_ENV_NS) protected Set> sections = Sets.newLinkedHashSet(); @XmlElement(name = "Entity") protected Set entities = Sets.newLinkedHashSet(); @XmlAnyElement(lax = true) protected Set any = Sets.newLinkedHashSet(); - @XmlAttribute(namespace = VCLOUD_OVF_ENV_NS) + @XmlAttribute(namespace = OVF_ENV_NS) protected String id; @XmlAnyAttribute private Map otherAttributes = Maps.newLinkedHashMap(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PlatformSectionType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PlatformSectionType.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PlatformSectionType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PlatformSectionType.java index 10424e41a6..026bbac131 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PlatformSectionType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PlatformSectionType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; import java.util.Set; @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimString; +import org.jclouds.dmtf.cim.CimString; import com.google.common.base.Objects; import com.google.common.collect.Sets; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/Property.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java similarity index 87% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/Property.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java index b370113d7c..0b06dc05d4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/Property.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/Property.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS; import java.util.HashMap; import java.util.Map; @@ -34,9 +34,9 @@ import javax.xml.namespace.QName; @XmlType(name = "") public class Property { - @XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) + @XmlAttribute(namespace = OVF_ENV_NS, required = true) protected String key; - @XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) + @XmlAttribute(namespace = OVF_ENV_NS, required = true) protected String value; @XmlAnyAttribute private Map otherAttributes = new HashMap(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PropertySectionType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PropertySectionType.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PropertySectionType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PropertySectionType.java index e56fc04904..f60913dbed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/PropertySectionType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/PropertySectionType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; import java.util.Set; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/SectionType.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/SectionType.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/SectionType.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/SectionType.java index 2da26a0076..ea60969848 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/SectionType.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/SectionType.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; import java.util.Map; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/package-info.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/package-info.java similarity index 69% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/package-info.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/package-info.java index b7217a07d6..4c5614427f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/environment/package-info.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/environment/package-info.java @@ -16,19 +16,20 @@ * specific language governing permissions and limitations * under the License. */ -@XmlSchema(namespace = VCLOUD_OVF_ENV_NS, +@XmlSchema(namespace = OVF_ENV_NS, elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), - @XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS) + @XmlNs(prefix = "cim", namespaceURI = CIM_NS), + @XmlNs(prefix = "ovf", namespaceURI = OVF_NS), + @XmlNs(prefix = "env", namespaceURI = OVF_ENV_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) -package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; +package org.jclouds.dmtf.ovf.environment; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseEnvelope.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseEnvelope.java similarity index 64% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseEnvelope.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseEnvelope.java index f74ea65e6f..8303ac6aec 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseEnvelope.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseEnvelope.java @@ -16,15 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.internal; +package org.jclouds.dmtf.ovf.internal; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Set; -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.SectionType; +import org.jclouds.dmtf.ovf.DiskSection; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; @@ -32,80 +32,87 @@ import com.google.common.collect.Sets; /** * @author Adrian Cole + * @author grkvlt@apache.org */ public abstract class BaseEnvelope> { - - // FIXME Fix builder pattern used - public abstract Builder toBuilder(); + public abstract Builder toBuilder(); + + public static abstract class Builder, V extends BaseVirtualSystem, E extends BaseEnvelope> { - public static abstract class Builder> { protected Set diskSections = Sets.newLinkedHashSet(); protected Set networkSections = Sets.newLinkedHashSet(); protected Set additionalSections = Sets.newLinkedHashSet(); protected V virtualSystem; + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } + /** * @see BaseEnvelope#getDiskSections */ - public Builder diskSection(DiskSection diskSection) { + public B diskSection(DiskSection diskSection) { this.diskSections.add(checkNotNull(diskSection, "diskSection")); - return this; + return self(); } /** * @see BaseEnvelope#getDiskSections */ - public Builder diskSections(Iterable diskSections) { + public B diskSections(Iterable diskSections) { this.diskSections = ImmutableSet. copyOf(checkNotNull(diskSections, "diskSections")); - return this; + return self(); } /** * @see BaseEnvelope#getNetworkSections */ - public Builder networkSection(NetworkSection networkSection) { + public B networkSection(NetworkSection networkSection) { this.networkSections.add(checkNotNull(networkSection, "networkSection")); - return this; + return self(); } /** * @see BaseEnvelope#getNetworkSections */ - public Builder networkSections(Iterable networkSections) { + public B networkSections(Iterable networkSections) { this.networkSections = ImmutableSet. copyOf(checkNotNull(networkSections, "networkSections")); - return this; + return self(); } /** * @see BaseEnvelope#getAdditionalSections */ - public Builder additionalSection(SectionType additionalSection) { + public B additionalSection(SectionType additionalSection) { this.additionalSections.add(checkNotNull(additionalSection, "additionalSection")); - return this; + return self(); } /** * @see BaseEnvelope#getAdditionalSections */ - public Builder additionalSections(Iterable additionalSections) { + public B additionalSections(Iterable additionalSections) { this.additionalSections = ImmutableSet. copyOf(checkNotNull(additionalSections, "additionalSections")); - return this; + return self(); } /** * @see BaseEnvelope#getVirtualSystem */ - public Builder virtualSystem(V virtualSystem) { + public B virtualSystem(V virtualSystem) { this.virtualSystem = virtualSystem; - return this; + return self(); } - public abstract E build() ; + public abstract E build(); - public Builder fromEnvelope(BaseEnvelope in) { - return virtualSystem(in.getVirtualSystem()).diskSections(in.getDiskSections()) - .networkSections(networkSections).additionalSections(in.getAdditionalSections()); + public B fromEnvelope(BaseEnvelope in) { + return virtualSystem(in.getVirtualSystem()) + .diskSections(in.getDiskSections()) + .networkSections(networkSections) + .additionalSections(in.getAdditionalSections()); } } @@ -115,12 +122,11 @@ public abstract class BaseEnvelope additionalSections; private V virtualSystem; - protected BaseEnvelope(Iterable diskSections, Iterable networkSections, - Iterable additionalSections, V virtualSystem) { - this.diskSections = ImmutableSet.copyOf(checkNotNull(diskSections, "diskSections")); - this.networkSections = ImmutableSet.copyOf(checkNotNull(networkSections, "networkSections")); - this.additionalSections = ImmutableSet.copyOf(checkNotNull(additionalSections, "additionalSections")); - this.virtualSystem = checkNotNull(virtualSystem, "virtualSystem"); + protected BaseEnvelope(Builder builder) { + this.diskSections = ImmutableSet.copyOf(checkNotNull(builder.diskSections, "diskSections")); + this.networkSections = ImmutableSet.copyOf(checkNotNull(builder.networkSections, "networkSections")); + this.additionalSections = ImmutableSet.copyOf(checkNotNull(builder.additionalSections, "additionalSections")); + this.virtualSystem = checkNotNull(builder.virtualSystem, "virtualSystem"); } protected BaseEnvelope() { @@ -134,6 +140,10 @@ public abstract class BaseEnvelope getDiskSections() { return diskSections; } + + public Set getNetworkSections() { + return networkSections; + } public Set getAdditionalSections() { return additionalSections; @@ -163,11 +173,10 @@ public abstract class BaseEnvelope getNetworkSections() { - return networkSections; + return Objects.toStringHelper("") + .add("diskSections", diskSections) + .add("networkSections", networkSections) + .add("additionalSections", additionalSections) + .add("virtualSystem", virtualSystem); } } \ No newline at end of file diff --git a/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseVirtualSystem.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseVirtualSystem.java new file mode 100644 index 0000000000..74bd231a3c --- /dev/null +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/BaseVirtualSystem.java @@ -0,0 +1,175 @@ +/** + * 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.dmtf.ovf.internal; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; + +import java.util.Set; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; + +import org.jclouds.dmtf.ovf.ProductSection; +import org.jclouds.dmtf.ovf.SectionType; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + +/** + * @author Adrian Cole + */ +public abstract class BaseVirtualSystem extends SectionType { + + public static abstract class Builder> extends SectionType.Builder { + + private String id; + private String name; + private Set productSections = Sets.newLinkedHashSet(); + private Set additionalSections = Sets.newLinkedHashSet(); + + /** + * @see BaseVirtualSystem#getName() + */ + public B name(String name) { + this.name = name; + return self(); + } + + /** + * @see BaseVirtualSystem#getId() + */ + public B id(String id) { + this.id = id; + return self(); + } + + /** + * @see BaseVirtualSystem#getProductSections() + */ + public B productSection(ProductSection productSection) { + this.productSections.add(checkNotNull(productSection, "productSection")); + return self(); + } + + /** + * @see BaseVirtualSystem#getProductSections() + */ + public B productSections(Iterable productSections) { + this.productSections = Sets.newLinkedHashSet(checkNotNull(productSections, "productSections")); + return self(); + } + + /** + * @see BaseVirtualSystem#getAdditionalSections() + */ + public B additionalSection(SectionType additionalSection) { + this.additionalSections.add(checkNotNull(additionalSection, "additionalSection")); + return self(); + } + + /** + * @see BaseVirtualSystem#getAdditionalSections() + */ + public B additionalSections(Iterable additionalSections) { + this.additionalSections = Sets.newLinkedHashSet(checkNotNull(additionalSections, "additionalSections")); + return self(); + } + + public B fromBaseVirtualSystem(BaseVirtualSystem in) { + return fromSectionType(in) + .id(in.getId()) + .name(in.getName()) + .productSections(in.getProductSections()) + .additionalSections(in.getAdditionalSections()); + } + } + + @XmlAttribute(namespace = OVF_NS) + private String id; + @XmlElement(name = "Name") + private String name; + @XmlElement(name = "ProductSection") + private Set productSections; + @XmlElementRef + private Set additionalSections; + + protected BaseVirtualSystem(Builder builder) { + super(builder); + this.id = builder.id; + this.name = builder.name; + this.productSections = ImmutableSet.copyOf(checkNotNull(builder.productSections, "productSections")); + this.additionalSections = ImmutableSet.copyOf(checkNotNull(builder.additionalSections, "additionalSections")); + } + + protected BaseVirtualSystem() { + // For JAXB + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + /** + * Specifies product-information for a package, such as product name and version, along with a + * set of properties that can be configured + */ + public Set getProductSections() { + return productSections; + } + + public Set getAdditionalSections() { + return additionalSections; + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), id, name, productSections, additionalSections); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + BaseVirtualSystem other = (BaseVirtualSystem) obj; + return super.equals(other) + && equal(id, other.id) + && equal(name, other.name) + && equal(productSections, other.productSections) + && equal(additionalSections, other.additionalSections); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string() + .add("id", id) + .add("name", name) + .add("productSections", productSections) + .add("additionalSections", additionalSections); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/package-info.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/package-info.java similarity index 77% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/package-info.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/package-info.java index b08a2ea879..b9f8c9df30 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/package-info.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/internal/package-info.java @@ -16,17 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -@XmlSchema(namespace = VCLOUD_OVF_NS, +@XmlSchema(namespace = OVF_NS, elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS) + @XmlNs(prefix = "cim", namespaceURI = CIM_NS), + @XmlNs(prefix = "ovf", namespaceURI = OVF_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) -package org.jclouds.vcloud.director.v1_5.domain.ovf.internal; +package org.jclouds.dmtf.ovf.internal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/package-info.java b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/package-info.java similarity index 64% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/package-info.java rename to labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/package-info.java index f93613590f..48a2043de0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/package-info.java +++ b/labs/dmtf/src/main/java/org/jclouds/dmtf/ovf/package-info.java @@ -16,21 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -@XmlSchema(namespace = VCLOUD_OVF_NS, +@XmlSchema(namespace = OVF_NS, elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), - @XmlNs(prefix = "vmv", namespaceURI = VCLOUD_VMW_NS), - @XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS) + @XmlNs(prefix = "cim", namespaceURI = CIM_NS), + @XmlNs(prefix = "ovf", namespaceURI = OVF_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.dmtf.ovf; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_VMW_NS; +import static org.jclouds.dmtf.DMTFConstants.CIM_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/dmtf/src/test/resources/log4j.xml b/labs/dmtf/src/test/resources/log4j.xml new file mode 100644 index 0000000000..63810d3ca0 --- /dev/null +++ b/labs/dmtf/src/test/resources/log4j.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/labs/pom.xml b/labs/pom.xml index a2dc41f3be..c0c4ae9725 100644 --- a/labs/pom.xml +++ b/labs/pom.xml @@ -39,5 +39,6 @@ elb aws-elb savvis-symphonyvpdc + dmtf diff --git a/labs/vcloud-director/pom.xml b/labs/vcloud-director/pom.xml index 3deb2d64b7..32e12456a7 100644 --- a/labs/vcloud-director/pom.xml +++ b/labs/vcloud-director/pom.xml @@ -57,6 +57,11 @@ jclouds-compute ${project.version} + + org.jclouds.labs + dmtf + ${project.version} + org.jclouds jclouds-core diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorApiMetadata.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorApiMetadata.java index 293275c8c4..62a837d3c8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorApiMetadata.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorApiMetadata.java @@ -20,7 +20,6 @@ package org.jclouds.vcloud.director.v1_5; import java.net.URI; -import org.jclouds.apis.ApiMetadata; import org.jclouds.apis.ApiType; import org.jclouds.apis.BaseApiMetadata; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java index 4ebd2eb96b..3ac2dee73b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java @@ -30,16 +30,6 @@ public class VCloudDirectorConstants { public static final String VCLOUD_VMW_NS = "http://www.vmware.com/schema/ovf"; - 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"; - - public static final String VCLOUD_CIM_VSSD_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; - - public static final String VCLOUD_CIM_RASD_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; - /** The property used to configure the timeout for task completion. */ public static final String PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud-director.timeout.task-complete"; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java index 97837c7ca7..d99efbb7b1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java @@ -19,12 +19,6 @@ package org.jclouds.vcloud.director.v1_5.admin; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; -import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Group; -import org.jclouds.vcloud.director.v1_5.domain.User; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java index fe257065dd..e747962391 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java @@ -22,12 +22,6 @@ import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; -import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Group; -import org.jclouds.vcloud.director.v1_5.domain.User; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; @@ -35,7 +29,6 @@ import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient; import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; import org.jclouds.vcloud.director.v1_5.features.admin.UserClient; -import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient; import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient; /** @@ -82,6 +75,7 @@ public interface VCloudDirectorAdminClient extends VCloudDirectorClient { /** * @return synchronous access to {@link AdminVdc} features */ + @Override @Delegate AdminVdcClient getVdcClient(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java index 3003ae7add..a1a062f893 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java @@ -28,8 +28,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.DMTFConstants; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; @@ -100,9 +100,8 @@ public abstract class AbstractVAppType extends ResourceEntityType { /** * @see AbstractVAppType#getSections() */ - public B sections(List sections) { - if (checkNotNull(sections, "sections").size() > 0) - this.sections = Lists.newArrayList(sections); + public B sections(Iterable sections) { + this.sections = Lists.newArrayList(checkNotNull(sections, "sections")); return self(); } @@ -123,8 +122,8 @@ public abstract class AbstractVAppType extends ResourceEntityType { @XmlElement(name = "VAppParent") private Reference vAppParent; - @XmlElementRef(name = "Section", namespace = VCloudDirectorConstants.VCLOUD_OVF_NS) - private List sections = Lists.newArrayList(); + @XmlElementRef(namespace = DMTFConstants.OVF_NS) + private List sections = Lists.newArrayList(); @XmlAttribute private Boolean deployed; @@ -171,7 +170,7 @@ public abstract class AbstractVAppType extends ResourceEntityType { *
  • InstallSectionType * */ - public List getSections() { + public List getSections() { return this.sections; } @@ -189,8 +188,10 @@ public abstract class AbstractVAppType extends ResourceEntityType { 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); + return super.equals(that) + && equal(this.vAppParent, that.vAppParent) + && equal(this.sections, that.sections) + && equal(this.deployed, that.deployed); } @Override @@ -200,6 +201,9 @@ public abstract class AbstractVAppType extends ResourceEntityType { @Override public ToStringHelper string() { - return super.string().add("vAppParent", vAppParent).add("sections", sections).add("deployed", deployed); + return super.string() + .add("vAppParent", vAppParent) + .add("sections", sections) + .add("deployed", deployed); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java index dcd945ec1c..6b6cabc4e4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java @@ -131,6 +131,7 @@ public class AdminVdc extends Vdc { return self(); } + @Override public AdminVdc build() { return new AdminVdc(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java index 75e7275981..9e50423f66 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java @@ -61,6 +61,7 @@ public class CapacityWithUsage extends CapacityType return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromCapacityWithUsage(this); } @@ -87,6 +88,7 @@ public class CapacityWithUsage extends CapacityType } + @Override public CapacityWithUsage build() { return new CapacityWithUsage(units, allocated, limit, used, overhead); } @@ -94,6 +96,7 @@ public class CapacityWithUsage extends CapacityType /** * @see CapacityType#getUnits() */ + @Override public Builder units(String units) { this.units = units; return this; @@ -102,6 +105,7 @@ public class CapacityWithUsage extends CapacityType /** * @see CapacityType#getAllocated() */ + @Override public Builder allocated(Long allocated) { this.allocated = allocated; return this; @@ -110,6 +114,7 @@ public class CapacityWithUsage extends CapacityType /** * @see CapacityType#getLimit() */ + @Override public Builder limit(Long limit) { this.limit = limit; return this; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java index 3e2271f9e0..071da5176c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java @@ -31,8 +31,7 @@ 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.SectionType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; @@ -111,6 +110,7 @@ public class CaptureVAppParams extends ParamsType { return self(); } + @Override public CaptureVAppParams build() { return new CaptureVAppParams(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java index eeeb825f4d..915751e600 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java @@ -42,6 +42,7 @@ public class Catalog extends CatalogType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromCatalog(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java index baa364dd00..55e7fe756a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java @@ -49,6 +49,7 @@ public class CatalogItem extends EntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromCatalogItem(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java index aa12a68bc6..1988a5f5ed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java @@ -61,6 +61,7 @@ public class CloneMediaParams extends ParamsType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromCloneMediaParams(this); } @@ -89,6 +90,7 @@ public class CloneMediaParams extends ParamsType { return self(); } + @Override public CloneMediaParams build() { return new CloneMediaParams(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java index 116c1ec802..4e149a2920 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java @@ -44,12 +44,13 @@ import com.google.common.collect.Lists; */ @XmlRootElement(name = "ComposeVAppParams") @XmlType(name = "ComposeVAppParamsType") -public class ComposeVAppParams extends VAppCreationParamsType { +public class ComposeVAppParams extends VAppCreationParams { public static Builder builder() { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromComposeVAppParams(this); } @@ -57,7 +58,7 @@ public class ComposeVAppParams extends VAppCreationParamsType { private static class ConcreteBuilder extends Builder { } - public static abstract class Builder> extends VAppCreationParamsType.Builder { + public static abstract class Builder> extends VAppCreationParams.Builder { private List sourcedItems = Lists.newArrayList(); private Boolean allEULAsAccepted; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java index 31bf250c43..471395d1bf 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomizationSection.java @@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java index 1d16051727..ca8b6b848f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/DhcpService.java @@ -88,6 +88,7 @@ public class DhcpService extends NetworkServiceType { return this; } + @Override public DhcpService build() { return new DhcpService(isEnabled, defaultLeaseTime, maxLeaseTime, ipRange); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java index 16f92a2f04..9bb44e4d1c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java @@ -33,6 +33,7 @@ public class Entity extends EntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromEntity(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Envelope.java similarity index 56% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Envelope.java index 15f9a545c7..a23500485a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/VirtualSystem.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Envelope.java @@ -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,52 +16,49 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.vcloud.director.v1_5.domain; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; +import static org.jclouds.dmtf.DMTFConstants.OVF_NS; import javax.xml.bind.annotation.XmlRootElement; -import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseVirtualSystem; +import org.jclouds.dmtf.ovf.internal.BaseEnvelope; /** - * @author Adrian Cole - * @author Adam Lowe + * @author grkvlt@apache.org */ -@XmlRootElement(name = "VirtualSystem", namespace = VCLOUD_OVF_NS) -public class VirtualSystem extends BaseVirtualSystem { +@XmlRootElement(name = "Envelope", namespace = OVF_NS) +public class Envelope extends BaseEnvelope { + @SuppressWarnings("rawtypes") public static Builder builder() { - return new ConcreteBuilder(); + return new Builder(); } + /** + * {@inheritDoc} + */ + @Override public Builder toBuilder() { - return builder().fromVirtualSystem(this); + return builder().fromEnvelope(this); } - private static class ConcreteBuilder extends Builder { - } - - public static class Builder> extends BaseVirtualSystem.Builder { + public static class Builder> extends BaseEnvelope.Builder { /** * {@inheritDoc} */ @Override - public VirtualSystem build() { - return new VirtualSystem(this); - } - - public B fromVirtualSystem(VirtualSystem in) { - return fromBaseVirtualSystem(in); + public Envelope build() { + return new Envelope(this); } } - private VirtualSystem(Builder builder) { + protected Envelope(Builder builder) { super(builder); } - private VirtualSystem() { - // for JAXB + protected Envelope() { + // For JaxB } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java index 7d706ed678..2190de4f5f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/File.java @@ -59,6 +59,7 @@ public class File extends EntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromFile(this); } @@ -96,12 +97,13 @@ public class File extends EntityType { return self(); } + @Override public File build() { return new File(this); } - public Builder fromFile(File in) { + public B fromFile(File in) { return fromEntityType(in) .size(in.getSize()) .bytesTransferred(in.getBytesTransferred()) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java index ff31582edd..caa26ec66d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FirewallService.java @@ -69,6 +69,7 @@ public class FirewallService extends NetworkServiceType { return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromFirewallService(this); } @@ -102,6 +103,7 @@ public class FirewallService extends NetworkServiceType { return this; } + @Override public FirewallService build() { return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java index 4d8f2f75b3..3d0d17bbac 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/GuestCustomizationSection.java @@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateOvfParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateOvfParams.java index 2640106f52..0c62584046 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateOvfParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateOvfParams.java @@ -37,12 +37,13 @@ import com.google.common.base.Objects.ToStringHelper; * @author grkvlt@apache.org */ @XmlType(name = "InstantiateOvfParams") -public class InstantiateOvfParams extends VAppCreationParamsType { +public class InstantiateOvfParams extends VAppCreationParams { public static Builder builder() { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromInstantiateOvfParams(this); } @@ -50,7 +51,7 @@ public class InstantiateOvfParams extends VAppCreationParamsType { private static class ConcreteBuilder extends Builder { } - public static abstract class Builder> extends VAppCreationParamsType.Builder { + public static abstract class Builder> extends VAppCreationParams.Builder { private Boolean allEULAsAccepted; private String transferFormat; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java index aeed48a8f5..2c4baef1c4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java @@ -42,7 +42,7 @@ import com.google.common.base.Objects.ToStringHelper; */ @XmlRootElement(name = "InstantiateVAppParams") @XmlType(name = "InstantiateVAppParamsType") -public class InstantiateVAppParams extends VAppCreationParamsType { +public class InstantiateVAppParams extends VAppCreationParams { public static final String MEDIA_TYPe = VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS; @@ -58,7 +58,7 @@ public class InstantiateVAppParams extends VAppCreationParamsType { private static class ConcreteBuilder extends Builder { } - public static abstract class Builder> extends VAppCreationParamsType.Builder { + public static abstract class Builder> extends VAppCreationParams.Builder { private Reference source; private Boolean sourceDelete; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java index 9d515662d8..d004efc0cd 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java @@ -40,6 +40,7 @@ public class InstantiateVAppTemplateParams extends InstantiateVAppParams { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromInstantiateVAppTemplateParams(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java index f9ef0e1f8e..43073147f2 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java @@ -27,7 +27,7 @@ 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.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java index c1f30df663..a268f41a68 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnManagedPeerType.java @@ -39,7 +39,7 @@ public abstract class IpsecVpnManagedPeerType id(String id) { this.id = id; return this; } @@ -47,13 +47,14 @@ public abstract class IpsecVpnManagedPeerType name(String name) { this.name = name; return this; } public Builder fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType in) { - return id(in.getId()).name(in.getName()); + return id(in.getId()) + .name(in.getName()); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java index 652ed93981..f7aeb13dc1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnRemotePeer.java @@ -58,7 +58,7 @@ import com.google.common.base.Objects; "vcdUsername" }) public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType { - @SuppressWarnings("unchecked") + public static Builder builder() { return new Builder(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java index 198f43d958..0a7cdd17ce 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpsecVpnService.java @@ -69,6 +69,7 @@ public class IpsecVpnService extends NetworkServiceType { return new Builder(); } + @Override public Builder toBuilder() { return new Builder().fromIpsecVpnService(this); } @@ -103,6 +104,7 @@ public class IpsecVpnService extends NetworkServiceType { return this; } + @Override public IpsecVpnService build() { return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java index 8d9cee0fba..8d838d828a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java @@ -33,7 +33,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java index f5bce3a2db..dd4a13ebbb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java @@ -153,6 +153,7 @@ public class Link extends Reference { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromLink(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java index ab00a90710..963a603977 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java @@ -85,6 +85,7 @@ public class Media extends ResourceEntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromMedia(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java index 59c0fb89ed..4e590fdf05 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Metadata.java @@ -52,6 +52,7 @@ public class Metadata extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromMetadata(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java index 04cd7f1038..910df170d3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataEntry.java @@ -51,6 +51,7 @@ public class MetadataEntry extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromMetadataEntry(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java index da1e367d5d..cd4a79ed18 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/MetadataValue.java @@ -51,6 +51,7 @@ public class MetadataValue extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromMetadataValue(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java index 1fe1625f27..c713226072 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatRule.java @@ -62,7 +62,7 @@ import com.google.common.base.Objects; "vmRule" }) public class NatRule { - @SuppressWarnings("unchecked") + public static Builder builder() { return new Builder(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java index ee1d401b0d..5727e22aba 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NatService.java @@ -102,6 +102,7 @@ public class NatService extends NetworkServiceType { return this; } + @Override public NatService build() { return new NatService(isEnabled, natType, policy, natRules); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java index 21db1e672c..4da43d2fcd 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfigSection.java @@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java index 7cbd25ccaa..65b37518f6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConnectionSection.java @@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OperatingSystemSection.java similarity index 61% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OperatingSystemSection.java index a7c8dc35e5..50fab311ce 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/OperatingSystemSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OperatingSystemSection.java @@ -16,12 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.domain.ovf; +package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_VMW_NS; import java.net.URI; @@ -30,11 +29,10 @@ 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.vcloud.director.v1_5.domain.Link; +import javax.xml.bind.annotation.XmlSeeAlso; 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; @@ -43,15 +41,17 @@ import com.google.common.collect.Sets; * * @author Adrian Cole * @author Adam Lowe + * @author grkvlt@apache.org */ @XmlRootElement(name = "OperatingSystemSection") -@XmlType -public class OperatingSystemSection extends SectionType { +@XmlSeeAlso({ org.jclouds.dmtf.ovf.OperatingSystemSection.class }) +public class OperatingSystemSection extends org.jclouds.dmtf.ovf.OperatingSystemSection { public static Builder builder() { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromOperatingSystemSection(this); } @@ -59,39 +59,13 @@ public class OperatingSystemSection extends SectionType { private static class ConcreteBuilder extends Builder { } - public static class Builder> extends SectionType.Builder { - private int id; - private String description; - private String version; + public static class Builder> extends org.jclouds.dmtf.ovf.OperatingSystemSection.Builder { + private String osType; private URI href; private String type; private Set links; - /** - * @see OperatingSystemSection#getId() - */ - public B id(int id) { - this.id = id; - return self(); - } - - /** - * @see OperatingSystemSection#getVersion() - */ - public B version(String version) { - this.version = version; - return self(); - } - - /** - * @see OperatingSystemSection#getDescription - */ - public B description(String description) { - this.description = description; - return self(); - } - /** * @see OperatingSystemSection#getOsType() */ @@ -125,11 +99,9 @@ public class OperatingSystemSection extends SectionType { } /** - * @see ResourceType#getLinks() + * @see OperatingSystemSection#getLinks() */ public B link(Link link) { - if (links == null) - links = Sets.newLinkedHashSet(); this.links.add(checkNotNull(link, "link")); return self(); } @@ -143,18 +115,14 @@ public class OperatingSystemSection extends SectionType { } public B fromOperatingSystemSection(OperatingSystemSection in) { - return fromSectionType(in) - .id(in.getId()).version(in.getVersion()).description(in.getDescription()) - .osType(in.getOsType()).href(in.getHref()).type(in.getType()).links(in.getLinks()); + return super.fromOperatingSystemSection(in) + .osType(in.getOsType()) + .href(in.getHref()) + .type(in.getType()) + .links(in.getLinks()); } } - @XmlAttribute(namespace = VCLOUD_OVF_NS, required = true) - protected int id; - @XmlAttribute - protected String version; - @XmlElement(name = "Description") - protected String description; @XmlAttribute(namespace = VCLOUD_VMW_NS) protected String osType; @XmlAttribute(namespace = VCLOUD_1_5_NS) @@ -162,46 +130,20 @@ public class OperatingSystemSection extends SectionType { @XmlAttribute(namespace = VCLOUD_1_5_NS) private String type; @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) - private Set links; + private Set links = Sets.newLinkedHashSet(); public OperatingSystemSection(Builder builder) { super(builder); - this.id = builder.id; - this.description = builder.description; - this.version = builder.version; this.osType = builder.osType; this.href = builder.href; this.type = builder.type; - this.links = builder.links; + this.links = builder.links != null && builder.links.isEmpty() ? null : builder.links;; } protected OperatingSystemSection() { // For Builders and JAXB } - /** - * Gets the OVF id - * - * @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode() - */ - public int getId() { - return id; - } - - /** - * Gets the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the description or null - */ - public String getDescription() { - return description; - } - /** * Gets the osType */ @@ -233,12 +175,12 @@ public class OperatingSystemSection extends SectionType { * @see ResourceType#getLinks() */ public Set getLinks() { - return links == null ? Sets.newLinkedHashSet() : ImmutableSet.copyOf(links); + return links != null ? ImmutableSet.copyOf(links) : Sets.newLinkedHashSet(); } @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), id, version, description, osType, href, type, links); + return Objects.hashCode(super.hashCode(), osType, href, type, links); } @Override @@ -246,16 +188,21 @@ public class OperatingSystemSection extends SectionType { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; - + OperatingSystemSection that = (OperatingSystemSection) obj; - return super.equals(that) && - equal(this.id, that.id) && equal(this.version, that.version) && equal(this.description, that.description) && - equal(this.osType, that.osType) && equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type); + return super.equals(that) + && equal(this.osType, that.osType) + && equal(this.href, that.href) + && equal(this.links, that.links) + && equal(this.type, that.type); } @Override - protected Objects.ToStringHelper string() { - return super.string().add("id", id).add("version", version).add("description", description).add("osType", osType) - .add("href", href).add("links", links).add("type", type); + public ToStringHelper string() { + return super.string() + .add("osType", osType) + .add("type", type) + .add("href", href) + .add("links", links); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java index 5969579b76..766f743bf5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java @@ -50,6 +50,7 @@ public class Org extends EntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromOrg(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java index ffb4d39a12..b6da767354 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java @@ -61,6 +61,7 @@ public class OrgGeneralSettings extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromOrgGeneralSettings(this); } @@ -116,6 +117,7 @@ public class OrgGeneralSettings extends ResourceType { return self(); } + @Override public OrgGeneralSettings build() { return new OrgGeneralSettings(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java index 3bdc674082..64aa4b1b65 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java @@ -64,6 +64,7 @@ public class OrgSettings extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromOrgSettings(this); } @@ -128,6 +129,7 @@ public class OrgSettings extends ResourceType { return self(); } + @Override public OrgSettings build() { return new OrgSettings(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java index ac5fb1c9bc..b06d483e68 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java @@ -44,6 +44,7 @@ public class Owner extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromOwner(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java index a382e31063..80472eeb2b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ProductSectionList.java @@ -30,8 +30,8 @@ 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 org.jclouds.dmtf.DMTFConstants; +import org.jclouds.dmtf.ovf.ProductSection; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; @@ -78,8 +78,7 @@ public class ProductSectionList extends ResourceType implements Set productSections) { - if (checkNotNull(productSections, "productSections").size() > 0) - this.productSections = Sets.newLinkedHashSet(productSections); + this.productSections = Sets.newLinkedHashSet(checkNotNull(productSections, "productSections")); return self(); } @@ -87,8 +86,6 @@ public class ProductSectionList extends ResourceType implements Set productSections; /** @@ -131,7 +128,8 @@ public class ProductSectionList extends ResourceType implements Set builder() { + return new ConcreteBuilder(); + } + + @Override + public Builder toBuilder() { + return builder().fromRasdItem(this); + } + + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> extends ResourceAllocationSettingData.Builder>{ + + private URI href; + private String type; + private Set links = Sets.newLinkedHashSet(); + + @Override + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } + + /** + * @see ResourceAllocationSettingData#getType() + */ + public B type(String type) { + this.type = type; + return self(); + } + + /** + * @see ResourceAllocationSettingData#getHref() + */ + public B href(URI href) { + this.href = href; + return self(); + } + + /** + * @see ResourceAllocationSettingData#getLinks() + */ + public B links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return self(); + } + + /** + * @see ResourceAllocationSettingData#getLinks() + */ + public B link(Link link) { + this.links.add(checkNotNull(link, "link")); + return self(); + } + + @Override + public RasdItem build() { + return new RasdItem(this); + } + + public B fromRasdItem(RasdItem in) { + return fromResourceAllocationSettingData(in) + .type(in.getType()) + .href(in.getHref()) + .links(in.getLinks()); + } + } + + @XmlAttribute(name = "type", namespace = VCLOUD_1_5_NS) + private String type; + @XmlAttribute(name = "href", namespace = VCLOUD_1_5_NS) + @XmlSchemaType(name = "anyURI") + private URI href; + @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) + private Set links = Sets.newLinkedHashSet(); + + protected RasdItem(Builder builder) { + super(builder); + this.type = builder.type; + this.href = builder.href; + this.links = builder.links != null && builder.links.isEmpty() ? null : builder.links;; + } + + protected RasdItem() { + // for JAXB + } + + /** + * Contains the URI to the entity. + * + * @see ResourceType#getHref() + */ + public String getType() { + return type; + } + + /** + * Contains the type of the the entity. + * + * @see ResourceType#getType() + */ + public URI getHref() { + return href; + } + + /** + * Set of optional links to an entity or operation associated with this object. + * + * @see ResourceType#getLinks() + */ + public Set getLinks() { + return links != null ? ImmutableSet.copyOf(links) : Sets.newLinkedHashSet(); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("type", type) + .add("href", href) + .add("links", links); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), type, href, links); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + RasdItem that = RasdItem.class.cast(obj); + return super.equals(that) + && equal(this.type, that.type) + && equal(this.href, that.href) + && equal(this.links, that.links); + } + +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RasdItemsList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RasdItemsList.java index 8f8a444699..e271539728 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RasdItemsList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RasdItemsList.java @@ -29,8 +29,6 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; - import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Sets; @@ -46,7 +44,7 @@ import com.google.common.collect.Sets; */ @XmlRootElement(name = "RasdItemsList") @XmlType(name = "RasdItemsList") -public class RasdItemsList extends ResourceType implements Set { +public class RasdItemsList extends ResourceType implements Set { public static Builder builder() { return new ConcreteBuilder(); @@ -62,12 +60,12 @@ public class RasdItemsList extends ResourceType implements Set> extends ResourceType.Builder { - private Set items = Sets.newLinkedHashSet(); + private Set items = Sets.newLinkedHashSet(); /** * @see RasdItemsList#getItems() */ - public B items(Set items) { + public B items(Set items) { this.items = checkNotNull(items, "items"); return self(); } @@ -75,7 +73,7 @@ public class RasdItemsList extends ResourceType implements Set items = Sets.newLinkedHashSet(); + protected Set items = Sets.newLinkedHashSet(); /** * A RASD item content. */ - public Set getItems() { + public Set getItems() { return items; } @@ -137,17 +135,17 @@ public class RasdItemsList extends ResourceType implements Set * NOTE Annoying lack of multiple inheritance for using ForwardingList! */ - private Set delegate() { + private Set delegate() { return getItems(); } @Override - public boolean add(ResourceAllocationSettingData arg0) { + public boolean add(RasdItem arg0) { return delegate().add(arg0); } @Override - public boolean addAll(Collection arg0) { + public boolean addAll(Collection arg0) { return delegate().addAll(arg0); } @@ -172,7 +170,7 @@ public class RasdItemsList extends ResourceType implements Set iterator() { + public Iterator iterator() { return delegate().iterator(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RecomposeVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RecomposeVAppParams.java index 78c26343a4..db4549871a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RecomposeVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RecomposeVAppParams.java @@ -55,6 +55,7 @@ public class RecomposeVAppParams extends ComposeVAppParams { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromRecomposeVAppParams(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/References.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/References.java index 2df6c38c0e..f47bbf9a1d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/References.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/References.java @@ -22,7 +22,6 @@ import static com.google.common.base.Objects.equal; import java.util.Set; -import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java index 1467b925e7..279137df6d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java @@ -32,6 +32,7 @@ public class Resource extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromResource(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RuntimeInfoSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RuntimeInfoSection.java index f1b55de8c5..a923eff86f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RuntimeInfoSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RuntimeInfoSection.java @@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; +import org.jclouds.dmtf.ovf.SectionType; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java index 995b65a3d2..4202bd17bf 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/StaticRoutingService.java @@ -65,6 +65,7 @@ public class StaticRoutingService extends NetworkServiceType toBuilder() { return builder().fromTask(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java index 9cb8f2347c..1a8e4851b0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/TasksList.java @@ -47,6 +47,7 @@ public class TasksList extends ResourceType implements Set { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromTasksList(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java index 15d18a455d..d40715e3df 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java @@ -43,6 +43,7 @@ public class UploadVAppTemplateParams extends ParamsType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromUploadVAppTemplateParams(this); } @@ -72,6 +73,7 @@ public class UploadVAppTemplateParams extends ParamsType { } + @Override public UploadVAppTemplateParams build() { return new UploadVAppTemplateParams(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java index accc0ece1a..20a54c287e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/User.java @@ -97,6 +97,7 @@ public class User extends EntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromUser(this); } @@ -128,6 +129,7 @@ public class User extends EntityType { /** * @see EntityType#getName() */ + @Override public B name(String name) { return super.name(name.toLowerCase()); } @@ -284,6 +286,7 @@ public class User extends EntityType { return self(); } + @Override public User build() { return new User(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java index 44781a7531..09b1ceefd7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java @@ -45,6 +45,7 @@ public class VApp extends AbstractVAppType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVApp(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParams.java index 7fea3e9dda..41da48e1e6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParams.java @@ -18,51 +18,165 @@ */ 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.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; /** * Represents vApp creation parameters. * - *
    - * <complexType name="VAppCreationParams" />
    - * 
    - * * @author grkvlt@apache.org + * @see + * vCloud REST API - VAppCreationParamsType + * @since 0.9 */ -@XmlType(name = "VAppCreationParams") -public class VAppCreationParams extends VAppCreationParamsType { +@XmlRootElement(name = "VAppCreationParams") +@XmlType(name = "VAppCreationParamsType") +public class VAppCreationParams extends ParamsType { public static Builder builder() { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { - return builder().fromVAppCreationParams(this); + return builder().fromVAppCreationParamsType(this); } private static class ConcreteBuilder extends Builder { } - public static abstract class Builder> extends VAppCreationParamsType.Builder { + public static abstract class Builder> extends ParamsType.Builder { - @Override - public VAppCreationParams build() { - VAppCreationParams vAppCreationParams = new VAppCreationParams(this); - return vAppCreationParams; + private Reference vAppParent; + private InstantiationParams instantiationParams; + private Boolean deploy; + private Boolean powerOn; + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public B vAppParent(Reference vAppParent) { + this.vAppParent = vAppParent; + return self(); } - public B fromVAppCreationParams(VAppCreationParams in) { - return fromVAppCreationParamsType(in); + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public B instantiationParams(InstantiationParams instantiationParams) { + this.instantiationParams = instantiationParams; + return self(); + } + + /** + * @see VAppCreationParamsType#isDeploy() + */ + public B deploy(Boolean deploy) { + this.deploy = deploy; + return self(); + } + + /** + * @see VAppCreationParamsType#isDeploy() + */ + public B deploy() { + this.deploy = Boolean.TRUE; + return self(); + } + + /** + * @see VAppCreationParamsType#isDeploy() + */ + public B notDeploy() { + this.deploy = Boolean.FALSE; + return self(); + } + + /** + * @see VAppCreationParamsType#isPowerOn() + */ + public B powerOn(Boolean powerOn) { + this.powerOn = powerOn; + return self(); + } + + /** + * @see VAppCreationParamsType#isPowerOn() + */ + public B powerOn() { + this.powerOn = Boolean.TRUE; + return self(); + } + + /** + * @see VAppCreationParamsType#isPowerOn() + */ + public B notPowerOn() { + this.powerOn = Boolean.FALSE; + return self(); + } + + public B fromVAppCreationParamsType(VAppCreationParams in) { + return fromParamsType(in).vAppParent(in.getVAppParent()).instantiationParams(in.getInstantiationParams()).deploy(in.isDeploy()).powerOn(in.isPowerOn()); } } protected VAppCreationParams() { - // For JAXB and builder use + // For JAXB and B use } - protected VAppCreationParams(Builder builder) { + public VAppCreationParams(Builder builder) { super(builder); + this.vAppParent = builder.vAppParent; + this.instantiationParams = builder.instantiationParams; + this.deploy = builder.deploy; + this.powerOn = builder.powerOn; + } + + @XmlElement(name = "VAppParent") + protected Reference vAppParent; + @XmlElement(name = "InstantiationParams") + protected InstantiationParams instantiationParams; + @XmlAttribute + protected Boolean deploy; + @XmlAttribute + protected Boolean powerOn; + + /** + * Reserved. + * + * Unimplemented. + */ + public Reference getVAppParent() { + return vAppParent; + } + + /** + * Instantiation parameters of a VApp. + */ + public InstantiationParams getInstantiationParams() { + return instantiationParams; + } + + /** + * Flag to deploy the VApp after successful creation. + */ + public Boolean isDeploy() { + return deploy; + } + + /** + * Flag to deploy and power on the VApp after successful creation. + */ + public Boolean isPowerOn() { + return powerOn; } @Override @@ -72,6 +186,24 @@ public class VAppCreationParams extends VAppCreationParamsType { if (o == null || getClass() != o.getClass()) return false; VAppCreationParams that = VAppCreationParams.class.cast(o); - return super.equals(that); + return super.equals(that) && + equal(vAppParent, that.vAppParent) && + equal(instantiationParams, that.instantiationParams) && + equal(deploy, that.deploy) && + equal(powerOn, that.powerOn); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), vAppParent, instantiationParams, deploy, powerOn); + } + + @Override + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("vAppParent", vAppParent) + .add("instantiationParams", instantiationParams) + .add("deploy", deploy) + .add("powerOn", powerOn); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java deleted file mode 100644 index 5f25f98701..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.vcloud.director.v1_5.domain; - -import static com.google.common.base.Objects.equal; - -import 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 creation parameters. - * - * @author grkvlt@apache.org - * @see - * vCloud REST API - VAppCreationParamsType - * @since 0.9 - */ -@XmlType(name = "VAppCreationParamsType") -public class VAppCreationParamsType extends ParamsType { - - public static Builder builder() { - return new ConcreteBuilder(); - } - - @Override - public Builder toBuilder() { - return builder().fromVAppCreationParamsType(this); - } - - private static class ConcreteBuilder extends Builder { - } - - public static abstract class Builder> extends ParamsType.Builder { - - private Reference vAppParent; - private InstantiationParams instantiationParams; - private Boolean deploy; - private Boolean powerOn; - - /** - * @see VAppCreationParamsType#getVAppParent() - */ - public B vAppParent(Reference vAppParent) { - this.vAppParent = vAppParent; - return self(); - } - - /** - * @see VAppCreationParamsType#getInstantiationParams() - */ - public B instantiationParams(InstantiationParams instantiationParams) { - this.instantiationParams = instantiationParams; - return self(); - } - - /** - * @see VAppCreationParamsType#isDeploy() - */ - public B deploy(Boolean deploy) { - this.deploy = deploy; - return self(); - } - - /** - * @see VAppCreationParamsType#isDeploy() - */ - public B deploy() { - this.deploy = Boolean.TRUE; - return self(); - } - - /** - * @see VAppCreationParamsType#isDeploy() - */ - public B notDeploy() { - this.deploy = Boolean.FALSE; - return self(); - } - - /** - * @see VAppCreationParamsType#isPowerOn() - */ - public B powerOn(Boolean powerOn) { - this.powerOn = powerOn; - return self(); - } - - /** - * @see VAppCreationParamsType#isPowerOn() - */ - public B powerOn() { - this.powerOn = Boolean.TRUE; - return self(); - } - - /** - * @see VAppCreationParamsType#isPowerOn() - */ - public B notPowerOn() { - this.powerOn = Boolean.FALSE; - return self(); - } - - public B fromVAppCreationParamsType(VAppCreationParamsType in) { - return fromParamsType(in).vAppParent(in.getVAppParent()).instantiationParams(in.getInstantiationParams()).deploy(in.isDeploy()).powerOn(in.isPowerOn()); - } - } - - protected VAppCreationParamsType() { - // For JAXB and B use - } - - public VAppCreationParamsType(Builder builder) { - super(builder); - this.vAppParent = builder.vAppParent; - this.instantiationParams = builder.instantiationParams; - this.deploy = builder.deploy; - this.powerOn = builder.powerOn; - } - - @XmlElement(name = "VAppParent") - protected Reference vAppParent; - @XmlElement(name = "InstantiationParams") - protected InstantiationParams instantiationParams; - @XmlAttribute - protected Boolean deploy; - @XmlAttribute - protected Boolean powerOn; - - /** - * Reserved. - * - * Unimplemented. - */ - public Reference getVAppParent() { - return vAppParent; - } - - /** - * Instantiation parameters of a VApp. - */ - public InstantiationParams getInstantiationParams() { - return instantiationParams; - } - - /** - * Flag to deploy the VApp after successful creation. - */ - public Boolean isDeploy() { - return deploy; - } - - /** - * Flag to deploy and power on the VApp after successful creation. - */ - public Boolean isPowerOn() { - return powerOn; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - VAppCreationParamsType that = VAppCreationParamsType.class.cast(o); - return super.equals(that) && - equal(vAppParent, that.vAppParent) && - equal(instantiationParams, that.instantiationParams) && - equal(deploy, that.deploy) && - equal(powerOn, that.powerOn); - } - - @Override - public int hashCode() { - return Objects.hashCode(super.hashCode(), vAppParent, instantiationParams, deploy, powerOn); - } - - @Override - public ToStringHelper string() { - return Objects.toStringHelper("") - .add("vAppParent", vAppParent) - .add("instantiationParams", instantiationParams) - .add("deploy", deploy) - .add("powerOn", powerOn); - } -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetwork.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetwork.java index dd60ec9d21..1ecbbf9a61 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetwork.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetwork.java @@ -41,6 +41,7 @@ public class VAppNetwork extends Network { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVAppNetwork(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java index 1d84820f5b..8f4874dc71 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppNetworkConfiguration.java @@ -43,6 +43,7 @@ public class VAppNetworkConfiguration extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVAppNetworkConfiguration(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java index 7d8e3781f4..751ead8e36 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java @@ -27,10 +27,18 @@ import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; -import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection; +import org.jclouds.dmtf.ovf.DeploymentOptionSection; +import org.jclouds.dmtf.ovf.DiskSection; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.OperatingSystemSection; +import org.jclouds.dmtf.ovf.ProductSection; +import org.jclouds.dmtf.ovf.SectionType; +import org.jclouds.dmtf.ovf.StartupSection; +import org.jclouds.dmtf.ovf.VirtualHardwareSection; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; @@ -50,6 +58,7 @@ public class VAppTemplate extends ResourceEntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVAppTemplate(this); } @@ -133,7 +142,26 @@ public class VAppTemplate extends ResourceEntityType { private Owner owner; @XmlElement(name = "Children") private VAppTemplateChildren children = VAppTemplateChildren.builder().build(); - @XmlElementRef + @XmlElementRefs({ + @XmlElementRef(type = SectionType.class), + @XmlElementRef(type = VirtualHardwareSection.class), + @XmlElementRef(type = LeaseSettingsSection.class), +// @XmlElementRef(type = EulaSection.class), + @XmlElementRef(type = RuntimeInfoSection.class), +// @XmlElementRef(type = AnnotationSection.class), + @XmlElementRef(type = DeploymentOptionSection.class), + @XmlElementRef(type = StartupSection.class), +// @XmlElementRef(type = ResourceAllocationSection.class), + @XmlElementRef(type = NetworkConnectionSection.class), + @XmlElementRef(type = CustomizationSection.class), + @XmlElementRef(type = ProductSection.class), + @XmlElementRef(type = GuestCustomizationSection.class), + @XmlElementRef(type = OperatingSystemSection.class), + @XmlElementRef(type = NetworkConfigSection.class), + @XmlElementRef(type = NetworkSection.class), +// @XmlElementRef(type = InstallSection.class), + @XmlElementRef(type = DiskSection.class) + }) private Set sections = Sets.newLinkedHashSet(); @XmlElement(name = "VAppScopedLocalId") private String vAppScopedLocalId; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualHardwareSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualHardwareSection.java new file mode 100644 index 0000000000..a5c216a7df --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualHardwareSection.java @@ -0,0 +1,189 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlSeeAlso; + +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; + +/** + * The virtual hardware required by a virtual machine is specified in VirtualHardwareSection. + * + * @author grkvlt@apache.org + */ +@XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_1_5_NS) +@XmlSeeAlso({ org.jclouds.dmtf.ovf.VirtualHardwareSection.class }) +public class VirtualHardwareSection extends org.jclouds.dmtf.ovf.VirtualHardwareSection { + + public static Builder builder() { + return new ConcreteBuilder(); + } + + @Override + public Builder toBuilder() { + return builder().fromVirtualHardwareSection(this); + } + + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> extends org.jclouds.dmtf.ovf.VirtualHardwareSection.Builder { + + private URI href; + private String type; + private Set links = Sets.newLinkedHashSet(); + + @Override + @SuppressWarnings("unchecked") + protected B self() { + return (B) this; + } + + /** + * @see VirtualHardwareSection#getType() + */ + public B type(String type) { + this.type = type; + return self(); + } + + /** + * @see VirtualHardwareSection#getHref() + */ + public B href(URI href) { + this.href = href; + return self(); + } + + /** + * @see VirtualHardwareSection#getLinks() + */ + public B links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return self(); + } + + /** + * @see VirtualHardwareSection#getLinks() + */ + public B link(Link link) { + this.links.add(checkNotNull(link, "link")); + return self(); + } + + @Override + public VirtualHardwareSection build() { + return new VirtualHardwareSection(this); + } + + public B fromVirtualHardwareSection(VirtualHardwareSection in) { + return super.fromVirtualHardwareSection(in) + .type(in.getType()) + .href(in.getHref()) + .links(in.getLinks()); + } + } + + @XmlAttribute(namespace = VCLOUD_1_5_NS) + protected String type; + @XmlAttribute(namespace = VCLOUD_1_5_NS) + @XmlSchemaType(name = "anyURI") + protected URI href; + @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) + protected Set links = Sets.newLinkedHashSet(); + + + protected VirtualHardwareSection(Builder builder) { + super(builder); + this.type = builder.type; + this.href = builder.href; + this.links = builder.links != null && builder.links.isEmpty() ? null : builder.links;; + } + + protected VirtualHardwareSection() { + // for JAXB + } + + /** + * Contains the URI to the entity. + * + * @see ResourceType#getHref() + */ + public String getType() { + return type; + } + + /** + * Contains the type of the the entity. + * + * @see ResourceType#getType() + */ + public URI getHref() { + return href; + } + + /** + * Set of optional links to an entity or operation associated with this object. + * + * @see ResourceType#getLinks() + */ + public Set getLinks() { + return links != null ? ImmutableSet.copyOf(links) : Sets.newLinkedHashSet(); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("type", type) + .add("href", href) + .add("links", links); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), type, href, links); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + VirtualHardwareSection that = VirtualHardwareSection.class.cast(obj); + return super.equals(that) + && equal(this.type, that.type) + && equal(this.href, that.href) + && equal(this.links, that.links); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualSystem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualSystem.java new file mode 100644 index 0000000000..2f1eb49d48 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VirtualSystem.java @@ -0,0 +1,149 @@ +/** + * 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 static org.jclouds.dmtf.DMTFConstants.OVF_NS; + +import java.util.Set; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.jclouds.dmtf.ovf.internal.BaseVirtualSystem; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + +/** + * @author Adrian Cole + * @author Adam Lowe + */ +@XmlRootElement(name = "VirtualSystem", namespace = OVF_NS) +public class VirtualSystem extends BaseVirtualSystem { + + public static Builder builder() { + return new ConcreteBuilder(); + } + + public Builder toBuilder() { + return builder().fromVirtualSystem(this); + } + + private static class ConcreteBuilder extends Builder { + } + + public static class Builder> extends BaseVirtualSystem.Builder { + + private OperatingSystemSection operatingSystem; + private Set virtualHardwareSections = Sets.newLinkedHashSet(); + + + /** + * @see BaseVirtualSystem#getOperatingSystemSection() + */ + public B operatingSystemSection(OperatingSystemSection operatingSystem) { + this.operatingSystem = operatingSystem; + return self(); + } + + /** + * @see BaseVirtualSystem#getVirtualHardwareSections() + */ + public B virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) { + this.virtualHardwareSections.add(checkNotNull(virtualHardwareSection, "virtualHardwareSection")); + return self(); + } + + /** + * @see BaseVirtualSystem#getVirtualHardwareSections() + */ + public B virtualHardwareSections(Iterable virtualHardwareSections) { + this.virtualHardwareSections = Sets.newLinkedHashSet(checkNotNull(virtualHardwareSections, "virtualHardwareSections")); + return self(); + } + + /** + * {@inheritDoc} + */ + @Override + public VirtualSystem build() { + return new VirtualSystem(this); + } + + public B fromVirtualSystem(VirtualSystem in) { + return fromBaseVirtualSystem(in) + .operatingSystemSection(in.getOperatingSystemSection()) + .virtualHardwareSections(in.getVirtualHardwareSections()); + } + } + + @XmlElement(name = "OperatingSystemSection", namespace = OVF_NS) + private OperatingSystemSection operatingSystem; + @XmlElement(name = "VirtualHardwareSection", namespace = OVF_NS) + private Set virtualHardwareSections; + + private VirtualSystem(Builder builder) { + super(builder); + this.operatingSystem = checkNotNull(builder.operatingSystem, "operatingSystem"); + this.virtualHardwareSections = ImmutableSet.copyOf(checkNotNull(builder.virtualHardwareSections, "virtualHardwareSections")); + } + + private VirtualSystem() { + // for JAXB + } + + public OperatingSystemSection getOperatingSystemSection() { + return operatingSystem; + } + + /** + * Each VirtualSystem element may contain one or more VirtualHardwareSection elements, each of + * which describes the virtual virtualHardwareSections required by the virtual system. + */ + public Set getVirtualHardwareSections() { + return virtualHardwareSections; + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), operatingSystem, virtualHardwareSections); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + + VirtualSystem other = (VirtualSystem) obj; + return super.equals(other) + && equal(operatingSystem, other.operatingSystem) + && equal(virtualHardwareSections, other.virtualHardwareSections); + } + + @Override + protected Objects.ToStringHelper string() { + return super.string() + .add("operatingSystem", operatingSystem) + .add("virtualHardwareSections", virtualHardwareSections); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java index a7d71d3bd7..d961091764 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java @@ -24,7 +24,7 @@ import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType; +import org.jclouds.dmtf.ovf.environment.EnvironmentType; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; @@ -45,6 +45,7 @@ public class Vm extends AbstractVAppType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVm(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VmPendingQuestion.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VmPendingQuestion.java index bce76e6e30..a2d51d9bed 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VmPendingQuestion.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VmPendingQuestion.java @@ -45,6 +45,7 @@ public class VmPendingQuestion extends ResourceType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromVmPendingQuestion(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java deleted file mode 100644 index 6352083217..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Envelope.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.vcloud.director.v1_5.domain.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.ImmutableSet; - -/** - * @author Adrian Cole - * @author Adam Lowe - */ -@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS) -public class Envelope extends BaseEnvelope { - - public static Builder builder() { - return new Builder(); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder toBuilder() { - return new Builder().fromEnvelope(this); - } - - public static class Builder extends BaseEnvelope.Builder { - - /** - * {@inheritDoc} - */ - @Override - public Envelope build() { - return new Envelope(diskSections, networkSections, additionalSections, virtualSystem); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder additionalSection(SectionType additionalSection) { - this.additionalSections.add(checkNotNull(additionalSection, "additionalSection")); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder additionalSections(Iterable additionalSections) { - this.additionalSections = ImmutableSet. copyOf(checkNotNull(additionalSections, "additionalSections")); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder diskSection(DiskSection diskSection) { - return Builder.class.cast(super.diskSection(diskSection)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder diskSections(Iterable diskSections) { - return Builder.class.cast(super.diskSections(diskSections)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder fromEnvelope(BaseEnvelope in) { - return Builder.class.cast(super.fromEnvelope(in)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder networkSection(NetworkSection networkSection) { - return Builder.class.cast(super.networkSection(networkSection)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder networkSections(Iterable networkSections) { - return Builder.class.cast(super.networkSections(networkSections)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder virtualSystem(VirtualSystem virtualSystem) { - return Builder.class.cast(super.virtualSystem(virtualSystem)); - } - - } - - private Envelope(Iterable diskSections, Iterable networkSections, - Iterable additionalSections, VirtualSystem virtualSystem) { - super(diskSections, networkSections, additionalSections, virtualSystem); - } - - private Envelope() { - // For JaxB - } - -} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java deleted file mode 100644 index 498e9b6819..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/internal/BaseVirtualSystem.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.vcloud.director.v1_5.domain.ovf.internal; - -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; - -import java.util.Set; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; - -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.VirtualHardwareSection; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -public abstract class BaseVirtualSystem extends SectionType { - - public static abstract class Builder> extends SectionType.Builder { - - private String id; - private String name; - private OperatingSystemSection operatingSystem; - private Set virtualHardwareSections = Sets.newLinkedHashSet(); - private Set productSections = Sets.newLinkedHashSet(); - private Set additionalSections = Sets.newLinkedHashSet(); - - /** - * @see BaseVirtualSystem#getName - */ - public B name(String name) { - this.name = name; - return self(); - } - - /** - * @see BaseVirtualSystem#getId - */ - public B id(String id) { - this.id = id; - return self(); - } - - /** - * @see BaseVirtualSystem#getOperatingSystemSection - */ - public B operatingSystemSection(OperatingSystemSection operatingSystem) { - this.operatingSystem = operatingSystem; - return self(); - } - - /** - * @see BaseVirtualSystem#getVirtualHardwareSections - */ - public B virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) { - this.virtualHardwareSections.add(checkNotNull(virtualHardwareSection, "virtualHardwareSection")); - return self(); - } - - /** - * @see BaseVirtualSystem#getVirtualHardwareSections - */ - public B virtualHardwareSections(Iterable virtualHardwareSections) { - this.virtualHardwareSections = ImmutableSet. copyOf(checkNotNull(virtualHardwareSections, - "virtualHardwareSections")); - return self(); - } - - /** - * @see BaseVirtualSystem#getProductSections - */ - public B productSection(ProductSection productSection) { - this.productSections.add(checkNotNull(productSection, "productSection")); - return self(); - } - - /** - * @see BaseVirtualSystem#getProductSections - */ - public B productSections(Iterable productSections) { - this.productSections = ImmutableSet. copyOf(checkNotNull(productSections, "productSections")); - return self(); - } - - /** - * @see BaseVirtualSystem#getAdditionalSections - */ - public B additionalSection(SectionType additionalSection) { - this.additionalSections.add(checkNotNull(additionalSection, "additionalSection")); - return self(); - } - - /** - * @see BaseVirtualSystem#getAdditionalSections - */ - public B additionalSections(Set additionalSections) { - this.additionalSections = checkNotNull(additionalSections, "additionalSections"); - return self(); - } - - public B fromBaseVirtualSystem(BaseVirtualSystem in) { - return fromSectionType(in).id(in.getId()).name(in.getName()) - .operatingSystemSection(in.getOperatingSystemSection()) - .virtualHardwareSections(in.getVirtualHardwareSections()) - .productSections(in.getProductSections()) - .additionalSections(in.getAdditionalSections()); - } - } - - @XmlAttribute(namespace = VCLOUD_OVF_NS) - private String id; - @XmlElement(name = "Name") - private String name; - @XmlElement(name = "OperatingSystemSection") - private OperatingSystemSection operatingSystem; - @XmlElement(name = "VirtualHardwareSection") - private Set virtualHardwareSections; - @XmlElement(name = "ProductSection") - private Set productSections; - - // NOTE what is the right annotation here? - private Set additionalSections; - - protected BaseVirtualSystem(Builder builder) { - super(builder); - this.id = builder.id; - this.name = builder.name; - this.operatingSystem = checkNotNull(builder.operatingSystem, "operatingSystem"); - this.virtualHardwareSections = ImmutableSet.copyOf(checkNotNull(builder.virtualHardwareSections, "virtualHardwareSections")); - this.productSections = ImmutableSet.copyOf(checkNotNull(builder.productSections, "productSections")); - this.additionalSections = ImmutableSet.copyOf(checkNotNull(builder.additionalSections, "additionalSections")); - } - - protected BaseVirtualSystem() { - // For JAXB - } - - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public OperatingSystemSection getOperatingSystemSection() { - return operatingSystem; - } - - /** - * Each VirtualSystem element may contain one or more VirtualHardwareSection elements, each of - * which describes the virtual virtualHardwareSections required by the virtual system. - */ - public Set getVirtualHardwareSections() { - return virtualHardwareSections; - } - - /** - * Specifies product-information for a package, such as product name and version, along with a - * set of properties that can be configured - */ - public Set getProductSections() { - return productSections; - } - - public Set getAdditionalSections() { - return additionalSections; - } - - @Override - public int hashCode() { - return Objects.hashCode(super.hashCode(), id, name, operatingSystem, virtualHardwareSections, productSections, additionalSections); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - - BaseVirtualSystem other = (BaseVirtualSystem) obj; - return super.equals(other) - && equal(id, other.id) - && equal(name, other.name) - && equal(operatingSystem, other.operatingSystem) - && equal(virtualHardwareSections, other.virtualHardwareSections) - && equal(productSections, other.productSections) - && equal(additionalSections, other.additionalSections); - } - - @Override - protected Objects.ToStringHelper string() { - return super.string().add("id", id).add("name", name) - .add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections) - .add("productSections", productSections).add("additionalSections", additionalSections) - .add("additionalSections", additionalSections); - } -} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/package-info.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/package-info.java index d479475fde..fe2926586c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/package-info.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/package-info.java @@ -17,22 +17,15 @@ * under the License. */ @XmlSchema(namespace = VCLOUD_1_5_NS, - location = "http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd", elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "", namespaceURI = VCLOUD_1_5_NS), - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), - @XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS), - @XmlNs(prefix = "env", namespaceURI = VCLOUD_OVF_ENV_NS) + @XmlNs(prefix = "", namespaceURI = VCLOUD_1_5_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) package org.jclouds.vcloud.director.v1_5.domain; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java index e194c65530..b8949e7075 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryList.java @@ -41,6 +41,7 @@ public class QueryList extends ContainerType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromQueryList(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultNetworkRecord.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultNetworkRecord.java index ad974f3949..b6f9a415bc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultNetworkRecord.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/QueryResultNetworkRecord.java @@ -169,7 +169,7 @@ public class QueryResultNetworkRecord extends QueryResultRecordType { } private QueryResultNetworkRecord() { - // Qfor JAXB + // for JAXB } @XmlAttribute diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/package-info.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/package-info.java index 58514959d2..899fb3ac1d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/package-info.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/query/package-info.java @@ -17,22 +17,15 @@ * under the License. */ @XmlSchema(namespace = VCLOUD_1_5_NS, - location = "http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd", elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { - @XmlNs(prefix = "", namespaceURI = VCLOUD_1_5_NS), - @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), - @XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS), - @XmlNs(prefix = "env", namespaceURI = VCLOUD_OVF_ENV_NS) + @XmlNs(prefix = "", namespaceURI = VCLOUD_1_5_NS) } ) @XmlAccessorType(XmlAccessType.FIELD) package org.jclouds.vcloud.director.v1_5.domain.query; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java index 585f3fe063..6793f86307 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java @@ -50,6 +50,8 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; @@ -66,8 +68,10 @@ import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.MediaInsertOrEjectParams; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; +import org.jclouds.vcloud.director.v1_5.domain.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; +import org.jclouds.vcloud.director.v1_5.domain.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.RecomposeVAppParams; import org.jclouds.vcloud.director.v1_5.domain.RelocateParams; @@ -76,13 +80,9 @@ import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -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.StartupSection; -import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes; @@ -575,7 +575,7 @@ public interface VAppAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam URI vmURI); + ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam URI vmURI); /** * @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData) @@ -586,7 +586,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser ListenableFuture modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd); + @BinderParam(BindToXMLPayload.class) RasdItem rasd); /** * @see VAppClient#getVirtualHardwareSectionDisks(URI) @@ -627,7 +627,7 @@ public interface VAppAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam URI vmURI); + ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam URI vmURI); /** * @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData) @@ -638,7 +638,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser ListenableFuture modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd); + @BinderParam(BindToXMLPayload.class) RasdItem rasd); /** * @see VAppClient#getVirtualHardwareSectionNetworkCards(URI) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java index 2daa5e0da8..4dbc9aae6f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java @@ -22,6 +22,8 @@ import java.net.URI; import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams; @@ -30,8 +32,10 @@ import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.MediaInsertOrEjectParams; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; +import org.jclouds.vcloud.director.v1_5.domain.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; +import org.jclouds.vcloud.director.v1_5.domain.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.RecomposeVAppParams; import org.jclouds.vcloud.director.v1_5.domain.RelocateParams; @@ -40,13 +44,9 @@ import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -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.StartupSection; -import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; /** * Provides synchronous access to {@link VApp} objects. @@ -674,7 +674,7 @@ public interface VAppClient { * * @since 0.9 */ - ResourceAllocationSettingData getVirtualHardwareSectionCpu(URI vmURI); + RasdItem getVirtualHardwareSectionCpu(URI vmURI); /** * Modifies the CPU properties in virtual hardware section of a VM. @@ -685,7 +685,7 @@ public interface VAppClient { * * @since 0.9 */ - Task modifyVirtualHardwareSectionCpu(URI vmURI, ResourceAllocationSettingData rasd); + Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd); /** * Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM. @@ -729,7 +729,7 @@ public interface VAppClient { * * @since 0.9 */ - ResourceAllocationSettingData getVirtualHardwareSectionMemory(URI vmURI); + RasdItem getVirtualHardwareSectionMemory(URI vmURI); /** * Modifies the memory properties in virtual hardware section of a VM. @@ -740,7 +740,7 @@ public interface VAppClient { * * @since 0.9 */ - Task modifyVirtualHardwareSectionMemory(URI vmURI, ResourceAllocationSettingData rasd); + Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd); /** * Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java index 7219a37fc4..e49e85d604 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateAsyncClient.java @@ -40,6 +40,7 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; @@ -49,6 +50,7 @@ import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.binders.BindToXMLPayload; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection; +import org.jclouds.vcloud.director.v1_5.domain.Envelope; import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; @@ -59,8 +61,6 @@ import org.jclouds.vcloud.director.v1_5.domain.References; import org.jclouds.vcloud.director.v1_5.domain.RelocateParams; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope; -import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java index bdc154750a..4f5a74a5bb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClient.java @@ -22,8 +22,10 @@ import java.net.URI; import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; +import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection; +import org.jclouds.vcloud.director.v1_5.domain.Envelope; import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; @@ -34,8 +36,6 @@ import org.jclouds.vcloud.director.v1_5.domain.References; import org.jclouds.vcloud.director.v1_5.domain.RelocateParams; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope; -import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; /** * Provides synchronous access to {@link VAppTemplate} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java index fe1996a5de..418c09358f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java @@ -42,7 +42,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java index 110ae3b4d8..5cffad6c3b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; -import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java index d0b6f90056..883a8f4a85 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java @@ -41,7 +41,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java index 44fca80ede..01e4884ebc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java @@ -28,7 +28,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.MetadataClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; /** * Provides synchronous access to admin {@link Network} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java index d4294f9fea..11c303cda9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java @@ -45,7 +45,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java index 5b1bcbfa84..ac86ada421 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java @@ -33,7 +33,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; import org.jclouds.vcloud.director.v1_5.features.MetadataClient; import org.jclouds.vcloud.director.v1_5.features.OrgClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; /** * Provides synchronous access to {@link Org} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java index 984d623bef..6f593d4361 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java @@ -39,7 +39,6 @@ import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java index 735402dae4..7ad436c377 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java @@ -28,7 +28,6 @@ import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.MetadataClient; import org.jclouds.vcloud.director.v1_5.features.VdcClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; /** * Provides synchronous access to {@link AdminVdc}. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java index 9488ba7fda..90b848b5e9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java @@ -19,15 +19,7 @@ package org.jclouds.vcloud.director.v1_5.user; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Media; -import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; -import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.VApp; -import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; -import org.jclouds.vcloud.director.v1_5.domain.Vdc; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java index f0a3f02574..fda7a3686e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java @@ -22,16 +22,7 @@ import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient; -import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Media; -import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; -import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.VApp; -import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; -import org.jclouds.vcloud.director.v1_5.domain.Vdc; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java index 78eed46dfd..9f341d7be1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java @@ -33,8 +33,13 @@ import java.math.BigInteger; import java.net.URI; import java.util.List; +import org.jclouds.dmtf.cim.CimBoolean; +import org.jclouds.dmtf.cim.CimString; +import org.jclouds.dmtf.cim.CimUnsignedInt; +import org.jclouds.dmtf.cim.CimUnsignedLong; import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; +import org.jclouds.vcloud.director.v1_5.domain.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status; @@ -43,11 +48,6 @@ import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.Vm; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimBoolean; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimString; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedInt; -import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedLong; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; import org.jclouds.vcloud.director.v1_5.features.MetadataClient; import org.jclouds.vcloud.director.v1_5.features.QueryClient; @@ -74,329 +74,262 @@ import com.google.common.collect.Iterables; * * @author grkvlt@apache.org */ -public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClientLiveTest -{ +public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { - public static final String VAPP = "vApp"; + public static final String VAPP = "vApp"; + public static final String VAPP_TEMPLATE = "vAppTemplate"; + public static final String VDC = "vdc"; - public static final String VAPP_TEMPLATE = "vAppTemplate"; + /* + * Convenience reference to API clients. + */ - public static final String VDC = "vdc"; + protected CatalogClient catalogClient; + protected QueryClient queryClient; + protected VAppClient vAppClient; + protected VAppTemplateClient vAppTemplateClient; + protected VdcClient vdcClient; + protected MetadataClient.Writeable metadataClient; - /* - * Convenience reference to API clients. - */ + /* + * Objects shared between tests. + */ - protected CatalogClient catalogClient; + protected Vdc vdc; + protected Vm vm; + protected URI vAppURI; + protected VApp vApp; + protected VAppTemplate vAppTemplate; - protected QueryClient queryClient; + /** + * Retrieves the required clients from the REST API context + * + * @see BaseVCloudDirectorClientLiveTest#setupRequiredClients() + */ + @Override + @BeforeClass(alwaysRun = true, description = "Retrieves the required clients from the REST API context") + protected void setupRequiredClients() { + assertNotNull(context.getApi()); - protected VAppClient vAppClient; + catalogClient = context.getApi().getCatalogClient(); + queryClient = context.getApi().getQueryClient(); + vAppClient = context.getApi().getVAppClient(); + vAppTemplateClient = context.getApi().getVAppTemplateClient(); + vdcClient = context.getApi().getVdcClient(); - protected VAppTemplateClient vAppTemplateClient; + setupEnvironment(); + } - protected VdcClient vdcClient; + /** + * Sets up the environment. Retrieves the test {@link Vdc} and {@link VAppTemplate} from their + * configured {@link URI}s. Instantiates a new test VApp. + */ + protected void setupEnvironment() { + // Get the configured Vdc for the tests + vdc = vdcClient.getVdc(vdcURI); + assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC)); - protected MetadataClient.Writeable metadataClient; + // Get the configured VAppTemplate for the tests + vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI); + assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE)); - /* - * Objects shared between tests. - */ + // Instantiate a new VApp + VApp vAppInstantiated = instantiateVApp(); + assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP)); + vAppURI = vAppInstantiated.getHref(); - protected Vdc vdc; + // Wait for the task to complete + Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks()); + assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask")); - protected Vm vm; + // Get the instantiated VApp + vApp = vAppClient.getVApp(vAppURI); - protected URI vAppURI; + // Get the Vm + List vms = vApp.getChildren().getVms(); + vm = Iterables.getOnlyElement(vms); + assertFalse(vms.isEmpty(), "The VApp must have a Vm"); + } - protected VApp vApp; + protected void getGuestCustomizationSection(final Function getGuestCustomizationSection) { + // Get URI for child VM + URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); - protected VAppTemplate vAppTemplate; + // The method under test + try { + GuestCustomizationSection section = getGuestCustomizationSection.apply(vmURI); - /** - * Retrieves the required clients from the REST API context - * - * @see BaseVCloudDirectorClientLiveTest#setupRequiredClients() - */ - @Override - @BeforeClass(alwaysRun = true, description = "Retrieves the required clients from the REST API context") - protected void setupRequiredClients() - { - assertNotNull(context.getApi()); + // Check the retrieved object is well formed + checkGuestCustomizationSection(section); + } catch (Exception e) { + Throwables.propagate(e); + } + } - catalogClient = context.getApi().getCatalogClient(); - queryClient = context.getApi().getQueryClient(); - vAppClient = context.getApi().getVAppClient(); - vAppTemplateClient = context.getApi().getVAppTemplateClient(); - vdcClient = context.getApi().getVdcClient(); + protected void getNetworkConnectionSection(final Function getNetworkConnectionSection) { + // Get URI for child VM + URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); - setupEnvironment(); - } + // The method under test + try { + NetworkConnectionSection section = getNetworkConnectionSection.apply(vmURI); - /** - * Sets up the environment. Retrieves the test {@link Vdc} and {@link VAppTemplate} from their - * configured {@link URI}s. Instantiates a new test VApp. - */ - protected void setupEnvironment() - { - // Get the configured Vdc for the tests - vdc = vdcClient.getVdc(vdcURI); - assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC)); + // Check the retrieved object is well formed + checkNetworkConnectionSection(section); + } catch (Exception e) { + Throwables.propagate(e); + } + } - // Get the configured VAppTemplate for the tests - vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI); - assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE)); + @AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting created VApps") + protected void cleanUp() { + vdc = vdcClient.getVdc(vdcURI); // Refresh + // Find references in the Vdc with the VApp type and in the list of instantiated VApp names + Iterable vApps = Iterables.filter(vdc.getResourceEntities(), + Predicates.and(ReferencePredicates. typeEquals(VCloudDirectorMediaType.VAPP), ReferencePredicates. nameIn(vAppNames))); - // Instantiate a new VApp - VApp vAppInstantiated = instantiateVApp(); - assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP)); - vAppURI = vAppInstantiated.getHref(); + // If we found any references, delete the VApp they point to + if (!Iterables.isEmpty(vApps)) { + for (Reference ref : vApps) { + cleanUpVApp(ref.getHref()); // NOTE may fail, but should continue deleting + } + } else { + logger.warn("No VApps in list found in Vdc %s (%s)", vdc.getName(), Iterables.toString(vAppNames)); + } + } - // Wait for the task to complete - Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks()); - assertTrue(retryTaskSuccessLong.apply(instantiateTask), - String.format(TASK_COMPLETE_TIMELY, "instantiateTask")); + protected static CimBoolean cimBoolean(boolean val) { + CimBoolean result = new CimBoolean(); + result.setValue(val); + return result; + } - // Get the instantiated VApp - vApp = vAppClient.getVApp(vAppURI); + protected static CimUnsignedInt cimUnsignedInt(long val) { + CimUnsignedInt result = new CimUnsignedInt(); + result.setValue(val); + return result; + } - // Get the Vm - List vms = vApp.getChildren().getVms(); - vm = Iterables.getOnlyElement(vms); - assertFalse(vms.isEmpty(), "The VApp must have a Vm"); - } + protected static CimUnsignedLong cimUnsignedLong(BigInteger val) { + CimUnsignedLong result = new CimUnsignedLong(); + result.setValue(val); + return result; + } - protected void getGuestCustomizationSection( - final Function getGuestCustomizationSection) - { - // Get URI for child VM - URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); + protected static CimString cimString(String value) { + return new CimString(value); + } - // The method under test - try - { - GuestCustomizationSection section = getGuestCustomizationSection.apply(vmURI); - - // Check the retrieved object is well formed - checkGuestCustomizationSection(section); - } - catch (Exception e) - { - Throwables.propagate(e); - } - } - - protected void getNetworkConnectionSection( - final Function getNetworkConnectionSection) - { - // Get URI for child VM - URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); - - // The method under test - try - { - NetworkConnectionSection section = getNetworkConnectionSection.apply(vmURI); - - // Check the retrieved object is well formed - checkNetworkConnectionSection(section); - } - catch (Exception e) - { - Throwables.propagate(e); - } - } - - @AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting created VApps") - protected void cleanUp() - { - vdc = vdcClient.getVdc(vdcURI); // Refresh - // Find references in the Vdc with the VApp type and in the list of instantiated VApp names - Iterable vApps = - Iterables.filter(vdc.getResourceEntities(), Predicates.and( - ReferencePredicates. typeEquals(VCloudDirectorMediaType.VAPP), - ReferencePredicates. nameIn(vAppNames))); - - // If we found any references, delete the VApp they point to - if (!Iterables.isEmpty(vApps)) - { - for (Reference ref : vApps) - { - cleanUpVApp(ref.getHref()); // NOTE may fail, but should continue deleting + protected void checkHasMatchingItem(final String context, final RasdItemsList items, final String instanceId, final String elementName) { + Optional found = Iterables.tryFind(items.getItems(), new Predicate() { + @Override + public boolean apply(RasdItem item) { + String itemInstanceId = item.getInstanceID(); + if (itemInstanceId.equals(instanceId)) { + Assert.assertEquals(item.getElementName(), elementName, + String.format(OBJ_FIELD_EQ, VAPP, context + "/" + instanceId + "/elementName", elementName, item.getElementName())); + return true; } - } - else - { - logger.warn("No VApps in list found in Vdc %s (%s)", vdc.getName(), - Iterables.toString(vAppNames)); - } - } + return false; + } + }); + assertTrue(found.isPresent(), "no " + context + " item found with id " + instanceId + "; only found " + items); + } - protected static CimBoolean cimBoolean(final boolean val) - { - CimBoolean result = new CimBoolean(); - result.setValue(val); - return result; - } + /** + * Power on a {@link VApp}s {@link Vm}s. + * + * @see #powerOn(URI) + */ + protected VApp powerOn(final VApp testVApp) { + return powerOn(testVApp.getHref()); + } - protected static CimUnsignedInt cimUnsignedInt(final long val) - { - CimUnsignedInt result = new CimUnsignedInt(); - result.setValue(val); - return result; - } + /** + * Power on a VApp. + */ + protected VApp powerOn(final URI testVAppURI) { + VApp testVApp = vAppClient.getVApp(testVAppURI); + Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); + Status status = Status.fromValue(vm.getStatus()); + if (status != Status.POWERED_ON) { + Task powerOn = vAppClient.powerOn(vm.getHref()); + assertTaskSucceedsLong(powerOn); + } + assertVAppStatus(testVAppURI, Status.POWERED_ON); + return testVApp; + } - protected static CimUnsignedLong cimUnsignedLong(final BigInteger val) - { - CimUnsignedLong result = new CimUnsignedLong(); - result.setValue(val); - return result; - } + /** + * Power off a {@link VApp}s {@link Vm}s. + * + * @see #powerOff(URI) + */ + protected VApp powerOff(final VApp testVApp) { + return powerOff(testVApp.getHref()); + } - protected static CimString cimString(final String value) - { - return new CimString(value); - } + /** + * Power off a {@link VApp}s {@link Vm}s. + */ + protected VApp powerOff(final URI testVAppURI) { + VApp testVApp = vAppClient.getVApp(testVAppURI); + Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); + Status status = Status.fromValue(vm.getStatus()); + if (status != Status.POWERED_OFF) { + Task powerOff = vAppClient.powerOff(vm.getHref()); + assertTaskSucceedsLong(powerOff); + } + assertVAppStatus(testVAppURI, Status.POWERED_OFF); + return testVApp; + } - protected void checkHasMatchingItem(final String context, final RasdItemsList items, - final String instanceId, final String elementName) - { - Optional found = - Iterables.tryFind(items.getItems(), new Predicate() - { - @Override - public boolean apply(final ResourceAllocationSettingData item) - { - String itemInstanceId = item.getInstanceID(); - if (itemInstanceId.equals(instanceId)) - { - Assert.assertEquals( - item.getElementName(), - elementName, - String.format(OBJ_FIELD_EQ, VAPP, context + "/" + instanceId - + "/elementName", elementName, item.getElementName())); + /** + * Suspend a {@link VApp}s {@link Vm}s. + * + * @see #suspend(URI) + */ + protected VApp suspend(final VApp testVApp) { + return powerOff(testVApp.getHref()); + } - return true; - } - return false; - } - }); - assertTrue(found.isPresent(), "no " + context + " item found with id " + instanceId - + "; only found " + items); - } + /** + * Suspend a {@link VApp}s {@link Vm}s. + */ + protected VApp suspend(final URI testVAppURI) { + VApp testVApp = vAppClient.getVApp(testVAppURI); + Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); + Status status = Status.fromValue(vm.getStatus()); + if (status != Status.SUSPENDED) { + Task suspend = vAppClient.suspend(vm.getHref()); + assertTaskSucceedsLong(suspend); + } + assertVAppStatus(testVAppURI, Status.SUSPENDED); + return testVApp; + } - /** - * Power on a {@link VApp}s {@link Vm}s. - * - * @see #powerOn(URI) - */ - protected VApp powerOn(final VApp testVApp) - { - return powerOn(testVApp.getHref()); - } + /** + * Check the {@link VApp}s {@link Vm}s current status. + */ + protected void assertVAppStatus(final URI testVAppURI, final Status status) { + VApp testVApp = vAppClient.getVApp(testVAppURI); + Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); + assertEquals(vm.getStatus(), status.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", status.toString(), Status.fromValue(vm.getStatus()).toString())); + } - /** - * Power on a VApp. - */ - protected VApp powerOn(final URI testVAppURI) - { - VApp testVApp = vAppClient.getVApp(testVAppURI); - Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); - Status status = Status.fromValue(vm.getStatus()); - if (status != Status.POWERED_ON) - { - Task powerOn = vAppClient.powerOn(vm.getHref()); - assertTaskSucceedsLong(powerOn); - } - assertVAppStatus(testVAppURI, Status.POWERED_ON); - return testVApp; - } - - /** - * Power off a {@link VApp}s {@link Vm}s. - * - * @see #powerOff(URI) - */ - protected VApp powerOff(final VApp testVApp) - { - return powerOff(testVApp.getHref()); - } - - /** - * Power off a {@link VApp}s {@link Vm}s. - */ - protected VApp powerOff(final URI testVAppURI) - { - VApp testVApp = vAppClient.getVApp(testVAppURI); - Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); - Status status = Status.fromValue(vm.getStatus()); - if (status != Status.POWERED_OFF) - { - Task powerOff = vAppClient.powerOff(vm.getHref()); - assertTaskSucceedsLong(powerOff); - } - assertVAppStatus(testVAppURI, Status.POWERED_OFF); - return testVApp; - } - - /** - * Suspend a {@link VApp}s {@link Vm}s. - * - * @see #suspend(URI) - */ - protected VApp suspend(final VApp testVApp) - { - return powerOff(testVApp.getHref()); - } - - /** - * Suspend a {@link VApp}s {@link Vm}s. - */ - protected VApp suspend(final URI testVAppURI) - { - VApp testVApp = vAppClient.getVApp(testVAppURI); - Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); - Status status = Status.fromValue(vm.getStatus()); - if (status != Status.SUSPENDED) - { - Task suspend = vAppClient.suspend(vm.getHref()); - assertTaskSucceedsLong(suspend); - } - assertVAppStatus(testVAppURI, Status.SUSPENDED); - return testVApp; - } - - /** - * Check the {@link VApp}s {@link Vm}s current status. - */ - protected void assertVAppStatus(final URI testVAppURI, final Status status) - { - VApp testVApp = vAppClient.getVApp(testVAppURI); - Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms()); - assertEquals( - vm.getStatus(), - status.getValue(), - String.format(OBJ_FIELD_EQ, VAPP, "status", status.toString(), - Status.fromValue(vm.getStatus()).toString())); - } - - /** - * Marshals a JAXB annotated object into XML. The XML is output using - * {@link org.jclouds.logging.Logger#debug(String)} - */ - protected void debug(final Object object) - { - JAXBParser parser = new JAXBParser("true"); - try - { - String xml = parser.toXML(object); - logger.debug(Strings.padStart( - Strings.padEnd(" " + object.getClass().toString() + " ", 70, '-'), 80, '-')); - logger.debug(xml); - logger.debug(Strings.repeat("-", 80)); - } - catch (IOException ioe) - { - Throwables.propagate(ioe); - } - } + /** + * Marshals a JAXB annotated object into XML. The XML is output using + * {@link org.jclouds.logging.Logger#debug(String)} + */ + protected void debug(final Object object) { + JAXBParser parser = new JAXBParser("true"); + try { + String xml = parser.toXML(object); + logger.debug(Strings.padStart(Strings.padEnd(" " + object.getClass().toString() + " ", 70, '-'), 80, '-')); + logger.debug(xml); + logger.debug(Strings.repeat("-", 80)); + } catch (IOException ioe) { + Throwables.propagate(ioe); + } + } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java index 3904d25d63..65f4aa31e5 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java @@ -32,7 +32,6 @@ import org.jclouds.http.HttpResponse; import org.jclouds.util.Strings2; import org.jclouds.vcloud.director.v1_5.domain.OrgList; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.xml.internal.JAXBParser; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java index f4f6a80d88..9779ec5efe 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java @@ -46,24 +46,20 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import org.jclouds.dmtf.cim.ResourceAllocationSettingData; +import org.jclouds.dmtf.cim.VirtualSystemSettingData; +import org.jclouds.dmtf.ovf.Disk; +import org.jclouds.dmtf.ovf.DiskSection; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.ProductSection; +import org.jclouds.dmtf.ovf.SectionType; +import org.jclouds.dmtf.ovf.StartupSection; +import org.jclouds.dmtf.ovf.environment.EnvironmentType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.CustomOrgLdapSettings.AuthenticationMechanism; import org.jclouds.vcloud.director.v1_5.domain.CustomOrgLdapSettings.ConnectorType; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection.IpAddressAllocationMode; import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings.LdapMode; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Disk; -import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope; -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 org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem; -import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType; import org.jclouds.vcloud.director.v1_5.domain.query.ContainerType; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; @@ -713,7 +709,7 @@ public class Checks { // NOTE transport cannot be checked if (hardware.getItems() != null) { for (ResourceAllocationSettingData item : hardware.getItems()) { - checkResourceAllocationSettingData(item); + checkResourceAllocationSettingData((RasdItem) item); } } @@ -744,7 +740,7 @@ public class Checks { // assertNotNull(virtualSystem.getVirtualSystemType(), String.format(OBJ_FIELD_REQ, "VirtualSystemSettingData", "virtualSystemType")); } - public static void checkResourceAllocationSettingData(ResourceAllocationSettingData item) { + public static void checkResourceAllocationSettingData(RasdItem item) { // TODO } @@ -1101,8 +1097,8 @@ public class Checks { // Check optional fields if (section.getNetworks() != null) { - for (org.jclouds.vcloud.director.v1_5.domain.ovf.Network network : section.getNetworks()) { - checkNetwork(network); + for (org.jclouds.dmtf.ovf.Network network : section.getNetworks()) { + checkOvfNetwork(network); } } @@ -1110,7 +1106,7 @@ public class Checks { checkOvfSectionType(section); } - public static void checkNetwork(org.jclouds.vcloud.director.v1_5.domain.ovf.Network network) { + public static void checkOvfNetwork(org.jclouds.dmtf.ovf.Network network) { assertNotNull(network, String.format(NOT_NULL_OBJ_FMT, "Network")); // Check optional fields @@ -1222,7 +1218,7 @@ public class Checks { // Check fields // TODO - for (ResourceAllocationSettingData item : items.getItems()) { + for (RasdItem item : items.getItems()) { checkResourceAllocationSettingData(item); } } @@ -1235,7 +1231,7 @@ public class Checks { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ProductSection")); if (val.getProperties() != null) { - for (org.jclouds.vcloud.director.v1_5.domain.ovf.Property property : val.getProperties()) { + for (org.jclouds.dmtf.ovf.Property property : val.getProperties()) { checkOvfProperty(property); } } @@ -1244,7 +1240,7 @@ public class Checks { checkOvfSectionType(val); } - private static void checkOvfProperty(org.jclouds.vcloud.director.v1_5.domain.ovf.Property val) { + private static void checkOvfProperty(org.jclouds.dmtf.ovf.Property val) { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Property")); } @@ -1252,7 +1248,7 @@ public class Checks { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkSection")); if (val.getNetworks() != null) { - for (org.jclouds.vcloud.director.v1_5.domain.ovf.Network network : val.getNetworks()) { + for (org.jclouds.dmtf.ovf.Network network : val.getNetworks()) { checkOvfNetwork(network); } } @@ -1260,10 +1256,6 @@ public class Checks { checkOvfSectionType(val); } - private static void checkOvfNetwork(org.jclouds.vcloud.director.v1_5.domain.ovf.Network val) { - assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Network")); - } - public static void checkOvfEnvelope(Envelope val) { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Envelope")); @@ -1329,7 +1321,7 @@ public class Checks { if (section.getItems() != null) { for (ResourceAllocationSettingData item : section.getItems()) { - checkCimResourceAllocationSettingData(item); + checkCimResourceAllocationSettingData((RasdItem) item); } } if (section.getSystem() != null) { @@ -1345,7 +1337,7 @@ public class Checks { assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VirtualSystemSettingData")); } - private static void checkCimResourceAllocationSettingData(ResourceAllocationSettingData val) { + private static void checkCimResourceAllocationSettingData(RasdItem val) { // TODO Could do more assertions... assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ResouorceAllocatoinSettingData")); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java index c8d273b91d..ebf622b700 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java @@ -22,6 +22,8 @@ import static org.testng.Assert.assertEquals; import java.net.URI; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams; @@ -32,8 +34,10 @@ import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.MediaInsertOrEjectParams; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; +import org.jclouds.vcloud.director.v1_5.domain.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; +import org.jclouds.vcloud.director.v1_5.domain.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.RecomposeVAppParams; import org.jclouds.vcloud.director.v1_5.domain.Reference; @@ -43,13 +47,9 @@ import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -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.StartupSection; -import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient; import org.testng.annotations.BeforeClass; @@ -898,7 +898,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { .xmlFilePayload("/vApp/getVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM) .httpResponseBuilder().build()); - ResourceAllocationSettingData expected = getVirtualHardwareSectionCpu(); + RasdItem expected = getVirtualHardwareSectionCpu(); assertEquals(client.getVAppClient().getVirtualHardwareSectionCpu(vAppURI), expected); } @@ -915,7 +915,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { .xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpuTask.xml", VCloudDirectorMediaType.TASK) .httpResponseBuilder().build()); - ResourceAllocationSettingData cpu = getVirtualHardwareSectionCpu(); // .toBuilder(); + RasdItem cpu = getVirtualHardwareSectionCpu(); // .toBuilder(); // .build(); Task expected = modifyVirtualHardwareSectionCpuTask(); @@ -986,7 +986,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { .xmlFilePayload("/vApp/getVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.OVF_RASD_ITEM) .httpResponseBuilder().build()); - ResourceAllocationSettingData expected = getVirtualHardwareSectionMemory(); + RasdItem expected = getVirtualHardwareSectionMemory(); assertEquals(client.getVAppClient().getVirtualHardwareSectionMemory(vAppURI), expected); } @@ -1003,7 +1003,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { .xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemoryTask.xml", VCloudDirectorMediaType.TASK) .httpResponseBuilder().build()); - ResourceAllocationSettingData memory = getVirtualHardwareSectionCpu(); // .toBuilder(); + RasdItem memory = getVirtualHardwareSectionCpu(); // .toBuilder(); // .build(); Task expected = modifyVirtualHardwareSectionMemoryTask(); @@ -1414,8 +1414,8 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { return task; } - public static ResourceAllocationSettingData getVirtualHardwareSectionCpu() { - ResourceAllocationSettingData cpu = ResourceAllocationSettingData.builder() + public static RasdItem getVirtualHardwareSectionCpu() { + RasdItem cpu = RasdItem.builder() .build(); return cpu; @@ -1449,8 +1449,8 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest { return media; } - public static ResourceAllocationSettingData getVirtualHardwareSectionMemory() { - ResourceAllocationSettingData memory = ResourceAllocationSettingData.builder() + public static RasdItem getVirtualHardwareSectionMemory() { + RasdItem memory = RasdItem.builder() .build(); return memory; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java index ade21eef5c..0f0879696e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java @@ -69,6 +69,12 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import org.jclouds.io.Payloads; +import org.jclouds.dmtf.cim.OSType; +import org.jclouds.dmtf.cim.ResourceAllocationSettingData; +import org.jclouds.dmtf.ovf.MsgType; +import org.jclouds.dmtf.ovf.NetworkSection; +import org.jclouds.dmtf.ovf.ProductSection; +import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; @@ -88,8 +94,10 @@ import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection.IpAddressAllocationMode; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; +import org.jclouds.vcloud.director.v1_5.domain.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; +import org.jclouds.vcloud.director.v1_5.domain.RasdItem; import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; import org.jclouds.vcloud.director.v1_5.domain.RecomposeVAppParams; import org.jclouds.vcloud.director.v1_5.domain.Reference; @@ -100,17 +108,10 @@ import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswerChoice; -import org.jclouds.vcloud.director.v1_5.domain.cim.OSType; -import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; -import org.jclouds.vcloud.director.v1_5.domain.ovf.MsgType; -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.StartupSection; -import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; import org.testng.annotations.AfterClass; @@ -966,7 +967,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { // Copy existing section and update fields VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vm.getHref()); - Set oldItems = oldSection.getItems(); + Set oldItems = oldSection.getItems(); Set newItems = Sets.newLinkedHashSet(oldItems); ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate() { @Override @@ -1010,7 +1011,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { @Test(description = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" }) public void testGetVirtualHardwareSectionCpu() { // Method under test - ResourceAllocationSettingData rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); + RasdItem rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); // Check the retrieved object is well formed checkResourceAllocationSettingData(rasd); @@ -1019,8 +1020,8 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { @Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" }) public void testModifyVirtualHardwareSectionCpu() { // Copy existing section and update fields - ResourceAllocationSettingData oldItem = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); - ResourceAllocationSettingData newItem = oldItem.toBuilder() + RasdItem oldItem = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); + RasdItem newItem = oldItem.toBuilder() .elementName("2 virtual CPU(s)") .virtualQuantity(new BigInteger("2")) .build(); @@ -1030,7 +1031,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu")); // Retrieve the modified section - ResourceAllocationSettingData modified = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); + RasdItem modified = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); // Check the retrieved object checkResourceAllocationSettingData(modified); @@ -1098,7 +1099,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { @Test(description = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" }) public void testGetVirtualHardwareSectionMemory() { // Method under test - ResourceAllocationSettingData rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); + RasdItem rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref()); // Check the retrieved object is well formed checkResourceAllocationSettingData(rasd); @@ -1106,8 +1107,8 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { @Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" }) public void testModifyVirtualHardwareSectionMemory() { - ResourceAllocationSettingData origItem = vAppClient.getVirtualHardwareSectionMemory(vm.getHref()); - ResourceAllocationSettingData newItem = origItem.toBuilder() + RasdItem origItem = vAppClient.getVirtualHardwareSectionMemory(vm.getHref()); + RasdItem newItem = origItem.toBuilder() .elementName("1024 MB of memory") .virtualQuantity(new BigInteger("1024")) .build(); @@ -1117,7 +1118,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory")); // Retrieve the modified section - ResourceAllocationSettingData modified = vAppClient.getVirtualHardwareSectionMemory(vm.getHref()); + RasdItem modified = vAppClient.getVirtualHardwareSectionMemory(vm.getHref()); // Check the retrieved object checkResourceAllocationSettingData(modified); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java index 1f1b2a9982..14f8254657 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java @@ -41,11 +41,13 @@ import java.net.URI; import java.util.Map; import java.util.Set; +import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams; import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection; +import org.jclouds.vcloud.director.v1_5.domain.Envelope; import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.Link; @@ -63,8 +65,6 @@ import org.jclouds.vcloud.director.v1_5.domain.References; import org.jclouds.vcloud.director.v1_5.domain.RelocateParams; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; -import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope; -import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClientExpectTest.java index 6391ce39ed..5f2c3a71ff 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClientExpectTest.java @@ -30,7 +30,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClientExpectTest.java index 5fe8699d89..380f14c061 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClientExpectTest.java @@ -29,7 +29,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.NetworkClientExpectTest; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClientExpectTest.java index 11c725d072..2539fce13d 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClientExpectTest.java @@ -35,7 +35,6 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClientExpectTest.java index 531c35aeb2..aac0747ce1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClientExpectTest.java @@ -29,7 +29,6 @@ import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientExpectTest.java index 59e962be29..b34dad2d43 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientExpectTest.java @@ -27,7 +27,6 @@ import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.features.VdcClientExpectTest; -import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient; import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientLiveTest.java index baed95de50..6ef70f5087 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClientLiveTest.java @@ -34,8 +34,6 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.features.MetadataClient; -import org.jclouds.vcloud.director.v1_5.features.VdcClient; -import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.AfterClass; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java index ec0f1dc55e..24183b5695 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java @@ -42,7 +42,6 @@ import com.google.common.cache.LoadingCache; */ @Test(groups = "unit", testName = "InvalidateSessionAndRetryOn401AndLogoutOnCloseTest") public class InvalidateSessionAndRetryOn401AndLogoutOnCloseTest { - @SuppressWarnings("unchecked") @Test public void test401ShouldInvalidateSessionAndRetry() { HttpCommand command = createMock(HttpCommand.class); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java index 75a45c3327..d55ee72a6d 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java @@ -19,7 +19,6 @@ package org.jclouds.vcloud.director.v1_5.internal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.rest.RestContextFactory.createContext; import static org.testng.Assert.assertNotNull; import java.net.URI; @@ -29,22 +28,15 @@ import org.jclouds.Constants; import org.jclouds.date.DateService; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.logging.config.NullLoggingModule; import org.jclouds.rest.BaseRestClientExpectTest; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.BaseRestClientExpectTest.ExpectModule; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Reference; -import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient; import org.testng.annotations.BeforeGroups; -import com.google.common.base.Function; import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; import com.google.inject.Guice; -import com.google.inject.Module; /** * Base class for writing KeyStone Rest Client Expect tests